Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini:
"x86 bugfix patches and one compilation fix for ARM"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: arm64/sve: Fix vq_present() macro to yield a bool
KVM: LAPIC: Fix pending interrupt in IRR blocked by software disable LAPIC
KVM: nVMX: Change KVM_STATE_NESTED_EVMCS to signal vmcs12 is copied from eVMCS
KVM: nVMX: Allow restore nested-state to enable eVMCS when vCPU in SMM
KVM: x86: degrade WARN to pr_warn_ratelimited

+26 -15
+1 -1
arch/arm64/kvm/guest.c
··· 208 208 209 209 #define vq_word(vq) (((vq) - SVE_VQ_MIN) / 64) 210 210 #define vq_mask(vq) ((u64)1 << ((vq) - SVE_VQ_MIN) % 64) 211 - #define vq_present(vqs, vq) ((vqs)[vq_word(vq)] & vq_mask(vq)) 211 + #define vq_present(vqs, vq) (!!((vqs)[vq_word(vq)] & vq_mask(vq))) 212 212 213 213 static int get_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) 214 214 {
+1 -1
arch/x86/kvm/lapic.c
··· 2339 2339 struct kvm_lapic *apic = vcpu->arch.apic; 2340 2340 u32 ppr; 2341 2341 2342 - if (!apic_enabled(apic)) 2342 + if (!kvm_apic_hw_enabled(apic)) 2343 2343 return -1; 2344 2344 2345 2345 __apic_update_ppr(apic, &ppr);
+20 -10
arch/x86/kvm/vmx/nested.c
··· 5240 5240 vmx = to_vmx(vcpu); 5241 5241 vmcs12 = get_vmcs12(vcpu); 5242 5242 5243 - if (nested_vmx_allowed(vcpu) && vmx->nested.enlightened_vmcs_enabled) 5244 - kvm_state.flags |= KVM_STATE_NESTED_EVMCS; 5245 - 5246 5243 if (nested_vmx_allowed(vcpu) && 5247 5244 (vmx->nested.vmxon || vmx->nested.smm.vmxon)) { 5248 5245 kvm_state.hdr.vmx.vmxon_pa = vmx->nested.vmxon_ptr; ··· 5247 5250 5248 5251 if (vmx_has_valid_vmcs12(vcpu)) { 5249 5252 kvm_state.size += sizeof(user_vmx_nested_state->vmcs12); 5253 + 5254 + if (vmx->nested.hv_evmcs) 5255 + kvm_state.flags |= KVM_STATE_NESTED_EVMCS; 5250 5256 5251 5257 if (is_guest_mode(vcpu) && 5252 5258 nested_cpu_has_shadow_vmcs(vmcs12) && ··· 5350 5350 if (kvm_state->hdr.vmx.vmcs12_pa != -1ull) 5351 5351 return -EINVAL; 5352 5352 5353 + /* 5354 + * KVM_STATE_NESTED_EVMCS used to signal that KVM should 5355 + * enable eVMCS capability on vCPU. However, since then 5356 + * code was changed such that flag signals vmcs12 should 5357 + * be copied into eVMCS in guest memory. 5358 + * 5359 + * To preserve backwards compatability, allow user 5360 + * to set this flag even when there is no VMXON region. 5361 + */ 5353 5362 if (kvm_state->flags & ~KVM_STATE_NESTED_EVMCS) 5354 5363 return -EINVAL; 5355 5364 } else { ··· 5367 5358 5368 5359 if (!page_address_valid(vcpu, kvm_state->hdr.vmx.vmxon_pa)) 5369 5360 return -EINVAL; 5370 - } 5361 + } 5371 5362 5372 5363 if ((kvm_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_GUEST_MODE) && 5373 5364 (kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) ··· 5382 5373 * nor can VMLAUNCH/VMRESUME be pending. Outside SMM, SMM flags 5383 5374 * must be zero. 5384 5375 */ 5385 - if (is_smm(vcpu) ? kvm_state->flags : kvm_state->hdr.vmx.smm.flags) 5376 + if (is_smm(vcpu) ? 5377 + (kvm_state->flags & 5378 + (KVM_STATE_NESTED_GUEST_MODE | KVM_STATE_NESTED_RUN_PENDING)) 5379 + : kvm_state->hdr.vmx.smm.flags) 5386 5380 return -EINVAL; 5387 5381 5388 5382 if ((kvm_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_GUEST_MODE) && 5389 5383 !(kvm_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON)) 5390 5384 return -EINVAL; 5391 5385 5392 - vmx_leave_nested(vcpu); 5393 - if (kvm_state->flags & KVM_STATE_NESTED_EVMCS) { 5394 - if (!nested_vmx_allowed(vcpu)) 5386 + if ((kvm_state->flags & KVM_STATE_NESTED_EVMCS) && 5387 + (!nested_vmx_allowed(vcpu) || !vmx->nested.enlightened_vmcs_enabled)) 5395 5388 return -EINVAL; 5396 5389 5397 - nested_enable_evmcs(vcpu, NULL); 5398 - } 5390 + vmx_leave_nested(vcpu); 5399 5391 5400 5392 if (kvm_state->hdr.vmx.vmxon_pa == -1ull) 5401 5393 return 0;
+3 -3
arch/x86/kvm/x86.c
··· 1554 1554 vcpu->arch.tsc_always_catchup = 1; 1555 1555 return 0; 1556 1556 } else { 1557 - WARN(1, "user requested TSC rate below hardware speed\n"); 1557 + pr_warn_ratelimited("user requested TSC rate below hardware speed\n"); 1558 1558 return -1; 1559 1559 } 1560 1560 } ··· 1564 1564 user_tsc_khz, tsc_khz); 1565 1565 1566 1566 if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) { 1567 - WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n", 1568 - user_tsc_khz); 1567 + pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n", 1568 + user_tsc_khz); 1569 1569 return -1; 1570 1570 } 1571 1571
+1
tools/testing/selftests/kvm/x86_64/evmcs_test.c
··· 146 146 kvm_vm_restart(vm, O_RDWR); 147 147 vm_vcpu_add(vm, VCPU_ID, 0, 0); 148 148 vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid()); 149 + vcpu_ioctl(vm, VCPU_ID, KVM_ENABLE_CAP, &enable_evmcs_cap); 149 150 vcpu_load_state(vm, VCPU_ID, state); 150 151 run = vcpu_state(vm, VCPU_ID); 151 152 free(state);