qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Questions about the VFIO device BAR emulation


From: Alex Williamson
Subject: Re: [Qemu-devel] Questions about the VFIO device BAR emulation
Date: Mon, 3 Dec 2018 07:00:15 -0700

On Mon, 3 Dec 2018 21:06:00 +0800
Li Qiang <address@hidden> 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 <address@hidden>
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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]