Re: [PATCH v6 5/9] iommu/amd: Modify set_dte_entry() to use 256-bit DTE helpers
From: Jason Gunthorpe
Date: Wed Oct 16 2024 - 10:12:34 EST
On Wed, Oct 16, 2024 at 05:17:52AM +0000, Suravee Suthikulpanit wrote:
> /*
> * When SNP is enabled, Only set TV bit when IOMMU
> * page translation is in use.
> */
> if (!amd_iommu_snp_en || (domid != 0))
> + new.data[0] |= DTE_FLAG_TV;
This one still doesn't seem quite right..
Since the blocking domain path now uses make_clear_dte(), the only
time we'd get here is for IDENTITY,
Except SNP does not support identity:
if (amd_iommu_snp_en && (type == IOMMU_DOMAIN_IDENTITY))
return ERR_PTR(-EINVAL);
So this is impossible code.
/* SNP is not allowed to use identity */
WARN_ON(amd_iommu_snp_en && domid == 0)
??
I guess the original introduction got the rational wrong it should
have been "Use TV=0 instead of TV=1/IR=0/IW=0 for BLOCKED/cleared
domains because SNP does not support TV=1/Mode=0 at all. IDENTITY is
already disabled."
Jason