]> Git Repo - linux.git/commitdiff
Merge branch kvm-arm64/misc-5.15 into kvmarm-master/next
authorMarc Zyngier <[email protected]>
Thu, 26 Aug 2021 10:36:12 +0000 (11:36 +0100)
committerMarc Zyngier <[email protected]>
Thu, 26 Aug 2021 10:36:12 +0000 (11:36 +0100)
* kvm-arm64/misc-5.15:
  : Misc improvements for 5.15:
  :
  : - Account the number of VMID-wide TLB invalidations as
  :   remote TLB flushes
  : - Fix comments in the VGIC code
  : - Cleanup the PMU IMPDEF identification
  : - Streamline the TGRAN2 usage
  : - Avoid advertising a 52bit IPA range for non-64KB configs
  : - Avoid spurious signalling when a HW-mapped interrupt is in the
  :   A+P state on entry, and in the P state on exit, but that the
  :   physical line is not pending anymore.
  : - Bunch of minor cleanups
  KVM: arm64: Trim guest debug exception handling

Signed-off-by: Marc Zyngier <[email protected]>
1  2 
arch/arm64/kvm/handle_exit.c

index 04ebab299aa4ee7f6a4eeed4666ab620af9149c8,b143f1ab65204ac692729f7e00d5128eb9804fd8..275a27368a04c21264406cd68351592836c5800a
@@@ -113,34 -113,20 +113,20 @@@ static int kvm_handle_wfx(struct kvm_vc
   * guest and host are using the same debug facilities it will be up to
   * userspace to re-inject the correct exception for guest delivery.
   *
-  * @return: 0 (while setting vcpu->run->exit_reason), -1 for error
+  * @return: 0 (while setting vcpu->run->exit_reason)
   */
  static int kvm_handle_guest_debug(struct kvm_vcpu *vcpu)
  {
        struct kvm_run *run = vcpu->run;
        u32 esr = kvm_vcpu_get_esr(vcpu);
-       int ret = 0;
  
        run->exit_reason = KVM_EXIT_DEBUG;
        run->debug.arch.hsr = esr;
  
-       switch (ESR_ELx_EC(esr)) {
-       case ESR_ELx_EC_WATCHPT_LOW:
+       if (ESR_ELx_EC(esr) == ESR_ELx_EC_WATCHPT_LOW)
                run->debug.arch.far = vcpu->arch.fault.far_el2;
-               fallthrough;
-       case ESR_ELx_EC_SOFTSTP_LOW:
-       case ESR_ELx_EC_BREAKPT_LOW:
-       case ESR_ELx_EC_BKPT32:
-       case ESR_ELx_EC_BRK64:
-               break;
-       default:
-               kvm_err("%s: un-handled case esr: %#08x\n",
-                       __func__, (unsigned int) esr);
-               ret = -1;
-               break;
-       }
  
-       return ret;
+       return 0;
  }
  
  static int kvm_handle_unknown_ec(struct kvm_vcpu *vcpu)
@@@ -292,12 -278,11 +278,12 @@@ void handle_exit_early(struct kvm_vcpu 
                kvm_handle_guest_serror(vcpu, kvm_vcpu_get_esr(vcpu));
  }
  
 -void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr, u64 elr,
 +void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
 +                                            u64 elr_virt, u64 elr_phys,
                                              u64 par, uintptr_t vcpu,
                                              u64 far, u64 hpfar) {
 -      u64 elr_in_kimg = __phys_to_kimg(__hyp_pa(elr));
 -      u64 hyp_offset = elr_in_kimg - kaslr_offset() - elr;
 +      u64 elr_in_kimg = __phys_to_kimg(elr_phys);
 +      u64 hyp_offset = elr_in_kimg - kaslr_offset() - elr_virt;
        u64 mode = spsr & PSR_MODE_MASK;
  
        /*
                kvm_err("Invalid host exception to nVHE hyp!\n");
        } else if (ESR_ELx_EC(esr) == ESR_ELx_EC_BRK64 &&
                   (esr & ESR_ELx_BRK64_ISS_COMMENT_MASK) == BUG_BRK_IMM) {
 -              struct bug_entry *bug = find_bug(elr_in_kimg);
                const char *file = NULL;
                unsigned int line = 0;
  
                /* All hyp bugs, including warnings, are treated as fatal. */
 -              if (bug)
 -                      bug_get_file_line(bug, &file, &line);
 +              if (!is_protected_kvm_enabled() ||
 +                  IS_ENABLED(CONFIG_NVHE_EL2_DEBUG)) {
 +                      struct bug_entry *bug = find_bug(elr_in_kimg);
 +
 +                      if (bug)
 +                              bug_get_file_line(bug, &file, &line);
 +              }
  
                if (file)
                        kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line);
                else
 -                      kvm_err("nVHE hyp BUG at: %016llx!\n", elr + hyp_offset);
 +                      kvm_err("nVHE hyp BUG at: %016llx!\n", elr_virt + hyp_offset);
        } else {
 -              kvm_err("nVHE hyp panic at: %016llx!\n", elr + hyp_offset);
 +              kvm_err("nVHE hyp panic at: %016llx!\n", elr_virt + hyp_offset);
        }
  
        /*
        kvm_err("Hyp Offset: 0x%llx\n", hyp_offset);
  
        panic("HYP panic:\nPS:%08llx PC:%016llx ESR:%08llx\nFAR:%016llx HPFAR:%016llx PAR:%016llx\nVCPU:%016lx\n",
 -            spsr, elr, esr, far, hpfar, par, vcpu);
 +            spsr, elr_virt, esr, far, hpfar, par, vcpu);
  }
This page took 0.062714 seconds and 4 git commands to generate.