Revert "tty: hvc: Fix data abort due to race in hvc_open"
[linux/fpc-iii.git] / virt / kvm / arm / hypercalls.c
blob550dfa3e53cddd3a7c5b567f488e4a16a0e90ab9
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2019 Arm Ltd.
4 #include <linux/arm-smccc.h>
5 #include <linux/kvm_host.h>
7 #include <asm/kvm_emulate.h>
9 #include <kvm/arm_hypercalls.h>
10 #include <kvm/arm_psci.h>
12 int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
14 u32 func_id = smccc_get_function(vcpu);
15 long val = SMCCC_RET_NOT_SUPPORTED;
16 u32 feature;
17 gpa_t gpa;
19 switch (func_id) {
20 case ARM_SMCCC_VERSION_FUNC_ID:
21 val = ARM_SMCCC_VERSION_1_1;
22 break;
23 case ARM_SMCCC_ARCH_FEATURES_FUNC_ID:
24 feature = smccc_get_arg1(vcpu);
25 switch (feature) {
26 case ARM_SMCCC_ARCH_WORKAROUND_1:
27 switch (kvm_arm_harden_branch_predictor()) {
28 case KVM_BP_HARDEN_UNKNOWN:
29 break;
30 case KVM_BP_HARDEN_WA_NEEDED:
31 val = SMCCC_RET_SUCCESS;
32 break;
33 case KVM_BP_HARDEN_NOT_REQUIRED:
34 val = SMCCC_RET_NOT_REQUIRED;
35 break;
37 break;
38 case ARM_SMCCC_ARCH_WORKAROUND_2:
39 switch (kvm_arm_have_ssbd()) {
40 case KVM_SSBD_FORCE_DISABLE:
41 case KVM_SSBD_UNKNOWN:
42 break;
43 case KVM_SSBD_KERNEL:
44 val = SMCCC_RET_SUCCESS;
45 break;
46 case KVM_SSBD_FORCE_ENABLE:
47 case KVM_SSBD_MITIGATED:
48 val = SMCCC_RET_NOT_REQUIRED;
49 break;
51 break;
52 case ARM_SMCCC_HV_PV_TIME_FEATURES:
53 val = SMCCC_RET_SUCCESS;
54 break;
56 break;
57 case ARM_SMCCC_HV_PV_TIME_FEATURES:
58 val = kvm_hypercall_pv_features(vcpu);
59 break;
60 case ARM_SMCCC_HV_PV_TIME_ST:
61 gpa = kvm_init_stolen_time(vcpu);
62 if (gpa != GPA_INVALID)
63 val = gpa;
64 break;
65 default:
66 return kvm_psci_call(vcpu);
69 smccc_set_retval(vcpu, val, 0, 0, 0);
70 return 1;