On 4/10/24 21:41, Jason Gunthorpe wrote:
On Fri, Oct 04, 2024 at 02:32:28PM +1000, Alexey Kardashevskiy wrote:
- __u32 __reserved;
- __aligned_u64 vdev_id;
I believe this ended up being "virt_id"...
What is the nature of this id?
It should be the vIOMMU's HW representation for the virtual device.
On ARM it is the stream id, the index into the Stream Table
On AMD it would be the "DeviceID" the index in the Device Table
... and I just hit a problem with it - this is basically guest BDFn and it works as long as I'm hotplugging the TEE-IO VF into an SNP VM but does not when I pass through via the QEMU cmdline - bus numbers are not assigned yet. So I have to postpone the vdevice allocation till run time, did I miss something here? Thanks,
On Intel it is an index into the context table
The primary usage is to transform virtual invalidations from the guest into physical invalidations.
For my SEV-TIO exercise ("trusted IO"), I am looking for a kernel interface to pass the guest's BDFs for a specific host device (which is passed through) and nothing in the kernel has any knowledge of it atm, is this the right place, or another ioctl() is needed here?
We probably need to add the vRID as well to this struct for that reason.
The vdev_id is the iommu handle, and there is a platform specific transformation between Bus/Device/Function and the iommu handle. In some cases this is math, in some cases it is ACPI/DT tables or something.
So I think the kernel should not make an assumption about the relationship.
Jason