From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6A2EC433B4 for ; Mon, 10 May 2021 18:23:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DFFF61483 for ; Mon, 10 May 2021 18:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbhEJSYW (ORCPT ); Mon, 10 May 2021 14:24:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:47580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbhEJSYW (ORCPT ); Mon, 10 May 2021 14:24:22 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14DC761359; Mon, 10 May 2021 18:23:17 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lgAYk-000WgL-W1; Mon, 10 May 2021 19:23:15 +0100 Date: Mon, 10 May 2021 19:23:14 +0100 Message-ID: <87r1ieo3cd.wl-maz@kernel.org> From: Marc Zyngier To: Jean-Philippe Brucker Cc: bhelgaas@google.com, lorenzo.pieralisi@arm.com, linux-pci@vger.kernel.org Subject: Re: [PATCH] PCI/MSI: Fix MSIs for generic hosts that use device-tree's "msi-map" In-Reply-To: <20210510173129.750496-1-jean-philippe@linaro.org> References: <20210510173129.750496-1-jean-philippe@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: jean-philippe@linaro.org, bhelgaas@google.com, lorenzo.pieralisi@arm.com, linux-pci@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Hi Jean-Philippe, On Mon, 10 May 2021 18:31:30 +0100, Jean-Philippe Brucker wrote: > > Since commit 9ec37efb8783 ("PCI/MSI: Make pci_host_common_probe() > declare its reliance on MSI domains"), platforms that rely on the > "msi-map" device-tree property don't get MSIs anymore. > > On the Arm Fast Model for example [1], the host bridge doesn't have a > "msi-parent" property since it doesn't itself generate MSIs, and so > doesn't get a MSI domain. It has an "msi-map" property instead to > describe MSI controllers of child devices. As a result, due to the new > msi_domain check in pci_register_host_bridge(), the whole bus gets > PCI_BUS_FLAGS_NO_MSI. Urgh... I knew I was going to break something... :-( Thanks for picking this up. > Check whether the root complex has an "msi-map" property before giving > up on MSIs. > > [1] arch/arm64/boot/dts/arm/fvp-base-revc.dts > > Fixes: 9ec37efb8783 ("PCI/MSI: Make pci_host_common_probe() declare its reliance on MSI domains") > Signed-off-by: Jean-Philippe Brucker > --- > include/linux/pci.h | 2 ++ > drivers/pci/of.c | 7 +++++++ > drivers/pci/probe.c | 3 ++- > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/include/linux/pci.h b/include/linux/pci.h > index c20211e59a57..24306504226a 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -2344,6 +2344,7 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, > struct device_node; > struct irq_domain; > struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus); > +bool pci_host_of_has_msi_map(struct device *dev); > > /* Arch may override this (weak) */ > struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); > @@ -2351,6 +2352,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); > #else /* CONFIG_OF */ > static inline struct irq_domain * > pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } > +static inline bool pci_host_of_has_msi_map(struct device *dev) { return false; } > #endif /* CONFIG_OF */ > > static inline struct device_node * > diff --git a/drivers/pci/of.c b/drivers/pci/of.c > index da5b414d585a..85dcb7097da4 100644 > --- a/drivers/pci/of.c > +++ b/drivers/pci/of.c > @@ -103,6 +103,13 @@ struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus) > #endif > } > > +bool pci_host_of_has_msi_map(struct device *dev) > +{ > + if (dev && dev->of_node) > + return of_get_property(dev->of_node, "msi-map", NULL); > + return false; > +} > + > static inline int __of_pci_pci_compare(struct device_node *node, > unsigned int data) > { > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 3a62d09b8869..275204646c68 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -925,7 +925,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) > device_enable_async_suspend(bus->bridge); > pci_set_bus_of_node(bus); > pci_set_bus_msi_domain(bus); > - if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev)) > + if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev) && > + !pci_host_of_has_msi_map(parent)) > bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI; > > if (!parent) Do we need something similar for IORT, which implements a similar functionality to "msi-map"? My ACPI boxes seem to get their MSIs just fine though... Thanks, M. -- Without deviation from the norm, progress is not possible.