Revert "ANDROID: KVM: arm64: Add 'host_mmio_dabt_handler' to kvm_iommu_ops"

This reverts commit 565267794a.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5b1129b0a71416675a15008157e7a7a98a343517
This commit is contained in:
Will Deacon
2022-07-07 15:51:50 +01:00
parent 09d1f2e4ff
commit 2c2b64e5b3
2 changed files with 2 additions and 39 deletions

View File

@@ -126,9 +126,6 @@ extern u64 kvm_nvhe_sym(id_aa64mmfr2_el1_sys_val);
struct kvm_iommu_ops {
int (*init)(void);
bool (*host_smc_handler)(struct kvm_cpu_context *host_ctxt);
bool (*host_mmio_dabt_handler)(struct kvm_cpu_context *host_ctxt,
phys_addr_t fault_pa, unsigned int len,
bool is_write, int rd);
void (*host_stage2_set_owner)(phys_addr_t addr, size_t size, u8 owner_id);
};

View File

@@ -12,7 +12,6 @@
#include <asm/kvm_pkvm.h>
#include <asm/stage2_pgtable.h>
#include <hyp/adjust_pc.h>
#include <hyp/fault.h>
#include <nvhe/gfp.h>
@@ -379,50 +378,17 @@ unlock:
return ret;
}
static int host_mmio_dabt_handler(struct kvm_cpu_context *host_ctxt, u32 esr,
phys_addr_t addr)
{
bool wnr = esr & ESR_ELx_WNR;
unsigned int len = BIT((esr & ESR_ELx_SAS) >> ESR_ELx_SAS_SHIFT);
int rd = (esr & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT;
bool handled = false;
if (kvm_iommu_ops.host_mmio_dabt_handler) {
handled = kvm_iommu_ops.host_mmio_dabt_handler(host_ctxt, addr,
len, wnr, rd);
}
if (!handled)
return -EPERM;
kvm_skip_host_instr();
return 0;
}
static bool is_dabt(u64 esr)
{
return ESR_ELx_EC(esr) == ESR_ELx_EC_DABT_LOW;
}
void handle_host_mem_abort(struct kvm_cpu_context *host_ctxt)
{
struct kvm_vcpu_fault_info fault;
u64 esr, addr;
int ret = -EPERM;
int ret = 0;
esr = read_sysreg_el2(SYS_ESR);
BUG_ON(!__get_fault_info(esr, &fault));
addr = (fault.hpfar_el2 & HPFAR_MASK) << 8;
/* See if any subsystem can handle this abort. */
if (is_dabt(esr) && !addr_is_memory(addr))
ret = host_mmio_dabt_handler(host_ctxt, esr, addr);
/* If not handled, attempt to map the page. */
if (ret == -EPERM)
ret = host_stage2_idmap(addr);
ret = host_stage2_idmap(addr);
BUG_ON(ret && ret != -EAGAIN);
}