Hi Marc, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on kvm/master] url: https://github.com/0day-ci/linux/commits/Marc-Orr/kvm-vmx-use-vmalloc-to-allocate-vcpus/20181025-045750 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git master config: i386-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): arch/x86/kvm/vmx.c: In function 'vmx_vcpu_setup': >> arch/x86/kvm/vmx.c:6629:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] (u64)&vmx->pi_desc % PAGE_SIZE; ^ vim +6629 arch/x86/kvm/vmx.c 6586 6587 #define VMX_XSS_EXIT_BITMAP 0 6588 /* 6589 * Sets up the vmcs for emulated real mode. 6590 */ 6591 static void vmx_vcpu_setup(struct vcpu_vmx *vmx) 6592 { 6593 int i; 6594 6595 if (enable_shadow_vmcs) { 6596 /* 6597 * At vCPU creation, "VMWRITE to any supported field 6598 * in the VMCS" is supported, so use the more 6599 * permissive vmx_vmread_bitmap to specify both read 6600 * and write permissions for the shadow VMCS. 6601 */ 6602 vmcs_write64(VMREAD_BITMAP, __pa(vmx_vmread_bitmap)); 6603 vmcs_write64(VMWRITE_BITMAP, __pa(vmx_vmread_bitmap)); 6604 } 6605 if (cpu_has_vmx_msr_bitmap()) 6606 vmcs_write64(MSR_BITMAP, __pa(vmx->vmcs01.msr_bitmap)); 6607 6608 vmcs_write64(VMCS_LINK_POINTER, -1ull); /* 22.3.1.5 */ 6609 6610 /* Control */ 6611 vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx)); 6612 vmx->hv_deadline_tsc = -1; 6613 6614 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, vmx_exec_control(vmx)); 6615 6616 if (cpu_has_secondary_exec_ctrls()) { 6617 vmx_compute_secondary_exec_control(vmx); 6618 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, 6619 vmx->secondary_exec_control); 6620 } 6621 6622 if (kvm_vcpu_apicv_active(&vmx->vcpu)) { 6623 /* 6624 * Note, pi_desc is contained within a single 6625 * page because the struct is 64 bytes and 64-byte aligned. 6626 */ 6627 phys_addr_t pi_desc_phys = 6628 page_to_phys(vmalloc_to_page(&vmx->pi_desc)) + > 6629 (u64)&vmx->pi_desc % PAGE_SIZE; 6630 6631 vmcs_write64(EOI_EXIT_BITMAP0, 0); 6632 vmcs_write64(EOI_EXIT_BITMAP1, 0); 6633 vmcs_write64(EOI_EXIT_BITMAP2, 0); 6634 vmcs_write64(EOI_EXIT_BITMAP3, 0); 6635 6636 vmcs_write16(GUEST_INTR_STATUS, 0); 6637 6638 vmcs_write16(POSTED_INTR_NV, POSTED_INTR_VECTOR); 6639 vmcs_write64(POSTED_INTR_DESC_ADDR, pi_desc_phys); 6640 } 6641 6642 if (!kvm_pause_in_guest(vmx->vcpu.kvm)) { 6643 vmcs_write32(PLE_GAP, ple_gap); 6644 vmx->ple_window = ple_window; 6645 vmx->ple_window_dirty = true; 6646 } 6647 6648 vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0); 6649 vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, 0); 6650 vmcs_write32(CR3_TARGET_COUNT, 0); /* 22.2.1 */ 6651 6652 vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */ 6653 vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */ 6654 vmx_set_constant_host_state(vmx); 6655 vmcs_writel(HOST_FS_BASE, 0); /* 22.2.4 */ 6656 vmcs_writel(HOST_GS_BASE, 0); /* 22.2.4 */ 6657 6658 if (cpu_has_vmx_vmfunc()) 6659 vmcs_write64(VM_FUNCTION_CONTROL, 0); 6660 6661 vmcs_write32(VM_EXIT_MSR_STORE_COUNT, 0); 6662 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, 0); 6663 vmcs_write64(VM_EXIT_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.host.val)); 6664 vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, 0); 6665 vmcs_write64(VM_ENTRY_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.guest.val)); 6666 6667 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) 6668 vmcs_write64(GUEST_IA32_PAT, vmx->vcpu.arch.pat); 6669 6670 for (i = 0; i < ARRAY_SIZE(vmx_msr_index); ++i) { 6671 u32 index = vmx_msr_index[i]; 6672 u32 data_low, data_high; 6673 int j = vmx->nmsrs; 6674 6675 if (rdmsr_safe(index, &data_low, &data_high) < 0) 6676 continue; 6677 if (wrmsr_safe(index, data_low, data_high) < 0) 6678 continue; 6679 vmx->guest_msrs[j].index = i; 6680 vmx->guest_msrs[j].data = 0; 6681 vmx->guest_msrs[j].mask = -1ull; 6682 ++vmx->nmsrs; 6683 } 6684 6685 vmx->arch_capabilities = kvm_get_arch_capabilities(); 6686 6687 vm_exit_controls_init(vmx, vmcs_config.vmexit_ctrl); 6688 6689 /* 22.2.1, 20.8.1 */ 6690 vm_entry_controls_init(vmx, vmcs_config.vmentry_ctrl); 6691 6692 vmx->vcpu.arch.cr0_guest_owned_bits = X86_CR0_TS; 6693 vmcs_writel(CR0_GUEST_HOST_MASK, ~X86_CR0_TS); 6694 6695 set_cr4_guest_host_mask(vmx); 6696 6697 if (vmx_xsaves_supported()) 6698 vmcs_write64(XSS_EXIT_BITMAP, VMX_XSS_EXIT_BITMAP); 6699 6700 if (enable_pml) { 6701 ASSERT(vmx->pml_pg); 6702 vmcs_write64(PML_ADDRESS, page_to_phys(vmx->pml_pg)); 6703 vmcs_write16(GUEST_PML_INDEX, PML_ENTITY_NUM - 1); 6704 } 6705 6706 if (cpu_has_vmx_encls_vmexit()) 6707 vmcs_write64(ENCLS_EXITING_BITMAP, -1ull); 6708 } 6709 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation