]> git.karo-electronics.de Git - mv-sheeva.git/log
mv-sheeva.git
16 years agoKVM: PIC: enhance IPI avoidance
Marcelo Tosatti [Wed, 24 Sep 2008 23:28:34 +0000 (20:28 -0300)]
KVM: PIC: enhance IPI avoidance

The PIC code makes little effort to avoid kvm_vcpu_kick(), resulting in
unnecessary guest exits in some conditions.

For example, if the timer interrupt is routed through the IOAPIC, IRR
for IRQ 0 will get set but not cleared, since the APIC is handling the
acks.

This means that everytime an interrupt < 16 is triggered, the priority
logic will find IRQ0 pending and send an IPI to vcpu0 (in case IRQ0 is
not masked, which is Linux's case).

Introduce a new variable isr_ack to represent the IRQ's for which the
guest has been signalled / cleared the ISR. Use it to avoid more than
one IPI per trigger-ack cycle, in addition to the avoidance when ISR is
set in get_priority().

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: add "oos_shadow" parameter to disable oos
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:41 +0000 (13:18 -0300)]
KVM: MMU: add "oos_shadow" parameter to disable oos

Subject says it all.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: speed up mmu_unsync_walk
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:40 +0000 (13:18 -0300)]
KVM: MMU: speed up mmu_unsync_walk

Cache the unsynced children information in a per-page bitmap.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: out of sync shadow core
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:39 +0000 (13:18 -0300)]
KVM: MMU: out of sync shadow core

Allow guest pagetables to go out of sync.  Instead of emulating write
accesses to guest pagetables, or unshadowing them, we un-write-protect
the page table and allow the guest to modify it at will.  We rely on
invlpg executions to synchronize individual ptes, and will synchronize
the entire pagetable on tlb flushes.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: mmu_convert_notrap helper
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:38 +0000 (13:18 -0300)]
KVM: MMU: mmu_convert_notrap helper

Need to convert shadow_notrap_nonpresent -> shadow_trap_nonpresent when
unsyncing pages.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: awareness of new kvm_mmu_zap_page behaviour
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:37 +0000 (13:18 -0300)]
KVM: MMU: awareness of new kvm_mmu_zap_page behaviour

kvm_mmu_zap_page will soon zap the unsynced children of a page. Restart
list walk in such case.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: mmu_parent_walk
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:36 +0000 (13:18 -0300)]
KVM: MMU: mmu_parent_walk

Introduce a function to walk all parents of a given page, invoking a handler.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: x86: trap invlpg
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:35 +0000 (13:18 -0300)]
KVM: x86: trap invlpg

With pages out of sync invlpg needs to be trapped. For now simply nuke
the entry.

Untested on AMD.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: sync roots on mmu reload
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:34 +0000 (13:18 -0300)]
KVM: MMU: sync roots on mmu reload

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: mode specific sync_page
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:33 +0000 (13:18 -0300)]
KVM: MMU: mode specific sync_page

Examine guest pagetable and bring the shadow back in sync. Caller is responsible
for local TLB flush before re-entering guest mode.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: do not write-protect large mappings
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:32 +0000 (13:18 -0300)]
KVM: MMU: do not write-protect large mappings

There is not much point in write protecting large mappings. This
can only happen when a page is shadowed during the window between
is_largepage_backed and mmu_lock acquision. Zap the entry instead, so
the next pagefault will find a shadowed page via is_largepage_backed and
fallback to 4k translations.

Simplifies out of sync shadow.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: move local TLB flush to mmu_set_spte
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:31 +0000 (13:18 -0300)]
KVM: MMU: move local TLB flush to mmu_set_spte

Since the sync page path can collapse flushes.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: split mmu_set_spte
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:30 +0000 (13:18 -0300)]
KVM: MMU: split mmu_set_spte

Split the spte entry creation code into a new set_spte function.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: MMU: flush remote TLBs on large->normal entry overwrite
Marcelo Tosatti [Tue, 23 Sep 2008 16:18:29 +0000 (13:18 -0300)]
KVM: MMU: flush remote TLBs on large->normal entry overwrite

It is necessary to flush all TLB's when a large spte entry is
overwritten with a normal page directory pointer.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agox86: pvclock: fix shadowed variable warning
Harvey Harrison [Tue, 23 Sep 2008 18:01:45 +0000 (11:01 -0700)]
x86: pvclock: fix shadowed variable warning

arch/x86/kernel/pvclock.c:102:6: warning: symbol 'tsc_khz' shadows an earlier one
include/asm/tsc.h:18:21: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: ia64: add support for Tukwila processors
Xiantao Zhang [Fri, 12 Sep 2008 22:21:22 +0000 (06:21 +0800)]
KVM: ia64: add support for Tukwila processors

In Tukwila processor, VT-i has been enhanced in its
implementation, it is often called VT-i2 techonology.
With VTi-2 support, virtulization performance should be
improved. In this patch, we added the related stuff to
support kvm/ia64 for Tukwila processors.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: ia64: Implement a uniform vps interface
Xiantao Zhang [Fri, 12 Sep 2008 12:23:11 +0000 (20:23 +0800)]
KVM: ia64: Implement a uniform vps interface

An uniform entry kvm_vps_entry is added for
vps_sync_write/read, vps_resume_handler/guest,
and branches to differnt PAL service according to the offset.

Singed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: Remove useless intel-iommu.h header inclusion
Weidong Han [Wed, 24 Sep 2008 05:39:57 +0000 (13:39 +0800)]
KVM: Remove useless intel-iommu.h header inclusion

Currently "#include <linux/intel-iommu.h>" is not needed in
virt/kvm/kvm_main.c.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: Don't destroy vcpu in case vcpu_setup fails
Glauber Costa [Thu, 18 Sep 2008 02:16:59 +0000 (23:16 -0300)]
KVM: Don't destroy vcpu in case vcpu_setup fails

One of vcpu_setup responsibilities is to do mmu initialization.
However, in case we fail in kvm_arch_vcpu_reset, before we get the
chance to init mmu. OTOH, vcpu_destroy will attempt to destroy mmu,
triggering a bug. Keeping track of whether or not mmu is initialized
would unnecessarily complicate things. Rather, we just make return,
making sure any needed uninitialization is done before we return, in
case we fail.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: don't enter guest after SIPI was received by a CPU
Gleb Natapov [Mon, 22 Sep 2008 11:28:53 +0000 (14:28 +0300)]
KVM: don't enter guest after SIPI was received by a CPU

The vcpu should process pending SIPI message before entering guest mode again.
kvm_arch_vcpu_runnable() returns true if the vcpu is in SIPI state, so
we can't call it here.

Signed-off-by: Gleb Natapov <gleb@qumranet.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoMAINTAINERS: Update Avi Kivity's email address
Avi Kivity [Sat, 20 Sep 2008 02:25:30 +0000 (19:25 -0700)]
MAINTAINERS: Update Avi Kivity's email address

Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: x86.c make kvm_load_realmode_segment static
Harvey Harrison [Fri, 22 Aug 2008 20:29:17 +0000 (13:29 -0700)]
KVM: x86.c make kvm_load_realmode_segment static

Noticed by sparse:
arch/x86/kvm/x86.c:3591:5: warning: symbol 'kvm_load_realmode_segment' was not declared. Should it be static?

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: switch to get_user_pages_fast
Marcelo Tosatti [Tue, 16 Sep 2008 23:54:47 +0000 (20:54 -0300)]
KVM: switch to get_user_pages_fast

Convert gfn_to_pfn to use get_user_pages_fast, which can do lockless
pagetable lookups on x86. Kernel compilation on 4-way guest is 3.7%
faster on VMX.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: opencode gfn_to_page in kvm_vm_fault
Marcelo Tosatti [Tue, 16 Sep 2008 23:54:46 +0000 (20:54 -0300)]
KVM: opencode gfn_to_page in kvm_vm_fault

kvm_vm_fault is invoked with mmap_sem held in read mode. Since gfn_to_page
will be converted to get_user_pages_fast, which requires this lock NOT
to be held, switch to opencoded get_user_pages.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: Device Assignment: Free device structures if IRQ allocation fails
Amit Shah [Tue, 16 Sep 2008 15:04:28 +0000 (18:04 +0300)]
KVM: Device Assignment: Free device structures if IRQ allocation fails

When an IRQ allocation fails, we free up the device structures and
disable the device so that we can unregister the device in the
userspace and not expose it to the guest at all.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
16 years agoKVM: Device Assignment with VT-d
Ben-Ami Yassour [Sun, 14 Sep 2008 00:48:28 +0000 (03:48 +0300)]
KVM: Device Assignment with VT-d

Based on a patch by: Kay, Allen M <allen.m.kay@intel.com>

This patch enables PCI device assignment based on VT-d support.
When a device is assigned to the guest, the guest memory is pinned and
the mapping is updated in the VT-d IOMMU.

[Amit: Expose KVM_CAP_IOMMU so we can check if an IOMMU is present
and also control enable/disable from userspace]

Signed-off-by: Kay, Allen M <allen.m.kay@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Acked-by: Mark Gross <mgross@linux.intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoVT-d: Changes to support KVM
Kay, Allen M [Tue, 9 Sep 2008 15:37:29 +0000 (18:37 +0300)]
VT-d: Changes to support KVM

This patch extends the VT-d driver to support KVM

[Ben: fixed memory pinning]
[avi: move dma_remapping.h as well]

Signed-off-by: Kay, Allen M <allen.m.kay@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Acked-by: Mark Gross <mgross@linux.intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Use DstAcc for 'and'
Guillaume Thouvenin [Fri, 12 Sep 2008 11:52:18 +0000 (13:52 +0200)]
KVM: x86 emulator: Use DstAcc for 'and'

For instruction 'and al,imm' we use DstAcc instead of doing
the emulation directly into the instruction's opcode.

Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Add cmp al, imm and cmp ax, imm instructions (ocodes 3c, 3d)
Guillaume Thouvenin [Fri, 12 Sep 2008 11:51:15 +0000 (13:51 +0200)]
KVM: x86 emulator: Add cmp al, imm and cmp ax, imm instructions (ocodes 3c, 3d)

Add decode entries for these opcodes; execution is already implemented.

Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Add DstAcc operand type
Guillaume Thouvenin [Fri, 12 Sep 2008 11:50:25 +0000 (13:50 +0200)]
KVM: x86 emulator: Add DstAcc operand type

Add DstAcc operand type. That means that there are 4 bits now for
DstMask.

"In the good old days cpus would have only one register that was able to
 fully participate in arithmetic operations, typically called A for
 Accumulator.  The x86 retains this tradition by having special, shorter
 encodings for the A register (like the cmp opcode), and even some
 instructions that only operate on A (like mul).

 SrcAcc and DstAcc would accommodate these instructions by decoding A
 into the corresponding 'struct operand'."
  -- Avi Kivity

Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agox86: Move FEATURE_CONTROL bits to msr-index.h
Sheng Yang [Thu, 11 Sep 2008 07:27:50 +0000 (15:27 +0800)]
x86: Move FEATURE_CONTROL bits to msr-index.h

For MSR_IA32_FEATURE_CONTROL is already there.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Rename IA32_FEATURE_CONTROL bits
Sheng Yang [Thu, 11 Sep 2008 07:27:49 +0000 (15:27 +0800)]
KVM: VMX: Rename IA32_FEATURE_CONTROL bits

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoMAINTAINERS: add entry for the KVM AMD module
Joerg Roedel [Wed, 10 Sep 2008 18:01:07 +0000 (20:01 +0200)]
MAINTAINERS: add entry for the KVM AMD module

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: fix jmp r/m64 instruction
Avi Kivity [Thu, 11 Sep 2008 16:47:13 +0000 (19:47 +0300)]
KVM: x86 emulator: fix jmp r/m64 instruction

jmp r/m64 doesn't require the rex.w prefix to indicate the operand size
is 64 bits.  Set the Stack attribute (even though it doesn't involve the
stack, really) to indicate this.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Cleanup stalled INTR_INFO read
Jan Kiszka [Thu, 11 Sep 2008 10:58:00 +0000 (12:58 +0200)]
KVM: VMX: Cleanup stalled INTR_INFO read

Commit 1c0f4f5011829dac96347b5f84ba37c2252e1e08 left a useless access
of VM_ENTRY_INTR_INFO_FIELD in vmx_intr_assist behind. Clean this up.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ppc: kvmppc_44x_shadow_release() does not require mmap_sem to be locked
Hollis Blanchard [Thu, 11 Sep 2008 15:04:29 +0000 (10:04 -0500)]
KVM: ppc: kvmppc_44x_shadow_release() does not require mmap_sem to be locked

And it gets in the way of get_user_pages_fast().

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86: unhalt vcpu0 on reset
Marcelo Tosatti [Wed, 10 Sep 2008 19:40:55 +0000 (16:40 -0300)]
KVM: x86: unhalt vcpu0 on reset

Since "KVM: x86: do not execute halted vcpus", HLT by vcpu0 before system
reset by the IO thread will hang the guest.

Mark vcpu as runnable in such case.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Add call near absolute instruction (opcode 0xff/2)
Mohammed Gamal [Mon, 8 Sep 2008 18:47:19 +0000 (21:47 +0300)]
KVM: x86 emulator: Add call near absolute instruction (opcode 0xff/2)

Add call near absolute instruction.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86: do not execute halted vcpus
Marcelo Tosatti [Mon, 8 Sep 2008 18:23:48 +0000 (15:23 -0300)]
KVM: x86: do not execute halted vcpus

Offline or uninitialized vcpu's can be executed if requested to perform
userspace work.

Follow Avi's suggestion to handle halted vcpu's in the main loop,
simplifying kvm_emulate_halt(). Introduce a new vcpu->requests bit to
indicate events that promote state from halted to running.

Also standardize vcpu wake sites.

Signed-off-by: Marcelo Tosatti <mtosatti <at> redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Add in/out instructions (opcodes 0xe4-0xe7, 0xec-0xef)
Mohammed Gamal [Sat, 6 Sep 2008 14:22:29 +0000 (17:22 +0300)]
KVM: x86 emulator: Add in/out instructions (opcodes 0xe4-0xe7, 0xec-0xef)

The patch adds in/out instructions to the x86 emulator.

The instruction was encountered while running the BIOS while using
the invalid guest state emulation patch.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add statistics for guest irq injections
Avi Kivity [Mon, 1 Sep 2008 12:57:51 +0000 (15:57 +0300)]
KVM: Add statistics for guest irq injections

These can help show whether a guest is making progress or not.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Modify kvm_shadow_walk.entry to accept u64 addr
Sheng Yang [Mon, 1 Sep 2008 11:41:20 +0000 (19:41 +0800)]
KVM: MMU: Modify kvm_shadow_walk.entry to accept u64 addr

EPT is 4 level by default in 32pae(48 bits), but the addr parameter
of kvm_shadow_walk->entry() only accept unsigned long as virtual
address, which is 32bit in 32pae. This result in SHADOW_PT_INDEX()
overflow when try to fetch level 4 index.

Fix it by extend kvm_shadow_walk->entry() to accept 64bit addr in
parameter.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ia64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate
Xiantao Zhang [Thu, 28 Aug 2008 01:34:08 +0000 (09:34 +0800)]
KVM: ia64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate

Two ioctl arch functions are added to set vcpu's smp state.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Add std and cld instructions (opcodes 0xfc-0xfd)
Mohammed Gamal [Mon, 1 Sep 2008 01:52:24 +0000 (04:52 +0300)]
KVM: x86 emulator: Add std and cld instructions (opcodes 0xfc-0xfd)

This adds the std and cld instructions to the emulator.

Encountered while running the BIOS with invalid guest
state emulation enabled.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: s390: change help text of guest Kconfig
Christian Borntraeger [Fri, 29 Aug 2008 11:30:56 +0000 (13:30 +0200)]
KVM: s390: change help text of guest Kconfig

The current help text for CONFIG_S390_GUEST is not very helpful.
Lets add more text.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: s390: Make facility bits future-proof
Christian Borntraeger [Fri, 29 Aug 2008 11:29:45 +0000 (13:29 +0200)]
KVM: s390: Make facility bits future-proof

Heiko Carstens pointed out, that its safer to activate working facilities
instead of disabling problematic facilities. The new code uses the host
facility bits and masks it with known good ones.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: add MC5_MISC msr read support
Joerg Roedel [Fri, 29 Aug 2008 09:52:07 +0000 (11:52 +0200)]
KVM: add MC5_MISC msr read support

Currently KVM implements MC0-MC4_MISC read support. When booting Linux this
results in KVM warnings in the kernel log when the guest tries to read
MC5_MISC. Fix this warnings with this patch.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: No need to unprotect memory during event injection when using npt
Avi Kivity [Thu, 28 Aug 2008 15:27:15 +0000 (18:27 +0300)]
KVM: SVM: No need to unprotect memory during event injection when using npt

No memory is protected anyway.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Fix setting the accessed bit on non-speculative sptes
Avi Kivity [Wed, 27 Aug 2008 17:01:04 +0000 (20:01 +0300)]
KVM: MMU: Fix setting the accessed bit on non-speculative sptes

The accessed bit was accidentally turned on in a random flag word, rather
than, the spte itself, which was lucky, since it used the non-EPT compatible
PT_ACCESSED_MASK.

Fix by turning the bit on in the spte and changing it to use the portable
accessed mask.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Flush tlbs after clearing write permission when accessing dirty log
Avi Kivity [Wed, 27 Aug 2008 13:40:51 +0000 (16:40 +0300)]
KVM: MMU: Flush tlbs after clearing write permission when accessing dirty log

Otherwise, the cpu may allow writes to the tracked pages, and we lose
some display bits or fail to migrate correctly.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Add locking around kvm_mmu_slot_remove_write_access()
Avi Kivity [Wed, 27 Aug 2008 13:32:24 +0000 (16:32 +0300)]
KVM: MMU: Add locking around kvm_mmu_slot_remove_write_access()

It was generally safe due to slots_lock being held for write, but it wasn't
very nice.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Account for npt/ept/realmode page faults
Avi Kivity [Wed, 27 Aug 2008 13:30:56 +0000 (16:30 +0300)]
KVM: MMU: Account for npt/ept/realmode page faults

Now that two-dimensional paging is becoming common, account for tdp page
faults.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: Add mov r, imm instructions (opcodes 0xb0-0xbf)
Mohammed Gamal [Wed, 27 Aug 2008 02:02:56 +0000 (05:02 +0300)]
KVM: x86 emulator: Add mov r, imm instructions (opcodes 0xb0-0xbf)

The emulator only supported one instance of mov r, imm instruction
(opcode 0xb8), this adds the rest of these instructions.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Don't call get_user_pages(.force = 1)
Avi Kivity [Tue, 26 Aug 2008 14:31:31 +0000 (17:31 +0300)]
KVM: Don't call get_user_pages(.force = 1)

This is esoteric and only needed to break COW on MAP_SHARED mappings.  Since
KVM no longer does these sorts of mappings, breaking COW on them is no longer
necessary.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Allocate guest memory as MAP_PRIVATE, not MAP_SHARED
Avi Kivity [Tue, 26 Aug 2008 14:22:47 +0000 (17:22 +0300)]
KVM: Allocate guest memory as MAP_PRIVATE, not MAP_SHARED

There is no reason to share internal memory slots with fork()ed instances.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Convert the paging mode shadow walk to use the generic walker
Avi Kivity [Fri, 22 Aug 2008 16:11:39 +0000 (19:11 +0300)]
KVM: MMU: Convert the paging mode shadow walk to use the generic walker

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Convert direct maps to use the generic shadow walker
Avi Kivity [Fri, 22 Aug 2008 16:28:04 +0000 (19:28 +0300)]
KVM: MMU: Convert direct maps to use the generic shadow walker

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Add generic shadow walker
Avi Kivity [Fri, 22 Aug 2008 16:24:38 +0000 (19:24 +0300)]
KVM: MMU: Add generic shadow walker

We currently walk the shadow page tables in two places: direct map (for
real mode and two dimensional paging) and paging mode shadow.  Since we
anticipate requiring a third walk (for invlpg), it makes sense to have
a generic facility for shadow walk.

This patch adds such a shadow walker, walks the page tables and calls a
method for every spte encountered.  The method can examine the spte,
modify it, or even instantiate it.  The walk can be aborted by returning
nonzero from the method.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Infer shadow root level in direct_map()
Avi Kivity [Tue, 26 Aug 2008 13:16:08 +0000 (16:16 +0300)]
KVM: MMU: Infer shadow root level in direct_map()

In all cases the shadow root level is available in mmu.shadow_root_level,
so there is no need to pass it as a parameter.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ia64: Enable virtio driver for ia64 in Kconfig
Xiantao Zhang [Tue, 26 Aug 2008 00:58:53 +0000 (08:58 +0800)]
KVM: ia64: Enable virtio driver for ia64 in Kconfig

kvm/ia64 uses the virtio drivers to optimize its I/O subsytem.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Unify direct map 4K and large page paths
Avi Kivity [Fri, 22 Aug 2008 16:14:17 +0000 (19:14 +0300)]
KVM: MMU: Unify direct map 4K and large page paths

The two paths are equivalent except for one argument, which is already
available.  Merge the two codepaths.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: MMU: Move SHADOW_PT_INDEX to mmu.c
Avi Kivity [Thu, 21 Aug 2008 14:49:56 +0000 (17:49 +0300)]
KVM: MMU: Move SHADOW_PT_INDEX to mmu.c

It is not specific to the paging mode, so can be made global (and reusable).

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: remove bad ByteOp specifier from NEG descriptor
Avi Kivity [Thu, 21 Aug 2008 14:41:39 +0000 (17:41 +0300)]
KVM: x86 emulator: remove bad ByteOp specifier from NEG descriptor

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: x86 emulator: remove duplicate SrcImm
roel kluin [Tue, 19 Aug 2008 01:25:01 +0000 (21:25 -0400)]
KVM: x86 emulator: remove duplicate SrcImm

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Load real mode segments correctly
Avi Kivity [Wed, 20 Aug 2008 12:51:42 +0000 (15:51 +0300)]
KVM: Load real mode segments correctly

Real mode segments to not reference the GDT or LDT; they simply compute
base = selector * 16.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Change segment dpl at reset to 3
Avi Kivity [Wed, 20 Aug 2008 12:48:27 +0000 (15:48 +0300)]
KVM: VMX: Change segment dpl at reset to 3

This is more emulation friendly, if not 100% correct.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Change cs reset state to be a data segment
Avi Kivity [Wed, 20 Aug 2008 12:07:31 +0000 (15:07 +0300)]
KVM: VMX: Change cs reset state to be a data segment

Real mode cs is a data segment, not a code segment.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ia64: add a dummy irq ack notification
Xiantao Zhang [Tue, 19 Aug 2008 12:48:03 +0000 (20:48 +0800)]
KVM: ia64: add a dummy irq ack notification

Before enabling notify_acked_irq for ia64, leave the related APIs as
nop-op first.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: make irq ack notifier functions static
Harvey Harrison [Mon, 11 Aug 2008 23:54:20 +0000 (16:54 -0700)]
KVM: make irq ack notifier functions static

sparse says:

arch/x86/kvm/x86.c:107:32: warning: symbol 'kvm_find_assigned_dev' was not declared. Should it be static?
arch/x86/kvm/i8254.c:225:6: warning: symbol 'kvm_pit_ack_irq' was not declared. Should it be static?

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Use kvm_set_irq to inject interrupts
Amit Shah [Mon, 18 Aug 2008 12:07:05 +0000 (15:07 +0300)]
KVM: Use kvm_set_irq to inject interrupts

... instead of using the pic and ioapic variants

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: SVM: Fix typo
Amit Shah [Mon, 18 Aug 2008 10:11:46 +0000 (13:11 +0300)]
KVM: SVM: Fix typo

Fix typo in as-yet unused macro definition.

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Modify mode switching and vmentry functions
Mohammed Gamal [Sun, 17 Aug 2008 13:42:16 +0000 (16:42 +0300)]
KVM: VMX: Modify mode switching and vmentry functions

This patch modifies mode switching and vmentry function in order to
drive invalid guest state emulation.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Add invalid guest state handler
Mohammed Gamal [Sun, 17 Aug 2008 13:47:05 +0000 (16:47 +0300)]
KVM: VMX: Add invalid guest state handler

This adds the invalid guest state handler function which invokes the x86
emulator until getting the guest to a VMX-friendly state.

[avi: leave atomic context if scheduling]
[guillaume: return to atomic context correctly]

Signed-off-by: Laurent Vivier <laurent.vivier@bull.net>
Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Add module parameter and emulation flag.
Mohammed Gamal [Sun, 17 Aug 2008 13:39:48 +0000 (16:39 +0300)]
KVM: VMX: Add module parameter and emulation flag.

The patch adds the module parameter required to enable emulating invalid
guest state, as well as the emulation_required flag used to drive
emulation whenever needed.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Add Guest State Validity Checks
Mohammed Gamal [Sun, 17 Aug 2008 13:38:32 +0000 (16:38 +0300)]
KVM: VMX: Add Guest State Validity Checks

This patch adds functions to check whether guest state is VMX compliant.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Device assignment: Check for privileges before assigning irq
Amit Shah [Wed, 13 Aug 2008 13:22:37 +0000 (16:22 +0300)]
KVM: Device assignment: Check for privileges before assigning irq

Even though we don't share irqs at the moment, we should ensure
regular user processes don't try to allocate system resources.

We check for capability to access IO devices (CAP_SYS_RAWIO) before
we request_irq on behalf of the guest.

Noticed by Avi.

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Handle spurious acks for PIT interrupts
Avi Kivity [Sun, 17 Aug 2008 13:03:46 +0000 (16:03 +0300)]
KVM: Handle spurious acks for PIT interrupts

Spurious acks can be generated, for example if the PIC is being reset.
Handle those acks gracefully rather than flooding the log with warnings.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: fix i8259 reset irq acking
Marcelo Tosatti [Thu, 14 Aug 2008 23:53:25 +0000 (20:53 -0300)]
KVM: fix i8259 reset irq acking

The irq ack during pic reset has three problems:

- Ignores slave/master PIC, using gsi 0-8 for both.
- Generates an ACK even if the APIC is in control.
- Depends upon IMR being clear, which is broken if the irq was masked
at the time it was generated.

The last one causes the BIOS to hang after the first reboot of
Windows installation, since PIT interrupts stop.

[avi: fix check whether pic interrupts are seen by cpu]

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Simplify exception entries by using __ASM_SIZE and _ASM_PTR
Avi Kivity [Thu, 14 Aug 2008 18:25:47 +0000 (21:25 +0300)]
KVM: Simplify exception entries by using __ASM_SIZE and _ASM_PTR

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Use interrupt queue for !irqchip_in_kernel
Avi Kivity [Thu, 14 Aug 2008 08:13:16 +0000 (11:13 +0300)]
KVM: VMX: Use interrupt queue for !irqchip_in_kernel

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: set debug registers after "schedulable" section
Marcelo Tosatti [Fri, 1 Aug 2008 23:09:13 +0000 (20:09 -0300)]
KVM: set debug registers after "schedulable" section

The vcpu thread can be preempted after the guest_debug_pre() callback,
resulting in invalid debug registers on the new vcpu.

Move it inside the non-preemptable section.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: remove unused field from the assigned dev struct
Ben-Ami Yassour [Tue, 5 Aug 2008 12:30:13 +0000 (15:30 +0300)]
KVM: remove unused field from the assigned dev struct

Remove unused field: struct kvm_assigned_pci_dev assigned_dev
from struct: struct kvm_assigned_dev_kernel

Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Clean up magic number 0x66 in init_rmode_tss
Sheng Yang [Wed, 13 Aug 2008 06:10:33 +0000 (14:10 +0800)]
KVM: VMX: Clean up magic number 0x66 in init_rmode_tss

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Reduce stack usage in kvm_pv_mmu_op()
Dave Hansen [Mon, 11 Aug 2008 17:01:49 +0000 (10:01 -0700)]
KVM: Reduce stack usage in kvm_pv_mmu_op()

We're in a hot path.  We can't use kmalloc() because
it might impact performance.  So, we just stick the buffer that
we need into the kvm_vcpu_arch structure.  This is used very
often, so it is not really a waste.

We also have to move the buffer structure's definition to the
arch-specific x86 kvm header.

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Reduce stack usage in kvm_arch_vcpu_ioctl()
Dave Hansen [Mon, 11 Aug 2008 17:01:47 +0000 (10:01 -0700)]
KVM: Reduce stack usage in kvm_arch_vcpu_ioctl()

[sheng: fix KVM_GET_LAPIC using wrong size]

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Reduce stack usage in kvm_vcpu_ioctl()
Dave Hansen [Mon, 11 Aug 2008 17:01:46 +0000 (10:01 -0700)]
KVM: Reduce stack usage in kvm_vcpu_ioctl()

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Reduce kvm stack usage in kvm_arch_vm_ioctl()
Dave Hansen [Mon, 11 Aug 2008 17:01:45 +0000 (10:01 -0700)]
KVM: Reduce kvm stack usage in kvm_arch_vm_ioctl()

On my machine with gcc 3.4, kvm uses ~2k of stack in a few
select functions.  This is mostly because gcc fails to
notice that the different case: statements could have their
stack usage combined.  It overflows very nicely if interrupts
happen during one of these large uses.

This patch uses two methods for reducing stack usage.
1. dynamically allocate large objects instead of putting
   on the stack.
2. Use a union{} member for all of the case variables. This
   tricks gcc into combining them all into a single stack
   allocation. (There's also a comment on this)

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: pci device assignment
Ben-Ami Yassour [Mon, 28 Jul 2008 16:26:26 +0000 (19:26 +0300)]
KVM: pci device assignment

Based on a patch from: Amit Shah <amit.shah@qumranet.com>

This patch adds support for handling PCI devices that are assigned to
the guest.

The device to be assigned to the guest is registered in the host kernel
and interrupt delivery is handled.  If a device is already assigned, or
the device driver for it is still loaded on the host, the device
assignment is failed by conveying a -EBUSY reply to the userspace.

Devices that share their interrupt line are not supported at the moment.

By itself, this patch will not make devices work within the guest.
The VT-d extension is required to enable the device to perform DMA.
Another alternative is PVDMA.

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: direct mmio pfn check
Ben-Ami Yassour [Mon, 28 Jul 2008 16:26:24 +0000 (19:26 +0300)]
KVM: direct mmio pfn check

Userspace may specify memory slots that are backed by mmio pages rather than
normal RAM.  In some cases it is not enough to identify these mmio pages
by pfn_valid().  This patch adds checking the PageReserved as well.

Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agox86: KVM guest: use paravirt function to calculate cpu khz
Glauber Costa [Mon, 28 Jul 2008 14:47:53 +0000 (11:47 -0300)]
x86: KVM guest: use paravirt function to calculate cpu khz

We're currently facing timing problems in guests that do
calibration under heavy load, and then the load vanishes.
This means we'll have a much lower lpj than we actually should,
and delays end up taking less time than they should, which is a
nasty bug.

Solution is to pass on the lpj value from host to guest, and have it
preset.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agox86: paravirt: factor out cpu_khz to common code
Glauber Costa [Mon, 28 Jul 2008 14:47:52 +0000 (11:47 -0300)]
x86: paravirt: factor out cpu_khz to common code

KVM intends to use paravirt code to calibrate khz. Xen
current code will do just fine. So as a first step, factor out
code to pvclock.c.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: PIT: fix injection logic and count
Marcelo Tosatti [Sat, 26 Jul 2008 20:01:01 +0000 (17:01 -0300)]
KVM: PIT: fix injection logic and count

The PIT injection logic is problematic under the following cases:

1) If there is a higher priority vector to be delivered by the time
kvm_pit_timer_intr_post is invoked ps->inject_pending won't be set.
This opens the possibility for missing many PIT event injections (say if
guest executes hlt at this point).

2) ps->inject_pending is racy with more than two vcpus. Since there's no locking
around read/dec of pt->pending, two vcpu's can inject two interrupts for a single
pt->pending count.

Fix 1 by using an irq ack notifier: only reinject when the previous irq
has been acked. Fix 2 with appropriate locking around manipulation of
pending count and irq_ack by the injection / ack paths.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: irq ack notification
Marcelo Tosatti [Sat, 26 Jul 2008 20:01:00 +0000 (17:01 -0300)]
KVM: irq ack notification

Based on a patch from: Ben-Ami Yassour <benami@il.ibm.com>
which was based on a patch from: Amit Shah <amit.shah@qumranet.com>

Notify IRQ acking on PIC/APIC emulation. The previous patch missed two things:

- Edge triggered interrupts on IOAPIC
- PIC reset with IRR/ISR set should be equivalent to ack (LAPIC probably
needs something similar).

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
CC: Amit Shah <amit.shah@qumranet.com>
CC: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Add irq ack notifier list
Avi Kivity [Sat, 26 Jul 2008 20:00:59 +0000 (17:00 -0300)]
KVM: Add irq ack notifier list

This can be used by kvm subsystems that are interested in when
interrupts are acked, for example time drift compensation.

Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: powerpc: Map guest userspace with TID=0 mappings
Hollis Blanchard [Fri, 25 Jul 2008 18:54:53 +0000 (13:54 -0500)]
KVM: powerpc: Map guest userspace with TID=0 mappings

When we use TID=N userspace mappings, we must ensure that kernel mappings have
been destroyed when entering userspace. Using TID=1/TID=0 for kernel/user
mappings and running userspace with PID=0 means that userspace can't access the
kernel mappings, but the kernel can directly access userspace.

The net is that we don't need to flush the TLB on privilege switches, but we do
on guest context switches (which are far more infrequent). Guest boot time
performance improvement: about 30%.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ppc: Write only modified shadow entries into the TLB on exit
Hollis Blanchard [Fri, 25 Jul 2008 18:54:52 +0000 (13:54 -0500)]
KVM: ppc: Write only modified shadow entries into the TLB on exit

Track which TLB entries need to be written, instead of overwriting everything
below the high water mark. Typically only a single guest TLB entry will be
modified in a single exit.

Guest boot time performance improvement: about 15%.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ppc: Stop saving host TLB state
Hollis Blanchard [Fri, 25 Jul 2008 18:54:51 +0000 (13:54 -0500)]
KVM: ppc: Stop saving host TLB state

We're saving the host TLB state to memory on every exit, but never using it.
Originally I had thought that we'd want to restore host TLB for heavyweight
exits, but that could actually hurt when context switching to an unrelated host
process (i.e. not qemu).

Since this decreases the performance penalty of all exits, this patch improves
guest boot time by about 15%.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: ppc: guest breakpoint support
Hollis Blanchard [Fri, 25 Jul 2008 18:54:49 +0000 (13:54 -0500)]
KVM: ppc: guest breakpoint support

Allow host userspace to program hardware debug registers to set breakpoints
inside guests.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: Ignore DEBUGCTL MSRs with no effect
Alexander Graf [Tue, 22 Jul 2008 06:00:45 +0000 (08:00 +0200)]
KVM: Ignore DEBUGCTL MSRs with no effect

Netware writes to DEBUGCTL and reads from the DEBUGCTL and LAST*IP MSRs
without further checks and is really confused to receive a #GP during that.
To make it happy we should just make them stubs, which is exactly what SVM
already does.

Writes to DEBUGCTL that are vendor-specific are resembled to behave as if the
virtual CPU does not know them.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@qumranet.com>
16 years agoKVM: VMX: Avoid vmwrite(HOST_RSP) when possible
Avi Kivity [Thu, 17 Jul 2008 15:04:30 +0000 (18:04 +0300)]
KVM: VMX: Avoid vmwrite(HOST_RSP) when possible

Usually HOST_RSP retains its value across guest entries.  Take advantage
of this and avoid a vmwrite() when this is so.

Signed-off-by: Avi Kivity <avi@qumranet.com>