Re: [PATCH v5 19/24] iommu/amd: Add per-segment translate device ID pool

From: fuwenxin

Date: Thu Sep 24 2026 - 08:47:22 EST


Hi Suravee,

> A translate device ID (TransDevID) is a host device-table index used
> by hardware vIOMMU. VFCTRL guest-misc names the slot; that DTE holds
> the nest-parent v1 table for GPA->SPA walks of guest IOMMU traffic.

> Reserve PCI requestor IDs in a per-segment pool so they are not
> used as vIOMMU translation DTEs. The device table is per-segment,
> so the pool is too.
>
> Add trans_devid.c with pci_seg init/fini and
> amd_iommu_trans_devid_reserve() from probe_device(). Keep
> reservations for the pci_seg lifetime, including after
> amd_iommu_release_device().

Reservation only happens on the probe path, but some DTE-slot holders
never probe, so their devids stay unreserved while
trans_devid_find_free_locked() [patch 22] treats any xa_load()==NULL
slot as free.

One such holder is the IOMMU's own function: init.c deliberately does
rlookup_table[iommu->devid] = NULL , so it never reaches probe_device()
-- yet patch 13 programs the self DTE at exactly iommu->devid.

Thanks,
fuwenxin