mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ANDROID: KVM: arm64: Fix nVHE enter/exit events
Some entry and exit points were not covered. This hopefully won't miss anything: each SMC call is exiting EL2 and when a CPU is being turned on, it goes directly through kvm_host_psci_cpu_entry(). Bug: 249050813 Change-Id: Ie88d36df249cb6f0f8e8a49df20654b0628d43d5 Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
13
arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h
Normal file
13
arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <asm/kvm_hypevents.h>
|
||||
|
||||
#include <linux/arm-smccc.h>
|
||||
|
||||
#undef arm_smccc_1_1_smc
|
||||
#define arm_smccc_1_1_smc(...) \
|
||||
do { \
|
||||
trace_hyp_exit(); \
|
||||
__arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__); \
|
||||
trace_hyp_enter(); \
|
||||
} while (0)
|
||||
@@ -26,10 +26,10 @@
|
||||
* the duration and are therefore serialised.
|
||||
*/
|
||||
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/arm_ffa.h>
|
||||
#include <asm/kvm_pkvm.h>
|
||||
|
||||
#include <nvhe/arm-smccc.h>
|
||||
#include <nvhe/ffa.h>
|
||||
#include <nvhe/mem_protect.h>
|
||||
#include <nvhe/memory.h>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <asm/kvm_emulate.h>
|
||||
|
||||
#include <nvhe/arm-smccc.h>
|
||||
#include <nvhe/mem_protect.h>
|
||||
#include <nvhe/memory.h>
|
||||
#include <nvhe/mm.h>
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <asm/kvm_hyp.h>
|
||||
#include <asm/kvm_hypevents.h>
|
||||
#include <asm/kvm_mmu.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/kvm_host.h>
|
||||
#include <uapi/linux/psci.h>
|
||||
|
||||
#include <nvhe/arm-smccc.h>
|
||||
#include <nvhe/mem_protect.h>
|
||||
#include <nvhe/memory.h>
|
||||
#include <nvhe/pkvm.h>
|
||||
@@ -186,7 +186,6 @@ static int psci_cpu_suspend(u64 func_id, struct kvm_cpu_context *host_ctxt)
|
||||
boot_args->r0 = r0;
|
||||
|
||||
pkvm_psci_notify(PKVM_PSCI_CPU_SUSPEND, host_ctxt);
|
||||
trace_hyp_exit();
|
||||
/*
|
||||
* Will either return if shallow sleep state, or wake up into the entry
|
||||
* point if it is a deep sleep state.
|
||||
@@ -194,7 +193,6 @@ static int psci_cpu_suspend(u64 func_id, struct kvm_cpu_context *host_ctxt)
|
||||
ret = psci_call(func_id, power_state,
|
||||
__hyp_pa(&kvm_hyp_cpu_resume),
|
||||
__hyp_pa(init_params));
|
||||
trace_hyp_enter();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -230,6 +228,8 @@ asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool is_cpu_on)
|
||||
struct psci_boot_args *boot_args;
|
||||
struct kvm_cpu_context *host_ctxt;
|
||||
|
||||
trace_hyp_enter();
|
||||
|
||||
host_ctxt = &this_cpu_ptr(&kvm_host_data)->host_ctxt;
|
||||
|
||||
if (is_cpu_on)
|
||||
@@ -245,6 +245,7 @@ asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool is_cpu_on)
|
||||
|
||||
pkvm_psci_notify(PKVM_PSCI_CPU_ENTRY, host_ctxt);
|
||||
|
||||
trace_hyp_exit();
|
||||
__host_enter(host_ctxt);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <hyp/switch.h>
|
||||
#include <hyp/sysreg-sr.h>
|
||||
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/kvm_host.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/jump_label.h>
|
||||
|
||||
Reference in New Issue
Block a user