[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241004114147.GF1365916@nvidia.com>
Date: Fri, 4 Oct 2024 08:41:47 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Alexey Kardashevskiy <aik@....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 Fri, Oct 04, 2024 at 02:32:28PM +1000, Alexey Kardashevskiy wrote:
> > + __u32 __reserved;
> > + __aligned_u64 vdev_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
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
Powered by blists - more mailing lists