Skip to content

Commit c5b0320

Browse files
aljimenezbjoergroedel
authored andcommitted
iommu/amd: Preserve default DTE fields when updating Host Page Table Root
When updating the page table root field on the DTE, avoid overwriting any bits that are already set. The earlier call to make_clear_dte() writes default values that all DTEs must have set (currently DTE[V]), and those must be preserved. Currently this doesn't cause problems since the page table root update is the first field that is set after make_clear_dte() is called, and DTE_FLAG_V is set again later along with the permission bits (IR/IW). Remove this redundant assignment too. Fixes: fd5dff9 ("iommu/amd: Modify set_dte_entry() to use 256-bit DTE helpers") Signed-off-by: Alejandro Jimenez <[email protected]> Reviewed-by: Dheeraj Kumar Srivastava <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent d082ecb commit c5b0320

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,12 +2043,12 @@ static void set_dte_entry(struct amd_iommu *iommu,
20432043
make_clear_dte(dev_data, dte, &new);
20442044

20452045
if (domain->iop.mode != PAGE_MODE_NONE)
2046-
new.data[0] = iommu_virt_to_phys(domain->iop.root);
2046+
new.data[0] |= iommu_virt_to_phys(domain->iop.root);
20472047

20482048
new.data[0] |= (domain->iop.mode & DEV_ENTRY_MODE_MASK)
20492049
<< DEV_ENTRY_MODE_SHIFT;
20502050

2051-
new.data[0] |= DTE_FLAG_IR | DTE_FLAG_IW | DTE_FLAG_V;
2051+
new.data[0] |= DTE_FLAG_IR | DTE_FLAG_IW;
20522052

20532053
/*
20542054
* When SNP is enabled, we can only support TV=1 with non-zero domain ID.

0 commit comments

Comments
 (0)