From 31094eab00236ad384d4ae8446cee3c5bcc39742 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 7 Jul 2022 15:51:44 +0100 Subject: [PATCH] Revert "Revert "ANDROID: KVM: arm64: Unmap S2MPU MMIO regions in MPT"" This reverts commit d52e3e4473075ddf199c9ae763e747302d729468. Bug: 233587962 Signed-off-by: Will Deacon Change-Id: I465cb99696ef1aba22a8cb575736b81773e47831 --- arch/arm64/kvm/hyp/nvhe/iommu/s2mpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/iommu/s2mpu.c b/arch/arm64/kvm/hyp/nvhe/iommu/s2mpu.c index 4d6e6a0ff94c..a1286e1b3bc2 100644 --- a/arch/arm64/kvm/hyp/nvhe/iommu/s2mpu.c +++ b/arch/arm64/kvm/hyp/nvhe/iommu/s2mpu.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -452,6 +453,11 @@ static int s2mpu_init(void) */ for_each_powered_s2mpu(dev) initialize_with_mpt(dev, &kvm_hyp_host_mpt); + + /* Prevent DMA to the S2MPU MMIO regions. */ + for_each_s2mpu(dev) + s2mpu_host_stage2_set_owner(dev->pa, S2MPU_MMIO_SIZE, pkvm_hyp_id); + return 0; }