I/O Space on IA-64 [was: How to build Port IO...]

First, let me say that I strongly agree with the people who told the
original poster that he shouldn’t whack on PCI configuration I/O ports
directly.

Second, let me point out that the CF8/CFC mechanism that is so prevalent on
PCs is hardly architecturally required on IA-64, particularly since all
(legal) PCI configuration access, even by the OS, goes through the SAL,
which a firmware layer. So IA-64 machines are completely free to implement
PCI configuration space through absolutely any hardware mechanism. They
could map it linearly in physical memory space, if they cared to. And they
probably will with future chipsets, as that’s what PCI-Express requires. Go
through the OS layers that work on x86 and you’ll automatically go through
the right firmware layers on IA-64.

Third, several people have mused on the general nature of I/O space on
IA-64. So here’s some actual information.

  1. There is no processor bus cycle for I/O space. (But there isn’t one for
    Athlon or Opteron either, so that’s nothing new.)

  2. I/O is mapped into linear physical memory address space. (Again, it is
    on Athlon or Opteron, too.)

  3. There are special processor instructions that implement I/O, just like
    on x86. They look at a base address register inside the processor and then
    convert the instruction into a memory fetch with the proper barriers.
    (Again, this is very much like an Athlon or an Opteron.)

  4. The memory base is chipset-specific, and it’s reasonably difficult to
    uncover.

  5. The I/O is mapped sparsely into memory space, with small blocks of ports
    mapped into individual memory pages, making it much, much easier to
    implement a DOS emulator with I/O space protection, since you can put the
    protection into the page tables.


Jake Oshins
Windows Base Kernel Team

This posting is provided “AS IS” with no warranties, and confers no rights.

“Ed in Calif” wrote in message news:xxxxx@ntdev…
> There is no IO but I think the IO space is somewhere
> in the main memory map. But I am still trying to figure
> that out.
>
> Ed
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, January 15, 2004 8:10 AM
> Subject: Re: [ntdev] How to build Port IO driver for IA-64?
>
>
> > > IO space. So how do I access the configuration space
> > > on a PCI card when running a 64 bit OS? Is there an example
> > > somewhere of how the IA-64 systems access IO addresses?
> >
> > I think such a task can be completely impossible, except by !pci command
> in the
> > kernel debugger.
> >
> > Is there any “IO addresses” on IA-64 at all?
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@attbi.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

> implement a DOS emulator with I/O space protection, since you can put the

protection into the page tables.

Sorry, but the DOS emulators run (I will use x86-world terms, not the general
OS terms) in ring 3 with IOPL=0.

So, if the DOS code does IN, it will hit a GP fault (reflected to DOS emulator
for sure), unless… the port is allowed in the IOPM bitmap.

IOPM bitmap gives IIRC the port-per-port fine-grained access control, not page
level as you describe.

So, it is not clear how Athlon’s or IA64’s features can simplify the DOS
emulator.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Right. But imagine trying to emulate DOS on a machine with no IOPM
bitmap. How do you let the emulator run full-speed, except when it
tries to touch a port for which it doesn’t have the right permissions?

The general answer (on PowerPC, Alpha, and now IA-64) is that you map
I/O space sparsely into memory address space, which each port occupying
a single page. Then, you map each page using page tables, with invalid
pages corresponding to ports that should cause a trap. Then your
emulator only traps when there is a port access that should trap.

  • Jake

-----Original Message-----
Subject: Re: I/O Space on IA-64 [was: How to build Port IO…]
From: “Maxim S. Shatskih”
Date: Fri, 16 Jan 2004 22:22:16 +0300
X-Message-Number: 30

> implement a DOS emulator with I/O space protection, since you can put
the
> protection into the page tables.

Sorry, but the DOS emulators run (I will use x86-world terms, not the
general
OS terms) in ring 3 with IOPL=0.

So, if the DOS code does IN, it will hit a GP fault (reflected to DOS
emulator
for sure), unless… the port is allowed in the IOPM bitmap.

IOPM bitmap gives IIRC the port-per-port fine-grained access control,
not page
level as you describe.

So, it is not clear how Athlon’s or IA64’s features can simplify the DOS
emulator.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com