mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
UPSTREAM: KVM: arm64: Move skip_host_instruction to adjust_pc.h
Move function for skipping host instruction in the host trap handler to
a header file containing analogical helpers for guests.
Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201208142452.87237-7-dbrazdil@google.com
(cherry picked from commit 860a4c3d1e)
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I22849ad41eb80f1fba1bba079ab6fd1147dd6ed8
Bug: 178098380
Test: atest VirtualizationHostTestCases on an EL2-enabled device
This commit is contained in:
committed by
Will Deacon
parent
f7ba673f17
commit
fdf077065a
@@ -59,4 +59,13 @@ static inline void __adjust_pc(struct kvm_vcpu *vcpu)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip an instruction while host sysregs are live.
|
||||
* Assumes host is always 64-bit.
|
||||
*/
|
||||
static inline void kvm_skip_host_instr(void)
|
||||
{
|
||||
write_sysreg_el2(read_sysreg_el2(SYS_ELR) + 4, SYS_ELR);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -157,11 +157,6 @@ static void default_host_smc_handler(struct kvm_cpu_context *host_ctxt)
|
||||
__kvm_hyp_host_forward_smc(host_ctxt);
|
||||
}
|
||||
|
||||
static void skip_host_instruction(void)
|
||||
{
|
||||
write_sysreg_el2(read_sysreg_el2(SYS_ELR) + 4, SYS_ELR);
|
||||
}
|
||||
|
||||
static void handle_host_smc(struct kvm_cpu_context *host_ctxt)
|
||||
{
|
||||
bool handled;
|
||||
@@ -170,11 +165,8 @@ static void handle_host_smc(struct kvm_cpu_context *host_ctxt)
|
||||
if (!handled)
|
||||
default_host_smc_handler(host_ctxt);
|
||||
|
||||
/*
|
||||
* Unlike HVC, the return address of an SMC is the instruction's PC.
|
||||
* Move the return address past the instruction.
|
||||
*/
|
||||
skip_host_instruction();
|
||||
/* SMC was trapped, move ELR past the current PC. */
|
||||
kvm_skip_host_instr();
|
||||
}
|
||||
|
||||
void handle_trap(struct kvm_cpu_context *host_ctxt)
|
||||
|
||||
Reference in New Issue
Block a user