[PATCH] Update NetBSD support in libpciaccess

Michael macallan at netbsd.org
Wed Dec 29 10:18:24 PST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Dec 29, 2010, at 12:42 PM, Mark Kettenis wrote:

>> From: Michael <macallan at netbsd.org>
>> Date: Mon, 27 Dec 2010 16:23:40 -0500
>>
>> Hello,
>>
>> this patch is pulled straight from NetBSD -current, it does:
>> - add support for multiple PCI host bridges
>> - add sane support for reading ROMs
>> - get rid of all /dev/mem use
>> - all that in a machine independent manner, the same code runs on
>> sparc64, i386 etc.
>
> Hi Michael,
>
> Not sure if review is essential for pciaccess patches, but just in
> case, here are my observations.

Well, I guess I'll take care of the NetBSD-specific bits anyway ;)

> If I read this code correctly, you're putting each PCI bus in a
> seperate domain.  That is not quite right!

It's not what the domain ID is supposed to be for but it gets the job  
done without having to add additional kernel code.
The problem is that userland in NetBSD has no sane way to find out  
wether any two given PCI buses are subordinates of each other or not.  
Then, in the Xserver itself, that information isn't essential to  
anything - all operations are either per bus or global. So we use the  
'domain' number simply as a unique identifier since bus numbers can  
(and do) overlap.

> On the other hand, XOrg is now largely PCI domain unaware.  I think
> there are basically two places where domains still matter:
>
> 1. The xf86-video-intel driver does a look up of the host bridge in
>   domain 0.  On NetBSD on i386/amd64 the host bridge probably always
>   ends up in domain 0, since it lives on the first PCI bus in the
>   system.  So you're probably safe here.

What does it need that information for?
Either way, the code has been in use for more than a year so it better  
be fine.

> 2. The BusID's used to select specific PCI devices in xorg.conf may
>   include the domain.  I'm not quite sure what the impact of putting
>   each PCI bus in its own domain is here.  It may mean that you'll
>   need to specify the domain for devices that don't sit on PCI bus 0.

Yes, and for 1.6 I patched the X -configure code to include the domain  
specifier if it's not zero. Not sure what to do about 1.9 where that's  
completely broken but at least existing configs work.

> Anyway, just some stuff to keep in mind.  If you think this helps
> NetBSD users, by all means go ahead.

It sure does, just think about sparc64 and macppc which tend to have  
more than one host bridge. With the old, rather braindead code the  
Xserver could only access either what's visible through /dev/pci0 or / 
dev/ttyE0, with the new code it can use any PCI device.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBTRt7ccpnzkX8Yg2nAQKLRwgAj+4i3eUkgQNAe5tI5GVvvgBmXWDucN3B
ULYx4hgEkhwSBhUokqIuSwqZXxBcX9NvKbYW+H1qgXGzru4BEDwgejMxVdTzmKkw
VYvg3bIaor2HlMymE4gwAkC/9RXZ63sCLfEQ9EwlNGL8AE55HzhnbZsukH3MrwwS
pw+5LPIrfi6J2Kz2prlNsMVZ2icGOyQsOpitZuAB98dozaGVBMHHlXe5VGkIT/dZ
Rcaa+IhFTvc8dJZepXGy+8DlHUk0np3MABn8h7Vki2q4pNajXD8ijp+M2Nd44dL3
zXyrjBFAVbDBSTkN45v6VDmSkiSe2hxcWYBramnLWLJdzZ29/ZX6Ew==
=vY4Q
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list