qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Questions about the VFIO device BAR emulation
@ 2018-12-03 13:06 Li Qiang
  2018-12-03 14:00 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2018-12-03 13:06 UTC (permalink / raw)
  To: Alex Williamson, qemu-devel@nongnu.org, pbonzini@redhat.com

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?


Thanks,
Li Qiang

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

* Re: [Qemu-devel] Questions about the VFIO device BAR emulation
  2018-12-03 13:06 [Qemu-devel] Questions about the VFIO device BAR emulation Li Qiang
@ 2018-12-03 14:00 ` Alex Williamson
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2018-12-03 14:00 UTC (permalink / raw)
  To: Li Qiang; +Cc: Alex Williamson, qemu-devel@nongnu.org, pbonzini@redhat.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>

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

end of thread, other threads:[~2018-12-03 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-03 13:06 [Qemu-devel] Questions about the VFIO device BAR emulation Li Qiang
2018-12-03 14:00 ` Alex Williamson

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