1
>> >with an error message indicating DMA mapping failed for the
1
Hi Daniel,
2
>> passthrough >devices.
2
3
>>
3
> -----Original Message-----
4
>> A correction - the message indicates UEFI failed to find a mapping for
4
> From: Daniel P. Berrangé <berrange@redhat.com>
5
>> the boot partition ("map: no mapping found"), not that DMA mapping
5
> Sent: Thursday, January 30, 2025 4:00 PM
6
>> failed. But earlier EDK debug logs still show PCI host bridge resource
6
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
7
>> conflicts for the passthrough devices that seem related to the VM boot
7
> Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org;
8
>> failure.
8
> eric.auger@redhat.com; peter.maydell@linaro.org; jgg@nvidia.com;
9
> nicolinc@nvidia.com; ddutile@redhat.com; Linuxarm
10
> <linuxarm@huawei.com>; Wangzhou (B) <wangzhou1@hisilicon.com>;
11
> jiangkunkun <jiangkunkun@huawei.com>; Jonathan Cameron
12
> <jonathan.cameron@huawei.com>; zhangfei.gao@linaro.org
13
> Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable
14
> nested SMMUv3
9
>
15
>
10
> I have tried a 2023 version EFI which works. And for more recent tests I am
16
> On Fri, Nov 08, 2024 at 12:52:37PM +0000, Shameer Kolothum via wrote:
11
> using a one built directly from,
17
> > How to use it(Eg:):
12
> https://github.com/tianocore/edk2.git master
18
> >
19
> > On a HiSilicon platform that has multiple physical SMMUv3s, the ACC ZIP
20
> VF
21
> > devices and HNS VF devices are behind different SMMUv3s. So for a
22
> Guest,
23
> > specify two smmuv3-nested devices each behind a pxb-pcie as below,
24
> >
25
> > ./qemu-system-aarch64 -machine virt,gic-version=3,default-bus-bypass-
26
> iommu=on \
27
> > -enable-kvm -cpu host -m 4G -smp cpus=8,maxcpus=8 \
28
> > -object iommufd,id=iommufd0 \
29
> > -bios QEMU_EFI.fd \
30
> > -kernel Image \
31
> > -device virtio-blk-device,drive=fs \
32
> > -drive if=none,file=rootfs.qcow2,id=fs \
33
> > -device pxb-pcie,id=pcie.1,bus_nr=8,bus=pcie.0 \
34
> > -device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1 \
35
> > -device arm-smmuv3-nested,id=smmuv1,pci-bus=pcie.1 \
36
> > -device vfio-pci,host=0000:7d:02.1,bus=pcie.port1,iommufd=iommufd0 \
37
> > -device pxb-pcie,id=pcie.2,bus_nr=16,bus=pcie.0 \
38
> > -device pcie-root-port,id=pcie.port2,bus=pcie.2,chassis=2 \
39
> > -device arm-smmuv3-nested,id=smmuv2,pci-bus=pcie.2 \
40
> > -device vfio-pci,host=0000:75:00.1,bus=pcie.port2,iommufd=iommufd0 \
41
> > -append "rdinit=init console=ttyAMA0 root=/dev/vda2 rw
42
> earlycon=pl011,0x9000000" \
43
> > -device virtio-9p-pci,fsdev=p9fs2,mount_tag=p9,bus=pcie.0 \
44
> > -fsdev local,id=p9fs2,path=p9root,security_model=mapped \
45
> > -net none \
46
> > -nographic
13
>
47
>
14
> Commit: 0f3867fa6ef0("UefiPayloadPkg/UefiPayloadEntry: Fix PT protection
48
> Above you say the host has 2 SMMUv3 devices, and you've created 2
15
> in 5 level paging"
49
> SMMUv3
50
> guest devices to match.
16
>
51
>
17
> With both, I don’t remember seeing any boot failure and the above UEFI
52
> The various emails in this thread & libvirt thread, indicate that each
18
> related "map: no mapping found" error. But the Guest kernel at times
53
> guest SMMUv3 is associated with a host SMMUv3, but I don't see any
19
> complaints about pci bridge window memory assignment failures.
54
> property on the command line for 'arm-ssmv3-nested' that tells it which
20
> ...
55
> host eSMMUv3 it is to be associated with.
21
> pci 0000:10:01.0: bridge window [mem size 0x00200000 64bit pref]: can't assign; no space
22
> pci 0000:10:01.0: bridge window [mem size 0x00200000 64bit pref]: failed to assign
23
> pci 0000:10:00.0: bridge window [io size 0x1000]:can't assign; no space
24
> ...
25
>
56
>
26
> But Guest still boots and worked fine so far.
57
> How does this association work ?
27
58
28
Hi Shameer,
59
You are right. The association is not very obvious in Qemu. The association
60
and checking is done implicitly by kernel at the moment. I will try to explain
61
it here.
29
62
30
Just letting you know I resolved this by increasing the MMIO region size
63
Each "arm-smmuv3-nested" instance, when the first device gets attached
31
in hw/arm/virt.c to support passing through GPUs with large BAR regions
64
to it, will create a S2 HWPT and a corresponding SMMUv3 domain in kernel
32
(VIRT_HIGH_PCIE_MMIO). Thanks for taking a look.
65
SMMUv3 driver. This domain will have a pointer representing the physical
66
SMMUv3 that the device belongs. And any other device which belongs to
67
the same physical SMMUv3 can share this S2 domain.
68
69
If a device that belongs to a different physical SMMUv3 gets attached to
70
the above domain, the HWPT attach will eventually fail as the physical
71
smmuv3 in the domains will have a mismatch,
72
https://elixir.bootlin.com/linux/v6.13/source/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c#L2860
73
74
And as I mentioned in cover letter, Qemu will report,
75
76
"
77
Attempt to add the HNS VF to a different SMMUv3 will result in,
78
79
-device vfio-pci,host=0000:7d:02.2,bus=pcie.port3,iommufd=iommufd0: Unable to attach viommu
80
-device vfio-pci,host=0000:7d:02.2,bus=pcie.port3,iommufd=iommufd0: vfio 0000:7d:02.2:
81
Failed to set iommu_device: [iommufd=29] error attach 0000:7d:02.2 (38) to id=11: Invalid argument
82
83
At present Qemu is not doing any extra validation other than the above
84
failure to make sure the user configuration is correct or not. The
85
assumption is libvirt will take care of this.
86
"
87
So in summary, if the libvirt gets it wrong, Qemu will fail with error.
88
89
If a more explicit association is required, some help from kernel is required
90
to identify the physical SMMUv3 associated with the device.
91
92
Jason/Nicolin, any thoughts on this?
33
93
34
Thanks,
94
Thanks,
35
Nathan
95
Shameer
36
96
diff view generated by jsdifflib