[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <95ab62fa-bb1c-4e4a-a210-b0bdba0d4ad2@amd.com>
Date: Wed, 30 Apr 2025 17:54:53 +1000
From: Alexey Kardashevskiy <aik@....com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Nicolin Chen <nicolinc@...dia.com>, kevin.tian@...el.com,
will@...nel.org, joro@...tes.org, suravee.suthikulpanit@....com,
robin.murphy@....com, dwmw2@...radead.org, baolu.lu@...ux.intel.com,
shuah@...nel.org, linux-kernel@...r.kernel.org, iommu@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kselftest@...r.kernel.org,
eric.auger@...hat.com, jean-philippe@...aro.org, mdf@...nel.org,
mshavit@...gle.com, shameerali.kolothum.thodi@...wei.com,
smostafa@...gle.com, yi.l.liu@...el.com
Subject: Re: [PATCH v2 06/19] iommufd/viommu: Add
IOMMU_VIOMMU_SET/UNSET_VDEV_ID ioctl
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
--
Alexey
Powered by blists - more mailing lists