mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
KVM: arm64: pkvm: Add a generic synchronous exception injection primitive
Similarly to the "classic" KVM code, pKVM doesn't have an "anything goes" synchronous exception injection primitive. Carve one out of the UNDEF injection code. Link: https://patch.msgid.link/20260108173233.2911955-8-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
70a5ce4efc
commit
e5d40a5a97
|
|
@ -243,16 +243,15 @@ static u64 pvm_calc_id_reg(const struct kvm_vcpu *vcpu, u32 id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static void inject_sync64(struct kvm_vcpu *vcpu, u64 esr)
|
||||||
* Inject an unknown/undefined exception to an AArch64 guest while most of its
|
|
||||||
* sysregs are live.
|
|
||||||
*/
|
|
||||||
static void inject_undef64(struct kvm_vcpu *vcpu)
|
|
||||||
{
|
{
|
||||||
u64 esr = (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT);
|
|
||||||
|
|
||||||
*vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);
|
*vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);
|
||||||
*vcpu_cpsr(vcpu) = read_sysreg_el2(SYS_SPSR);
|
*vcpu_cpsr(vcpu) = read_sysreg_el2(SYS_SPSR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure we have the latest update to VBAR_EL1, as pKVM
|
||||||
|
* handles traps very early, before sysregs are resync'ed
|
||||||
|
*/
|
||||||
__vcpu_assign_sys_reg(vcpu, VBAR_EL1, read_sysreg_el1(SYS_VBAR));
|
__vcpu_assign_sys_reg(vcpu, VBAR_EL1, read_sysreg_el1(SYS_VBAR));
|
||||||
|
|
||||||
kvm_pend_exception(vcpu, EXCEPT_AA64_EL1_SYNC);
|
kvm_pend_exception(vcpu, EXCEPT_AA64_EL1_SYNC);
|
||||||
|
|
@ -265,6 +264,15 @@ static void inject_undef64(struct kvm_vcpu *vcpu)
|
||||||
write_sysreg_el2(*vcpu_cpsr(vcpu), SYS_SPSR);
|
write_sysreg_el2(*vcpu_cpsr(vcpu), SYS_SPSR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inject an unknown/undefined exception to an AArch64 guest while most of its
|
||||||
|
* sysregs are live.
|
||||||
|
*/
|
||||||
|
static void inject_undef64(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
inject_sync64(vcpu, (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT));
|
||||||
|
}
|
||||||
|
|
||||||
static u64 read_id_reg(const struct kvm_vcpu *vcpu,
|
static u64 read_id_reg(const struct kvm_vcpu *vcpu,
|
||||||
struct sys_reg_desc const *r)
|
struct sys_reg_desc const *r)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user