All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/pci: Try harder to get PXM information for Xen
@ 2015-04-08 13:39 Ross Lagerwall
  2015-04-08 14:01 ` Boris Ostrovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Lagerwall @ 2015-04-08 13:39 UTC (permalink / raw)
  To: xen-devel; +Cc: Ross Lagerwall, Boris Ostrovsky, David Vrabel

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 <ross.lagerwall@citrix.com>
---
 drivers/xen/pci.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
index 95ee430..6837181 100644
--- a/drivers/xen/pci.c
+++ b/drivers/xen/pci.c
@@ -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);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/pci: Try harder to get PXM information for Xen
  2015-04-08 13:39 [PATCH] xen/pci: Try harder to get PXM information for Xen Ross Lagerwall
@ 2015-04-08 14:01 ` Boris Ostrovsky
  2015-04-08 16:44   ` David Vrabel
  0 siblings, 1 reply; 6+ messages in thread
From: Boris Ostrovsky @ 2015-04-08 14:01 UTC (permalink / raw)
  To: Ross Lagerwall, xen-devel; +Cc: David Vrabel

On 04/08/2015 09:39 AM, Ross Lagerwall wrote:
> 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 <ross.lagerwall@citrix.com>
> ---
>   drivers/xen/pci.c | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
> index 95ee430..6837181 100644
> --- a/drivers/xen/pci.c
> +++ b/drivers/xen/pci.c
> @@ -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);


Shouldn't we first look at physfn, before going up the tree?

-boris

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/pci: Try harder to get PXM information for Xen
  2015-04-08 14:01 ` Boris Ostrovsky
@ 2015-04-08 16:44   ` David Vrabel
  2015-04-08 17:17     ` Boris Ostrovsky
  0 siblings, 1 reply; 6+ messages in thread
From: David Vrabel @ 2015-04-08 16:44 UTC (permalink / raw)
  To: Boris Ostrovsky, Ross Lagerwall, xen-devel

On 08/04/15 15:01, Boris Ostrovsky wrote:
> On 04/08/2015 09:39 AM, Ross Lagerwall wrote:
>> 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 <ross.lagerwall@citrix.com>
>> ---
>>   drivers/xen/pci.c | 15 +++++++++++++--
>>   1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
>> index 95ee430..6837181 100644
>> --- a/drivers/xen/pci.c
>> +++ b/drivers/xen/pci.c
>> @@ -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);
> 
> 
> Shouldn't we first look at physfn, before going up the tree?

That sounds sensible but should be a separate pre-requisite patch.

David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/pci: Try harder to get PXM information for Xen
  2015-04-08 16:44   ` David Vrabel
@ 2015-04-08 17:17     ` Boris Ostrovsky
  2015-04-08 17:57       ` David Vrabel
  2015-04-09  6:55       ` Ross Lagerwall
  0 siblings, 2 replies; 6+ messages in thread
From: Boris Ostrovsky @ 2015-04-08 17:17 UTC (permalink / raw)
  To: David Vrabel, Ross Lagerwall, xen-devel

On 04/08/2015 12:44 PM, David Vrabel wrote:
> On 08/04/15 15:01, Boris Ostrovsky wrote:
>> On 04/08/2015 09:39 AM, Ross Lagerwall wrote:
>>> 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 <ross.lagerwall@citrix.com>
>>> ---
>>>    drivers/xen/pci.c | 15 +++++++++++++--
>>>    1 file changed, 13 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
>>> index 95ee430..6837181 100644
>>> --- a/drivers/xen/pci.c
>>> +++ b/drivers/xen/pci.c
>>> @@ -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);
>>
>> Shouldn't we first look at physfn, before going up the tree?
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/pci: Try harder to get PXM information for Xen
  2015-04-08 17:17     ` Boris Ostrovsky
@ 2015-04-08 17:57       ` David Vrabel
  2015-04-09  6:55       ` Ross Lagerwall
  1 sibling, 0 replies; 6+ messages in thread
From: David Vrabel @ 2015-04-08 17:57 UTC (permalink / raw)
  To: Boris Ostrovsky, David Vrabel, Ross Lagerwall, xen-devel

On 08/04/15 18:17, Boris Ostrovsky wrote:
> On 04/08/2015 12:44 PM, David Vrabel wrote:
>> On 08/04/15 15:01, Boris Ostrovsky wrote:
>>> On 04/08/2015 09:39 AM, Ross Lagerwall wrote:
>>>> 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 <ross.lagerwall@citrix.com>
>>>> ---
>>>>    drivers/xen/pci.c | 15 +++++++++++++--
>>>>    1 file changed, 13 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
>>>> index 95ee430..6837181 100644
>>>> --- a/drivers/xen/pci.c
>>>> +++ b/drivers/xen/pci.c
>>>> @@ -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);
>>>
>>> Shouldn't we first look at physfn, before going up the tree?
>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/pci: Try harder to get PXM information for Xen
  2015-04-08 17:17     ` Boris Ostrovsky
  2015-04-08 17:57       ` David Vrabel
@ 2015-04-09  6:55       ` Ross Lagerwall
  1 sibling, 0 replies; 6+ messages in thread
From: Ross Lagerwall @ 2015-04-09  6:55 UTC (permalink / raw)
  To: Boris Ostrovsky, David Vrabel, xen-devel

On 08/04/15 18:17, Boris Ostrovsky wrote:
> On 04/08/2015 12:44 PM, David Vrabel wrote:
>> On 08/04/15 15:01, Boris Ostrovsky wrote:
>>> On 04/08/2015 09:39 AM, Ross Lagerwall wrote:
>>>> 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 <ross.lagerwall@citrix.com>
>>>> ---
>>>>    drivers/xen/pci.c | 15 +++++++++++++--
>>>>    1 file changed, 13 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
>>>> index 95ee430..6837181 100644
>>>> --- a/drivers/xen/pci.c
>>>> +++ b/drivers/xen/pci.c
>>>> @@ -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);
>>>
>>> Shouldn't we first look at physfn, before going up the tree?
>> 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.

-- 
Ross Lagerwall

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-09  6:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 13:39 [PATCH] xen/pci: Try harder to get PXM information for Xen Ross Lagerwall
2015-04-08 14:01 ` Boris Ostrovsky
2015-04-08 16:44   ` David Vrabel
2015-04-08 17:17     ` Boris Ostrovsky
2015-04-08 17:57       ` David Vrabel
2015-04-09  6:55       ` Ross Lagerwall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.