PCI: Memory mapped / ROM resources
Hi,
I'm writing some qemu PCI devices and i'd like to know if it's possible to register memory mapped I/O regions and also I'd like to be able to map in a ROM device, but I guess this is missing for the same reason memory mapped resources aren't currently supported. Is that to do with the qemu CPU/MMU code?
Is this going to be implemented any time soon, what are the issues if any? I don't mind doing the monkey work to get it implemented, if i'm pointed in the right direction. I haven't even looked at how the CPU emulation parts work yet.
Thanks.
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
Hi,
Quoted 5 lines · Gianni Tedesco
I'm writing some qemu PCI devices and i'd like to know if it's possible to register memory mapped I/O regions and also I'd like to be able to map in a ROM device, but I guess this is missing for the same reason memory mapped resources aren't currently supported. Is that to do with the qemu CPU/MMU code?
Memory mapped resources are fully supported. ROM devices are not supported, but it is very easy to add.
Quoted 4 lines
Is this going to be implemented any time soon, what are the issues if any? I don't mind doing the monkey work to get it implemented, if i'm pointed in the right direction. I haven't even looked at how the CPU emulation parts work yet.
Which hardware do you want to add ? I can add ROM devices if it is really necessary.
Fabrice.
Quoted 11 lines · Fabrice Bellard
Hi,
Quoted 5 lines · Gianni Tedesco
I'm writing some qemu PCI devices and i'd like to know if it's possible to register memory mapped I/O regions and also I'd like to be able to map in a ROM device, but I guess this is missing for the same reason memory mapped resources aren't currently supported. Is that to do with the qemu CPU/MMU code?
Memory mapped resources are fully supported. ROM devices are not supported, but it is very easy to add.
Yeah, i figred that just after I hit send my last post. (isnt that always the way).
Quoted 7 lines
Quoted 4 lines
Is this going to be implemented any time soon, what are the issues if any? I don't mind doing the monkey work to get it implemented, if i'm pointed in the right direction. I haven't even looked at how the CPU emulation parts work yet.
Which hardware do you want to add ? I can add ROM devices if it is really necessary.
I'm adding a host PCI proxy layer that works under Linux, ie: make host PCI devices appear within the emulator. Similar to 'pcidev' on bochs, but without a custom kernel module, and some minor performance enhancements. I ought to have a patch ready by tomorrow evening.
It's not amazingly urgent really, don't kill yourself over it, I'll probably get around to adding it later myself.
PS. I am using mmap() on /proc/pci/bus/XX/YY.Z nodes to map PCI registers, probably there is a nice way to allow the code generator to generate accesses directly on to these vmas? It's probably not that much of a win in any case, but interesting.
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
Quoted 5 lines · Hetz Ben Hamo
Let me see if I get this straight:
With your patches, will I be able to use a real PCI card within the emulator? for example: Would I be able to use a PCI graphics card which is not being used by XFree under Linux?
Yes basically. However there are some technical limitations which mean that for most PCI devices this will be unusable as it is impossible (well, very difficult) to emulate PCI DMA.
Also, I don't think VGA cards will work correctly under this scheme without hacking qemu's BIOS code.
Quoted 4 lines
Also, if you plan to use real PCI cards under guest OS, you might need to create some "locking" mechanism so that the host OS cannot use them, nor another instance of QEMU which will run in parallel (and I see already few people running few QEMU instances at once ;)
Yeah, I think we can tell if the kernel is using the device already buy checking if a driver is associated with it. Excluding multiple copies of qemu can probably be done with an advisory file lock. I'll look in to this. I was basically ignoring these issues up till now as it is quite a 'hacker tool' for the moment :)
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
Quoted 5 lines
I'm adding a host PCI proxy layer that works under Linux, ie: make host PCI devices appear within the emulator. Similar to 'pcidev' on bochs, but without a custom kernel module, and some minor performance enhancements. I ought to have a patch ready by tomorrow evening.
Quoted 7 lines
It's not amazingly urgent really, don't kill yourself over it, I'll probably get around to adding it later myself.
PS. I am using
mmap()on/proc/pci/bus/XX/YY.Znodes to map PCI registers, probably there is a nice way to allow the code generator to generate accesses directly on to these vmas? It's probably not that much of a win in any case, but interesting.
Let me see if I get this straight:
With your patches, will I be able to use a real PCI card within the emulator? for example: Would I be able to use a PCI graphics card which is not being used by XFree under Linux?
Also, if you plan to use real PCI cards under guest OS, you might need to create some "locking" mechanism so that the host OS cannot use them, nor another instance of QEMU which will run in parallel (and I see already few people running few QEMU instances at once ;)
Thanks,
Hetz
Quoted 7 lines · Gianni Tedesco
Hi,
I'm writing some qemu PCI devices and i'd like to know if it's possible to register memory mapped I/O regions and also I'd like to be able to map in a ROM device, but I guess this is missing for the same reason memory mapped resources aren't currently supported. Is that to do with the qemu CPU/MMU code?
Scratch that. I see memory mapped is possible.
But what about ROMs? Have to implement those manually? I'll see if I can knock up a patch to add a 7th resource slot and treat that as ROM.
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
Quoted 4 lines · Gianni Tedesco
I'm adding a host PCI proxy layer that works under Linux, ie: make host PCI devices appear within the emulator. Similar to 'pcidev' on bochs, but without a custom kernel module, and some minor performance enhancements. I ought to have a patch ready by tomorrow evening.
Interesting. How do you redirect irqs ?
Quoted 4 lines
PS. I am using
mmap()on/proc/pci/bus/XX/YY.Znodes to map PCI registers, probably there is a nice way to allow the code generator to generate accesses directly on to these vmas? It's probably not that much of a win in any case, but interesting.
You'd better defines memory access callbacks. It could be possible to define RAM memory areas for which the access is optimised internally by the CPU core, but currently they must stay in the phys_ram_base array.
Fabrice.
Quoted 8 lines · Fabrice Bellard
Quoted 4 lines · Gianni Tedesco
I'm adding a host PCI proxy layer that works under Linux, ie: make host PCI devices appear within the emulator. Similar to 'pcidev' on bochs, but without a custom kernel module, and some minor performance enhancements. I ought to have a patch ready by tomorrow evening.
Interesting. How do you redirect irqs ?
A small patch to /proc/pci which adds an ioctl PCIIOC_SIGIRQ which allows for the kernel to send (user defined) rtsignals when IRQs are recieved. It may be interesting to X folk and the like, so with some cleanups maybe they'll merge it, who knows.
Quoted 8 lines
Quoted 4 lines
PS. I am using
mmap()on/proc/pci/bus/XX/YY.Znodes to map PCI registers, probably there is a nice way to allow the code generator to generate accesses directly on to these vmas? It's probably not that much of a win in any case, but interesting.You'd better defines memory access callbacks. It could be possible to define RAM memory areas for which the access is optimised internally by the CPU core, but currently they must stay in the
phys_ram_basearray.
It will be OK if i pass mmap a start address and map right over some regions in phys_ram_base?
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D