[PATCH libpciaccess] Support for 32-bit domains

Mark Kettenis mark.kettenis at xs4all.nl
Wed Aug 10 22:17:48 UTC 2016


> From: Keith Busch <keith.busch at intel.com>
> Date: Tue,  9 Aug 2016 15:39:35 -0600
> 
> A pci "domain" is a purely software construct, and need not be limited
> to the 16-bit ACPI defined segment. The Linux kernel currently supports
> 32-bit domains, so this patch matches up with those capabilities to make
> it usable on systems exporting such domains.

Well, yes, and no.  PCI domains really are a hardware property.  There
are systems out there that have multiple PCI host bridges, each with
their own separate config/mem/io address spaces and bus numbers
starting with 0 for the root of the PCI bus hierarchy.  Pretty much
any 64-bit SPARC system falls into this category, and I've seen
PA-RISC and POWER systems with such a hardware configuration as well.
And given that HP's Itanium line developed from their PA-RISC hardware
I expect them to be in the same boat.  There is no domain numering
scheme that is implied by the hardware though, do domain numbers are
indeed purely a software construct.  On OpenBSD we simply number the
domains sequentially.  So 16 bits are more than enough.

The Linux kernel could do the same with ACPI segments (which may or
may not map onto true PCI domains).  That would remove the need to
change te libpciaccess ABI.  Although I can see that having a 1:1
mapping of ACPI segments to domains is something that is nice to have.
However, I do believe that ACPI segments are actually encoded as
64-bit integers.  So such a 1:1 mapping may not be achievable.

> Reported-by: Pawel Baldysiak <pawel.baldysiak at intel.com>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
> ---
>  include/pciaccess.h | 2 +-
>  src/linux_sysfs.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/pciaccess.h b/include/pciaccess.h
> index 1d7aa4b..93ed76f 100644
> --- a/include/pciaccess.h
> +++ b/include/pciaccess.h
> @@ -321,7 +321,7 @@ struct pci_device {
>       * the domain will always be zero.
>       */
>      /*@{*/
> -    uint16_t    domain;
> +    uint32_t    domain;
>      uint8_t     bus;
>      uint8_t     dev;
>      uint8_t     func;
> diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
> index 6367b11..c0c8f2a 100644
> --- a/src/linux_sysfs.c
> +++ b/src/linux_sysfs.c
> @@ -159,7 +159,7 @@ populate_entries( struct pci_system * p )
>  			(struct pci_device_private *) &p->devices[i];
>  
>  
> -		sscanf(devices[i]->d_name, "%04x:%02x:%02x.%1u",
> +		sscanf(devices[i]->d_name, "%x:%02x:%02x.%1u",
>  		       & dom, & bus, & dev, & func);
>  
>  		device->base.domain = dom;
> -- 
> 2.7.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 
> 


More information about the xorg-devel mailing list