]>
xen/arm: Fix P2M root page tables invalidation
authorMichal Orzel <michal.orzel@amd.com>
Mon, 16 Jun 2025 06:56:48 +0000 (08:56 +0200)
committerMichal Orzel <michal.orzel@amd.com>
Tue, 17 Jun 2025 06:31:52 +0000 (08:31 +0200)
commit14c57887f36937c1deb9eeca852c3a7595d2d0b8
tree77858cf76c166b1acabf7c50cdaff65087960525
parent3c63d6b3304f4c01fc2e98009e1ef45cd7155453
xen/arm: Fix P2M root page tables invalidation

Fix the condition part of the for loop in p2m_invalidate_root() that
uses P2M_ROOT_LEVEL instead of P2M_ROOT_PAGES. The goal here is to
invalidate all root page tables (that can be concatenated), so the loop
must iterate through all these pages. Root level can be 0 or 1, whereas
there can be 1,2,8,16 root pages. The issue may lead to some pages
not being invalidated and therefore the guest access won't be trapped.
We use it to track pages accessed by guest for set/way emulation provided
no IOMMU, IOMMU not enabled for the domain or P2M not shared with IOMMU.

Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
Reported-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/mmu/p2m.c