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

"Suthikulpanit, Suravee" <[email protected]> Mon, 27 Jul 2026 17:38:38 +0700
Newsgroups dev.linux.lists.iommu,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 7/7/2026 9:36 PM, Jason Gunthorpe wrote:
> On Mon, Jun 29, 2026 at 03:35:32PM +0000, Suravee Suthikulpanit wrote:
>> Track translate-device-id slots per PCI segment so real PCI device IDs can
>> be reserved for normal DTE programming and excluded from dynamic allocation
>> for vIOMMU translation DTEs.
> 
> Why does it have to be per segment? The segment is encoded in the
> devid isn't it?

This is per-segment because the AMD IOMMU device table is per-segment.

> This seems like a sketchy design to me, is it impossible to atomically
> change the viommu used devids once they start being used? It seems
> like this should be doable
> 
> If so the algorithm would be simpler, just maintain an xarray of all
> dev ids, if the entry is marked as a VIOMMU and PCI needs it then move
> the VIOMMU out of the way and use the entry for PCI.
> 
> No need to try to guess what ranges are usable or not.

Thanks for suggestion. I'm implementing this in V4.

Suravee