From patchwork Thu Nov 24 23:25:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 25742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3660494wrr; Thu, 24 Nov 2022 15:28:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HgeLTLSkocpcODzYn0YaqMmIo72oX3AW8UOZpE668ieaE7j4i0UvI2nVdRN2DjqWERVCG X-Received: by 2002:a05:6402:248e:b0:461:e2ab:912d with SMTP id q14-20020a056402248e00b00461e2ab912dmr15977369eda.93.1669332495421; Thu, 24 Nov 2022 15:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669332495; cv=none; d=google.com; s=arc-20160816; b=Zqofpypbp4GJ984uXs8W1F9+y/mXN68WwWg1ZxXZdrHg6owzuFlVCah/mBfAO/mA0O 9g8RLg/1zWxnASkBDULU40G1Lvyw/9wtTeokH7woSesgf/rIJHBdzV9KPhove2YRIohD FzTMtahXqJmuuHTm0yABmXlAxBc/o9J4pz3hLYm4oAxxQntRLY39mZP/fmB7i1KAAl/c fXSDFsh/XJ0Tf0EdCxFQ26gcMlOmZh71bicf7FPqLvzgn3c3cyMz8h9HE6Jg0aUi/RzV xlFNIFsE30F9mmLmMQNIdNIVOvUchLrd1bTrgiZVZwqZoJCY5iPvxH6DWZB6H+B5BLJH mrqg== 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=+NyMkWp2GrUOU3BDiTzPL4SzyzA5986NyW2OtHWo5NY=; b=KWKKz7el1jFo1LFH832b44JbkG4Flx9uyfFmmk9xpkzmEA8Lai4Z+pJoqlVr5WH6bv 6LDY3W4jyC0NXZvnNBht2LD6aR2sURfvt9ry4FnZwqunlHd5ReL/C7MSQa5owbftvhF7 c9GxQPqGt8x0v9qYMI1QvFJiUtAaFPbjbM5GZQyuB8Ei7Yp/vixyMQZtFDb9h01YZ42C 5C6M84KKzFKpAgdvZdCglWlJRGupZ/ZjhLhlElGUdIZ2wfE7k3rp4jbz1wjtSpNlimDp fRf3NeWDuhJVFYHjaP7xdy8sKFApeZRRYapeRXjYNH7M+8xQw4iHa49xHd2b5oRsjzCP FXZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wrPZ5arX; dkim=neutral (no key) header.i=@linutronix.de; 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 di20-20020a170906731400b007adb2862222si1602162ejc.828.2022.11.24.15.27.52; Thu, 24 Nov 2022 15:28:15 -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=wrPZ5arX; dkim=neutral (no key) header.i=@linutronix.de; 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 S229487AbiKXX1Q (ORCPT + 99 others); Thu, 24 Nov 2022 18:27:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbiKXX07 (ORCPT ); Thu, 24 Nov 2022 18:26:59 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A9DC6D1E; Thu, 24 Nov 2022 15:25:49 -0800 (PST) Message-ID: <20221124232325.322714918@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669332347; 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=+NyMkWp2GrUOU3BDiTzPL4SzyzA5986NyW2OtHWo5NY=; b=wrPZ5arXlEuMY3dc+oI+StHT4KdlWJKlCvS3aFKiaaafmyjqdWa8s67KwfOU4A6TNXY/mN Uupdh56kZux2e6Msz+cNT1zMAppfiMea1cDLszyduul4m/glJImW++N37CVo6Ym7ZUGMHR +NMszj6yOTvGHR5k/vHllq1eqfxF+rscjSL92mxTUaOZzZJz0jN23aPNrsfz8Xa8QRxCMI 09DW7Q6DVXrYxbDJbynQLmTGzvB9pDkSEG9hUqwNnJTd6fNqu3ORSDXdi8ecLjxwDyFZVh Ui8mIspY3J1GP4TfGkO6qGCnGqzaVtd3X3jvlWN8ZZ3LBbpcadDledPxEGd3Rg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669332347; 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=+NyMkWp2GrUOU3BDiTzPL4SzyzA5986NyW2OtHWo5NY=; b=3If8dJ4/lkxNmnocohjV1Y3E1AJKtKtRh1sYRx2I5xdpITvzwfmgemEuM32+O4bMazHIhf nG65hDHwUJpLhQBQ== 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 , Jason Gunthorpe Subject: [patch V3 01/33] genirq/msi: Rearrange MSI domain flags References: <20221124230505.073418677@linutronix.de> MIME-Version: 1.0 Date: Fri, 25 Nov 2022 00:25:46 +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?1750421991163870589?= X-GMAIL-MSGID: =?utf-8?q?1750421991163870589?= 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 */ @@ -440,7 +442,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 @@ -452,33 +463,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,