[PATCH libpciaccess] Support for 32-bit domains

Mark Kettenis mark.kettenis at xs4all.nl
Fri Aug 12 09:43:52 UTC 2016

> From: Eric Anholt <eric at anholt.net>
> Date: Thu, 11 Aug 2016 23:32:04 -0700
> Keith Busch <keith.busch at intel.com> writes:
> > On Thu, Aug 11, 2016 at 12:03:30PM -0700, Eric Anholt wrote:
> >> Given that libpciaccess allocates the struct, and the struct isn't
> >> embedded in any other public structs, I think you could just tack a
> >> "uint16_t domain_high;" at the end of the struct and fill that with the
> >> high bits.
> >
> > Hmm, then we have to change every usage of domain to combine the two,
> > and every usage thereafter must do the same.
> >
> > How about tacking 'uint32_t domain' to the end for the full domain,
> > rename the existing 'uint16_t domain' to 'domain_low', and then just
> > copy the lower bits from the full domain into there? That should satisfy
> > legacy usage, and everywhere else will automatically use the full value.
> >
> > Does something like this look more reasonable?
> That looks even better to me!  Let's give people a few days to comment,
> but I like this solution.

'struct pci_device' isn't an opaque struct, and the "documentation"
never says that you can't build your own.  It isn't unreasonable to
expect to be able to fill in the domain, bus, device and function
yourself and be able to call pci_device_cfg_read().  It also means
that code can copy a 'struct pci_device' instance around.  Code using
the old ABI would lose the new 32-bit domain field in that case.

More information about the xorg-devel mailing list