Skip to content

Commit 746bdea

Browse files
author
Marc Zyngier
committed
KVM: arm64: pkvm: Move kvm_handle_pvm_restricted around
Place kvm_handle_pvm_restricted() next to its little friends such as kvm_handle_pvm_sysreg(). This allows to make inject_undef64() static. 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 3061725 commit 746bdea

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

arch/arm64/kvm/hyp/include/nvhe/fixed_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194

195195
u64 pvm_read_id_reg(const struct kvm_vcpu *vcpu, u32 id);
196196
bool kvm_handle_pvm_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code);
197+
bool kvm_handle_pvm_restricted(struct kvm_vcpu *vcpu, u64 *exit_code);
197198
int kvm_check_pvm_sysreg_table(void);
198-
void inject_undef64(struct kvm_vcpu *vcpu);
199199

200200
#endif /* __ARM64_KVM_FIXED_CONFIG_H__ */

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,6 @@ static void __pmu_switch_to_host(struct kvm_cpu_context *host_ctxt)
159159
write_sysreg(pmu->events_host, pmcntenset_el0);
160160
}
161161

162-
/**
163-
* Handler for protected VM restricted exceptions.
164-
*
165-
* Inject an undefined exception into the guest and return true to indicate that
166-
* the hypervisor has handled the exit, and control should go back to the guest.
167-
*/
168-
static bool kvm_handle_pvm_restricted(struct kvm_vcpu *vcpu, u64 *exit_code)
169-
{
170-
inject_undef64(vcpu);
171-
return true;
172-
}
173-
174162
/**
175163
* Handler for protected VM MSR, MRS or System instruction execution in AArch64.
176164
*

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ u64 id_aa64mmfr2_el1_sys_val;
3030
* Inject an unknown/undefined exception to an AArch64 guest while most of its
3131
* sysregs are live.
3232
*/
33-
void inject_undef64(struct kvm_vcpu *vcpu)
33+
static void inject_undef64(struct kvm_vcpu *vcpu)
3434
{
3535
u32 esr = (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT);
3636

@@ -473,3 +473,15 @@ bool kvm_handle_pvm_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code)
473473

474474
return true;
475475
}
476+
477+
/**
478+
* Handler for protected VM restricted exceptions.
479+
*
480+
* Inject an undefined exception into the guest and return true to indicate that
481+
* the hypervisor has handled the exit, and control should go back to the guest.
482+
*/
483+
bool kvm_handle_pvm_restricted(struct kvm_vcpu *vcpu, u64 *exit_code)
484+
{
485+
inject_undef64(vcpu);
486+
return true;
487+
}

0 commit comments

Comments
 (0)