[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About VFIO Device Pass-through on Qemu.
From: |
Alex Williamson |
Subject: |
Re: About VFIO Device Pass-through on Qemu. |
Date: |
Fri, 5 Jul 2024 08:12:37 -0600 |
On Fri, 5 Jul 2024 17:08:49 +0800 (CST)
tugouxp <13824125580@163.com> wrote:
> Hi folks:
>
>
> I have a questions about device vfio pass-through usage snarios,
> PCI device pass-throug for example. did the GPA that host physical
> memory mapped to Guest vcpu through MMU must be identical with the
> IOVA that host physical memory mapped to gust device thourgh iommu?
I'm having trouble parsing that wording, but without a vIOMMU the
device operates in the GPA address space, so IOVA == GPA.
> if so, that will be convenient for driver developer, because then can
> share data physical address between device and share memory. but is
> this true? is this the pass-through user manner?
If you're asking about a shared DMA memory buffer between devices, yes,
without a vIOMMU the buffer GPA (IOVA) would be the same between
devices. Also note that device MMIO is mapped into the device address
space, so depending on the underlying host support for peer-to-peer DMA
there might be a working "direct" path between devices (where "direct"
means bounced through the IOMMU).
> my thought: it will be very convent for driver developer if GPA ==
> IOVA. because theuy are all "physical" on Guest, will offer a
> consistent view of memory resource for vCPU and vDevice, but is this
> true?
>
>
> VCPU:
> GVA----(MMU)----GPA-------(+offset)----->HVA------>(MMU)----->HPA.
> Device in Guest:
> IOVA---->(IOMMU)---->HPA
Yes. In fact this is the only way we can do transparent device
assignment without a paravirtualized DMA layer is to use the IOMMU to
map the device into the GPA address space. Also the fixed IOVA/GPA to
HPA mapping in the IOMMU is what necessitates memory pinning. Thanks,
Alex