From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhou Wang Subject: Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation Date: Tue, 16 May 2017 11:22:37 +0800 Message-ID: <591A707D.5000000@hisilicon.com> References: <20170426100619.31758-1-lorenzo.pieralisi@arm.com> <20170426100619.31758-3-lorenzo.pieralisi@arm.com> <5919471B.7080607@hisilicon.com> <20170515091749.GA14348@red-moon> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: Received: from szxga03-in.huawei.com ([45.249.212.189]:5951 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbdEPDWp (ORCPT ); Mon, 15 May 2017 23:22:45 -0400 In-Reply-To: <20170515091749.GA14348@red-moon> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Lorenzo Pieralisi Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , Sergey Temerkhanov , Sinan Kaya On 2017/5/15 17:17, Lorenzo Pieralisi wrote: > On Mon, May 15, 2017 at 02:13:47PM +0800, Zhou Wang wrote: >> On 2017/4/26 18:06, Lorenzo Pieralisi wrote: >>> The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI >>> host bridge registration to detect the NUMA node for a given >>> struct pci_bus.dev. Implement an ACPI method that, through >>> the struct pci_bus.bridge ACPI companion, retrieve and return >>> the NUMA node corresponding to a given struct pci_bus.dev. >>> >>> Signed-off-by: Lorenzo Pieralisi >>> Cc: Bjorn Helgaas >>> --- >>> drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++ >>> include/linux/pci.h | 6 ++++++ >>> 2 files changed, 26 insertions(+) >>> >>> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c >>> index 0018603..915da79 100644 >>> --- a/drivers/pci/pci-acpi.c >>> +++ b/drivers/pci/pci-acpi.c >>> @@ -10,6 +10,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) >>> return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI); >>> } >>> >>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus) >>> +{ >>> + int node = NUMA_NO_NODE; >>> + struct device *bridge = get_device(bus->bridge); >>> + >>> + if (!bridge) >>> + return node; >>> + >>> + if (has_acpi_companion(bridge)) { >>> + struct acpi_device *adev = to_acpi_device_node(bridge->fwnode); >>> + >>> + node = acpi_get_node(adev->handle); >>> + } >>> + >>> + put_device(bridge); >>> + >>> + return node; >>> +} >>> + >> >> It seems there is no function to call this, am I right? > > Sorry, I missed updating pci_bus_find_numa_node() while reshuffling > the code, apologies. > > I will repost shortly. > >> Another question is that: in the latest IORT revision C, "Proximity >> domain" has been added to the IORT spec. So when we enable NUMA for a >> PCIe device, should we also consider this? > > That's for the SMMU device. Sorry, this is another problem. Now I get it that this Proximity domain is for SMMU itself. Thanks, Zhou > > Lorenzo > >> Thanks, >> Zhou >> >>> static int __init acpi_pci_init(void) >>> { >>> int ret; >>> diff --git a/include/linux/pci.h b/include/linux/pci.h >>> index 9e62462..b40d095 100644 >>> --- a/include/linux/pci.h >>> +++ b/include/linux/pci.h >>> @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) >>> #endif >>> int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent); >>> #endif >>> +#ifdef CONFIG_ACPI >>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus); >>> +#else >>> +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus) >>> +{ return NUMA_NO_NODE; } >>> +#endif >>> int pci_bus_find_numa_node(struct pci_bus *bus); >>> >>> /* some architectures require additional setup to direct VGA traffic */ >>> >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > . > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751169AbdEPDWr (ORCPT ); Mon, 15 May 2017 23:22:47 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5951 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbdEPDWp (ORCPT ); Mon, 15 May 2017 23:22:45 -0400 Subject: Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation To: Lorenzo Pieralisi References: <20170426100619.31758-1-lorenzo.pieralisi@arm.com> <20170426100619.31758-3-lorenzo.pieralisi@arm.com> <5919471B.7080607@hisilicon.com> <20170515091749.GA14348@red-moon> CC: , , , Bjorn Helgaas , "Sergey Temerkhanov" , Sinan Kaya From: Zhou Wang Message-ID: <591A707D.5000000@hisilicon.com> Date: Tue, 16 May 2017 11:22:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20170515091749.GA14348@red-moon> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.63.139.185] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.591A7082.00DF,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fc104394076700b20f6594bfc05372ef Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/5/15 17:17, Lorenzo Pieralisi wrote: > On Mon, May 15, 2017 at 02:13:47PM +0800, Zhou Wang wrote: >> On 2017/4/26 18:06, Lorenzo Pieralisi wrote: >>> The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI >>> host bridge registration to detect the NUMA node for a given >>> struct pci_bus.dev. Implement an ACPI method that, through >>> the struct pci_bus.bridge ACPI companion, retrieve and return >>> the NUMA node corresponding to a given struct pci_bus.dev. >>> >>> Signed-off-by: Lorenzo Pieralisi >>> Cc: Bjorn Helgaas >>> --- >>> drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++ >>> include/linux/pci.h | 6 ++++++ >>> 2 files changed, 26 insertions(+) >>> >>> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c >>> index 0018603..915da79 100644 >>> --- a/drivers/pci/pci-acpi.c >>> +++ b/drivers/pci/pci-acpi.c >>> @@ -10,6 +10,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) >>> return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI); >>> } >>> >>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus) >>> +{ >>> + int node = NUMA_NO_NODE; >>> + struct device *bridge = get_device(bus->bridge); >>> + >>> + if (!bridge) >>> + return node; >>> + >>> + if (has_acpi_companion(bridge)) { >>> + struct acpi_device *adev = to_acpi_device_node(bridge->fwnode); >>> + >>> + node = acpi_get_node(adev->handle); >>> + } >>> + >>> + put_device(bridge); >>> + >>> + return node; >>> +} >>> + >> >> It seems there is no function to call this, am I right? > > Sorry, I missed updating pci_bus_find_numa_node() while reshuffling > the code, apologies. > > I will repost shortly. > >> Another question is that: in the latest IORT revision C, "Proximity >> domain" has been added to the IORT spec. So when we enable NUMA for a >> PCIe device, should we also consider this? > > That's for the SMMU device. Sorry, this is another problem. Now I get it that this Proximity domain is for SMMU itself. Thanks, Zhou > > Lorenzo > >> Thanks, >> Zhou >> >>> static int __init acpi_pci_init(void) >>> { >>> int ret; >>> diff --git a/include/linux/pci.h b/include/linux/pci.h >>> index 9e62462..b40d095 100644 >>> --- a/include/linux/pci.h >>> +++ b/include/linux/pci.h >>> @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) >>> #endif >>> int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent); >>> #endif >>> +#ifdef CONFIG_ACPI >>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus); >>> +#else >>> +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus) >>> +{ return NUMA_NO_NODE; } >>> +#endif >>> int pci_bus_find_numa_node(struct pci_bus *bus); >>> >>> /* some architectures require additional setup to direct VGA traffic */ >>> >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > . >