Linux IOMMU Development
 help / color / mirror / Atom feed
* vIOMMU&IOMMU  gIOVA  to  HPA mapping
@ 2022-11-14 12:31 leohou
  2022-11-14 16:18 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: leohou @ 2022-11-14 12:31 UTC (permalink / raw)
  To: virtualization, iommu, qemu-arm, jasowang; +Cc: leohou1402

Hi,
     Here is my application scenario:
1. The NIC (Network Information Center) passes through to the VM(Virtual Machine);
2. The VM uses the user mode driver DPDK;

Question:
1. vIOMMU maintains the mapping gIOVA->gPA, When do you use this gPA ?
2. Physical IOMMU maintains the GIOVA->HPA mapping ?  If so, by what means (gIOVA -> HPA) mapping ?
3. What does QEMU do in NIC pass-through address translation ?


---------------------------------------------------------------------------------------------------------------------
           _____________________________________________________________________________                             
          |             ___________________________________________________________     |                            
          |            |    _____________________________________________________  |    |                            
          |            |    |                                                    | |    |                            
          |            |    |             __________________________________     | |    |                            
          |            |    |            |    ______                        |    | |    |        ______              
          |            |    |   User     |   | Mem  |-----------------------|----|-|----|-----> |      |             
          |            |    |            |   |______|        DPDK           |    | |    | (gVA) |______|             
          |            |    |            |    (gVA)                         |    | |    |        |    |              
          |            |    |            |______|___________________________|    | |    |        |    |              
          |            |    |--GuestOS----------|--------------------------------| |    |        |    |              
          |            |    |             ______\/__________________________     | |    |        |    |              
          |            | VM |            |                VFIO              |    | |    |        |    |              
          |   User     |    |   Kernel   |___________     __________________|    | |    |        |    |              
          |            |    |            | vfio-pci  |   |                  |    | |    |        |    |              
          |            |    |            |  (gIOVA)  |   | vfio_iommu_type2 |    | |    |        |    |              
Software  |            |    |            |______|____|___|__________________|    | |    |        |    |              
          |            |    |___________________|________________________________| |    |        |    |              
          |            |     ____________________________________________________  |    |        |    |              
          |            |    |             ______|____     __________________     | |    |        \/   \/             
          |            |    |            |      \/   |   |                  |    | |    |        ______              
          |            |    |            |    NIC    |   |      vIOMMU      |    | |    |       |      |             
          |            |    |   QEMU     |  Instance |   |                --|----|-|----|-----> |______|             
          |            |    |            |  (gIOVA)  |   |   (GIOVA-->GPA)  |    | |    | (gPA)  |    |              
          |            |    |            |_____|_____|   |__________________|    | |    |        |    |              
          |            |    |__________________|_________________________________| |    |        |    |              
          |            |_______________________|___________________________________|    |        |    |              
          |---HostOS---------------------------|----------------------------------------|        |    |              
          |             ___________________________________________________________     |        |    |              
          |            |                       |                                   |    |        |    |              
          |            |                       |    VFIO                           |    |        |    |              
          |   Kernel   |_______________________|_____     _________________________|    |        |    |              
          |            |                       \/    |   |                         |    |        |    |              
          |            |        vfio-pci             |   |    vfio_iommu_type1     |    |        |    |              
          |            |                       |     |   |                         |    |        |    |              
          |            |_______________________|_____|___|_________________________|    |        |    |              
          |____________________________________|________________________________________|        |    |              
-----------------------------------------------|-------------------------------------------------|----|--------------
           ____________________________________\/____     _________________________           ___\/___\/___________  
          |            |                             |   |                         |         |  |      |           | 
Hardware  |    NIC     |          DMA     (gIOVA)  --|---|->        IOMMU        --|---------|->|______|           | 
          |            |_____________________________|   |      (gIOVA-->HPA)      |   (HPA) |   Physical Memory   | 
          |__________________________________________|   |_________________________|         |_____________________| 
---------------------------------------------------------------------------------------------------------------------








leohou@tom.com



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

* Re: vIOMMU&IOMMU  gIOVA  to  HPA mapping
  2022-11-14 12:31 vIOMMU&IOMMU gIOVA to HPA mapping leohou
@ 2022-11-14 16:18 ` Alex Williamson
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2022-11-14 16:18 UTC (permalink / raw)
  To: leohou@tom.com; +Cc: virtualization, iommu, qemu-arm, jasowang, leohou1402

On Mon, 14 Nov 2022 20:31:49 +0800
"leohou@tom.com" <leohou@tom.com> wrote:

> Hi,
>      Here is my application scenario:
> 1. The NIC (Network Information Center) passes through to the VM(Virtual Machine);
> 2. The VM uses the user mode driver DPDK;
> 
> Question:
> 1. vIOMMU maintains the mapping gIOVA->gPA, When do you use this gPA ?

QEMU in the host derives the hVA from the gPA.  The vIOMMU driver in
QEMU is triggering the gIOVA to hVA mapping through vfio in the host.

> 2. Physical IOMMU maintains the GIOVA->HPA mapping ?  If so, by what means (gIOVA -> HPA) mapping ?

As above, the vIOMMU in the guest provides gIOVA -> gPA, in QEMU we do
the gPA -> hVA, then vfio in the host kernel performs hVA -> hPA via
page pinning.

> 3. What does QEMU do in NIC pass-through address translation ?

The guest visible vIOMMU triggers MemoryListener notifications in QEMU
for the device address space, which insert and removes mappings to the
vfio layer below it.  Thanks,

Alex


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

end of thread, other threads:[~2022-11-14 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 12:31 vIOMMU&IOMMU gIOVA to HPA mapping leohou
2022-11-14 16:18 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox