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:
- Fix for a Haswell regression in nested virtualization, introduced
during the merge window.
- A fix from Oleg to async page faults.
- A bunch of small ARM changes.
- A trivial patch to use the new MSI-X API introduced during the merge
window.

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: ARM: vgic: Fix the overlap check action about setting the GICD & GICC base address.
KVM: arm/arm64: vgic: fix GICD_ICFGR register accesses
KVM: async_pf: mm->mm_users can not pin apf->mm
KVM: ARM: vgic: Fix sgi dispatch problem
MAINTAINERS: co-maintainance of KVM/{arm,arm64}
arm: KVM: fix possible misalignment of PGDs and bounce page
KVM: x86: Check for host supported fields in shadow vmcs
kvm: Use pci_enable_msix_exact() instead of pci_enable_msix()
ARM: KVM: disable KVM in Kconfig on big-endian systems

+70 -31
+5
MAINTAINERS
··· 5114 5114 5115 5115 KERNEL VIRTUAL MACHINE (KVM) FOR ARM 5116 5116 M: Christoffer Dall <christoffer.dall@linaro.org> 5117 + M: Marc Zyngier <marc.zyngier@arm.com> 5118 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 5117 5119 L: kvmarm@lists.cs.columbia.edu 5118 5120 W: http://systems.cs.columbia.edu/projects/kvm-arm 5119 5121 S: Supported 5120 5122 F: arch/arm/include/uapi/asm/kvm* 5121 5123 F: arch/arm/include/asm/kvm* 5122 5124 F: arch/arm/kvm/ 5125 + F: virt/kvm/arm/ 5126 + F: include/kvm/arm_* 5123 5127 5124 5128 KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64) 5129 + M: Christoffer Dall <christoffer.dall@linaro.org> 5125 5130 M: Marc Zyngier <marc.zyngier@arm.com> 5126 5131 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 5127 5132 L: kvmarm@lists.cs.columbia.edu
+1 -1
arch/arm/kvm/Kconfig
··· 23 23 select HAVE_KVM_CPU_RELAX_INTERCEPT 24 24 select KVM_MMIO 25 25 select KVM_ARM_HOST 26 - depends on ARM_VIRT_EXT && ARM_LPAE 26 + depends on ARM_VIRT_EXT && ARM_LPAE && !CPU_BIG_ENDIAN 27 27 ---help--- 28 28 Support hosting virtualized guest machines. You will also 29 29 need to select one or more of the processor modules below.
+9 -6
arch/arm/kvm/mmu.c
··· 42 42 static unsigned long hyp_idmap_end; 43 43 static phys_addr_t hyp_idmap_vector; 44 44 45 + #define pgd_order get_order(PTRS_PER_PGD * sizeof(pgd_t)) 46 + 45 47 #define kvm_pmd_huge(_x) (pmd_huge(_x) || pmd_trans_huge(_x)) 46 48 47 49 static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) ··· 295 293 if (boot_hyp_pgd) { 296 294 unmap_range(NULL, boot_hyp_pgd, hyp_idmap_start, PAGE_SIZE); 297 295 unmap_range(NULL, boot_hyp_pgd, TRAMPOLINE_VA, PAGE_SIZE); 298 - kfree(boot_hyp_pgd); 296 + free_pages((unsigned long)boot_hyp_pgd, pgd_order); 299 297 boot_hyp_pgd = NULL; 300 298 } 301 299 302 300 if (hyp_pgd) 303 301 unmap_range(NULL, hyp_pgd, TRAMPOLINE_VA, PAGE_SIZE); 304 302 305 - kfree(init_bounce_page); 303 + free_page((unsigned long)init_bounce_page); 306 304 init_bounce_page = NULL; 307 305 308 306 mutex_unlock(&kvm_hyp_pgd_mutex); ··· 332 330 for (addr = VMALLOC_START; is_vmalloc_addr((void*)addr); addr += PGDIR_SIZE) 333 331 unmap_range(NULL, hyp_pgd, KERN_TO_HYP(addr), PGDIR_SIZE); 334 332 335 - kfree(hyp_pgd); 333 + free_pages((unsigned long)hyp_pgd, pgd_order); 336 334 hyp_pgd = NULL; 337 335 } 338 336 ··· 1026 1024 size_t len = __hyp_idmap_text_end - __hyp_idmap_text_start; 1027 1025 phys_addr_t phys_base; 1028 1026 1029 - init_bounce_page = kmalloc(PAGE_SIZE, GFP_KERNEL); 1027 + init_bounce_page = (void *)__get_free_page(GFP_KERNEL); 1030 1028 if (!init_bounce_page) { 1031 1029 kvm_err("Couldn't allocate HYP init bounce page\n"); 1032 1030 err = -ENOMEM; ··· 1052 1050 (unsigned long)phys_base); 1053 1051 } 1054 1052 1055 - hyp_pgd = kzalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL); 1056 - boot_hyp_pgd = kzalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL); 1053 + hyp_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, pgd_order); 1054 + boot_hyp_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, pgd_order); 1055 + 1057 1056 if (!hyp_pgd || !boot_hyp_pgd) { 1058 1057 kvm_err("Hyp mode PGD not allocated\n"); 1059 1058 err = -ENOMEM;
+41 -12
arch/x86/kvm/vmx.c
··· 503 503 [number##_HIGH] = VMCS12_OFFSET(name)+4 504 504 505 505 506 - static const unsigned long shadow_read_only_fields[] = { 506 + static unsigned long shadow_read_only_fields[] = { 507 507 /* 508 508 * We do NOT shadow fields that are modified when L0 509 509 * traps and emulates any vmx instruction (e.g. VMPTRLD, ··· 526 526 GUEST_LINEAR_ADDRESS, 527 527 GUEST_PHYSICAL_ADDRESS 528 528 }; 529 - static const int max_shadow_read_only_fields = 529 + static int max_shadow_read_only_fields = 530 530 ARRAY_SIZE(shadow_read_only_fields); 531 531 532 - static const unsigned long shadow_read_write_fields[] = { 532 + static unsigned long shadow_read_write_fields[] = { 533 533 GUEST_RIP, 534 534 GUEST_RSP, 535 535 GUEST_CR0, ··· 558 558 HOST_FS_SELECTOR, 559 559 HOST_GS_SELECTOR 560 560 }; 561 - static const int max_shadow_read_write_fields = 561 + static int max_shadow_read_write_fields = 562 562 ARRAY_SIZE(shadow_read_write_fields); 563 563 564 564 static const unsigned short vmcs_field_to_offset_table[] = { ··· 3009 3009 } 3010 3010 } 3011 3011 3012 + static void init_vmcs_shadow_fields(void) 3013 + { 3014 + int i, j; 3015 + 3016 + /* No checks for read only fields yet */ 3017 + 3018 + for (i = j = 0; i < max_shadow_read_write_fields; i++) { 3019 + switch (shadow_read_write_fields[i]) { 3020 + case GUEST_BNDCFGS: 3021 + if (!vmx_mpx_supported()) 3022 + continue; 3023 + break; 3024 + default: 3025 + break; 3026 + } 3027 + 3028 + if (j < i) 3029 + shadow_read_write_fields[j] = 3030 + shadow_read_write_fields[i]; 3031 + j++; 3032 + } 3033 + max_shadow_read_write_fields = j; 3034 + 3035 + /* shadowed fields guest access without vmexit */ 3036 + for (i = 0; i < max_shadow_read_write_fields; i++) { 3037 + clear_bit(shadow_read_write_fields[i], 3038 + vmx_vmwrite_bitmap); 3039 + clear_bit(shadow_read_write_fields[i], 3040 + vmx_vmread_bitmap); 3041 + } 3042 + for (i = 0; i < max_shadow_read_only_fields; i++) 3043 + clear_bit(shadow_read_only_fields[i], 3044 + vmx_vmread_bitmap); 3045 + } 3046 + 3012 3047 static __init int alloc_kvm_area(void) 3013 3048 { 3014 3049 int cpu; ··· 3074 3039 enable_vpid = 0; 3075 3040 if (!cpu_has_vmx_shadow_vmcs()) 3076 3041 enable_shadow_vmcs = 0; 3042 + if (enable_shadow_vmcs) 3043 + init_vmcs_shadow_fields(); 3077 3044 3078 3045 if (!cpu_has_vmx_ept() || 3079 3046 !cpu_has_vmx_ept_4levels()) { ··· 8840 8803 8841 8804 memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE); 8842 8805 memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE); 8843 - /* shadowed read/write fields */ 8844 - for (i = 0; i < max_shadow_read_write_fields; i++) { 8845 - clear_bit(shadow_read_write_fields[i], vmx_vmwrite_bitmap); 8846 - clear_bit(shadow_read_write_fields[i], vmx_vmread_bitmap); 8847 - } 8848 - /* shadowed read only fields */ 8849 - for (i = 0; i < max_shadow_read_only_fields; i++) 8850 - clear_bit(shadow_read_only_fields[i], vmx_vmread_bitmap); 8851 8806 8852 8807 /* 8853 8808 * Allow direct access to the PC debug port (it is often used for I/O
+8 -7
virt/kvm/arm/vgic.c
··· 548 548 u32 val; 549 549 u32 *reg; 550 550 551 - offset >>= 1; 552 551 reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, 553 - vcpu->vcpu_id, offset); 552 + vcpu->vcpu_id, offset >> 1); 554 553 555 - if (offset & 2) 554 + if (offset & 4) 556 555 val = *reg >> 16; 557 556 else 558 557 val = *reg & 0xffff; ··· 560 561 vgic_reg_access(mmio, &val, offset, 561 562 ACCESS_READ_VALUE | ACCESS_WRITE_VALUE); 562 563 if (mmio->is_write) { 563 - if (offset < 4) { 564 + if (offset < 8) { 564 565 *reg = ~0U; /* Force PPIs/SGIs to 1 */ 565 566 return false; 566 567 } 567 568 568 569 val = vgic_cfg_compress(val); 569 - if (offset & 2) { 570 + if (offset & 4) { 570 571 *reg &= 0xffff; 571 572 *reg |= val << 16; 572 573 } else { ··· 915 916 case 0: 916 917 if (!target_cpus) 917 918 return; 919 + break; 918 920 919 921 case 1: 920 922 target_cpus = ((1 << nrcpus) - 1) & ~(1 << vcpu_id) & 0xff; ··· 1667 1667 if (addr + size < addr) 1668 1668 return -EINVAL; 1669 1669 1670 + *ioaddr = addr; 1670 1671 ret = vgic_ioaddr_overlap(kvm); 1671 1672 if (ret) 1672 - return ret; 1673 - *ioaddr = addr; 1673 + *ioaddr = VGIC_ADDR_UNDEF; 1674 + 1674 1675 return ret; 1675 1676 } 1676 1677
+2 -1
virt/kvm/assigned-dev.c
··· 395 395 if (dev->entries_nr == 0) 396 396 return r; 397 397 398 - r = pci_enable_msix(dev->dev, dev->host_msix_entries, dev->entries_nr); 398 + r = pci_enable_msix_exact(dev->dev, 399 + dev->host_msix_entries, dev->entries_nr); 399 400 if (r) 400 401 return r; 401 402
+4 -4
virt/kvm/async_pf.c
··· 101 101 if (waitqueue_active(&vcpu->wq)) 102 102 wake_up_interruptible(&vcpu->wq); 103 103 104 - mmdrop(mm); 104 + mmput(mm); 105 105 kvm_put_kvm(vcpu->kvm); 106 106 } 107 107 ··· 118 118 flush_work(&work->work); 119 119 #else 120 120 if (cancel_work_sync(&work->work)) { 121 - mmdrop(work->mm); 121 + mmput(work->mm); 122 122 kvm_put_kvm(vcpu->kvm); /* == work->vcpu->kvm */ 123 123 kmem_cache_free(async_pf_cache, work); 124 124 } ··· 183 183 work->addr = hva; 184 184 work->arch = *arch; 185 185 work->mm = current->mm; 186 - atomic_inc(&work->mm->mm_count); 186 + atomic_inc(&work->mm->mm_users); 187 187 kvm_get_kvm(work->vcpu->kvm); 188 188 189 189 /* this can't really happen otherwise gfn_to_pfn_async ··· 201 201 return 1; 202 202 retry_sync: 203 203 kvm_put_kvm(work->vcpu->kvm); 204 - mmdrop(work->mm); 204 + mmput(work->mm); 205 205 kmem_cache_free(async_pf_cache, work); 206 206 return 0; 207 207 }