From: Marc Zyngier Date: Fri, 25 Feb 2022 13:49:48 +0000 (+0000) Subject: Merge branch kvm-arm64/psci-1.1 into kvmarm-master/next X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1a48ce92641d19afd16eb0c23efbf408d0a76911;p=linux.git Merge branch kvm-arm64/psci-1.1 into kvmarm-master/next * kvm-arm64/psci-1.1: : . : Limited PSCI-1.1 support from Will Deacon: : : This small series exposes the PSCI SYSTEM_RESET2 call to guests, which : allows the propagation of a "reset_type" and a "cookie" back to the VMM. : Although Linux guests only ever pass 0 for the type ("SYSTEM_WARM_RESET"), : the vendor-defined range can be used by a bootloader to provide additional : information about the reset, such as an error code. : . KVM: arm64: Remove unneeded semicolons KVM: arm64: Indicate SYSTEM_RESET2 in kvm_run::system_event flags field KVM: arm64: Expose PSCI SYSTEM_RESET2 call to the guest KVM: arm64: Bump guest PSCI version to 1.1 Signed-off-by: Marc Zyngier --- 1a48ce92641d19afd16eb0c23efbf408d0a76911 diff --cc arch/arm64/include/uapi/asm/kvm.h index d49f714f48e6c,06bc08fdf8ea6..47039f2a1bddf --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@@ -414,9 -413,13 +414,16 @@@ struct kvm_arm_copy_mte_tags #define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS #define KVM_PSCI_RET_DENIED PSCI_RET_DENIED + /* arm64-specific kvm_run::system_event flags */ + /* + * Reset caused by a PSCI v1.1 SYSTEM_RESET2 call. + * Valid only when the system event has a type of KVM_SYSTEM_EVENT_RESET. + */ + #define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 (1ULL << 0) + +/* run->fail_entry.hardware_entry_failure_reason codes. */ +#define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0) + #endif #endif /* __ARM_KVM_H__ */ diff --cc arch/arm64/kvm/psci.c index a0c10c11f40e3,0d48d1e7291d5..505e148ed1b9f --- a/arch/arm64/kvm/psci.c +++ b/arch/arm64/kvm/psci.c @@@ -392,9 -427,11 +427,11 @@@ static int kvm_psci_0_1_call(struct kvm */ int kvm_psci_call(struct kvm_vcpu *vcpu) { - switch (kvm_psci_version(vcpu, vcpu->kvm)) { + switch (kvm_psci_version(vcpu)) { + case KVM_ARM_PSCI_1_1: + return kvm_psci_1_x_call(vcpu, 1); case KVM_ARM_PSCI_1_0: - return kvm_psci_1_0_call(vcpu); + return kvm_psci_1_x_call(vcpu, 0); case KVM_ARM_PSCI_0_2: return kvm_psci_0_2_call(vcpu); case KVM_ARM_PSCI_0_1: diff --cc include/kvm/arm_psci.h index 297645edcafff,4a1003323a0c9..68b96c3826c36 --- a/include/kvm/arm_psci.h +++ b/include/kvm/arm_psci.h @@@ -13,10 -13,15 +13,11 @@@ #define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1) #define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2) #define KVM_ARM_PSCI_1_0 PSCI_VERSION(1, 0) + #define KVM_ARM_PSCI_1_1 PSCI_VERSION(1, 1) - #define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_0 + #define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_1 -/* - * We need the KVM pointer independently from the vcpu as we can call - * this from HYP, and need to apply kern_hyp_va on it... - */ -static inline int kvm_psci_version(struct kvm_vcpu *vcpu, struct kvm *kvm) +static inline int kvm_psci_version(struct kvm_vcpu *vcpu) { /* * Our PSCI implementation stays the same across versions from