Skip to content

Commit 0c7639c

Browse files
author
Marc Zyngier
committed
KVM: arm64: pkvm: Pass vpcu instead of kvm to kvm_get_exit_handler_array()
Passing a VM pointer around is odd, and results in extra work on VHE. Follow the rest of the design that uses the vcpu instead, and let the nVHE code look into the struct kvm as required. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Fuad Tabba <[email protected]> Tested-by: Fuad Tabba <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 746bdea commit 0c7639c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

arch/arm64/kvm/hyp/include/hyp/switch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
397397

398398
typedef bool (*exit_handler_fn)(struct kvm_vcpu *, u64 *);
399399

400-
static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm);
400+
static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu);
401401

402402
/*
403403
* Allow the hypervisor to handle the exit with an exit handler if it has one.
@@ -407,7 +407,7 @@ static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm);
407407
*/
408408
static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
409409
{
410-
const exit_handler_fn *handlers = kvm_get_exit_handler_array(kern_hyp_va(vcpu->kvm));
410+
const exit_handler_fn *handlers = kvm_get_exit_handler_array(vcpu);
411411
exit_handler_fn fn;
412412

413413
fn = handlers[kvm_vcpu_trap_get_class(vcpu)];

arch/arm64/kvm/hyp/nvhe/switch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ static const exit_handler_fn pvm_exit_handlers[] = {
211211
[ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
212212
};
213213

214-
static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm)
214+
static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu)
215215
{
216-
if (unlikely(kvm_vm_is_protected(kvm)))
216+
if (unlikely(kvm_vm_is_protected(kern_hyp_va(vcpu->kvm))))
217217
return pvm_exit_handlers;
218218

219219
return hyp_exit_handlers;

arch/arm64/kvm/hyp/vhe/switch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static const exit_handler_fn hyp_exit_handlers[] = {
107107
[ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
108108
};
109109

110-
static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm)
110+
static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu)
111111
{
112112
return hyp_exit_handlers;
113113
}

0 commit comments

Comments
 (0)