qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] E1000 emulation in qemu and pci configuration space
@ 2014-05-05  9:15 Ayaz Akram
  2014-05-05 12:30 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Ayaz Akram @ 2014-05-05  9:15 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

Does e1000's emulation in QEMU require that the guest set its base address
register(pci configuration space register) or qemu has default value for
its base address register?

[-- Attachment #2: Type: text/html, Size: 204 bytes --]

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

* Re: [Qemu-devel] E1000 emulation in qemu and pci configuration space
  2014-05-05  9:15 [Qemu-devel] E1000 emulation in qemu and pci configuration space Ayaz Akram
@ 2014-05-05 12:30 ` Stefan Hajnoczi
       [not found]   ` <CAC0+NVbUQKq4izoWfPLhXEk9qR4E4yKaVUQQwGZVvm+vc6fnfw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-05-05 12:30 UTC (permalink / raw)
  To: Ayaz Akram; +Cc: qemu-devel

On Mon, May 05, 2014 at 02:15:05PM +0500, Ayaz Akram wrote:
> Does e1000's emulation in QEMU require that the guest set its base address
> register(pci configuration space register) or qemu has default value for
> its base address register?

There is no default.

Drivers for some operating systems (Mac OS X?) may assume the device
state set up by the firmware (UEFI).  It's nasty to do that but it
happens.  Since QEMU's firmware is different from that on real machines
a hack may be necessary to make the guest OS driver work.  That hack
shouldn't be in QEMU's device emulation code though - putting it into
the guest firmware is closest to how the physical machine works.

Stefan

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

* Re: [Qemu-devel] E1000 emulation in qemu and pci configuration space
       [not found]   ` <CAC0+NVbUQKq4izoWfPLhXEk9qR4E4yKaVUQQwGZVvm+vc6fnfw@mail.gmail.com>
@ 2014-05-07 13:29     ` Stefan Hajnoczi
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-05-07 13:29 UTC (permalink / raw)
  To: Ayaz Akram; +Cc: qemu-devel

On Wed, May 7, 2014 at 3:08 PM, Ayaz Akram <aaqemu@gmail.com> wrote:
> So, if I have rightly understood, this means whatever address range guest
> wants to use, guest should write base address registers for particular
> device accordingly.

Yes.

> Actually, I have made a hack
[...]
> wrote bar0 in emulated e1000's config space, but I am not able to understand
> from e1000's code in qemu, that how does qemu get to know that this is going
> to be the base adress for this device.

Linux PCI drivers usually do not write a BAR address themselves.

A key feature of PCI is autoconfiguration.  That means the firmware or
operating system can scan all PCI adapters and query how much BAR
space they need.  Then the firmware or operation system sets the BAR
addresses to make the devices available.  The actual device driver
doesn't decide the specific BAR address, it usually just asks the
kernel PCI layer to "map" a BAR that it wants to use.

If you need more info, please see https://lwn.net/Kernel/LDD3/ and the
PCI specification.

Stefan

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

end of thread, other threads:[~2014-05-07 13:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05  9:15 [Qemu-devel] E1000 emulation in qemu and pci configuration space Ayaz Akram
2014-05-05 12:30 ` Stefan Hajnoczi
     [not found]   ` <CAC0+NVbUQKq4izoWfPLhXEk9qR4E4yKaVUQQwGZVvm+vc6fnfw@mail.gmail.com>
2014-05-07 13:29     ` Stefan Hajnoczi

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