Skip to content

amd_iommu: Fix page size reporting on hugepage mappings

Alejandro Jimenez qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2amd_iommu: Follow root pointer before page walk and use 1-based levelshw/i386/amd_iommu.c hw/i386/amd_iommu.h+97 -464 replies
2/2amd_iommu: Reject non-decreasing NextLevel in fetch_pte()hw/i386/amd_iommu.c+4 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchDavid HoppenbrouwersSairaj Kodilkar
1/2R-b R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] amd_iommu: Fix page size reporting on hugepage mappings

An issue in the page walking code where hugepage mappings were reported as 4K pages in certain configurations was reported by David Hoppenbrouwers in:
https://lore.kernel.org/qemu-devel/[email protected]/

While the change proposed in that thread fixes that specific bug, there are opportunities to simplify the algorithm by using a 1-based level accounting (matching DTE[Mode] and PTE NextLevel semantics).

The second change enforces a rule from the AMD-Vi specification which requires that NextLevel must be strictly lower than the current level to guarantee that the page walk eventually completes.

These changes make the page walk logic easier to follow, keep page size tracking aligned with the current page table level, and prevent invalid guest tables from causing page walk loops.

For stable: Please pick both patches together, PATCH 2 can be squashed into PATCH 1 for ease of backporting.

Thank you David and Sairaj for the detailed reporting/analysis of the original issue and the proposed fixes.

Alejandro

Alejandro Jimenez (2):
amd_iommu: Follow root pointer before page walk and use 1-based levels
amd_iommu: Reject non-decreasing NextLevel in fetch_pte()

 hw/i386/amd_iommu.c | 136 +++++++++++++++++++++++++++++++-------------
 hw/i386/amd_iommu.h |  11 ++--
 2 files changed, 101 insertions(+), 46 deletions(-)

base-commit: 1fd5ff9d76d23ab23a68419cbc76d5ee33e8b455

Signature · 1 line
2.47.3