Re: [Xen-devel] [PATCH] Revert "swiotlb: remove SWIOTLB_MAP_ERROR"
From: Julien Grall
Date: Fri Mar 08 2019 - 12:26:03 EST
Hi Christoph,
On 08/03/2019 15:23, Christoph Hellwig wrote:
On Tue, Mar 05, 2019 at 09:41:46AM +0000, Julien Grall wrote:
On Xen, dma_addr_t will always be 64-bit while the phys_addr_t will depend
on the MMU type. So we may have phys_addr_t smaller than dma_addr_t from
the kernel point of view.
How can dma_addr_t on arm have value > 32-bit when physical
addresses are 32-bit only?
The number of platform with IOMMU protected all DMA-capable device is not yet
there. So we decided to not require IOMMU for Dom0. Instead, its memory is be
directly mapped (i.e guest physical address == host physical address) and will
always be below 4GB to cater the short page table case.
In the common case, Dom0 also contains the PV backend drivers. Those drivers may
directly use the guest buffer in the DMA request (so a copy is avoided). To
avoid using a bounce buffer too much, xen-swiotlb will find the host physical
address associated to the guest buffer and will use it to compute the DMA address.
While Dom0 kernel may only deal with 32-bit physical address, the hypervisor can
still deal with up to 40-bit physical address. This means the guest memory can
be allocated above the 4GB threshold. Hence why the dma_addr_t is always 64-bit
with CONFIG_XEN=y.
Cheers,
--
Julien Grall