Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4449200rwb; Mon, 21 Nov 2022 07:44:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf77P7URuW0NV3B/JSqPhjFrpApqERMB3+WhlYyrlh2t6t2RV8hBT9lXUtLr8+kc8cL3eWRD X-Received: by 2002:a17:906:a148:b0:7ad:b286:8ee2 with SMTP id bu8-20020a170906a14800b007adb2868ee2mr15836212ejb.511.1669045482279; Mon, 21 Nov 2022 07:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669045482; cv=none; d=google.com; s=arc-20160816; b=Xfuk76+URESLFm9ekFP3zzfgx47nKon4TqzrBoZgug0yswA4nquSwRydZrPWV1n3I2 IfM3ZSIgOUOCmyJsUl87EyDkzGjQLQf1rtQT7g0Pg7rFpgwG9dnYq86EzzHD0NOdtPiu vggEwxwBOvAduUJM3E3wLqSz/puL/IuP/LJWPwfWLwLyZFyxHcTBgcFW/+qLsgkHx2K9 tqDrZpMBwnFcH6MUZ99YLTMGauSmfeLEJjV7xjqFPvAPBAE43wk/bwr3yb9zlq5BnOkn OtAGTKa44gAPLqbNXQ4tiDNp70IULB/96PeJVm5G0E8TcgIAc99F7AKY7/SeW34qznKm fHXw== 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=5KOdOFErPOp6C7y41wmv9AEPY8LdxWiLCXWagjX0LQo=; b=pSzdZdB1gsQy88zBTKrCYQ4jwUgE/d3BPTH5/mrtz45rBnxpbhvc3O+WGbhceKAhMx EV2iCXQPWq2qeU6JHYAHhSzUEKhf7vaggxkoL6D01j2isIHUEFIdPOxnNKNgfJ3e9e0J V/b3fPE7gQuczCbBNgHhHOol5WaXeXCbU/LYII+cwNClny2MyWUjqlUA5Fz5nCeIVNE4 eZD0wDNxsUlh2o5dfQyylSEZ6RQrDkxq4qOLUU2dRD+XWLAv18IWZS58d0UJqRPB6G8A yNYlX3igoAN3W+uptlnAyAl+YvpHBDYc1Gw10rRzy5YOPTrcUrxbqVBlOns6LBu6h+/G mGaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=haQMldzF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds21-20020a170907725500b007adfc1509afsi12905757ejc.34.2022.11.21.07.44.18; Mon, 21 Nov 2022 07:44:42 -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=haQMldzF; 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 S230283AbiKUOhN (ORCPT + 91 others); Mon, 21 Nov 2022 09:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbiKUOgk (ORCPT ); Mon, 21 Nov 2022 09:36:40 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45D1163CC; Mon, 21 Nov 2022 06:36:26 -0800 (PST) Message-ID: <20221121083325.794346723@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669041384; 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=5KOdOFErPOp6C7y41wmv9AEPY8LdxWiLCXWagjX0LQo=; b=haQMldzFjmkYzIKzl0buWuioeUdG3ipmHGvSoCdp4PTxoH+E0zllOk407xEqX/FPxFvXZw SHdagyp2CIPIBWHHXK+YQFfIhNwYxKOGTPQYRB53frUY38164440fDcieiL2nXJpUn9/Ha ynGPjdO1YmU5iLbAnXlJA6Z1n9oT1BoS1mbrM4htaLjRwlUfSiunL/AvOfRH85kQGomsRq eGXQfNUl9lK1inNjTuCbPLV8Jzyawst4PyUcByboVNmvpHUE/StFXY4fu7dd9K8VMrm0M0 kR7vPr6+NgVqqg1l1QgU+eS66aEuv85qu0sBQuIGEs88NNgMzfcrVx+GJJcI9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669041384; 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=5KOdOFErPOp6C7y41wmv9AEPY8LdxWiLCXWagjX0LQo=; b=XELV3RIw2uCnyajDA/yPX3948niuq2PrCPyxuWtwlDvfTH6apAXM5pU/JirIUkUC26s2sF COE0xQU6YqNEPyAA== 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 05/21] genirq/irqdomain: Provide IRQ_DOMAIN_FLAG_MSI_PARENT References: <20221121083210.309161925@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 21 Nov 2022 15:36:24 +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 The new PCI/IMS (Interrupt Message Store) functionality is allowing hardware vendors to provide implementation specific storage for the MSI messages. This can be device memory and also host/guest memory, e.g. in queue memory which is shared with the hardware. This requires device specific MSI interrupt domains, which cannot be achieved by expanding the existing PCI/MSI interrupt domain concept which is a global interrupt domain shared by all PCI devices on a particular (IOMMU) segment: |--- device 1 [Vector]---[Remapping]---[PCI/MSI]--|... |--- device N This works because the PCI/MSI[-X] space is uniform, but falls apart with PCI/IMS which is implementation defined and must be available along with PCI/MSI[-X] on the same device. To support PCI/MSI[-X] plus PCI/IMS on the same device it is required to rework the PCI/MSI interrupt domain hierarchy concept in the following way: |--- [PCI/MSI] device 1 [Vector]---[Remapping]---|... |--- [PCI/MSI] device N That allows in the next step to create multiple interrupt domains per device: |--- [PCI/MSI] device 1 |--- [PCI/IMS] device 1 [Vector]---[Remapping]---|... |--- [PCI/MSI] device N |--- [PCI/IMS] device N So the domain which previously created the global PCI/MSI domain must now act as parent domain for the per device domains. The hierarchy depth is the same as before, but the PCI/MSI domains are then device specific and not longer global. Provide IRQ_DOMAIN_FLAG_MSI_PARENT, which allows to identify these parent domains, along with helpers to query it. Signed-off-by: Thomas Gleixner Reviewed-by: Jason Gunthorpe --- include/linux/irqdomain.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -189,6 +189,9 @@ enum { /* Irq domain doesn't translate anything */ IRQ_DOMAIN_FLAG_NO_MAP = (1 << 6), + /* Irq domain is a MSI parent domain */ + IRQ_DOMAIN_FLAG_MSI_PARENT = (1 << 8), + /* * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved * for implementation specific purposes and ignored by the @@ -551,6 +554,11 @@ static inline bool irq_domain_is_msi_rem extern bool irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain); +static inline bool irq_domain_is_msi_parent(struct irq_domain *domain) +{ + return domain->flags & IRQ_DOMAIN_FLAG_MSI_PARENT; +} + #else /* CONFIG_IRQ_DOMAIN_HIERARCHY */ static inline int irq_domain_alloc_irqs(struct irq_domain *domain, unsigned int nr_irqs, int node, void *arg) @@ -596,6 +604,12 @@ irq_domain_hierarchical_is_msi_remap(str { return false; } + +static inline bool irq_domain_is_msi_parent(struct irq_domain *domain) +{ + return false; +} + #endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ #else /* CONFIG_IRQ_DOMAIN */