From 1e45bfa3e64da597e2e5573ab2b06641aaa1493e Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 29 Mar 2022 16:56:10 +0100 Subject: [PATCH] ANDROID: KVM: arm64: iommu: No powered check in DABT handler The IOMMU DABT handler currently checks if the device is considered powered by hyp before resolving the request. If the power tracking does not reflect reality, the IOMMU may trigger issues in the host but the incorrect state prevents it from diagnosing the issue. Drop the powered check from the generic IOMMU code. The host accessing the device's SFR means that it assumes it is powered, and individual drivers can choose to reject that DABT request. Bug: 224891559 Bug: 190463801 Change-Id: I3418a29c7deb7e3e866f89d933b9dad0aaa06365 Signed-off-by: David Brazdil (cherry picked from commit 798c4ea545e98e04797424c98c4329e6a34db60e) Signed-off-by: Mostafa Saleh Signed-off-by: Quentin Perret --- arch/arm64/kvm/hyp/nvhe/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/iommu.c b/arch/arm64/kvm/hyp/nvhe/iommu.c index 0f9f6950bdce..702af436277d 100644 --- a/arch/arm64/kvm/hyp/nvhe/iommu.c +++ b/arch/arm64/kvm/hyp/nvhe/iommu.c @@ -466,7 +466,8 @@ bool pkvm_iommu_host_dabt_handler(struct kvm_cpu_context *host_ctxt, u32 esr, if (pa < dev->pa || pa >= dev->pa + dev->size) continue; - if (!dev->powered || !dev->ops->host_dabt_handler || + /* No 'powered' check - the host assumes it is powered. */ + if (!dev->ops->host_dabt_handler || !dev->ops->host_dabt_handler(dev, host_ctxt, esr, pa - dev->pa)) return false;