From patchwork Fri Nov 11 13:56:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 18799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp755712wru; Fri, 11 Nov 2022 06:02:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BBbD3S5IIM5VSrUHaSzAuysSfu7wRcf/LBQNEJV86ycCJ+fVg46xo0+/rB/2fmYElp3R0 X-Received: by 2002:a19:2d53:0:b0:499:cce2:12d9 with SMTP id t19-20020a192d53000000b00499cce212d9mr843690lft.4.1668175338291; Fri, 11 Nov 2022 06:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668175338; cv=none; d=google.com; s=arc-20160816; b=lFv+hugTafxfpzjZiw0SBoaRI2M7371CnVinqQGymotWuIBq8wLJ3J72eJPugzv0eC s8xhilByAGUfNF9TPIqLtTJS5OlQp05CkM9lpZDhUBEpQlNmcy36ax92mc9Zu5K6BcFo YhnLnehCBpp+FZT3W/rzQuRfhC9b44Leg2OgnIFK7ordqLAaeJHu2r/YLLyuC0imO2A0 vd79kQLlEhf3q4PM005+OOMtnfy08Nj+pEldyzy5h7k5DyOpS5eb20+hNVkU/exbM9vx pype/KZOaAhPrKo7ygb3xjkgrSjURxf81lKFuqzhm/n5pgx7H6zg3UrQZMI5aafUrPXo 6iQw== 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=zA5ha748LKhDmb5FPzI8a0g9w0FaiptQdqB8uQ3jTXw=; b=fhtOGWjTUXtA0Vkag7WQnFOhziqm4AQzqNbzAqc2IxTFZssVTNv0H1XE2yBrvh78Gl EpJBiXfI9moZT0Eb35y1jpfIIDa4YCGwmSkSbcqNhgNGruYuQYuYokb6wjZ/VaB8OieW qlSAxkoncqvKwjt2zskw7Z+3SSBE7YISVOGFSuTtigPI6ANxTYEKF79fANmi/bZQEBEG VMAhuHkvWMwVQMY8+8e+DI9e9pQTQdjltDK/SZ+KEqZBXRRmu7UiXCCmndIRveYrzzJV VJty75IHyX55ggx9CwknwDnJg4CdSOlr7EFSrH4zUVkTIX6vRMes2G289Ql8AdgdXC6e idWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EbvSbUXW; 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 j17-20020a17090686d100b007adef1fc90fsi1551050ejy.304.2022.11.11.06.01.50; Fri, 11 Nov 2022 06:02:18 -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=EbvSbUXW; 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 S234020AbiKKOBC (ORCPT + 99 others); Fri, 11 Nov 2022 09:01:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbiKKOAa (ORCPT ); Fri, 11 Nov 2022 09:00:30 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFCCE56EDD; Fri, 11 Nov 2022 05:56:45 -0800 (PST) Message-ID: <20221111132706.276545278@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668175004; 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=zA5ha748LKhDmb5FPzI8a0g9w0FaiptQdqB8uQ3jTXw=; b=EbvSbUXW9nFHqG2WDwQcBgXL97thkoo4raFmOln8yVqrphIoC0l+9hZHMP5m9yUF/GECc4 KewKET9LzTLaaXlMfLo6KTDhrcxx4M5+mX+9+vH3yYqyIGJ/ZqTeq2DmusSXPt1Z68YxgY gm2HvOi0toYYKQZQ96JGxXlsPwFT9gZusZx6nLe+KC+CcnkaRsxW5Uc9XoWBoK0wRPgpYj J9QRr2LKPx5Q804UiQ1NffH88HSjiEsfcQn5mEmtNTxXFAgI6qhyQc/nQJlD73AOgazk1w bu8MzrlM0qKn3suCr6/sTsQSpD4UC91v1Vt+zPorCA7ZbBpnJ9Sh7zdcWOaIyA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668175004; 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=zA5ha748LKhDmb5FPzI8a0g9w0FaiptQdqB8uQ3jTXw=; b=T9IEE38gSYKi57w85Y2z1rWZQqe1G0LxfHLdyp2W+2FRPXDVlQDagn6EzBEVSfUZrqqmvL KkP6szVnXinU4rAg== 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 04/20] genirq/irqdomain: Provide IRQ_DOMAIN_FLAG_MSI_PARENT References: <20221111131813.914374272@linutronix.de> MIME-Version: 1.0 Date: Fri, 11 Nov 2022 14:56:43 +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?1749208623605172823?= X-GMAIL-MSGID: =?utf-8?q?1749208623605172823?= 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 achived 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 --- 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 */