Splitting hardware access out of xserver (in/out, int10, xf86emu)

Mark Kettenis mark.kettenis at xs4all.nl
Tue Oct 27 15:13:18 PDT 2009

> From: Adam Jackson <ajax at nwnk.net>
> Date: Tue, 27 Oct 2009 13:35:45 -0400
> On Tue, 2009-10-27 at 16:56 +0100, Mark Kettenis wrote:
> > That said, the way in/out are used in the xserver and associated (PCI)
> > drivers is really bogus.  Their usage should be replaced by a
> > mechanism similar to how memory mapped io is handled.  PCI drivers
> > should really use pci_device_map_range() to "map" io space just like
> > mmio space such that they can work on architectures that have multiple
> > PCI domains.
> While domainful PCI chipsets typically provide this functionality,
> normal x86 kit does not.  There's no especially good way to emulate it
> either, since even if the segfault handler told you i/o direction you'd
> still need to know the instruction length in the general case.
> So, no, you really can't force memory mapped i/o space access and still
> remain portable to x86, at least not without adding a modest amount of
> code to the kernel.

Right, that's probably not the way to go.

You'll still need access functions.  Those access functions would take
the address returned by pci_device_map_range() as an argument.  The
i386/amd64 versions would ignore that argument and issue the
appropriate in/out instructions.  Other platforms would do ordinary
memory access in those functions.

Anyway, the point I'm trying to make here is that if people are
seriously considering changing the interfaces for io space access, it
would make sense to do it right such that there is a decent chance for
things to work on other architectures as well.

More information about the xorg-devel mailing list