]> xenbits.xensource.com Git - xen.git/commit
xen/arm: Do not invalidate the P2M when the PT is shared with the IOMMU
authorStefano Stabellini <sstabellini@kernel.org>
Wed, 4 Aug 2021 20:57:07 +0000 (13:57 -0700)
committerStefano Stabellini <stefano.stabellini@xilinx.com>
Tue, 14 Dec 2021 20:39:20 +0000 (12:39 -0800)
commitcbadf67bcab4e29c883410db393f4f5ef34df04a
tree3e021dabc23e3cc7ce6202e83e85931a834e6415
parentc4cf5388652e8434652e30c73aa79635b4253675
xen/arm: Do not invalidate the P2M when the PT is shared with the IOMMU

Set/Way flushes never work correctly in a virtualized environment.

Our current implementation is based on clearing the valid bit in the p2m
pagetable to track guest memory accesses. This technique doesn't work
when the IOMMU is enabled for the domain and the pagetable is shared
between IOMMU and MMU because it triggers IOMMU faults.

Specifically, p2m_invalidate_root causes IOMMU faults if
iommu_use_hap_pt returns true for the domain.

Add a check in p2m_set_way_flush: if a set/way instruction is used
and iommu_use_hap_pt returns true, rather than failing with obscure
IOMMU faults, inject an undef exception straight away into the guest,
and print a verbose error message to explain the problem.

Also add an ASSERT in p2m_invalidate_root to make sure we don't
inadvertently stumble across this problem again in the future.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit 2b45ff60301a988badec526846e77b538383ae63)
xen/arch/arm/arm64/vsysreg.c
xen/arch/arm/p2m.c
xen/arch/arm/vcpreg.c
xen/include/asm-arm/p2m.h