From patchwork Mon Nov 21 14:37:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 23811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1627446wrr; Mon, 21 Nov 2022 06:39:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4b0wHcyPq8XXTN2pjyBGlqQDtDJKKBrtO6nRiMZXGXqX3A/lM7fewM3wSCMG5OcCtHgmJU X-Received: by 2002:a17:90b:2d85:b0:213:258d:68ef with SMTP id sj5-20020a17090b2d8500b00213258d68efmr20718938pjb.235.1669041568410; Mon, 21 Nov 2022 06:39:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669041568; cv=none; d=google.com; s=arc-20160816; b=kf6tPKmjT1jk9uCDGAybNXsPILDL4iLPw9wwmq6LM4XQfs/q0d1ROJsCNQHjGmnHa3 X7Edv6Hy81s9t0f//+N8Ffl/OkhtJKg9s8UpZ50CJhh1x6Bpj1RJxS83yy3eCbSrZq3u SCr74ATMT0w1hwRo55MPqvIKLElbieU5vGI/CcvMstfstudZmJy5mSNWQQjJS51uz+ZV t3q5jaWh9JJVT67Rr9LRbvXxcPA6oVPnINXzaLu/yCi2g6BKmDLYbpcit4Lxukj4V0Vm /G2ExWz5IAdqDHpOjiEO81Fhepku29xz3rFbeS/YvsbWPBjDQq+N5uQTwvDAsHwwY+Dx 4B/A== 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=uxE2Dly/6+Q4uRawtSsl3v/O5OKI6xZbIMyJaFXzjoA=; b=nsCbAVB0/HARFSuXo7L3SyNUqp+Myfjn9/Z8YkixLqhuLIegaAGEG+AurClg8HPFkE go/glfwoww9ybHR1IlKO6BNnpplUgsM6I25TomasJlew4LiIQHx1t1C3xAxnJ2RYNoDU hiUQOcaTBIbq/wVHn+olf8N7TMhj6ZtSE3vjURH0k26HnELMjDDo4aQhjLNb+C8eW05t R+m4j37lYWwFNJ0lRDSSqvNDw1YcnehcPfblZifxb+Z2HP5ty2c55dWFlxvZsq91Kfb9 1utAb04TbbeAgUTi/umPGGQRTsadG5fokCswu5TJl6xl61U9m474HBJMt77ymi79WYSr UCdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=H5FvQ0HM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=p5I9kVDh; 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 e9-20020a631e09000000b0046fc6e02bb9si11505117pge.253.2022.11.21.06.39.14; Mon, 21 Nov 2022 06:39:28 -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=H5FvQ0HM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=p5I9kVDh; 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 S231753AbiKUOiy (ORCPT + 99 others); Mon, 21 Nov 2022 09:38:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231373AbiKUOht (ORCPT ); Mon, 21 Nov 2022 09:37:49 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1B28606AA; Mon, 21 Nov 2022 06:37:48 -0800 (PST) Message-ID: <20221121091326.548660039@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669041467; 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=uxE2Dly/6+Q4uRawtSsl3v/O5OKI6xZbIMyJaFXzjoA=; b=H5FvQ0HMPFqq2/TfkTiq4NY0eoXPxKBhOuyfnrZ2HeGSZ60Qh7dSRPHAThmvdsx/6Q72SJ CSGlFqv6qbJ2+Lw2WcmT2DyINQyZYBK9GeEfhf+ViSrCsqdjuImi73OnSfhvzDc2tgLc3E Onx6X0N2Rg12QQVeiuqxVcooKsEYs2eHcWhsAP8BL3HubK18FCaiGJhlFQSqGcE5dAPOXl eJElaRgIenWRQxHz+oygtqmU47spwjbfaIToEXY/IMLD/sBHTcN/DA0P4w+i8sOZDy30Tx ULp9KiuvTQTCrUZGZIQcEV4LVACx2HmaA0B/HTlwQLQzvvvJ9SOqxUgU7kX9dg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669041467; 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=uxE2Dly/6+Q4uRawtSsl3v/O5OKI6xZbIMyJaFXzjoA=; b=p5I9kVDhYyGggj+rhwXTgsauKm6EWZCcnpND+ruO2nO4/QYYg9OfnUuAH/n4/HKST0eUEv xiJLh8sqbD95fZAg== 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 V2 01/33] genirq/msi: Rearrange MSI domain flags References: <20221121083657.157152924@linutronix.de> MIME-Version: 1.0 Date: Mon, 21 Nov 2022 15:37:47 +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?1750116931900693798?= X-GMAIL-MSGID: =?utf-8?q?1750116931900693798?= 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 */ @@ -432,7 +434,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 @@ -444,33 +455,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,