From patchwork Fri Nov 11 13:58:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 18818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp758664wru; Fri, 11 Nov 2022 06:06:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5R/4su9XcqqAIhQzR9F1tOJcg/Bbe2l14AbJqEobKFII/uX1dURj+1cAfGSp0llpIuDxhB X-Received: by 2002:aa7:8396:0:b0:56b:f3b2:5543 with SMTP id u22-20020aa78396000000b0056bf3b25543mr2810358pfm.65.1668175582845; Fri, 11 Nov 2022 06:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668175582; cv=none; d=google.com; s=arc-20160816; b=nVxVzCiF9ztLlXLNMmfBG4/ZaFRZ/UdN7gqBikhB190HuFBF4UjSvD255TlnfYxGIg QOZ3l+/2tymmfxOmcJdxTUH2FBbCDvG5CM/ALBVW870ZXBESTeLDat439QKkvdLbfNY1 7PDrkfi8gawgZQxSaRtO4NAQfPwf6itlL2Oc8GSQ5XVyLEP1jlDsjtwPDeZXOWO85C3Q 5ity+ymGNwl7BSOEJ+PQjDn7NRYU6NbAEbuh94H4VmVYLdEmUzO+0JZ0d8mFzFbdgibX RDmWCIQX7setWl7+mG2KpkIe0F1yqvDckAIOFeCtzLjOB07Q1BWaWPafjo6oEYvtxfp8 3iPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=x3hIqu1krW0wya/Cp5B9blgpcq3/YMthZGe6CW4aay0=; b=HoiKDo3I+4cv4hF1iUTQ6CQ8E0oKesqVw71KBexhMW96CZhCofLI+LzPvuUwn2gGFh sNhuhQdSkmgXOtedz35Igpo+vTLaXti9oXh9qnh9BRueSl2qPvJ2nY06o9FmnZU1tEgn KLu49QZj5wYSnJYbln4oC1/7QULPnSyjfIZ0NhNlY+9ECK4YljB5AaKanOXW0zshTF2b iI2I4ErSK1UwPxlG3Bbgf+7lsS8UkXpOptRL+cjVg+Z8n5cXALsNgBQkOsDvOlfUf9OO eCTzyUrovzc+3+bL4Mi59ln7fmoj8DhWlRyFb9lbt0Vs1XRqScxeWhGOeKAhMQBJB6+k 6j3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Cl5Cge90; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=vJI5ABKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a17090ad70e00b0020d9f618c4asi6933963pju.17.2022.11.11.06.06.05; Fri, 11 Nov 2022 06:06:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Cl5Cge90; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=vJI5ABKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234375AbiKKOFD (ORCPT + 99 others); Fri, 11 Nov 2022 09:05:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234108AbiKKOEl (ORCPT ); Fri, 11 Nov 2022 09:04:41 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3783889F93; Fri, 11 Nov 2022 05:58:52 -0800 (PST) Message-ID: <20221111135205.309731052@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668175093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=x3hIqu1krW0wya/Cp5B9blgpcq3/YMthZGe6CW4aay0=; b=Cl5Cge90NeD11tWuUxPPNdqZbeOuu4BQbbJMd3s9+G4WD0B9jm0X3WAOhAy2+ZIQ5xgVeY nPgODgSeTnlOzkTqejTq7e1tsTPXmPTG07cumpYKhU+huUjnB0PgzxC+HKe9O4D4kWOFDH GhQ0dJ890Y7W+YCJL9W8srS/HxDfxc2jEFyKjBp9PM8QeGxpdXM7Uwr93MATI+dlCynZ9K NPEn5kuFfG9Ka8zpB2HV86db979qP7UD18U+LQpUbq+rMjeoyToZjYkybfI2Rfo27lxpA6 E8LdRZHmeYCL1FIrZKAKpmHrfX7CygBkvkO9B1lGvGrHLvhYpy4+9twcRYbBIQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668175093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=x3hIqu1krW0wya/Cp5B9blgpcq3/YMthZGe6CW4aay0=; b=vJI5ABKsNoBbr9nzBicoj0rOjr0qz69urGN0yNn0bnfvWmNvrsRfmT6zwZYg8ATxc4NGuw 2IqzREvpGLwcaRBA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Joerg Roedel , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , "Ahmed S. Darwish" , Reinette Chatre Subject: [patch 01/33] genirq/msi: Rearrange MSI domain flags References: <20221111133158.196269823@linutronix.de> MIME-Version: 1.0 Date: Fri, 11 Nov 2022 14:58:12 +0100 (CET) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749208879963398399?= X-GMAIL-MSGID: =?utf-8?q?1749208879963398399?= These flags got added as necessary and have no obvious structure. For feature support checks and masking it's convenient to have two blocks of flags: 1) Flags to control the internal behaviour like allocating/freeing MSI descriptors. Those flags do not need any support from the underlying MSI parent domain. They are mostly under the control of the outermost domain which implements the actual MSI support. 2) Flags to expose features, e.g. PCI multi-MSI or requirements which can depend on a underlying domain. No functional change. Signed-off-by: Thomas Gleixner Reviewed-by: Jason Gunthorpe --- include/linux/msi.h | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -24,6 +24,8 @@ #include #include #include +#include + #include /* Dummy shadow structures if an architecture does not define them */ @@ -428,7 +430,16 @@ struct msi_domain_info { void *data; }; -/* Flags for msi_domain_info */ +/* + * Flags for msi_domain_info + * + * Bit 0-15: Generic MSI functionality which is not subject to restriction + * by parent domains + * + * Bit 16-31: Functionality which depends on the underlying parent domain and + * can be masked out by msi_parent_ops::init_dev_msi_info() when + * a device MSI domain is initialized. + */ enum { /* * Init non implemented ops callbacks with default MSI domain @@ -440,33 +451,41 @@ enum { * callbacks. */ MSI_FLAG_USE_DEF_CHIP_OPS = (1 << 1), - /* Support multiple PCI MSI interrupts */ - MSI_FLAG_MULTI_PCI_MSI = (1 << 2), - /* Support PCI MSIX interrupts */ - MSI_FLAG_PCI_MSIX = (1 << 3), /* Needs early activate, required for PCI */ - MSI_FLAG_ACTIVATE_EARLY = (1 << 4), + MSI_FLAG_ACTIVATE_EARLY = (1 << 2), /* * Must reactivate when irq is started even when * MSI_FLAG_ACTIVATE_EARLY has been set. */ - MSI_FLAG_MUST_REACTIVATE = (1 << 5), - /* Is level-triggered capable, using two messages */ - MSI_FLAG_LEVEL_CAPABLE = (1 << 6), + MSI_FLAG_MUST_REACTIVATE = (1 << 3), /* Populate sysfs on alloc() and destroy it on free() */ - MSI_FLAG_DEV_SYSFS = (1 << 7), - /* MSI-X entries must be contiguous */ - MSI_FLAG_MSIX_CONTIGUOUS = (1 << 8), + MSI_FLAG_DEV_SYSFS = (1 << 4), /* Allocate simple MSI descriptors */ - MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 9), + MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 5), /* Free MSI descriptors */ - MSI_FLAG_FREE_MSI_DESCS = (1 << 10), + MSI_FLAG_FREE_MSI_DESCS = (1 << 6), /* * Quirk to handle MSI implementations which do not provide * masking. Currently known to affect x86, but has to be partially * handled in the core MSI code. */ - MSI_FLAG_NOMASK_QUIRK = (1 << 11), + MSI_FLAG_NOMASK_QUIRK = (1 << 7), + + /* Mask for the generic functionality */ + MSI_GENERIC_FLAGS_MASK = GENMASK(15, 0), + + /* Mask for the domain specific functionality */ + MSI_DOMAIN_FLAGS_MASK = GENMASK(31, 16), + + /* Support multiple PCI MSI interrupts */ + MSI_FLAG_MULTI_PCI_MSI = (1 << 16), + /* Support PCI MSIX interrupts */ + MSI_FLAG_PCI_MSIX = (1 << 17), + /* Is level-triggered capable, using two messages */ + MSI_FLAG_LEVEL_CAPABLE = (1 << 18), + /* MSI-X entries must be contiguous */ + MSI_FLAG_MSIX_CONTIGUOUS = (1 << 19), + }; int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,