qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] PCI: Memory mapped / ROM resources
@ 2004-05-26 14:33 Gianni Tedesco
  2004-05-26 15:34 ` Gianni Tedesco
  2004-05-26 20:21 ` Fabrice Bellard
  0 siblings, 2 replies; 8+ messages in thread
From: Gianni Tedesco @ 2004-05-26 14:33 UTC (permalink / raw)
  To: qemu-devel

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.

-- 
// 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 14:33 [Qemu-devel] PCI: Memory mapped / ROM resources Gianni Tedesco
@ 2004-05-26 15:34 ` Gianni Tedesco
  2004-05-26 20:21 ` Fabrice Bellard
  1 sibling, 0 replies; 8+ messages in thread
From: Gianni Tedesco @ 2004-05-26 15:34 UTC (permalink / raw)
  To: qemu-devel

On Wed, 2004-05-26 at 15:33, Gianni Tedesco wrote:
> 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.

-- 
// 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 14:33 [Qemu-devel] PCI: Memory mapped / ROM resources Gianni Tedesco
  2004-05-26 15:34 ` Gianni Tedesco
@ 2004-05-26 20:21 ` Fabrice Bellard
  2004-05-26 20:32   ` Gianni Tedesco
  1 sibling, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2004-05-26 20:21 UTC (permalink / raw)
  To: qemu-devel

Hi,

Gianni Tedesco wrote:
> 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.

> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 20:21 ` Fabrice Bellard
@ 2004-05-26 20:32   ` Gianni Tedesco
  2004-05-26 21:45     ` Hetz Ben Hamo
  2004-05-26 22:50     ` Fabrice Bellard
  0 siblings, 2 replies; 8+ messages in thread
From: Gianni Tedesco @ 2004-05-26 20:32 UTC (permalink / raw)
  To: qemu-devel

On Wed, 2004-05-26 at 21:21, Fabrice Bellard wrote:
> Hi,
> 
> Gianni Tedesco wrote:
> > 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).

> > 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.

-- 
// 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 20:32   ` Gianni Tedesco
@ 2004-05-26 21:45     ` Hetz Ben Hamo
  2004-05-26 21:52       ` Gianni Tedesco
  2004-05-26 22:50     ` Fabrice Bellard
  1 sibling, 1 reply; 8+ messages in thread
From: Hetz Ben Hamo @ 2004-05-26 21:45 UTC (permalink / raw)
  To: qemu-devel

> 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.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 21:45     ` Hetz Ben Hamo
@ 2004-05-26 21:52       ` Gianni Tedesco
  0 siblings, 0 replies; 8+ messages in thread
From: Gianni Tedesco @ 2004-05-26 21:52 UTC (permalink / raw)
  To: hetz; +Cc: qemu-devel

On Wed, 2004-05-26 at 22:45, Hetz Ben Hamo wrote:
> 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.

> 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 :)

-- 
// 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 20:32   ` Gianni Tedesco
  2004-05-26 21:45     ` Hetz Ben Hamo
@ 2004-05-26 22:50     ` Fabrice Bellard
  2004-05-27  1:10       ` Gianni Tedesco
  1 sibling, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2004-05-26 22:50 UTC (permalink / raw)
  To: qemu-devel

Gianni Tedesco wrote:

> 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 ?

> 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.

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] PCI: Memory mapped / ROM resources
  2004-05-26 22:50     ` Fabrice Bellard
@ 2004-05-27  1:10       ` Gianni Tedesco
  0 siblings, 0 replies; 8+ messages in thread
From: Gianni Tedesco @ 2004-05-27  1:10 UTC (permalink / raw)
  To: qemu-devel

On Wed, 2004-05-26 at 23:50, Fabrice Bellard wrote:
> Gianni Tedesco wrote:
> 
> > 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.

> > 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.
> 
> 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.

It will be OK if i pass mmap a start address and map right over some
regions in phys_ram_base?

-- 
// 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-05-27  1:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-26 14:33 [Qemu-devel] PCI: Memory mapped / ROM resources Gianni Tedesco
2004-05-26 15:34 ` Gianni Tedesco
2004-05-26 20:21 ` Fabrice Bellard
2004-05-26 20:32   ` Gianni Tedesco
2004-05-26 21:45     ` Hetz Ben Hamo
2004-05-26 21:52       ` Gianni Tedesco
2004-05-26 22:50     ` Fabrice Bellard
2004-05-27  1:10       ` Gianni Tedesco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).