]> Git Repo - linux.git/commitdiff
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
authorLinus Torvalds <[email protected]>
Sun, 14 Mar 2021 19:35:02 +0000 (12:35 -0700)
committerLinus Torvalds <[email protected]>
Sun, 14 Mar 2021 19:35:02 +0000 (12:35 -0700)
Pull KVM fixes from Paolo Bonzini:
 "More fixes for ARM and x86"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: LAPIC: Advancing the timer expiration on guest initiated write
  KVM: x86/mmu: Skip !MMU-present SPTEs when removing SP in exclusive mode
  KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
  kvm: x86: annotate RCU pointers
  KVM: arm64: Fix exclusive limit for IPA size
  KVM: arm64: Reject VM creation when the default IPA size is unsupported
  KVM: arm64: Ensure I-cache isolation between vcpus of a same VM
  KVM: arm64: Don't use cbz/adr with external symbols
  KVM: arm64: Fix range alignment when walking page tables
  KVM: arm64: Workaround firmware wrongly advertising GICv2-on-v3 compatibility
  KVM: arm64: Rename __vgic_v3_get_ich_vtr_el2() to __vgic_v3_get_gic_config()
  KVM: arm64: Don't access PMSELR_EL0/PMUSERENR_EL0 when no PMU is available
  KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key
  KVM: arm64: Fix nVHE hyp panic host context restore
  KVM: arm64: Avoid corrupting vCPU context register in guest exit
  KVM: arm64: nvhe: Save the SPE context early
  kvm: x86: use NULL instead of using plain integer as pointer
  KVM: SVM: Connect 'npt' module param to KVM's internal 'npt_enabled'
  KVM: x86: Ensure deadline timer has truly expired before posting its IRQ

1  2 
arch/arm64/kvm/arm.c
arch/arm64/kvm/reset.c
arch/x86/kvm/x86.c

diff --combined arch/arm64/kvm/arm.c
index fc4c95dd2d26172cf6ae4a9bd7d401bed5a7b6be,a391b984dd05194d865c8a74697ba26d62cbccba..7f06ba76698d843d3b4696c98970865536013a48
@@@ -385,11 -385,16 +385,16 @@@ void kvm_arch_vcpu_load(struct kvm_vcp
        last_ran = this_cpu_ptr(mmu->last_vcpu_ran);
  
        /*
+        * We guarantee that both TLBs and I-cache are private to each
+        * vcpu. If detecting that a vcpu from the same VM has
+        * previously run on the same physical CPU, call into the
+        * hypervisor code to nuke the relevant contexts.
+        *
         * We might get preempted before the vCPU actually runs, but
         * over-invalidation doesn't affect correctness.
         */
        if (*last_ran != vcpu->vcpu_id) {
-               kvm_call_hyp(__kvm_tlb_flush_local_vmid, mmu);
+               kvm_call_hyp(__kvm_flush_cpu_context, mmu);
                *last_ran = vcpu->vcpu_id;
        }
  
@@@ -1966,9 -1971,6 +1971,9 @@@ static int __init early_kvm_mode_cfg(ch
                return 0;
        }
  
 +      if (strcmp(arg, "nvhe") == 0 && !WARN_ON(is_kernel_in_hyp_mode()))
 +              return 0;
 +
        return -EINVAL;
  }
  early_param("kvm-arm.mode", early_kvm_mode_cfg);
diff --combined arch/arm64/kvm/reset.c
index e81c7ec9e10202af2c737957b713f4a2277c0ce3,9d3d09a89894521492ea8e8ae10182e5e70fe92b..bd354cd45d2860e4595109c3375395f716f6c911
@@@ -311,25 -311,22 +311,24 @@@ int kvm_set_ipa_limit(void
        }
  
        switch (cpuid_feature_extract_unsigned_field(mmfr0, tgran_2)) {
 -      default:
 -      case 1:
 +      case ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE:
                kvm_err("PAGE_SIZE not supported at Stage-2, giving up\n");
                return -EINVAL;
 -      case 0:
 +      case ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT:
                kvm_debug("PAGE_SIZE supported at Stage-2 (default)\n");
                break;
 -      case 2:
 +      case ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN ... ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX:
                kvm_debug("PAGE_SIZE supported at Stage-2 (advertised)\n");
                break;
 +      default:
 +              kvm_err("Unsupported value for TGRAN_2, giving up\n");
 +              return -EINVAL;
        }
  
        kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange);
-       WARN(kvm_ipa_limit < KVM_PHYS_SHIFT,
-            "KVM IPA Size Limit (%d bits) is smaller than default size\n",
-            kvm_ipa_limit);
-       kvm_info("IPA Size Limit: %d bits\n", kvm_ipa_limit);
+       kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit,
+                ((kvm_ipa_limit < KVM_PHYS_SHIFT) ?
+                 " (Reduced IPA size, limited VM/VMM compatibility)" : ""));
  
        return 0;
  }
@@@ -358,6 -355,11 +357,11 @@@ int kvm_arm_setup_stage2(struct kvm *kv
                        return -EINVAL;
        } else {
                phys_shift = KVM_PHYS_SHIFT;
+               if (phys_shift > kvm_ipa_limit) {
+                       pr_warn_once("%s using unsupported default IPA limit, upgrade your VMM\n",
+                                    current->comm);
+                       return -EINVAL;
+               }
        }
  
        mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
diff --combined arch/x86/kvm/x86.c
index 2a20ce60152ea98e9521ed928c0cae06139317ab,46b0e52671bb620a968f29cf9bedced623c7f164..47e021bdcc94ab324d03057b881cad0dcfd78534
@@@ -1785,7 -1785,6 +1785,7 @@@ EXPORT_SYMBOL_GPL(kvm_emulate_wrmsr)
  
  static inline bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu)
  {
 +      xfer_to_guest_mode_prepare();
        return vcpu->mode == EXITING_GUEST_MODE || kvm_request_pending(vcpu) ||
                xfer_to_guest_mode_work_pending();
  }
@@@ -10601,7 -10600,7 +10601,7 @@@ void __user * __x86_set_memory_region(s
                        return (void __user *)hva;
        } else {
                if (!slot || !slot->npages)
-                       return 0;
+                       return NULL;
  
                old_npages = slot->npages;
                hva = slot->userspace_addr;
This page took 0.162036 seconds and 4 git commands to generate.