From: Alex Williamson <alex.williamson@redhat.com>
To: Li Qiang <liq3ea@163.com>
Cc: Alex Williamson <alex.l.williamson@gmail.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] Questions about the VFIO device BAR emulation
Date: Mon, 3 Dec 2018 07:00:15 -0700 [thread overview]
Message-ID: <20181203070015.03244928@x1.home> (raw)
In-Reply-To: <5C052A3D.01FFE0.13753@m12-18.163.com>
On Mon, 3 Dec 2018 21:06:00 +0800
Li Qiang <liq3ea@163.com> wrote:
> Hello Alex, Paolo and all
>
> I have a question about VFIO about the BAR.
>
> Why we have two MemoryRegion for every device’s BAR.
> I mean in VFIOBAR we have a field ‘mr’.
> typedef struct VFIOBAR {
> VFIORegion region;
> MemoryRegion *mr;
> size_t size;
> uint8_t type;
> bool ioport;
> bool mem64;
> QLIST_HEAD(, VFIOQuirk) quirks;
> } VFIOBAR;
>
> And in the field ‘region’ field of VFIOBAR,
> We also have a MemoryReion named ‘mem’.
> And the ‘VFIOBAR’s mr is just the subregion of ‘VFIOREGION’.
>
> Why here we can’t use just one MR link VFIOREGION’s ‘mem’field to represent the device’s BAR?
The answer lives in git history:
commit 3a286732d1563bdb440718d4e68137e06af785dd
Author: Alex Williamson <alex.williamson@redhat.com>
Date: Tue Feb 6 11:08:25 2018 -0700
vfio/pci: Add base BAR MemoryRegion
Add one more layer to our stack of MemoryRegions, this base region
allows us to register BARs independently of the vfio region or to
extend the size of BARs which do map to a region. This will be
useful when we want hypervisor defined BARs or sections of BARs,
for purposes such as relocating MSI-X emulation. We therefore call
msix_init() based on this new base MemoryRegion, while the quirks,
which only modify regions still operate on those sub-MemoryRegions.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
prev parent reply other threads:[~2018-12-03 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 13:06 [Qemu-devel] Questions about the VFIO device BAR emulation Li Qiang
2018-12-03 14:00 ` Alex Williamson [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=20181203070015.03244928@x1.home \
--to=alex.williamson@redhat.com \
--cc=alex.l.williamson@gmail.com \
--cc=liq3ea@163.com \
--cc=pbonzini@redhat.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).