[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested S
From: |
Daniel P . Berrangé |
Subject: |
Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3 |
Date: |
Fri, 31 Jan 2025 21:41:46 +0000 |
User-agent: |
Mutt/2.2.13 (2024-03-09) |
On Thu, Jan 30, 2025 at 06:09:24PM +0000, Shameerali Kolothum Thodi wrote:
>
> Each "arm-smmuv3-nested" instance, when the first device gets attached
> to it, will create a S2 HWPT and a corresponding SMMUv3 domain in kernel
> SMMUv3 driver. This domain will have a pointer representing the physical
> SMMUv3 that the device belongs. And any other device which belongs to
> the same physical SMMUv3 can share this S2 domain.
Ok, so given two guest SMMUv3s, A and B, and two host SMMUv3s,
C and D, we could end up with A&C and B&D paired, or we could
end up with A&D and B&C paired, depending on whether we plug
the first VFIO device into guest SMMUv3 A or B.
This is bad. Behaviour must not vary depending on the order
in which we create devices.
An guest SMMUv3 is paired to a guest PXB. A guest PXB is liable
to be paired to a guest NUMA node. A guest NUMA node is liable
to be paired to host NUMA node. The guest/host SMMU pairing
must be chosen such that it makes conceptual sense wrt to the
guest PXB NUMA to host NUMA pairing.
If the kernel picks guest<->host SMMU pairings on a first-device
first-paired basis, this can end up with incorrect guest NUMA
configurations.
The mgmt apps needs to be able to tell QEMU exactly which
host SMMU to pair with each guest SMMU, and QEMU needs to
then tell the kernel.
> And as I mentioned in cover letter, Qemu will report,
>
> "
> Attempt to add the HNS VF to a different SMMUv3 will result in,
>
> -device vfio-pci,host=0000:7d:02.2,bus=pcie.port3,iommufd=iommufd0: Unable to
> attach viommu
> -device vfio-pci,host=0000:7d:02.2,bus=pcie.port3,iommufd=iommufd0: vfio
> 0000:7d:02.2:
> Failed to set iommu_device: [iommufd=29] error attach 0000:7d:02.2 (38) to
> id=11: Invalid argument
>
> At present Qemu is not doing any extra validation other than the above
> failure to make sure the user configuration is correct or not. The
> assumption is libvirt will take care of this.
> "
> So in summary, if the libvirt gets it wrong, Qemu will fail with error.
That's good error checking, and required, but also insufficient
as illustrated above IMHO.
> If a more explicit association is required, some help from kernel is required
> to identify the physical SMMUv3 associated with the device.
Yep, I think SMMUv3 info for devices needs to be exposed to userspace,
as well as a mechanism for QEMU to tell the kernel the SMMU mapping.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, (continued)
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Daniel P . Berrangé, 2025/01/30
- RE: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Shameerali Kolothum Thodi, 2025/01/30
- RE: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Shameerali Kolothum Thodi, 2025/01/31
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Eric Auger, 2025/01/31
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Jason Gunthorpe, 2025/01/31
- RE: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Shameerali Kolothum Thodi, 2025/01/31
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Jason Gunthorpe, 2025/01/31
- RE: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Shameerali Kolothum Thodi, 2025/01/31
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Eric Auger, 2025/01/31
- Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3,
Daniel P . Berrangé <=
Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3, Daniel P . Berrangé, 2025/01/30