Re: [PATCH v5 13/14] iommu/amd: Refactor logic to program the host page table in DTE

From: Suthikulpanit, Suravee

Date: Thu Jan 15 2026 - 04:24:37 EST




On 11/14/2025 4:19 AM, Nicolin Chen wrote:
@@ -2097,35 +2115,29 @@ static void set_dte_entry(struct amd_iommu *iommu,

.....
- new.data[0] |= DTE_FLAG_IR | DTE_FLAG_IW;
-
/*
* When SNP is enabled, we can only support TV=1 with non-zero domain ID.
* This is prevented by the SNP-enable and IOMMU_DOMAIN_IDENTITY check in
* do_iommu_domain_alloc().
*/
WARN_ON(amd_iommu_snp_en && (domid == 0));
This, if it's very necessary, can go into individual functions.

Though I am not sure if it is accurate as it seems to imply that
IOMMU_DOMAIN_IDENTITY has domid == 0?

But an IOMMU_DOMAIN_IDENTITY does:
identity_domain.id = amd_iommu_pdom_id_alloc();
doing:
ida_alloc_range(&pdom_ids, 1, MAX_DOMAIN_ID - 1, GFP_ATOMIC);
which means it never returns 0.

Nicolin

After more careful review, I am removing this check for now since it's no longer applicable with the more recent code.

Thanks,
Suravee