The patch titled KVM: move vmcs accessors to vmx.c has been added to the -mm tree. Its filename is kvm-move-vmcs-accessors-to-vmxc.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: KVM: move vmcs accessors to vmx.c From: Avi Kivity <avi@xxxxxxxxxxxx> Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/kvm/kvm.h | 27 ----------------- drivers/kvm/kvm_main.c | 22 -------------- drivers/kvm/kvm_vmx.h | 16 ---------- drivers/kvm/vmx.c | 60 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 65 deletions(-) diff -puN drivers/kvm/kvm.h~kvm-move-vmcs-accessors-to-vmxc drivers/kvm/kvm.h --- a/drivers/kvm/kvm.h~kvm-move-vmcs-accessors-to-vmxc +++ a/drivers/kvm/kvm.h @@ -377,9 +377,6 @@ int kvm_write_guest(struct kvm_vcpu *vcp unsigned long size, void *data); -void vmcs_writel(unsigned long field, unsigned long value); -unsigned long vmcs_readl(unsigned long field); - unsigned long segment_base(u16 selector); static inline struct page *_gfn_to_page(struct kvm *kvm, gfn_t gfn) @@ -388,30 +385,6 @@ static inline struct page *_gfn_to_page( return (slot) ? slot->phys_mem[gfn - slot->base_gfn] : 0; } -static inline u16 vmcs_read16(unsigned long field) -{ - return vmcs_readl(field); -} - -static inline u32 vmcs_read32(unsigned long field) -{ - return vmcs_readl(field); -} - -static inline u64 vmcs_read64(unsigned long field) -{ -#ifdef __x86_64__ - return vmcs_readl(field); -#else - return vmcs_readl(field) | ((u64)vmcs_readl(field+1) << 32); -#endif -} - -static inline void vmcs_write32(unsigned long field, u32 value) -{ - vmcs_writel(field, value); -} - static inline int is_pae(struct kvm_vcpu *vcpu) { return vcpu->cr4 & CR4_PAE_MASK; diff -puN drivers/kvm/kvm_main.c~kvm-move-vmcs-accessors-to-vmxc drivers/kvm/kvm_main.c --- a/drivers/kvm/kvm_main.c~kvm-move-vmcs-accessors-to-vmxc +++ a/drivers/kvm/kvm_main.c @@ -310,28 +310,6 @@ static int kvm_dev_release(struct inode return 0; } -unsigned long vmcs_readl(unsigned long field) -{ - unsigned long value; - - asm volatile (ASM_VMX_VMREAD_RDX_RAX - : "=a"(value) : "d"(field) : "cc"); - return value; -} -EXPORT_SYMBOL_GPL(vmcs_readl); - -void vmcs_writel(unsigned long field, unsigned long value) -{ - u8 error; - - asm volatile (ASM_VMX_VMWRITE_RAX_RDX "; setna %0" - : "=q"(error) : "a"(value), "d"(field) : "cc" ); - if (error) - printk(KERN_ERR "vmwrite error: reg %lx value %lx (err %d)\n", - field, value, vmcs_read32(VM_INSTRUCTION_ERROR)); -} -EXPORT_SYMBOL_GPL(vmcs_writel); - static void inject_gp(struct kvm_vcpu *vcpu) { kvm_arch_ops->inject_gp(vcpu, 0); diff -puN drivers/kvm/kvm_vmx.h~kvm-move-vmcs-accessors-to-vmxc drivers/kvm/kvm_vmx.h --- a/drivers/kvm/kvm_vmx.h~kvm-move-vmcs-accessors-to-vmxc +++ a/drivers/kvm/kvm_vmx.h @@ -1,22 +1,6 @@ #ifndef __KVM_VMX_H #define __KVM_VMX_H -static inline void vmcs_write16(unsigned long field, u16 value) -{ - vmcs_writel(field, value); -} - -static inline void vmcs_write64(unsigned long field, u64 value) -{ -#ifdef __x86_64__ - vmcs_writel(field, value); -#else - vmcs_writel(field, value); - asm volatile (""); - vmcs_writel(field+1, value >> 32); -#endif -} - #ifdef __x86_64__ /* * avoid save/load MSR_SYSCALL_MASK and MSR_LSTAR by std vt diff -puN drivers/kvm/vmx.c~kvm-move-vmcs-accessors-to-vmxc drivers/kvm/vmx.c --- a/drivers/kvm/vmx.c~kvm-move-vmcs-accessors-to-vmxc +++ a/drivers/kvm/vmx.c @@ -101,6 +101,66 @@ static void __vcpu_clear(void *arg) per_cpu(current_vmcs, cpu) = 0; } +static unsigned long vmcs_readl(unsigned long field) +{ + unsigned long value; + + asm volatile (ASM_VMX_VMREAD_RDX_RAX + : "=a"(value) : "d"(field) : "cc"); + return value; +} + +static u16 vmcs_read16(unsigned long field) +{ + return vmcs_readl(field); +} + +static u32 vmcs_read32(unsigned long field) +{ + return vmcs_readl(field); +} + +static u64 vmcs_read64(unsigned long field) +{ +#ifdef __x86_64__ + return vmcs_readl(field); +#else + return vmcs_readl(field) | ((u64)vmcs_readl(field+1) << 32); +#endif +} + +static void vmcs_writel(unsigned long field, unsigned long value) +{ + u8 error; + + asm volatile (ASM_VMX_VMWRITE_RAX_RDX "; setna %0" + : "=q"(error) : "a"(value), "d"(field) : "cc" ); + if (error) + printk(KERN_ERR "vmwrite error: reg %lx value %lx (err %d)\n", + field, value, vmcs_read32(VM_INSTRUCTION_ERROR)); +} + +static void vmcs_write16(unsigned long field, u16 value) +{ + vmcs_writel(field, value); +} + +static void vmcs_write32(unsigned long field, u32 value) +{ + vmcs_writel(field, value); +} + +static void vmcs_write64(unsigned long field, u64 value) +{ +#ifdef __x86_64__ + vmcs_writel(field, value); +#else + vmcs_writel(field, value); + asm volatile (""); + vmcs_writel(field+1, value >> 32); +#endif +} + /* * Switches to specified vcpu, until a matching vcpu_put(), but assumes * vcpu mutex is already taken. _ Patches currently in -mm which might be from avi@xxxxxxxxxxxx are kvm-userspace-interface.patch kvm-userspace-interface-make-enum-values-in-userspace-interface-explicit.patch kvm-intel-virtual-mode-extensions-definitions.patch kvm-kvm-data-structures.patch kvm-random-accessors-and-constants.patch kvm-virtualization-infrastructure.patch kvm-virtualization-infrastructure-kvm-fix-guest-cr4-corruption.patch kvm-virtualization-infrastructure-include-desch.patch kvm-virtualization-infrastructure-fix-segment-state-changes-across-processor-mode-switches.patch kvm-virtualization-infrastructure-fix-asm-constraints-for-segment-loads.patch kvm-virtualization-infrastructure-fix-mmu-reset-locking-when-setting-cr0.patch kvm-memory-slot-management.patch kvm-vcpu-creation-and-maintenance.patch kvm-vcpu-creation-and-maintenance-segment-access-cleanup.patch kvm-workaround-cr0cd-cache-disable-bit-leak-from-guest-to.patch kvm-vcpu-execution-loop.patch kvm-define-exit-handlers.patch kvm-define-exit-handlers-pass-fs-gs-segment-bases-to-x86-emulator.patch kvm-less-common-exit-handlers.patch kvm-less-common-exit-handlers-handle-rdmsrmsr_efer.patch kvm-mmu.patch kvm-x86-emulator.patch kvm-clarify-licensing.patch kvm-x86-emulator-fix-emulator-mov-cr-decoding.patch kvm-plumbing.patch kvm-dynamically-determine-which-msrs-to-load-and-save.patch kvm-fix-calculation-of-initial-value-of-rdx-register.patch kvm-avoid-using-vmx-instruction-directly.patch kvm-avoid-using-vmx-instruction-directly-fix-asm-constraints.patch kvm-expose-interrupt-bitmap.patch kvm-add-time-stamp-counter-msr-and-accessors.patch kvm-expose-msrs-to-userspace.patch kvm-expose-msrs-to-userspace-v2.patch kvm-create-kvm-intelko-module.patch kvm-make-dev-registration-happen-when-the-arch.patch kvm-make-hardware-detection-an-arch-operation.patch kvm-make-the-per-cpu-enable-disable-functions-arch.patch kvm-make-the-hardware-setup-operations-non-percpu.patch kvm-make-the-guest-debugger-an-arch-operation.patch kvm-make-msr-accessors-arch-operations.patch kvm-make-the-segment-accessors-arch-operations.patch kvm-cache-guest-cr4-in-vcpu-structure.patch kvm-cache-guest-cr0-in-vcpu-structure.patch kvm-add-get_segment_base-arch-accessor.patch kvm-add-idt-and-gdt-descriptor-accessors.patch kvm-make-syncing-the-register-file-to-the-vcpu.patch kvm-make-the-vcpu-execution-loop-an-arch-operation.patch kvm-move-the-vmx-exit-handlers-to-vmxc.patch kvm-make-vcpu_setup-an-arch-operation.patch kvm-make-__set_cr0-and-dependencies-arch-operations.patch kvm-make-__set_cr4-an-arch-operation.patch kvm-make-__set_efer-an-arch-operation.patch kvm-make-set_cr3-and-tlb-flushing-arch-operations.patch kvm-make-inject_page_fault-an-arch-operation.patch kvm-make-inject_gp-an-arch-operation.patch kvm-use-the-idt-and-gdt-accessors-in-realmode-emulation.patch kvm-use-the-general-purpose-register-accessors-rather.patch kvm-move-the-vmx-tsc-accessors-to-vmxc.patch kvm-access-rflags-through-an-arch-operation.patch kvm-move-the-vmx-segment-field-definitions-to-vmxc.patch kvm-add-an-arch-accessor-for-cs-d-b-and-l-bits.patch kvm-add-a-set_cr0_no_modeswitch-arch-accessor.patch kvm-make-vcpu_load-and-vcpu_put-arch-operations.patch kvm-make-vcpu-creation-and-destruction-arch-operations.patch kvm-move-vmcs-static-variables-to-vmxc.patch kvm-make-is_long_mode-an-arch-operation.patch kvm-use-the-tlb-flush-arch-operation-instead-of-an.patch kvm-remove-guest_cpl.patch kvm-move-vmcs-accessors-to-vmxc.patch kvm-move-vmx-helper-inlines-to-vmxc.patch kvm-remove-vmx-includes-from-arch-independent-code.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html