Merge branch kvm-arm64/psci-1.1 into kvmarm-master/next
authorMarc Zyngier <maz@kernel.org>
Fri, 25 Feb 2022 13:49:48 +0000 (13:49 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 25 Feb 2022 13:49:48 +0000 (13:49 +0000)
* 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 <maz@kernel.org>
1  2 
arch/arm64/include/uapi/asm/kvm.h
arch/arm64/kvm/psci.c
include/kvm/arm_psci.h

index d49f714f48e6c95242c1858ae489d9f02df1c8ad,06bc08fdf8ea605bc33056770b7792a97f995a54..47039f2a1bddfa78c2c3ed33a5f9ed7b745f40fb
@@@ -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__ */
index a0c10c11f40e326478efef538bf0fc1303b0caa3,0d48d1e7291d5ad18ade9279fabc969e3a96b2cf..505e148ed1b9f8be6d2382492d611d0136c3a695
@@@ -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:
index 297645edcafff60baaaea37dfc5b3db2502734c4,4a1003323a0c9e84dee7b3fb862d3a2dc293cf70..68b96c3826c36725aab572241b22cce9c94501d1
  #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