]> err.no Git - linux-2.6/log
linux-2.6
16 years agoKVM: MMU: Move pse36 handling to the guest walker
Avi Kivity [Wed, 21 Nov 2007 11:54:47 +0000 (13:54 +0200)]
KVM: MMU: Move pse36 handling to the guest walker

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Introduce and use gpte_to_gfn()
Avi Kivity [Wed, 21 Nov 2007 10:35:07 +0000 (12:35 +0200)]
KVM: MMU: Introduce and use gpte_to_gfn()

Instead of repretitively open-coding this.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Code cleanup
Izik Eidus [Tue, 20 Nov 2007 10:02:12 +0000 (12:02 +0200)]
KVM: MMU: Code cleanup

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Don't bother the mmu if cr3 load doesn't change cr3
Avi Kivity [Wed, 21 Nov 2007 00:57:59 +0000 (02:57 +0200)]
KVM: Don't bother the mmu if cr3 load doesn't change cr3

If the guest requests just a tlb flush, don't take the vm lock and
drop the mmu context pointlessly.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Avoid unnecessary remote tlb flushes when guest updates a pte
Avi Kivity [Wed, 21 Nov 2007 00:06:21 +0000 (02:06 +0200)]
KVM: MMU: Avoid unnecessary remote tlb flushes when guest updates a pte

If all we're doing is increasing permissions on a pte (typical for demand
paging), then there's not need to flush remote tlbs.  Worst case they'll
get a spurious page fault.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add statistic for remote tlb flushes
Avi Kivity [Tue, 20 Nov 2007 21:01:14 +0000 (23:01 +0200)]
KVM: Add statistic for remote tlb flushes

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Implement guest page fault bypass for nonpae
Avi Kivity [Tue, 20 Nov 2007 19:39:54 +0000 (21:39 +0200)]
KVM: MMU: Implement guest page fault bypass for nonpae

I spent an hour worrying why I see so many guest page faults on FC6 i386.
Turns out bypass wasn't implemented for nonpae.  Implement it so it doesn't
happen again.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Split vcpu creation to avoid vcpu_load() before preemption setup
Avi Kivity [Tue, 20 Nov 2007 13:30:24 +0000 (15:30 +0200)]
KVM: Split vcpu creation to avoid vcpu_load() before preemption setup

Split kvm_arch_vcpu_create() into kvm_arch_vcpu_create() and
kvm_arch_vcpu_setup(), enabling preemption notification between the two.
This mean that we can now do vcpu_load() within kvm_arch_vcpu_setup().

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Split kvm_set_memory_region() to have an arch callout
Zhang Xiantao [Tue, 20 Nov 2007 08:25:04 +0000 (16:25 +0800)]
KVM: Portability:  Split kvm_set_memory_region() to have an arch callout

Moving !user_alloc case to kvm_arch to avoid unnecessary
code logic in non-x86 platform.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Recalculate mmu pages needed for every memory region change
Zhang Xiantao [Tue, 20 Nov 2007 05:11:38 +0000 (13:11 +0800)]
KVM: Recalculate mmu pages needed for every memory region change

Instead of incrementally changing the mmu cache size for every memory slot
operation, recalculate it from scratch.  This is simpler and safer.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: prefetch up to 15 bytes of the instruction executed
Avi Kivity [Tue, 20 Nov 2007 11:15:52 +0000 (13:15 +0200)]
KVM: x86 emulator: prefetch up to 15 bytes of the instruction executed

Instead of fetching one byte at a time, prefetch 15 bytes (or until the next
page boundary) to avoid guest page table walks.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: retire ->write_std()
Avi Kivity [Tue, 20 Nov 2007 10:49:31 +0000 (12:49 +0200)]
KVM: x86 emulator: retire ->write_std()

Theoretically used to acccess memory known to be ordinary RAM, it was
never implemented.  It is questionable whether it is possible to implement
it correctly.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Selectively set PageDirty when releasing guest memory
Izik Eidus [Tue, 20 Nov 2007 09:49:33 +0000 (11:49 +0200)]
KVM: MMU: Selectively set PageDirty when releasing guest memory

Improve dirty bit setting for pages that kvm release, until now every page
that we released we marked dirty, from now only pages that have potential
to get dirty we mark dirty.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Fix potential memory leak with smp real-mode
Izik Eidus [Tue, 20 Nov 2007 09:30:04 +0000 (11:30 +0200)]
KVM: MMU: Fix potential memory leak with smp real-mode

When we map a page, we check whether some other vcpu mapped it for us and if
so, bail out.  But we should decrease the refcount on the page as we do so.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Export include/asm-x86/kvm.h
Avi Kivity [Tue, 20 Nov 2007 09:45:14 +0000 (11:45 +0200)]
KVM: Export include/asm-x86/kvm.h

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move cpuid structures to <asm/kvm.h>
Jerone Young [Mon, 19 Nov 2007 23:06:37 +0000 (17:06 -0600)]
KVM: Portability: Move cpuid structures to <asm/kvm.h>

This patch moves structures:
kvm_cpuid_entry
kvm_cpuid

from include/linux/kvm.h to include/asm-x86/kvm.h

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_sregs and msr structures to <asm/kvm.h>
Jerone Young [Mon, 19 Nov 2007 23:06:36 +0000 (17:06 -0600)]
KVM: Portability: Move kvm_sregs and msr structures to <asm/kvm.h>

Move structures:
kvm_sregs
kvm_msr_entry
kvm_msrs
kvm_msr_list

from include/linux/kvm.h to include/asm-x86/kvm.h

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_segment & kvm_dtable structure to <asm/kvm.h>
Jerone Young [Mon, 19 Nov 2007 23:06:35 +0000 (17:06 -0600)]
KVM: Portability: Move kvm_segment & kvm_dtable structure to  <asm/kvm.h>

This patch moves structures:
kvm_segment
kvm_dtable
from include/linux/kvm.h to include/asm-x86/kvm.h

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move structure lapic_state to <asm/kvm.h>
Jerone Young [Mon, 19 Nov 2007 23:06:34 +0000 (17:06 -0600)]
KVM: Portability: Move structure lapic_state to <asm/kvm.h>

This patch moves structure lapic_state from include/linux/kvm.h
to include/asm-x86/kvm.h

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_regs to <asm/kvm.h>
Jerone Young [Mon, 19 Nov 2007 23:06:33 +0000 (17:06 -0600)]
KVM: Portability: Move kvm_regs to <asm/kvm.h>

This patch moves structure kvm_regs to include/asm-x86/kvm.h.
Each architecture will need to create there own version of this
structure.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move x86 pic strutctures
Jerone Young [Mon, 19 Nov 2007 23:06:32 +0000 (17:06 -0600)]
KVM: Portability: Move x86 pic strutctures

This patch moves structures:
kvm_pic_state
kvm_ioapic_state

to inclue/asm-x86/kvm.h.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_memory_alias to asm/kvm.h
Jerone Young [Mon, 19 Nov 2007 23:06:31 +0000 (17:06 -0600)]
KVM: Portability: Move kvm_memory_alias to asm/kvm.h

This patch moves sturct kvm_memory_alias from include/linux/kvm.h
to include/asm-x86/kvm.h. Also have include/linux/kvm.h include
include/asm/kvm.h.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Move misplaced comment
Hollis Blanchard [Mon, 19 Nov 2007 20:04:44 +0000 (14:04 -0600)]
KVM: Move misplaced comment

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Correct consistent typo: "destory" -> "destroy"
Hollis Blanchard [Mon, 19 Nov 2007 20:04:43 +0000 (14:04 -0600)]
KVM: Correct consistent typo: "destory" -> "destroy"

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Remove unused "rmap_overflow" variable
Hollis Blanchard [Mon, 19 Nov 2007 20:04:45 +0000 (14:04 -0600)]
KVM: Remove unused "rmap_overflow" variable

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Remove unused variable
Avi Kivity [Mon, 19 Nov 2007 16:44:15 +0000 (18:44 +0200)]
KVM: MMU: Remove unused variable

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Simplify kvm_clear_guest_page()
Izik Eidus [Mon, 19 Nov 2007 09:16:57 +0000 (11:16 +0200)]
KVM: Simplify kvm_clear_guest_page()

Use kvm_write_guest_page() with empty_zero_page, instead of doing
kmap and memset.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Change guest pte access to kvm_{read,write}_guest()
Izik Eidus [Mon, 19 Nov 2007 09:28:19 +0000 (11:28 +0200)]
KVM: MMU: Change guest pte access to kvm_{read,write}_guest()

Things are simpler and more regular this way.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Force seg.base == (seg.sel << 4) in real mode
Jan Kiszka [Mon, 19 Nov 2007 09:21:45 +0000 (10:21 +0100)]
KVM: VMX: Force seg.base == (seg.sel << 4) in real  mode

Ensure that segment.base == segment.selector << 4 when entering the real
mode on Intel so that the CPU will not bark at us.  This fixes some old
protected mode demo from http://www.x86.org/articles/pmbasics/tspec_a1_doc.htm.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move some function declarations to x86.h
Zhang Xiantao [Mon, 19 Nov 2007 07:24:28 +0000 (15:24 +0800)]
KVM: Portability: Move some function declarations to x86.h

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Move some static inline functions out from kvm.h into x86.h
Zhang Xiantao [Mon, 19 Nov 2007 07:08:31 +0000 (15:08 +0800)]
KVM: Move some static inline functions out from kvm.h into x86.h

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move vcpu regs enumeration definition to x86.h
Zhang Xiantao [Mon, 19 Nov 2007 06:56:05 +0000 (14:56 +0800)]
KVM: Portability: Move vcpu regs enumeration definition to x86.h

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move struct kvm_x86_ops definition to x86.h
Zhang Xiantao [Mon, 19 Nov 2007 06:40:47 +0000 (14:40 +0800)]
KVM: Portability: Move struct kvm_x86_ops definition to x86.h

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move some macro definitions from kvm.h to x86.h
Zhang Xiantao [Mon, 19 Nov 2007 06:33:37 +0000 (14:33 +0800)]
KVM: Portability: Move some macro definitions from kvm.h to x86.h

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: MMU initialization and teardown split
Zhang Xiantao [Sun, 18 Nov 2007 12:43:21 +0000 (20:43 +0800)]
KVM: Portability: MMU initialization and teardown split

Move out kvm_mmu init and exit functionality from kvm_main.c

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_vcpu_ioctl_get_dirty_log to arch-specific file
Zhang Xiantao [Sun, 18 Nov 2007 12:29:43 +0000 (20:29 +0800)]
KVM: Portability: Move kvm_vcpu_ioctl_get_dirty_log to arch-specific  file

Meanwhile keep the interface in common, and leave as more logic in common
as possible.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Make unloading of FPU state when putting vcpu arch-independent
Amit Shah [Thu, 15 Nov 2007 16:38:46 +0000 (18:38 +0200)]
KVM: Make unloading of FPU state when putting vcpu arch-independent

Instead of having each architecture do it individually, we
do this in the arch-independent code (just x86 as of now).

[avi: add svm to the mix, which was added to mainline during the
 2.6.24-rc process]

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Add some mmu statistics
Avi Kivity [Sun, 18 Nov 2007 14:37:07 +0000 (16:37 +0200)]
KVM: MMU: Add some mmu statistics

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Extend stats support for VM stats
Avi Kivity [Sun, 18 Nov 2007 14:24:12 +0000 (16:24 +0200)]
KVM: Extend stats support for VM stats

This is in addition to the current virtual cpu statistics.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add instruction emulation statistics
Avi Kivity [Sun, 18 Nov 2007 13:17:51 +0000 (15:17 +0200)]
KVM: Add instruction emulation statistics

16 years agoKVM: Add fpu_reload counter
Avi Kivity [Sun, 18 Nov 2007 11:54:33 +0000 (13:54 +0200)]
KVM: Add fpu_reload counter

Measure the number of times we switch the fpu state.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Replace 'light_exits' stat with 'host_state_reload'
Avi Kivity [Sun, 18 Nov 2007 11:50:24 +0000 (13:50 +0200)]
KVM: Replace 'light_exits' stat with 'host_state_reload'

This is a little more accurate (since it counts actual reloads, not potential
reloads), and reverses the sense of the statistic to measure a bad event like
most of the other stats (e.g. we want to minimize all counters).

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Add two hooks to handle kvm_create and destroy vm
Zhang Xiantao [Sun, 18 Nov 2007 10:43:45 +0000 (18:43 +0800)]
KVM: Portability: Add two hooks to handle kvm_create and destroy vm

Add two arch hooks to handle kvm_create_vm and kvm destroy_vm. Now, just
put io_bus init and destory in common.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Remove __init attributes for kvm_init_debug and kvm_init_msr_list
Zhang Xiantao [Fri, 16 Nov 2007 06:38:21 +0000 (14:38 +0800)]
KVM: Remove __init attributes for kvm_init_debug and kvm_init_msr_list

Since their callers are not declared with __init.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Remove ptr comparisons to 0
Joe Perches [Tue, 13 Nov 2007 04:06:51 +0000 (20:06 -0800)]
KVM: Remove ptr comparisons to 0

Fix sparse warnings "Using plain integer as NULL pointer"

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Make kvm_vcpu_ioctl_translate arch dependent
Zhang Xiantao [Fri, 16 Nov 2007 05:05:55 +0000 (13:05 +0800)]
KVM: Portability: Make kvm_vcpu_ioctl_translate arch dependent

Move kvm_vcpu_ioctl_translate to arch, since mmu would be put under arch.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Consolidate register usage in vmx_vcpu_run()
Avi Kivity [Thu, 15 Nov 2007 16:06:18 +0000 (18:06 +0200)]
KVM: VMX: Consolidate register usage in vmx_vcpu_run()

We pass vcpu, vmx->fail, and vmx->launched to assembly code, but all three
are fields within vmx.  Consolidate by only passing in vmx and offsets for
the rest.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: move KVM_CHECK_EXTENSION
Zhang Xiantao [Thu, 15 Nov 2007 15:07:47 +0000 (23:07 +0800)]
KVM: Portability: move KVM_CHECK_EXTENSION

Make KVM_CHECK_EXTENSION code into a function, all archs can define its
capability independently.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: modify 'lods', and 'stos' not to depend on CR2
Sheng Yang [Thu, 15 Nov 2007 06:52:28 +0000 (14:52 +0800)]
KVM: x86 emulator: modify 'lods', and 'stos' not to depend on CR2

The current 'lods' and 'stos' is depending on incoming CR2 rather than decode
memory address from registers.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move x86 specific code from kvm_init() to kvm_arch()
Zhang Xiantao [Wed, 14 Nov 2007 12:40:21 +0000 (20:40 +0800)]
KVM: Portability: Move x86 specific code from kvm_init() to kvm_arch()

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Combine kvm_init and kvm_init_x86
Zhang Xiantao [Wed, 14 Nov 2007 12:39:31 +0000 (20:39 +0800)]
KVM: Portability: Combine kvm_init and kvm_init_x86

Will be called once arch module registers itself.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Add vcpu and hardware management arch hooks
Zhang Xiantao [Wed, 14 Nov 2007 12:38:21 +0000 (20:38 +0800)]
KVM: Portability: Add vcpu and hardware management arch hooks

Add the following hooks:

  void decache_vcpus_on_cpu(int cpu);
  int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
  void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
  void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
  void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
  void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
  struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
  void kvm_arch_vcpu_destory(struct kvm_vcpu *vcpu);
  int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
  void kvm_arch_hardware_enable(void *garbage);
  void kvm_arch_hardware_disable(void *garbage);
  int kvm_arch_hardware_setup(void);
  void kvm_arch_hardware_unsetup(void);
  void kvm_arch_check_processor_compat(void *rtn);

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_x86_ops to x86.c
Zhang Xiantao [Wed, 14 Nov 2007 12:09:30 +0000 (20:09 +0800)]
KVM: Portability: Move kvm_x86_ops to x86.c

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move some includes to x86.c
Zhang Xiantao [Wed, 14 Nov 2007 12:08:51 +0000 (20:08 +0800)]
KVM: Portability: Move some includes to x86.c

Move some includes to x86.c from kvm_main.c, since the related functions
have been moved to x86.c

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Change kvm_{read,write}_guest() to use copy_{from,to}_user()
Izik Eidus [Sun, 11 Nov 2007 20:10:22 +0000 (22:10 +0200)]
KVM: Change kvm_{read,write}_guest() to use copy_{from,to}_user()

This changes kvm_write_guest_page/kvm_read_guest_page to use
copy_to_user/read_from_user, as a result we get better speed
and better dirty bit tracking.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: introduce gfn_to_hva()
Izik Eidus [Sun, 11 Nov 2007 20:05:04 +0000 (22:05 +0200)]
KVM: introduce gfn_to_hva()

Convert a guest frame number to the corresponding host virtual address.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: add kvm_is_error_hva()
Izik Eidus [Sun, 11 Nov 2007 20:02:22 +0000 (22:02 +0200)]
KVM: add kvm_is_error_hva()

Check for the "error hva", an address outside the user address space that
signals a bad gfn.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Simplify CPU_TASKS_FROZEN cpu notifier handling
Avi Kivity [Sun, 11 Nov 2007 16:37:32 +0000 (18:37 +0200)]
KVM: Simplify CPU_TASKS_FROZEN cpu notifier handling

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: remove 8 bytes operands emulator for call near instruction
Izik Eidus [Sun, 11 Nov 2007 12:48:17 +0000 (14:48 +0200)]
KVM: x86 emulator: remove 8 bytes operands emulator for call near instruction

it is removed beacuse it isnt supported on a real host

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: wbinvd exiting
Eddie Dong [Sun, 11 Nov 2007 10:28:35 +0000 (12:28 +0200)]
KVM: VMX: wbinvd exiting

Add wbinvd VM Exit support to prepare for pass-through
device cache emulation and also enhance real time
responsiveness.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Comment VMX primary/secondary exec ctl definitions
Eddie Dong [Sun, 11 Nov 2007 10:27:20 +0000 (12:27 +0200)]
KVM: VMX: Comment VMX primary/secondary exec ctl definitions

Add comments for secondary/primary Processor-Based VM-execution controls.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Fix faults during injection of real-mode interrupts
Avi Kivity [Thu, 22 Nov 2007 09:42:59 +0000 (11:42 +0200)]
KVM: Fix faults during injection of real-mode interrupts

If vmx fails to inject a real-mode interrupt while fetching the interrupt
redirection table, it fails to record this in the vectoring information
field.  So we detect this condition and do it ourselves.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Read & store IDT_VECTORING_INFO_FIELD
Avi Kivity [Thu, 22 Nov 2007 09:30:47 +0000 (11:30 +0200)]
KVM: VMX: Read & store IDT_VECTORING_INFO_FIELD

We'll want to write to it in order to fix real-mode irq injection problems,
but it is a read-only field.  Storing it in a variable solves that issue.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Use vmx to inject real-mode interrupts
Avi Kivity [Thu, 8 Nov 2007 16:19:20 +0000 (18:19 +0200)]
KVM: VMX: Use vmx to inject real-mode interrupts

Instead of injecting real-mode interrupts by writing the interrupt frame into
guest memory, abuse vmx by injecting a software interrupt.  We need to
pretend the software interrupt instruction had a length > 0, so we have to
adjust rip backward.

This lets us not to mess with writing guest memory, which is complex and also
sleeps.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add make_page_dirty() to kvm_clear_guest_page()
Dor Laor [Wed, 7 Nov 2007 14:20:06 +0000 (16:20 +0200)]
KVM: Add make_page_dirty() to kvm_clear_guest_page()

Every write access to guest pages should be tracked.

Signed-off-by: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move x86 vcpu ioctl handlers to x86.c
Hollis Blanchard [Thu, 1 Nov 2007 19:16:10 +0000 (14:16 -0500)]
KVM: Portability: Move x86 vcpu ioctl handlers to x86.c

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move x86 FPU handling to x86.c
Hollis Blanchard [Wed, 31 Oct 2007 22:24:25 +0000 (17:24 -0500)]
KVM: Portability: Move x86 FPU handling to x86.c

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move x86 instruction emulation code to x86.c
Hollis Blanchard [Wed, 31 Oct 2007 22:24:24 +0000 (17:24 -0500)]
KVM: Portability: Move x86 instruction emulation code to x86.c

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Make exported debugfs data architecture-specific
Hollis Blanchard [Wed, 31 Oct 2007 22:24:23 +0000 (17:24 -0500)]
KVM: Portability: Make exported debugfs data architecture-specific

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Hoist modrm and abs decoding into separate functions
Avi Kivity [Thu, 1 Nov 2007 04:31:28 +0000 (06:31 +0200)]
KVM: x86 emulator: Hoist modrm and abs decoding into separate functions

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Make mark_page_dirty() work for aliased pages too.
Uri Lublin [Tue, 30 Oct 2007 08:42:09 +0000 (10:42 +0200)]
KVM: Make mark_page_dirty() work for aliased pages too.

Recommended by Izik Eidus.

Signed-off-by: Uri Lublin <uril@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Simplify decode_register_operand() calling convention
Avi Kivity [Wed, 31 Oct 2007 09:21:06 +0000 (11:21 +0200)]
KVM: Simplify decode_register_operand() calling convention

Now that rex_prefix is part of the decode cache, there is no need to pass
it along.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: centralize decoding of one-byte register access insns
Avi Kivity [Wed, 31 Oct 2007 09:15:56 +0000 (11:15 +0200)]
KVM: x86 emulator: centralize decoding of one-byte register access insns

Instructions like 'inc reg' that have the register operand encoded
in the opcode are currently specially decoded.  Extend
decode_register_operand() to handle that case, indicated by having
DstReg or SrcReg without ModRM.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Extract the common code of SrcReg and DstReg
Avi Kivity [Wed, 31 Oct 2007 08:27:04 +0000 (10:27 +0200)]
KVM: x86 emulator: Extract the common code of SrcReg and DstReg

Share the common parts of SrcReg and DstReg decoding.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move pio emulation functions to x86.c
Carsten Otte [Tue, 30 Oct 2007 17:44:25 +0000 (18:44 +0100)]
KVM: Portability: Move pio emulation functions to x86.c

This patch moves implementation of the following functions from
kvm_main.c to x86.c:
free_pio_guest_pages, vcpu_find_pio_dev, pio_copy_data, complete_pio,
kernel_pio, pio_string_write, kvm_emulate_pio, kvm_emulate_pio_string

The function inject_gp, which was duplicated by yesterday's patch
series, is removed from kvm_main.c now because it is not needed anymore.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move x86 emulation and mmio device hook to x86.c
Carsten Otte [Tue, 30 Oct 2007 17:44:21 +0000 (18:44 +0100)]
KVM: Portability: Move x86 emulation and mmio device hook to x86.c

This patch moves the following functions to from kvm_main.c to x86.c:
emulator_read/write_std, vcpu_find_pervcpu_dev, vcpu_find_mmio_dev,
emulator_read/write_emulated, emulator_write_phys,
emulator_write_emulated_onepage, emulator_cmpxchg_emulated,
get_setment_base, emulate_invlpg, emulate_clts, emulator_get/set_dr,
kvm_report_emulation_failure, emulate_instruction

The following data type is moved to x86.c:
struct x86_emulate_ops emulate_ops

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move kvm_get/set_msr[_common] to x86.c
Carsten Otte [Tue, 30 Oct 2007 17:44:17 +0000 (18:44 +0100)]
KVM: Portability: Move kvm_get/set_msr[_common] to x86.c

This patch moves the implementation of the functions of kvm_get/set_msr,
kvm_get/set_msr_common, and set_efer from kvm_main.c to x86.c. The
definition of EFER_RESERVED_BITS is moved too.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Fix gfn_to_page() acquiring mmap_sem twice
Anthony Liguori [Mon, 29 Oct 2007 20:15:20 +0000 (15:15 -0500)]
KVM: Fix gfn_to_page() acquiring mmap_sem twice

KVM's nopage handler calls gfn_to_page() which acquires the mmap_sem when
calling out to get_user_pages().  nopage handlers are already invoked with the
mmap_sem held though.  Introduce a __gfn_to_page() for use by the nopage
handler which requires the lock to already be held.

This was noticed by tglx.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Enable memory mapped TPR shadow (FlexPriority)
Sheng Yang [Mon, 29 Oct 2007 01:40:42 +0000 (09:40 +0800)]
KVM: VMX: Enable memory mapped TPR shadow (FlexPriority)

This patch based on CR8/TPR patch, and enable the TPR shadow (FlexPriority)
for 32bit Windows.  Since TPR is accessed very frequently by 32bit
Windows, especially SMP guest, with FlexPriority enabled, we saw significant
performance gain.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move control register helper functions to x86.c
Carsten Otte [Mon, 29 Oct 2007 15:09:35 +0000 (16:09 +0100)]
KVM: Portability: Move control register helper functions to x86.c

This patch moves the definitions of CR0_RESERVED_BITS,
CR4_RESERVED_BITS, and CR8_RESERVED_BITS along with the following
functions from kvm_main.c to x86.c:
set_cr0(), set_cr3(), set_cr4(), set_cr8(), get_cr8(), lmsw(),
load_pdptrs()
The static function wrapper inject_gp is duplicated in kvm_main.c and
x86.c for now, the version in kvm_main.c should disappear once the last
user of it is gone too.
The function load_pdptrs is no longer static, and now defined in x86.h
for the time being, until the last user of it is gone from kvm_main.c.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: move get/set_apic_base to x86.c
Carsten Otte [Mon, 29 Oct 2007 15:09:10 +0000 (16:09 +0100)]
KVM: Portability: move get/set_apic_base to x86.c

This patch moves the implementation of get_apic_base and set_apic_base
from kvm_main.c to x86.c

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Move memory segmentation to x86.c
Carsten Otte [Mon, 29 Oct 2007 15:08:51 +0000 (16:08 +0100)]
KVM: Portability: Move memory segmentation to x86.c

This patch moves the definition of segment_descriptor_64 for AMD64 and
EM64T from kvm_main.c to segment_descriptor.h. It also adds a proper
#ifndef...#define...#endif around that header file.
The implementation of segment_base is moved from kvm_main.c to x86.c.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Split kvm_vm_ioctl v3
Carsten Otte [Mon, 29 Oct 2007 15:08:35 +0000 (16:08 +0100)]
KVM: Portability: Split kvm_vm_ioctl v3

This patch splits kvm_vm_ioctl into archtecture independent parts, and
x86 specific parts which go to kvm_arch_vcpu_ioctl in x86.c.
The patch is unchanged since last submission.

Common ioctls for all architectures are:
KVM_CREATE_VCPU, KVM_GET_DIRTY_LOG, KVM_SET_USER_MEMORY_REGION

x86 specific ioctls are:
KVM_SET_MEMORY_REGION,
KVM_GET/SET_NR_MMU_PAGES, KVM_SET_MEMORY_ALIAS, KVM_CREATE_IRQCHIP,
KVM_CREATE_IRQ_LINE, KVM_GET/SET_IRQCHIP
KVM_SET_TSS_ADDR

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Topup the mmu memory preallocation caches before emulating an insn
Avi Kivity [Sun, 28 Oct 2007 16:52:05 +0000 (18:52 +0200)]
KVM: MMU: Topup the mmu memory preallocation caches before emulating an insn

Emulation may cause a shadow pte to be instantiated, which requires
memory resources.  Make sure the caches are filled to avoid an oops.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Move page fault processing to common code
Avi Kivity [Sun, 28 Oct 2007 16:48:59 +0000 (18:48 +0200)]
KVM: Move page fault processing to common code

The code that dispatches the page fault and emulates if we failed to map
is duplicated across vmx and svm.  Merge it to simplify further bugfixing.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: don't depend on cr2 for mov abs emulation
Avi Kivity [Sun, 28 Oct 2007 14:34:25 +0000 (16:34 +0200)]
KVM: x86 emulator: don't depend on cr2 for mov abs emulation

The 'mov abs' instruction family (opcodes 0xa0 - 0xa3) still depends on cr2
provided by the page fault handler.  This is wrong for several reasons:

- if an instruction accessed misaligned data that crosses a page boundary,
  and if the fault happened on the second page, cr2 will point at the
  second page, not the data itself.

- if we're emulating in real mode, or due to a FlexPriority exit, there
  is no cr2 generated.

So, this change adds decoding for this instruction form and drops reliance
on cr2.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: Let gcc to choose which registers to save (i386)
Laurent Vivier [Thu, 25 Oct 2007 12:18:54 +0000 (14:18 +0200)]
KVM: SVM: Let gcc to choose which registers to save (i386)

This patch lets GCC to determine which registers to save when we
switch to/from a VCPU in the case of AMD i386

* Original code saves following registers:

    ebx, ecx, edx, esi, edi, ebp

* Patched code:

  - informs GCC that we modify following registers
    using the clobber description:

    ebx, ecx, edx, esi, edi

  - rbp is saved (pop/push) because GCC seems to ignore its use in the clobber
    description.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: Let gcc to choose which registers to save (x86_64)
Laurent Vivier [Thu, 25 Oct 2007 12:18:53 +0000 (14:18 +0200)]
KVM: SVM: Let gcc to choose which registers to save (x86_64)

This patch lets GCC to determine which registers to save when we
switch to/from a VCPU in the case of AMD x86_64.

* Original code saves following registers:

    rbx, rcx, rdx, rsi, rdi, rbp,
    r8, r9, r10, r11, r12, r13, r14, r15

* Patched code:

  - informs GCC that we modify following registers
    using the clobber description:

    rbx, rcx, rdx, rsi, rdi
    r8, r9, r10, r11, r12, r13, r14, r15

  - rbp is saved (pop/push) because GCC seems to ignore its use in the clobber
    description.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Let gcc to choose which registers to save (i386)
Laurent Vivier [Thu, 25 Oct 2007 12:18:55 +0000 (14:18 +0200)]
KVM: VMX: Let gcc to choose which registers to save (i386)

This patch lets GCC to determine which registers to save when we
switch to/from a VCPU in the case of intel i386.

* Original code saves following registers:

    eax, ebx, ecx, edx, edi, esi, ebp (using popa)

* Patched code:

  - informs GCC that we modify following registers
    using the clobber description:

    ebx, edi, rsi

  - doesn't save eax because it is an output operand (vmx->fail)

  - cannot put ecx in clobber description because it is an input operand,
    but as we modify it and we want to keep its value (vcpu), we must
    save it (pop/push)

  - ebp is saved (pop/push) because GCC seems to ignore its use the clobber
    description.

  - edx is saved (pop/push) because it is reserved by GCC (REGPARM) and
    cannot be put in the clobber description.

  - line "mov (%%esp), %3 \n\t" has been removed because %3
    is ecx and ecx is restored just after.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Let gcc to choose which registers to save (x86_64)
Laurent Vivier [Thu, 25 Oct 2007 12:18:52 +0000 (14:18 +0200)]
KVM: VMX: Let gcc to choose which registers to save (x86_64)

This patch lets GCC to determine which registers to save when we
switch to/from a VCPU in the case of intel x86_64.

* Original code saves following registers:

    rax, rbx, rcx, rdx, rsi, rdi, rbp,
    r8, r9, r10, r11, r12, r13, r14, r15

* Patched code:

  - informs GCC that we modify following registers
    using the clobber description:

    rbx, rdi, rsi,
    r8, r9, r10, r11, r12, r13, r14, r15

  - doesn't save rax because it is an output operand (vmx->fail)

  - cannot put rcx in clobber description because it is an input operand,
    but as we modify it and we want to keep its value (vcpu), we must
    save it (pop/push)

  - rbp is saved (pop/push) because GCC seems to ignore its use in the clobber
    description.

  - rdx is saved (pop/push) because it is reserved by GCC (REGPARM) and
    cannot be put in the clobber description.

  - line "mov (%%rsp), %3 \n\t" has been removed because %3
    is rcx and rcx is restored just after.

  - line ASM_VMX_VMWRITE_RSP_RDX() is moved out of the ifdef/else/endif

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add ioctl to tss address from userspace,
Izik Eidus [Wed, 24 Oct 2007 22:29:55 +0000 (00:29 +0200)]
KVM: Add ioctl to tss address from userspace,

Currently kvm has a wart in that it requires three extra pages for use
as a tss when emulating real mode on Intel.  This patch moves the allocation
internally, only requiring userspace to tell us where in the physical address
space we can place the tss.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add kernel-internal memory slots
Izik Eidus [Wed, 24 Oct 2007 21:57:46 +0000 (23:57 +0200)]
KVM: Add kernel-internal memory slots

Reserve a few memory slots for kernel internal use.  This is good for case
you have to register memory region and you want to be sure it was not
registered from userspace, and for case you want to register a memory region
that won't be seen from userspace.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Export memory slot allocation mechanism
Izik Eidus [Wed, 24 Oct 2007 21:52:57 +0000 (23:52 +0200)]
KVM: Export memory slot allocation mechanism

Remove kvm memory slot allocation mechanism from the ioctl
and put it to exported function.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Unmap kernel-allocated memory on slot destruction
Izik Eidus [Thu, 25 Oct 2007 09:54:04 +0000 (11:54 +0200)]
KVM: Unmap kernel-allocated memory on slot destruction

kvm_vm_ioctl_set_memory_region() is able to remove memory in addition to
adding it.  Therefore when using kernel swapping support for old userspaces,
we need to munmap the memory if the user request to remove it

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Per-architecture hypercall definitions
Christian Borntraeger [Thu, 11 Oct 2007 13:34:17 +0000 (15:34 +0200)]
KVM: Per-architecture hypercall definitions

Currently kvm provides hypercalls only for x86* architectures. To
provide hypercall infrastructure for other kvm architectures I split
kvm_para.h into a generic header file and architecture specific
definitions.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Split IOAPIC reset function and export for kernel RESET
Eddie Dong [Wed, 10 Oct 2007 10:15:54 +0000 (12:15 +0200)]
KVM: Split IOAPIC reset function and export for kernel RESET

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Export PIC reset for kernel device reset
Eddie Dong [Wed, 10 Oct 2007 10:14:25 +0000 (12:14 +0200)]
KVM: Export PIC reset for kernel device reset

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add a might_sleep() annotation to gfn_to_page()
Avi Kivity [Sun, 21 Oct 2007 09:03:36 +0000 (11:03 +0200)]
KVM: Add a might_sleep() annotation to gfn_to_page()

This will help trap accesses to guest memory in atomic context.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Move vmx_vcpu_reset() out of vmx_vcpu_setup()
Avi Kivity [Sun, 21 Oct 2007 09:00:39 +0000 (11:00 +0200)]
KVM: Move vmx_vcpu_reset() out of vmx_vcpu_setup()

Split guest reset code out of vmx_vcpu_setup().  Besides being cleaner, this
moves the realmode tss setup (which can sleep) outside vmx_vcpu_setup()
(which is executed with preemption enabled).

[izik: remove unused variable]

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Portability: Split kvm_vcpu into arch dependent and independent parts (part 1)
Zhang Xiantao [Sat, 20 Oct 2007 07:34:38 +0000 (15:34 +0800)]
KVM: Portability: Split kvm_vcpu into arch dependent and independent parts (part 1)

First step to split kvm_vcpu.  Currently, we just use an macro to define
the common fields in kvm_vcpu for all archs, and all archs need to define
its own kvm_vcpu struct.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>