[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object
|
From: |
Duan, Zhenzhong |
|
Subject: |
RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object |
|
Date: |
Fri, 17 Nov 2023 11:39:20 +0000 |
Hi Cédric,
>-----Original Message-----
>From: Cédric Le Goater <clg@redhat.com>
>Sent: Friday, November 17, 2023 7:10 PM
>Subject: Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object
>
>Hello,
>
>> +int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id,
>hwaddr iova,
>> + ram_addr_t size, void *vaddr, bool readonly)
>> +{
>> + int ret, fd = be->fd;
>> + struct iommu_ioas_map map = {
>> + .size = sizeof(map),
>> + .flags = IOMMU_IOAS_MAP_READABLE |
>> + IOMMU_IOAS_MAP_FIXED_IOVA,
>> + .ioas_id = ioas_id,
>> + .__reserved = 0,
>> + .user_va = (uintptr_t)vaddr,
>> + .iova = iova,
>> + .length = size,
>> + };
>> +
>> + if (!readonly) {
>> + map.flags |= IOMMU_IOAS_MAP_WRITEABLE;
>> + }
>> +
>> + ret = ioctl(fd, IOMMU_IOAS_MAP, &map);
>> + trace_iommufd_backend_map_dma(fd, ioas_id, iova, size,
>> + vaddr, readonly, ret);
>> + if (ret) {
>> + ret = -errno;
>> + error_report("IOMMU_IOAS_MAP failed: %m");
>> + }
>> + return ret;
>> +}
>
>When using a UEFI guest, QEMU reports errors when mapping regions
>in the top PCI space :
>
> iommufd_backend_map_dma iommufd=10 ioas=2 iova=0x380000001000
>size=0x3000 addr=0x7fce2c28b000 readonly=0 (-1)
> qemu-system-x86_64: IOMMU_IOAS_MAP failed: Invalid argument
> qemu-system-x86_64: vfio_container_dma_map(0x55a21b03a150,
>0x380000001000, 0x3000, 0x7fce2c28b000) = -22 (Invalid argument)
>
> iommufd_backend_map_dma iommufd=10 ioas=2 iova=0x380000004000
>size=0x4000 addr=0x7fce2c980000 readonly=0 (-1)
> qemu-system-x86_64: IOMMU_IOAS_MAP failed: Invalid argument
> qemu-system-x86_64: vfio_container_dma_map(0x55a21b03a150,
>0x380000004000, 0x4000, 0x7fce2c980000) = -22 (Invalid argument)
>
>This is because IOMMUFD reserved IOVAs areas are :
>
> [ fee00000 - feefffff ]
> [ 8000000000 - ffffffffffffffff ] (39 bits address space)
>
>which were allocated when the device was initially attached.
>The topology is basic. Something is wrong.
Thanks for your report. This looks a hardware limit of
host IOMMU address width(39) < guest physical address width.
A similar issue with a fix submitted below, ccing related people.
https://lists.gnu.org/archive/html/qemu-devel/2023-11/msg02937.html
It looks the fix will not work for hotplug.
Or below qemu cmdline may help:
"-cpu host,host-phys-bits-limit=39"
Thanks
Zhenzhong
Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/11/17
- RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object,
Duan, Zhenzhong <=
- Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/11/17
- Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Eric Auger, 2023/11/17
- Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/11/17
- RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Duan, Zhenzhong, 2023/11/19
- Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/11/20
- RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Duan, Zhenzhong, 2023/11/20
- Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/11/20
- RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Duan, Zhenzhong, 2023/11/20
- Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/11/21
- RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object, Duan, Zhenzhong, 2023/11/21