[PATCH v10 14/18] iommufd/viommu: Identify physical IOMMU backing with a tag

Tian, Kevin kevin.tian at intel.com
Wed Dec 2 22:42:51 PST 2026


> From: Aneesh Kumar K.V (Arm) <aneesh.kumar at kernel.org>
> Sent: Wednesday, November 25, 2026 4:11 PM
> 
> When allocating a vDEVICE or nested HWPT, IOMMUFD checks that the
> device
> and its vIOMMU use the same physical IOMMU.
> 
> The next patch adds vIOMMUs implemented by a TSM. These store a TSM
> pointer instead of a physical IOMMU pointer, so the same comparison
> cannot be used.
> 
> Add a backing field to identify vIOMMUs that use a physical IOMMU, and
> perform the comparison only for those vIOMMUs. All existing vIOMMUs
> select that value, so their behavior is unchanged.
> 

something behind this needs more consideration.

currently the uapi description includes below for viommu:

* Allocate a virtual IOMMU object, representing the underlying physical IOMMU's
 * virtualization support that is a security-isolated slice of the real IOMMU HW

it implies that all vdevices behind a viommu must belong to a same physical
iommu. This is the reason why we have "viommu->iommu_dev != iommu_dev "
check today.

this patch and next intend to put that constraint only on the legacy usage,
probably based on the observation that there is only one tsm in a platform
so one tsm viommu can support all kinds of devices behind different physical
IOMMUs.

it's probably true for tdx. I didn't see an obvious gap on that assumption.

but looking at your cca repo, cca_vdevice_init() has an internal check on
" params.psmmu_phys != psmmu->phys ". so it actually has the same
constraint, but you just move the check from iommufd core to the tsm
driver which doesn't sound correct.

not sure about AMD.

We have two options here. One is to inherit the current uapi definition
for tsm then abandon this patch. otherwise to not break the existing uapi
we'd better introduce a new viommu_alloc flag to explicitly mark the
viommu as CC type which then can be defined with a different semantics
from legacy.

an explicit flag also changes the fallback scheme when selecting the
viommu provider, i.e. calling tsm_get_device() only when the flag is set
instead of calling it in all cases.



More information about the linux-arm-kernel mailing list