mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
KVM: arm64: selftests: Convert to kernel's ESR terminology
Drop the KVM selftests specific flavoring of ESR in favor of the kernel header. Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20241025203106.3529261-4-oliver.upton@linux.dev Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
This commit is contained in:
parent
9fb8e9178b
commit
c660d334b3
|
|
@ -433,15 +433,15 @@ static void test_guest_debug_exceptions(uint8_t bpn, uint8_t wpn, uint8_t ctx_bp
|
|||
vcpu_init_descriptor_tables(vcpu);
|
||||
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_BRK_INS, guest_sw_bp_handler);
|
||||
ESR_ELx_EC_BRK64, guest_sw_bp_handler);
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_HW_BP_CURRENT, guest_hw_bp_handler);
|
||||
ESR_ELx_EC_BREAKPT_CUR, guest_hw_bp_handler);
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_WP_CURRENT, guest_wp_handler);
|
||||
ESR_ELx_EC_WATCHPT_CUR, guest_wp_handler);
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_SSTEP_CURRENT, guest_ss_handler);
|
||||
ESR_ELx_EC_SOFTSTP_CUR, guest_ss_handler);
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_SVC64, guest_svc_handler);
|
||||
ESR_ELx_EC_SVC64, guest_svc_handler);
|
||||
|
||||
/* Specify bpn/wpn/ctx_bpn to be tested */
|
||||
vcpu_args_set(vcpu, 3, bpn, wpn, ctx_bpn);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ static void test_guest_no_gicv3(void)
|
|||
vcpu_init_descriptor_tables(vcpu);
|
||||
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_UNKNOWN, guest_undef_handler);
|
||||
ESR_ELx_EC_UNKNOWN, guest_undef_handler);
|
||||
|
||||
test_run_vcpu(vcpu);
|
||||
|
||||
|
|
|
|||
|
|
@ -544,9 +544,9 @@ static void setup_abort_handlers(struct kvm_vm *vm, struct kvm_vcpu *vcpu,
|
|||
vcpu_init_descriptor_tables(vcpu);
|
||||
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_DABT, no_dabt_handler);
|
||||
ESR_ELx_EC_DABT_CUR, no_dabt_handler);
|
||||
vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
|
||||
ESR_EC_IABT, no_iabt_handler);
|
||||
ESR_ELx_EC_IABT_CUR, no_iabt_handler);
|
||||
}
|
||||
|
||||
static void setup_gva_maps(struct kvm_vm *vm)
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ static void guest_sync_handler(struct ex_regs *regs)
|
|||
uint64_t esr, ec;
|
||||
|
||||
esr = read_sysreg(esr_el1);
|
||||
ec = (esr >> ESR_EC_SHIFT) & ESR_EC_MASK;
|
||||
ec = ESR_ELx_EC(esr);
|
||||
|
||||
__GUEST_ASSERT(expected_ec == ec,
|
||||
"PC: 0x%lx; ESR: 0x%lx; EC: 0x%lx; EC expected: 0x%lx",
|
||||
|
|
@ -338,10 +338,10 @@ static void test_access_invalid_pmc_regs(struct pmc_accessor *acc, int pmc_idx)
|
|||
* Reading/writing the event count/type registers should cause
|
||||
* an UNDEFINED exception.
|
||||
*/
|
||||
TEST_EXCEPTION(ESR_EC_UNKNOWN, acc->read_cntr(pmc_idx));
|
||||
TEST_EXCEPTION(ESR_EC_UNKNOWN, acc->write_cntr(pmc_idx, 0));
|
||||
TEST_EXCEPTION(ESR_EC_UNKNOWN, acc->read_typer(pmc_idx));
|
||||
TEST_EXCEPTION(ESR_EC_UNKNOWN, acc->write_typer(pmc_idx, 0));
|
||||
TEST_EXCEPTION(ESR_ELx_EC_UNKNOWN, acc->read_cntr(pmc_idx));
|
||||
TEST_EXCEPTION(ESR_ELx_EC_UNKNOWN, acc->write_cntr(pmc_idx, 0));
|
||||
TEST_EXCEPTION(ESR_ELx_EC_UNKNOWN, acc->read_typer(pmc_idx));
|
||||
TEST_EXCEPTION(ESR_ELx_EC_UNKNOWN, acc->write_typer(pmc_idx, 0));
|
||||
/*
|
||||
* The bit corresponding to the (unimplemented) counter in
|
||||
* {PMCNTEN,PMINTEN,PMOVS}{SET,CLR} registers should be RAZ.
|
||||
|
|
@ -425,7 +425,7 @@ static void create_vpmu_vm(void *guest_code)
|
|||
|
||||
vpmu_vm.vm = vm_create(1);
|
||||
vm_init_descriptor_tables(vpmu_vm.vm);
|
||||
for (ec = 0; ec < ESR_EC_NUM; ec++) {
|
||||
for (ec = 0; ec < ESR_ELx_EC_MAX + 1; ec++) {
|
||||
vm_install_sync_handler(vpmu_vm.vm, VECTOR_SYNC_CURRENT, ec,
|
||||
guest_sync_handler);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/brk-imm.h>
|
||||
#include <asm/esr.h>
|
||||
#include <asm/sysreg.h>
|
||||
|
||||
|
||||
|
|
@ -100,19 +102,6 @@ enum {
|
|||
(v) == VECTOR_SYNC_LOWER_64 || \
|
||||
(v) == VECTOR_SYNC_LOWER_32)
|
||||
|
||||
#define ESR_EC_NUM 64
|
||||
#define ESR_EC_SHIFT 26
|
||||
#define ESR_EC_MASK (ESR_EC_NUM - 1)
|
||||
|
||||
#define ESR_EC_UNKNOWN 0x0
|
||||
#define ESR_EC_SVC64 0x15
|
||||
#define ESR_EC_IABT 0x21
|
||||
#define ESR_EC_DABT 0x25
|
||||
#define ESR_EC_HW_BP_CURRENT 0x31
|
||||
#define ESR_EC_SSTEP_CURRENT 0x33
|
||||
#define ESR_EC_WP_CURRENT 0x35
|
||||
#define ESR_EC_BRK_INS 0x3c
|
||||
|
||||
/* Access flag */
|
||||
#define PTE_AF (1ULL << 10)
|
||||
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ void assert_on_unhandled_exception(struct kvm_vcpu *vcpu)
|
|||
}
|
||||
|
||||
struct handlers {
|
||||
handler_fn exception_handlers[VECTOR_NUM][ESR_EC_NUM];
|
||||
handler_fn exception_handlers[VECTOR_NUM][ESR_ELx_EC_MAX + 1];
|
||||
};
|
||||
|
||||
void vcpu_init_descriptor_tables(struct kvm_vcpu *vcpu)
|
||||
|
|
@ -469,7 +469,7 @@ void route_exception(struct ex_regs *regs, int vector)
|
|||
switch (vector) {
|
||||
case VECTOR_SYNC_CURRENT:
|
||||
case VECTOR_SYNC_LOWER_64:
|
||||
ec = (read_sysreg(esr_el1) >> ESR_EC_SHIFT) & ESR_EC_MASK;
|
||||
ec = ESR_ELx_EC(read_sysreg(esr_el1));
|
||||
valid_ec = true;
|
||||
break;
|
||||
case VECTOR_IRQ_CURRENT:
|
||||
|
|
@ -508,7 +508,7 @@ void vm_install_sync_handler(struct kvm_vm *vm, int vector, int ec,
|
|||
|
||||
assert(VECTOR_IS_SYNC(vector));
|
||||
assert(vector < VECTOR_NUM);
|
||||
assert(ec < ESR_EC_NUM);
|
||||
assert(ec <= ESR_ELx_EC_MAX);
|
||||
handlers->exception_handlers[vector][ec] = handler;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user