Commit 7c7cce2c authored by Paolo Bonzini's avatar Paolo Bonzini

Merge tag 'kvmarm-fixes-6.6-1' of...

Merge tag 'kvmarm-fixes-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD

KVM/arm64 fixes for 6.6, take #1

- Fix EL2 Stage-1 MMIO mappings where a random address was used

- Fix SMCCC function number comparison when the SVE hint is set
parents 0bb80ecc 373beef0
...@@ -118,7 +118,7 @@ void deactivate_traps_vhe_put(struct kvm_vcpu *vcpu); ...@@ -118,7 +118,7 @@ void deactivate_traps_vhe_put(struct kvm_vcpu *vcpu);
u64 __guest_enter(struct kvm_vcpu *vcpu); u64 __guest_enter(struct kvm_vcpu *vcpu);
bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt); bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt, u32 func_id);
#ifdef __KVM_NVHE_HYPERVISOR__ #ifdef __KVM_NVHE_HYPERVISOR__
void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr, void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
......
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
#define FFA_MAX_FUNC_NUM 0x7F #define FFA_MAX_FUNC_NUM 0x7F
int hyp_ffa_init(void *pages); int hyp_ffa_init(void *pages);
bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt); bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id);
#endif /* __KVM_HYP_FFA_H */ #endif /* __KVM_HYP_FFA_H */
...@@ -634,9 +634,8 @@ static bool do_ffa_features(struct arm_smccc_res *res, ...@@ -634,9 +634,8 @@ static bool do_ffa_features(struct arm_smccc_res *res,
return true; return true;
} }
bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt) bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
{ {
DECLARE_REG(u64, func_id, host_ctxt, 0);
struct arm_smccc_res res; struct arm_smccc_res res;
/* /*
......
...@@ -57,6 +57,7 @@ __do_hyp_init: ...@@ -57,6 +57,7 @@ __do_hyp_init:
cmp x0, #HVC_STUB_HCALL_NR cmp x0, #HVC_STUB_HCALL_NR
b.lo __kvm_handle_stub_hvc b.lo __kvm_handle_stub_hvc
bic x0, x0, #ARM_SMCCC_CALL_HINTS
mov x3, #KVM_HOST_SMCCC_FUNC(__kvm_hyp_init) mov x3, #KVM_HOST_SMCCC_FUNC(__kvm_hyp_init)
cmp x0, x3 cmp x0, x3
b.eq 1f b.eq 1f
......
...@@ -368,6 +368,7 @@ static void handle_host_hcall(struct kvm_cpu_context *host_ctxt) ...@@ -368,6 +368,7 @@ static void handle_host_hcall(struct kvm_cpu_context *host_ctxt)
if (static_branch_unlikely(&kvm_protected_mode_initialized)) if (static_branch_unlikely(&kvm_protected_mode_initialized))
hcall_min = __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize; hcall_min = __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize;
id &= ~ARM_SMCCC_CALL_HINTS;
id -= KVM_HOST_SMCCC_ID(0); id -= KVM_HOST_SMCCC_ID(0);
if (unlikely(id < hcall_min || id >= ARRAY_SIZE(host_hcall))) if (unlikely(id < hcall_min || id >= ARRAY_SIZE(host_hcall)))
...@@ -392,11 +393,14 @@ static void default_host_smc_handler(struct kvm_cpu_context *host_ctxt) ...@@ -392,11 +393,14 @@ static void default_host_smc_handler(struct kvm_cpu_context *host_ctxt)
static void handle_host_smc(struct kvm_cpu_context *host_ctxt) static void handle_host_smc(struct kvm_cpu_context *host_ctxt)
{ {
DECLARE_REG(u64, func_id, host_ctxt, 0);
bool handled; bool handled;
handled = kvm_host_psci_handler(host_ctxt); func_id &= ~ARM_SMCCC_CALL_HINTS;
handled = kvm_host_psci_handler(host_ctxt, func_id);
if (!handled) if (!handled)
handled = kvm_host_ffa_handler(host_ctxt); handled = kvm_host_ffa_handler(host_ctxt, func_id);
if (!handled) if (!handled)
default_host_smc_handler(host_ctxt); default_host_smc_handler(host_ctxt);
......
...@@ -273,9 +273,8 @@ static unsigned long psci_1_0_handler(u64 func_id, struct kvm_cpu_context *host_ ...@@ -273,9 +273,8 @@ static unsigned long psci_1_0_handler(u64 func_id, struct kvm_cpu_context *host_
} }
} }
bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt) bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
{ {
DECLARE_REG(u64, func_id, host_ctxt, 0);
unsigned long ret; unsigned long ret;
switch (kvm_host_psci_config.version) { switch (kvm_host_psci_config.version) {
......
...@@ -652,6 +652,9 @@ int hyp_alloc_private_va_range(size_t size, unsigned long *haddr) ...@@ -652,6 +652,9 @@ int hyp_alloc_private_va_range(size_t size, unsigned long *haddr)
mutex_unlock(&kvm_hyp_pgd_mutex); mutex_unlock(&kvm_hyp_pgd_mutex);
if (!ret)
*haddr = base;
return ret; return ret;
} }
......
...@@ -67,6 +67,8 @@ ...@@ -67,6 +67,8 @@
#define ARM_SMCCC_VERSION_1_3 0x10003 #define ARM_SMCCC_VERSION_1_3 0x10003
#define ARM_SMCCC_1_3_SVE_HINT 0x10000 #define ARM_SMCCC_1_3_SVE_HINT 0x10000
#define ARM_SMCCC_CALL_HINTS ARM_SMCCC_1_3_SVE_HINT
#define ARM_SMCCC_VERSION_FUNC_ID \ #define ARM_SMCCC_VERSION_FUNC_ID \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment