qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Ayaz Akram <aaqemu@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] E1000 emulation in qemu and pci configuration space
Date: Wed, 7 May 2014 15:29:49 +0200	[thread overview]
Message-ID: <CAJSP0QUoLC16cGVPLafqt0YSvE9kSerOqxUsFj-mFLCFYduhqw@mail.gmail.com> (raw)
In-Reply-To: <CAC0+NVbUQKq4izoWfPLhXEk9qR4E4yKaVUQQwGZVvm+vc6fnfw@mail.gmail.com>

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

      parent reply	other threads:[~2014-05-07 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJSP0QUoLC16cGVPLafqt0YSvE9kSerOqxUsFj-mFLCFYduhqw@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=aaqemu@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).