xen/pci: Try harder to get PXM information for Xen
PATCH 1/1 xen/pci: Try harder to get PXM information for Xen
If the device being added to Xen is not contained in the ACPI table, walk the PCI device tree to find a parent that is contained in the ACPI table before finding the PXM information from this device.
--- drivers/xen/pci.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/xen/pci.c +13 -2
@@ -19,6 +19,7 @@#include <linux/pci.h> #include <linux/acpi.h> +#include <linux/pci-acpi.h> #include <xen/xen.h> #include <xen/interface/physdev.h> #include <xen/interface/xen.h>
@@ -67,8 +68,18 @@ static int xen_add_device(struct device *dev)#ifdef CONFIG_ACPI handle =ACPI_HANDLE (&pci_dev->dev); -if (!handle && pci_dev->bus->bridge) - handle =ACPI_HANDLE (pci_dev->bus->bridge); +if (!handle) { +/* +* This device was not listed in the ACPI name space at +* all. Try to get acpi handle of parent pci bus. +*/ +struct pci_bus *pbus; +for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { + handle =acpi_pci_get_bridge_handle (pbus); +if (handle) +break ; + } + }#ifdef CONFIG_PCI_IOV if (!handle && pci_dev->is_virtfn) handle =ACPI_HANDLE (physfn->bus->bridge);
Signature · 1 line
2.1.0
Quoted 32 lines · Ross Lagerwall
If the device being added to Xen is not contained in the ACPI table, walk the PCI device tree to find a parent that is contained in the ACPI table before finding the PXM information from this device.
Signed-off-by Ross Lagerwall <[email protected]>--- drivers/xen/pci.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/xen/pci.c +6
-2@@ -19,6 +19,7 @@#include <linux/pci.h> #include <linux/acpi.h> +#include <linux/pci-acpi.h> #include <xen/xen.h> #include <xen/interface/physdev.h> #include <xen/interface/xen.h> @@ -67,8 +68,18 @@ static int xen_add_device(struct device *dev)#ifdef CONFIG_ACPI handle =ACPI_HANDLE (&pci_dev->dev); -if (!handle && pci_dev->bus->bridge) - handle =ACPI_HANDLE (pci_dev->bus->bridge); +if (!handle) { +/* +* This device was not listed in the ACPI name space at +* all. Try to get acpi handle of parent pci bus. +*/
drivers/xen/pci.c static int xen_add_device(struct device *dev) · line 85
Quoted 10 lines
drivers/xen/pci.c +7
-0+struct pci_bus *pbus; +for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { + handle =acpi_pci_get_bridge_handle (pbus); +if (handle) +break ; + } + }#ifdef CONFIG_PCI_IOV if (!handle && pci_dev->is_virtfn) handle =ACPI_HANDLE (physfn->bus->bridge);
Shouldn't we first look at physfn, before going up the tree?
-boris
Quoted 36 lines · Boris Ostrovsky
Quoted 35 lines · Ross Lagerwall
If the device being added to Xen is not contained in the ACPI table, walk the PCI device tree to find a parent that is contained in the ACPI table before finding the PXM information from this device.
Signed-off-by Ross Lagerwall <[email protected]>--- drivers/xen/pci.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/xen/pci.c +11
-2@@ -19,6 +19,7 @@#include <linux/pci.h> #include <linux/acpi.h> +#include <linux/pci-acpi.h> #include <xen/xen.h> #include <xen/interface/physdev.h> #include <xen/interface/xen.h> @@ -67,8 +68,18 @@ static int xen_add_device(struct device *dev)#ifdef CONFIG_ACPI handle =ACPI_HANDLE (&pci_dev->dev); -if (!handle && pci_dev->bus->bridge) - handle =ACPI_HANDLE (pci_dev->bus->bridge); +if (!handle) { +/* +* This device was not listed in the ACPI name space at +* all. Try to get acpi handle of parent pci bus. +*/ +struct pci_bus *pbus; +for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { + handle =acpi_pci_get_bridge_handle (pbus); +if (handle) +break ;
Quoted 8 lines
drivers/xen/pci.c static int xen_add_device(struct device *dev) · line 85
Quoted 5 lines
drivers/xen/pci.c +2
-0+ } + }#ifdef CONFIG_PCI_IOV if (!handle && pci_dev->is_virtfn) handle =ACPI_HANDLE (physfn->bus->bridge);Shouldn't we first look at physfn, before going up the tree?
That sounds sensible but should be a separate pre-requisite patch.
David
Quoted 44 lines · David Vrabel
Quoted 35 lines · Boris Ostrovsky
Quoted 34 lines · Ross Lagerwall
If the device being added to Xen is not contained in the ACPI table, walk the PCI device tree to find a parent that is contained in the ACPI table before finding the PXM information from this device.
Signed-off-by Ross Lagerwall <[email protected]>--- drivers/xen/pci.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/xen/pci.c +10
-2@@ -19,6 +19,7 @@#include <linux/pci.h> #include <linux/acpi.h> +#include <linux/pci-acpi.h> #include <xen/xen.h> #include <xen/interface/physdev.h> #include <xen/interface/xen.h> @@ -67,8 +68,18 @@ static int xen_add_device(struct device *dev)#ifdef CONFIG_ACPI handle =ACPI_HANDLE (&pci_dev->dev); -if (!handle && pci_dev->bus->bridge) - handle =ACPI_HANDLE (pci_dev->bus->bridge); +if (!handle) { +/* +* This device was not listed in the ACPI name space at +* all. Try to get acpi handle of parent pci bus. +*/ +struct pci_bus *pbus; +for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { + handle =acpi_pci_get_bridge_handle (pbus); +if (handle)Quoted 8 lines
drivers/xen/pci.c static int xen_add_device(struct device *dev) · line 85
Quoted 6 lines
drivers/xen/pci.c +3
-0+break ; + } + }#ifdef CONFIG_PCI_IOV if (!handle && pci_dev->is_virtfn) handle =ACPI_HANDLE (physfn->bus->bridge);Shouldn't we first look at physfn, before going up the tree?
Quoted 1 line
That sounds sensible but should be a separate pre-requisite patch.
It's already there: the last two (unchanged) lines above. The added chunk should just move to after those two.
-boris
Quoted 45 lines · Boris Ostrovsky
Quoted 44 lines · David Vrabel
Quoted 43 lines · Boris Ostrovsky
Quoted 30 lines · Ross Lagerwall
If the device being added to Xen is not contained in the ACPI table, walk the PCI device tree to find a parent that is contained in the ACPI table before finding the PXM information from this device.
Signed-off-by Ross Lagerwall <[email protected]>--- drivers/xen/pci.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/xen/pci.c +6
-2@@ -19,6 +19,7 @@#include <linux/pci.h> #include <linux/acpi.h> +#include <linux/pci-acpi.h> #include <xen/xen.h> #include <xen/interface/physdev.h> #include <xen/interface/xen.h> @@ -67,8 +68,18 @@ static int xen_add_device(struct device *dev)#ifdef CONFIG_ACPI handle =ACPI_HANDLE (&pci_dev->dev); -if (!handle && pci_dev->bus->bridge) - handle =ACPI_HANDLE (pci_dev->bus->bridge); +if (!handle) { +/* +* This device was not listed in the ACPI name space at +* all. Try to get acpi handle of parent pci bus. +*/ drivers/xen/pci.c static int xen_add_device(struct device *dev) · line 84
Quoted 10 lines
drivers/xen/pci.c +7
-0+struct pci_bus *pbus; +for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { + handle =acpi_pci_get_bridge_handle (pbus); +if (handle) +break ; + } + }#ifdef CONFIG_PCI_IOV if (!handle && pci_dev->is_virtfn) handle =ACPI_HANDLE (physfn->bus->bridge);Shouldn't we first look at physfn, before going up the tree?
Quoted 4 lines
Quoted 1 line
That sounds sensible but should be a separate pre-requisite patch.
It's already there: the last two (unchanged) lines above. The added chunk should just move to after those two.
Oh yes, I didn't see that.
David
Quoted 45 lines · Boris Ostrovsky
Quoted 44 lines · David Vrabel
Quoted 43 lines · Boris Ostrovsky
Quoted 30 lines · Ross Lagerwall
If the device being added to Xen is not contained in the ACPI table, walk the PCI device tree to find a parent that is contained in the ACPI table before finding the PXM information from this device.
Signed-off-by Ross Lagerwall <[email protected]>--- drivers/xen/pci.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/xen/pci.c +6
-2@@ -19,6 +19,7 @@#include <linux/pci.h> #include <linux/acpi.h> +#include <linux/pci-acpi.h> #include <xen/xen.h> #include <xen/interface/physdev.h> #include <xen/interface/xen.h> @@ -67,8 +68,18 @@ static int xen_add_device(struct device *dev)#ifdef CONFIG_ACPI handle =ACPI_HANDLE (&pci_dev->dev); -if (!handle && pci_dev->bus->bridge) - handle =ACPI_HANDLE (pci_dev->bus->bridge); +if (!handle) { +/* +* This device was not listed in the ACPI name space at +* all. Try to get acpi handle of parent pci bus. +*/ drivers/xen/pci.c static int xen_add_device(struct device *dev) · line 84
Quoted 10 lines
drivers/xen/pci.c +7
-0+struct pci_bus *pbus; +for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { + handle =acpi_pci_get_bridge_handle (pbus); +if (handle) +break ; + } + }#ifdef CONFIG_PCI_IOV if (!handle && pci_dev->is_virtfn) handle =ACPI_HANDLE (physfn->bus->bridge);Shouldn't we first look at physfn, before going up the tree?
Quoted 5 lines
Quoted 1 line
That sounds sensible but should be a separate pre-requisite patch.
It's already there: the last two (unchanged) lines above. The added chunk should just move to after those two.
OK, I can swap it around.
Signature · 1 line
Ross Lagerwall