mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
ANDROID: KVM: arm64: Fix vcpu sys_reg accessors when running with VHE
Commit 3f6536412f ("ANDROID: KVM: arm64: refactor vcpu_read_sys_reg
and vcpu_write_sys_reg for hyp use") predicated direct access to the
live vCPU registers on an is_vhe_hyp_code() check, neglecting the fact
that these functions are also used by the VHE *kernel* code.
Restore the old behaviour by changing the check so that only the nVHE
hyp code unconditionally uses the 'ctxt_sys_reg' table.
Reported-by: Marc Zyngier <mzyngier@google.com>
Signed-off-by: Fuad Tabba <tabba@google.com>
Bug: 209580772
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I17d4c12ffdbbd95e8e8d1820ebb6438b138361aa
This commit is contained in:
@@ -686,7 +686,8 @@ static inline u64 vcpu_arch_read_sys_reg(const struct kvm_vcpu_arch *vcpu_arch,
|
||||
{
|
||||
u64 val = 0x8badf00d8badf00d;
|
||||
|
||||
if (is_vhe_hyp_code() && vcpu_arch->sysregs_loaded_on_cpu &&
|
||||
/* sysregs_loaded_on_cpu is only used in VHE */
|
||||
if (!is_nvhe_hyp_code() && vcpu_arch->sysregs_loaded_on_cpu &&
|
||||
__vcpu_read_sys_reg_from_cpu(reg, &val))
|
||||
return val;
|
||||
|
||||
@@ -695,7 +696,8 @@ static inline u64 vcpu_arch_read_sys_reg(const struct kvm_vcpu_arch *vcpu_arch,
|
||||
|
||||
static inline void vcpu_arch_write_sys_reg(struct kvm_vcpu_arch *vcpu_arch, u64 val, int reg)
|
||||
{
|
||||
if (is_vhe_hyp_code() && vcpu_arch->sysregs_loaded_on_cpu &&
|
||||
/* sysregs_loaded_on_cpu is only used in VHE */
|
||||
if (!is_nvhe_hyp_code() && vcpu_arch->sysregs_loaded_on_cpu &&
|
||||
__vcpu_write_sys_reg_to_cpu(val, reg))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user