]> git.karo-electronics.de Git - mv-sheeva.git/log
mv-sheeva.git
15 years agoKVM: Use kvm_{read,write}_guest_virt() to read and write segment descriptors
Mikhail Ershov [Wed, 19 Aug 2009 10:08:07 +0000 (14:08 +0400)]
KVM: Use kvm_{read,write}_guest_virt() to read and write segment descriptors

Segment descriptors tables can be placed on two non-contiguous pages.
This patch makes reading segment descriptors by linear address.

Signed-off-by: Mikhail Ershov <Mike.Ershov@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: x86 emulator: Add adc and sbb missing decoder flags
Mohammed Gamal [Tue, 18 Aug 2009 22:26:28 +0000 (01:26 +0300)]
KVM: x86 emulator: Add adc and sbb missing decoder flags

Add missing decoder flags for adc and sbb instructions
(opcodes 0x14-0x15, 0x1c-0x1d)

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Add missing #include
Avi Kivity [Sun, 16 Aug 2009 12:31:33 +0000 (15:31 +0300)]
KVM: Add missing #include

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Add __KERNEL__ guards to exported headers
Avi Kivity [Sun, 16 Aug 2009 12:31:11 +0000 (15:31 +0300)]
KVM: Add __KERNEL__ guards to exported headers

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: export kvm_para.h
Michael S. Tsirkin [Mon, 10 Aug 2009 12:59:25 +0000 (15:59 +0300)]
KVM: export kvm_para.h

kvm_para.h contains userspace interface and so
should be exported.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoDocumentation: Update KVM list email address
Amit Shah [Thu, 13 Aug 2009 14:35:48 +0000 (20:05 +0530)]
Documentation: Update KVM list email address

The KVM list moved to vger.kernel.org last year

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Rename x86_emulate.c to emulate.c
Avi Kivity [Wed, 12 Aug 2009 12:04:37 +0000 (15:04 +0300)]
KVM: Rename x86_emulate.c to emulate.c

We're in arch/x86, what could we possibly be emulating?

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: When switching to a vm8086 task, load segments as 16-bit
Anthony Liguori [Tue, 11 Aug 2009 20:57:59 +0000 (15:57 -0500)]
KVM: When switching to a vm8086 task, load segments as 16-bit

According to 16.2.5 in the SDM, eflags.vm in the tss is consulted before loading
and new segments.  If eflags.vm == 1, then the segments are treated as 16-bit
segments.  The LDTR and TR are not normally available in vm86 mode so if they
happen to somehow get loaded, they need to be treated as 32-bit segments.

This fixes an invalid vmentry failure in a custom OS that was happening after
a task switch into vm8086 mode.  Since the segments were being mistakenly
treated as 32-bit, we loaded garbage state.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: VMX: Adjust rflags if in real mode emulation
Avi Kivity [Wed, 12 Aug 2009 12:29:37 +0000 (15:29 +0300)]
KVM: VMX: Adjust rflags if in real mode emulation

We set rflags.vm86 when virtualizing real mode to do through vm8086 mode;
so we need to take it out again when reading rflags.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Move #endif KVM_CAP_IRQ_ROUTING to correct place
Avi Kivity [Mon, 10 Aug 2009 14:00:52 +0000 (17:00 +0300)]
KVM: Move #endif KVM_CAP_IRQ_ROUTING to correct place

The symbol only controls irq routing, not MSI-X.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: Drop tlb flush workaround in npt
Avi Kivity [Mon, 10 Aug 2009 12:42:41 +0000 (15:42 +0300)]
KVM: SVM: Drop tlb flush workaround in npt

It is no longer possible to reproduce the problem any more, so presumably
it has been fixed.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Update cr8 intercept when APIC TPR is changed by userspace
Gleb Natapov [Sun, 9 Aug 2009 12:17:40 +0000 (15:17 +0300)]
KVM: Update cr8 intercept when APIC TPR is changed by userspace

Since on vcpu entry we do it only if apic is enabled we should do
it when TPR is changed while apic is disabled. This happens when windows
resets HW without setting TPR to zero.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: enable nested svm by default
Joerg Roedel [Fri, 7 Aug 2009 09:49:48 +0000 (11:49 +0200)]
KVM: SVM: enable nested svm by default

Nested SVM is (in my experience) stable enough to be enabled by
default. So omit the requirement to pass a module parameter.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: check for nested VINTR flag in svm_interrupt_allowed
Joerg Roedel [Fri, 7 Aug 2009 09:49:47 +0000 (11:49 +0200)]
KVM: SVM: check for nested VINTR flag in svm_interrupt_allowed

Not checking for this flag breaks any nested hypervisor that does not
set VINTR. So fix it with this patch.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: move nested_svm_intr main logic out of if-clause
Joerg Roedel [Fri, 7 Aug 2009 09:49:46 +0000 (11:49 +0200)]
KVM: SVM: move nested_svm_intr main logic out of if-clause

This patch removes one indentation level from nested_svm_intr and
makes the logic more readable.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: remove unnecessary is_nested check from svm_cpu_run
Joerg Roedel [Fri, 7 Aug 2009 09:49:45 +0000 (11:49 +0200)]
KVM: SVM: remove unnecessary is_nested check from svm_cpu_run

This check is not necessary. We have to sync the vcpu->arch.cr2 always
back to the VMCB. This patch remove the is_nested check.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: move special nested exit handling to separate function
Joerg Roedel [Fri, 7 Aug 2009 09:49:44 +0000 (11:49 +0200)]
KVM: SVM: move special nested exit handling to separate function

This patch moves the handling for special nested vmexits like #pf to a
separate function. This makes the kvm_override parameter obsolete and
makes the code more readable.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: handle errors in vmrun emulation path appropriatly
Joerg Roedel [Fri, 7 Aug 2009 09:49:43 +0000 (11:49 +0200)]
KVM: SVM: handle errors in vmrun emulation path appropriatly

If nested svm fails to load the msrpm the vmrun succeeds with the old
msrpm which is not correct. This patch changes the logic to roll back
to host mode in case the msrpm cannot be loaded.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: remove nested_svm_do and helper functions
Joerg Roedel [Fri, 7 Aug 2009 09:49:42 +0000 (11:49 +0200)]
KVM: SVM: remove nested_svm_do and helper functions

This function is not longer required. So remove it.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: clean up nested vmrun path
Joerg Roedel [Fri, 7 Aug 2009 09:49:41 +0000 (11:49 +0200)]
KVM: SVM: clean up nested vmrun path

This patch removes the usage of nested_svm_do from the vmrun emulation
path.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: clean up nestec vmload/vmsave paths
Joerg Roedel [Fri, 7 Aug 2009 09:49:40 +0000 (11:49 +0200)]
KVM: SVM: clean up nestec vmload/vmsave paths

This patch removes the usage of nested_svm_do from the vmload and
vmsave emulation code paths.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: clean up nested_svm_exit_handled_msr
Joerg Roedel [Fri, 7 Aug 2009 09:49:39 +0000 (11:49 +0200)]
KVM: SVM: clean up nested_svm_exit_handled_msr

This patch changes nested svm to call nested_svm_exit_handled_msr
directly and not through nested_svm_do.

[alex: fix oops due to nested kmap_atomics]

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: get rid of nested_svm_vmexit_real
Joerg Roedel [Fri, 7 Aug 2009 09:49:38 +0000 (11:49 +0200)]
KVM: SVM: get rid of nested_svm_vmexit_real

This patch is the starting point of removing nested_svm_do from the
nested svm code. The nested_svm_do function basically maps two guest
physical pages to host virtual addresses and calls a passed function
on it. This function pointer code flow is hard to read and not the
best technical solution here.
As a side effect this patch indroduces the nested_svm_[un]map helper
functions.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: simplify nested_svm_check_exception
Joerg Roedel [Fri, 7 Aug 2009 09:49:37 +0000 (11:49 +0200)]
KVM: SVM: simplify nested_svm_check_exception

Makes the code of this function more readable by removing on
indentation level for the core logic.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: do nested vmexit in nested_svm_exit_handled
Joerg Roedel [Fri, 7 Aug 2009 09:49:36 +0000 (11:49 +0200)]
KVM: SVM: do nested vmexit in nested_svm_exit_handled

If this function returns true a nested vmexit is required. Move that
vmexit into the nested_svm_exit_handled function. This also simplifies
the handling of nested #pf intercepts in this function.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: consolidate nested_svm_exit_handled
Joerg Roedel [Fri, 7 Aug 2009 09:49:35 +0000 (11:49 +0200)]
KVM: SVM: consolidate nested_svm_exit_handled

When caching guest intercepts there is no need anymore for the
nested_svm_exit_handled_real function. So move its code into
nested_svm_exit_handled.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: cache nested intercepts
Joerg Roedel [Fri, 7 Aug 2009 09:49:34 +0000 (11:49 +0200)]
KVM: SVM: cache nested intercepts

When the nested intercepts are cached we don't need to call
get_user_pages and/or map the nested vmcb on every nested #vmexit to
check who will handle the intercept.
Further this patch aligns the emulated svm behavior better to real
hardware.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: move nested svm state into seperate struct
Joerg Roedel [Fri, 7 Aug 2009 09:49:33 +0000 (11:49 +0200)]
KVM: SVM: move nested svm state into seperate struct

This makes it more clear for which purpose these members in the vcpu_svm
exist.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: complete interrupts after handling nested exits
Joerg Roedel [Fri, 7 Aug 2009 09:49:32 +0000 (11:49 +0200)]
KVM: SVM: complete interrupts after handling nested exits

The interrupt completion code must run after nested exits are handled
because not injected interrupts or exceptions may be handled by the l1
guest first.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: copy only necessary parts of the control area on vmrun/vmexit
Joerg Roedel [Fri, 7 Aug 2009 09:49:31 +0000 (11:49 +0200)]
KVM: SVM: copy only necessary parts of the control area on vmrun/vmexit

The vmcb control area contains more then 800 bytes of reserved fields
which are unnecessarily copied. Fix this by introducing a copy
function which only copies the relevant part and saves time.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: optimize nested vmrun
Joerg Roedel [Fri, 7 Aug 2009 09:49:30 +0000 (11:49 +0200)]
KVM: SVM: optimize nested vmrun

Only copy the necessary parts of the vmcb save area on vmrun and save
precious time.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: optimize nested #vmexit
Joerg Roedel [Fri, 7 Aug 2009 09:49:29 +0000 (11:49 +0200)]
KVM: SVM: optimize nested #vmexit

It is more efficient to copy only the relevant parts of the vmcb back to
the nested vmcb when we emulate an vmexit.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: SVM: add helper functions for global interrupt flag
Joerg Roedel [Fri, 7 Aug 2009 09:49:28 +0000 (11:49 +0200)]
KVM: SVM: add helper functions for global interrupt flag

This patch makes the code easier to read when it comes to setting,
clearing and checking the status of the virtualized global
interrupt flag for the VCPU.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agox86: Export kmap_atomic_to_page()
Avi Kivity [Mon, 10 Aug 2009 07:41:27 +0000 (10:41 +0300)]
x86: Export kmap_atomic_to_page()

Needed by KVM.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Replace pic_lock()/pic_unlock() with direct call to spinlock functions
Gleb Natapov [Tue, 4 Aug 2009 12:30:29 +0000 (15:30 +0300)]
KVM: Replace pic_lock()/pic_unlock() with direct call to spinlock functions

They are not doing anything else now.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Call ack notifiers from PIC when guest OS acks an IRQ.
Gleb Natapov [Tue, 4 Aug 2009 12:30:28 +0000 (15:30 +0300)]
KVM: Call ack notifiers from PIC when guest OS acks an IRQ.

Currently they are called when irq vector is been delivered.  Calling ack
notifiers at this point is wrong.  Device assignment ack notifier enables
host interrupts, but guest not yet had a chance to clear interrupt
condition in a device.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Call kvm_vcpu_kick() inside pic spinlock
Gleb Natapov [Tue, 4 Aug 2009 12:30:27 +0000 (15:30 +0300)]
KVM: Call kvm_vcpu_kick() inside pic spinlock

d5ecfdd25 moved it out because back than it was impossible to
call it inside spinlock. This restriction no longer exists.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: fix EFER read buffer overflow
Roel Kluin [Tue, 4 Aug 2009 09:08:45 +0000 (02:08 -0700)]
KVM: fix EFER read buffer overflow

Check whether index is within bounds before grabbing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: ignore reads to perfctr msrs
Amit Shah [Tue, 30 Jun 2009 10:54:28 +0000 (16:24 +0530)]
KVM: ignore reads to perfctr msrs

We ignore writes to the perfctr msrs. Ignore reads as well.

Kaspersky antivirus crashes Windows guests if it can't read
these MSRs.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: VMX: Optimize vmx_get_cpl()
Avi Kivity [Tue, 4 Aug 2009 12:02:54 +0000 (15:02 +0300)]
KVM: VMX: Optimize vmx_get_cpl()

Instead of calling vmx_get_segment() (which reads a whole bunch of
vmcs fields), read only the cs selector which contains the cpl.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: x86: Disallow hypercalls for guest callers in rings > 0
Jan Kiszka [Mon, 3 Aug 2009 16:43:28 +0000 (18:43 +0200)]
KVM: x86: Disallow hypercalls for guest callers in rings > 0

So far unprivileged guest callers running in ring 3 can issue, e.g., MMU
hypercalls. Normally, such callers cannot provide any hand-crafted MMU
command structure as it has to be passed by its physical address, but
they can still crash the guest kernel by passing random addresses.

To close the hole, this patch considers hypercalls valid only if issued
from guest ring 0. This may still be relaxed on a per-hypercall base in
the future once required.

Cc: stable@kernel.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: fix bogus alloc_mmu_pages assignment
Marcelo Tosatti [Tue, 28 Jul 2009 18:26:59 +0000 (15:26 -0300)]
KVM: MMU: fix bogus alloc_mmu_pages assignment

Remove the bogus n_free_mmu_pages assignment from alloc_mmu_pages.

It breaks accounting of mmu pages, since n_free_mmu_pages is modified
but the real number of pages remains the same.

Cc: stable@kernel.org
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: make __kvm_mmu_free_some_pages handle empty list
Izik Eidus [Tue, 28 Jul 2009 18:26:58 +0000 (15:26 -0300)]
KVM: MMU: make __kvm_mmu_free_some_pages handle empty list

First check if the list is empty before attempting to look at list
entries.

Cc: stable@kernel.org
Signed-off-by: Izik Eidus <ieidus@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()
Bartlomiej Zolnierkiewicz [Tue, 28 Jul 2009 22:46:38 +0000 (00:46 +0200)]
KVM: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()

This takes care of the following entries from Dan's list:

arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable derefenced in initializer 'vcpu'
arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable derefenced before check 'vcpu'

Reported-by: Dan Carpenter <error27@gmail.com>
Cc: corbet@lwn.net
Cc: eteo@redhat.com
Cc: Julia Lawall <julia@diku.dk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: report 1GB page support to userspace
Joerg Roedel [Mon, 27 Jul 2009 14:30:48 +0000 (16:30 +0200)]
KVM: report 1GB page support to userspace

If userspace knows that the kernel part supports 1GB pages it can enable
the corresponding cpuid bit so that guests actually use GB pages.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: enable gbpages by increasing nr of pagesizes
Joerg Roedel [Mon, 27 Jul 2009 14:30:47 +0000 (16:30 +0200)]
KVM: MMU: enable gbpages by increasing nr of pagesizes

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: shadow support for 1gb pages
Joerg Roedel [Mon, 27 Jul 2009 14:30:46 +0000 (16:30 +0200)]
KVM: MMU: shadow support for 1gb pages

This patch adds support for shadow paging to the 1gb page table code in KVM.
With this code the guest can use 1gb pages even if the host does not support
them.

[ Marcelo: fix shadow page collision on pmd level if a guest 1gb page is mapped
           with 4kb ptes on host level ]

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: make page walker aware of mapping levels
Joerg Roedel [Mon, 27 Jul 2009 14:30:45 +0000 (16:30 +0200)]
KVM: MMU: make page walker aware of mapping levels

The page walker may be used with nested paging too when accessing mmio
areas.  Make it support the additional page-level too.

[ Marcelo: fix reserved bit check for 1gb pte ]

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: make direct mapping paths aware of mapping levels
Joerg Roedel [Mon, 27 Jul 2009 14:30:44 +0000 (16:30 +0200)]
KVM: MMU: make direct mapping paths aware of mapping levels

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: rename is_largepage_backed to mapping_level
Joerg Roedel [Mon, 27 Jul 2009 14:30:43 +0000 (16:30 +0200)]
KVM: MMU: rename is_largepage_backed to mapping_level

With the new name and the corresponding backend changes this function
can now support multiple hugepage sizes.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: make rmap code aware of mapping levels
Joerg Roedel [Mon, 27 Jul 2009 14:30:42 +0000 (16:30 +0200)]
KVM: MMU: make rmap code aware of mapping levels

This patch removes the largepage parameter from the rmap_add function.
Together with rmap_remove this function now uses the role.level field to
find determine if the page is a huge page.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: fix kvm_init() error handling
Xiao Guangrong [Mon, 3 Aug 2009 09:10:06 +0000 (17:10 +0800)]
KVM: fix kvm_init() error handling

Remove debugfs file if kvm_arch_init() return error

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: limit lapic periodic timer frequency
Marcelo Tosatti [Tue, 28 Jul 2009 02:41:01 +0000 (23:41 -0300)]
KVM: limit lapic periodic timer frequency

Otherwise its possible to starve the host by programming lapic timer
with a very high frequency.

Cc: stable@kernel.org
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Align cr8 threshold when userspace changes cr8
Mikhail Ershov [Mon, 3 Aug 2009 11:58:25 +0000 (14:58 +0300)]
KVM: Align cr8 threshold when userspace changes cr8

Commit f0a3602c20 ("KVM: Move interrupt injection logic to x86.c") does not
update the cr8 intercept if the lapic is disabled, so when userspace updates
cr8, the cr8 threshold control is not updated and we are left with illegal
control fields.

Fix by explicitly resetting the cr8 threshold.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: VMX: Avoid to return ENOTSUPP to userland
Jan Kiszka [Wed, 22 Jul 2009 21:53:01 +0000 (23:53 +0200)]
KVM: VMX: Avoid to return ENOTSUPP to userland

Choose some allowed error values for the cases VMX returned ENOTSUPP so
far as these values could be returned by the KVM_RUN IOCTL.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: Drop obsolete cpu_get/put in make_all_cpus_request
Jan Kiszka [Mon, 20 Jul 2009 09:30:12 +0000 (11:30 +0200)]
KVM: Drop obsolete cpu_get/put in make_all_cpus_request

spin_lock disables preemption, so we can simply read the current cpu.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: PIT: Unregister ack notifier callback when freeing
Gleb Natapov [Thu, 16 Jul 2009 14:03:30 +0000 (17:03 +0300)]
KVM: PIT: Unregister ack notifier callback when freeing

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: VMX: Introduce KVM_SET_IDENTITY_MAP_ADDR ioctl
Sheng Yang [Tue, 21 Jul 2009 02:42:48 +0000 (10:42 +0800)]
KVM: VMX: Introduce KVM_SET_IDENTITY_MAP_ADDR ioctl

Now KVM allow guest to modify guest's physical address of EPT's identity mapping page.

(change from v1, discard unnecessary check, change ioctl to accept parameter
address rather than value)

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: x86: use kvm_get_gdt() and kvm_read_ldt()
Akinobu Mita [Sat, 18 Jul 2009 15:00:01 +0000 (00:00 +0900)]
KVM: x86: use kvm_get_gdt() and kvm_read_ldt()

Use kvm_get_gdt() and kvm_read_ldt() to reduce inline assembly code.

Cc: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: x86: use get_desc_base() and get_desc_limit()
Akinobu Mita [Sat, 18 Jul 2009 14:58:32 +0000 (23:58 +0900)]
KVM: x86: use get_desc_base() and get_desc_limit()

Use get_desc_base() and get_desc_limit() to get the base address and
limit in desc_struct.

Cc: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: s390: remove unused structs
Gleb Natapov [Sun, 12 Jul 2009 14:13:29 +0000 (17:13 +0300)]
KVM: s390: remove unused structs

They are not used by common code without defines which s390 does not
have.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: MMU: fix missing locking in alloc_mmu_pages
Marcelo Tosatti [Wed, 15 Jul 2009 18:34:41 +0000 (15:34 -0300)]
KVM: MMU: fix missing locking in alloc_mmu_pages

n_requested_mmu_pages/n_free_mmu_pages are used by
kvm_mmu_change_mmu_pages to calculate the number of pages to zap.

alloc_mmu_pages, called from the vcpu initialization path, modifies this
variables without proper locking, which can result in a negative value
in kvm_mmu_change_mmu_pages (say, with cpu hotplug).

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: Discard unnecessary kvm_mmu_flush_tlb() in kvm_mmu_load()
Sheng Yang [Thu, 9 Jul 2009 09:00:42 +0000 (17:00 +0800)]
KVM: Discard unnecessary kvm_mmu_flush_tlb() in kvm_mmu_load()

set_cr3() should already cover the TLB flushing.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: silence lapic kernel messages that can be triggered by a guest
Gleb Natapov [Wed, 8 Jul 2009 08:26:54 +0000 (11:26 +0300)]
KVM: silence lapic kernel messages that can be triggered by a guest

Some Linux versions (f8) try to read EOI register that is write only.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
15 years agoKVM: Reduce runnability interface with arch support code
Gleb Natapov [Thu, 9 Jul 2009 12:33:52 +0000 (15:33 +0300)]
KVM: Reduce runnability interface with arch support code

Remove kvm_cpu_has_interrupt() and kvm_arch_interrupt_allowed() from
interface between general code and arch code. kvm_arch_vcpu_runnable()
checks for interrupts instead.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Move kvm_cpu_get_interrupt() declaration to x86 code
Gleb Natapov [Thu, 9 Jul 2009 12:33:53 +0000 (15:33 +0300)]
KVM: Move kvm_cpu_get_interrupt() declaration to x86 code

It is implemented only by x86.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Move exception handling to the same place as other events
Gleb Natapov [Thu, 9 Jul 2009 12:33:51 +0000 (15:33 +0300)]
KVM: Move exception handling to the same place as other events

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: Fix MMU_DEBUG compile breakage
Joerg Roedel [Thu, 9 Jul 2009 14:36:01 +0000 (16:36 +0200)]
KVM: MMU: Fix MMU_DEBUG compile breakage

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: add ioeventfd support
Gregory Haskins [Tue, 7 Jul 2009 21:08:49 +0000 (17:08 -0400)]
KVM: add ioeventfd support

ioeventfd is a mechanism to register PIO/MMIO regions to trigger an eventfd
signal when written to by a guest.  Host userspace can register any
arbitrary IO address with a corresponding eventfd and then pass the eventfd
to a specific end-point of interest for handling.

Normal IO requires a blocking round-trip since the operation may cause
side-effects in the emulated model or may return data to the caller.
Therefore, an IO in KVM traps from the guest to the host, causes a VMX/SVM
"heavy-weight" exit back to userspace, and is ultimately serviced by qemu's
device model synchronously before returning control back to the vcpu.

However, there is a subclass of IO which acts purely as a trigger for
other IO (such as to kick off an out-of-band DMA request, etc).  For these
patterns, the synchronous call is particularly expensive since we really
only want to simply get our notification transmitted asychronously and
return as quickly as possible.  All the sychronous infrastructure to ensure
proper data-dependencies are met in the normal IO case are just unecessary
overhead for signalling.  This adds additional computational load on the
system, as well as latency to the signalling path.

Therefore, we provide a mechanism for registration of an in-kernel trigger
point that allows the VCPU to only require a very brief, lightweight
exit just long enough to signal an eventfd.  This also means that any
clients compatible with the eventfd interface (which includes userspace
and kernelspace equally well) can now register to be notified. The end
result should be a more flexible and higher performance notification API
for the backend KVM hypervisor and perhipheral components.

To test this theory, we built a test-harness called "doorbell".  This
module has a function called "doorbell_ring()" which simply increments a
counter for each time the doorbell is signaled.  It supports signalling
from either an eventfd, or an ioctl().

We then wired up two paths to the doorbell: One via QEMU via a registered
io region and through the doorbell ioctl().  The other is direct via
ioeventfd.

You can download this test harness here:

ftp://ftp.novell.com/dev/ghaskins/doorbell.tar.bz2

The measured results are as follows:

qemu-mmio:       110000 iops, 9.09us rtt
ioeventfd-mmio: 200100 iops, 5.00us rtt
ioeventfd-pio:  367300 iops, 2.72us rtt

I didn't measure qemu-pio, because I have to figure out how to register a
PIO region with qemu's device model, and I got lazy.  However, for now we
can extrapolate based on the data from the NULLIO runs of +2.56us for MMIO,
and -350ns for HC, we get:

qemu-pio:      153139 iops, 6.53us rtt
ioeventfd-hc: 412585 iops, 2.37us rtt

these are just for fun, for now, until I can gather more data.

Here is a graph for your convenience:

http://developer.novell.com/wiki/images/7/76/Iofd-chart.png

The conclusion to draw is that we save about 4us by skipping the userspace
hop.

--------------------

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: make io_bus interface more robust
Gregory Haskins [Tue, 7 Jul 2009 21:08:44 +0000 (17:08 -0400)]
KVM: make io_bus interface more robust

Today kvm_io_bus_regsiter_dev() returns void and will internally BUG_ON
if it fails.  We want to create dynamic MMIO/PIO entries driven from
userspace later in the series, so we need to enhance the code to be more
robust with the following changes:

   1) Add a return value to the registration function
   2) Fix up all the callsites to check the return code, handle any
      failures, and percolate the error up to the caller.
   3) Add an unregister function that collapses holes in the array

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: add module parameters documentation
Andre Przywara [Fri, 10 Jul 2009 12:20:35 +0000 (14:20 +0200)]
KVM: add module parameters documentation

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: PIT support for HPET legacy mode
Beth Kon [Tue, 7 Jul 2009 15:50:38 +0000 (11:50 -0400)]
KVM: PIT support for HPET legacy mode

When kvm is in hpet_legacy_mode, the hpet is providing the timer
interrupt and the pit should not be. So in legacy mode, the pit timer
is destroyed, but the *state* of the pit is maintained. So if kvm or
the guest tries to modify the state of the pit, this modification is
accepted, *except* that the timer isn't actually started. When we exit
hpet_legacy_mode, the current state of the pit (which is up to date
since we've been accepting modifications) is used to restart the pit
timer.

The saved_mode code in kvm_pit_load_count temporarily changes mode to
0xff in order to destroy the timer, but then restores the actual
value, again maintaining "current" state of the pit for possible later
reenablement.

[avi: add some reserved storage in the ioctl; make SET_PIT2 IOW]
[marcelo: fix memory corruption due to reserved storage]

Signed-off-by: Beth Kon <eak@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Always report x2apic as supported feature
Gleb Natapov [Sun, 12 Jul 2009 13:10:55 +0000 (16:10 +0300)]
KVM: Always report x2apic as supported feature

We emulate x2apic in software, so host support is not required.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: No need to kick cpu if not in a guest mode
Gleb Natapov [Tue, 7 Jul 2009 12:27:32 +0000 (15:27 +0300)]
KVM: No need to kick cpu if not in a guest mode

This will save a couple of IPIs.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Add trace points in irqchip code
Gleb Natapov [Tue, 7 Jul 2009 13:00:57 +0000 (16:00 +0300)]
KVM: Add trace points in irqchip code

Add tracepoint in msi/ioapic/pic set_irq() functions,
in IPI sending and in the point where IRQ is placed into
apic's IRR.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: ignore msi request if !level
Michael S. Tsirkin [Sun, 5 Jul 2009 18:27:58 +0000 (21:27 +0300)]
KVM: ignore msi request if !level

Irqfd sets level for interrupt to 1 and then to 0.
For MSI, check level so that a single message is sent.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: fix MMIO_CONF_BASE MSR access
Andre Przywara [Thu, 2 Jul 2009 13:04:14 +0000 (15:04 +0200)]
KVM: fix MMIO_CONF_BASE MSR access

Some Windows versions check whether the BIOS has setup MMI/O for
config space accesses on AMD Fam10h CPUs, we say "no" by returning 0 on
reads and only allow disabling of MMI/O CfgSpace setup by igoring "0" writes.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Trace shadow page lifecycle
Avi Kivity [Mon, 6 Jul 2009 12:58:14 +0000 (15:58 +0300)]
KVM: Trace shadow page lifecycle

Create, sync, unsync, zap.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Document basic API
Avi Kivity [Tue, 9 Jun 2009 09:37:58 +0000 (12:37 +0300)]
KVM: Document basic API

Document the basic API corresponding to the 2.6.22 release.

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: MMU: Trace guest pagetable walker
Avi Kivity [Mon, 6 Jul 2009 09:21:32 +0000 (12:21 +0300)]
KVM: MMU: Trace guest pagetable walker

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoRevert "KVM: x86: check for cr3 validity in ioctl_set_sregs"
Jan Kiszka [Wed, 1 Jul 2009 18:52:03 +0000 (20:52 +0200)]
Revert "KVM: x86: check for cr3 validity in ioctl_set_sregs"

This reverts commit 6c20e1442bb1c62914bb85b7f4a38973d2a423ba.

To my understanding, it became obsolete with the advent of the more
robust check in mmu_alloc_roots (89da4ff17f). Moreover, it prevents
the conceptually safe pattern

 1. set sregs
 2. register mem-slots
 3. run vcpu

by setting a sticky triple fault during step 1.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: handle AMD microcode MSR
Andre Przywara [Fri, 3 Jul 2009 14:00:14 +0000 (16:00 +0200)]
KVM: handle AMD microcode MSR

Windows 7 tries to update the CPU's microcode on some processors,
so we ignore the MSR write here. The patchlevel register is already handled
(returning 0), because the MSR number is the same as Intel's.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Fix apic_mmio_write return for unaligned write
Sheng Yang [Mon, 6 Jul 2009 03:05:39 +0000 (11:05 +0800)]
KVM: Fix apic_mmio_write return for unaligned write

Some in-famous OS do unaligned writing for APIC MMIO, and the return value
has been missed in recent change, then the OS hangs.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Use temporary variable to shorten lines.
Gleb Natapov [Sun, 5 Jul 2009 15:48:12 +0000 (18:48 +0300)]
KVM: Use temporary variable to shorten lines.

Cosmetic only. No logic is changed by this patch.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: x2apic interface to lapic
Gleb Natapov [Sun, 5 Jul 2009 14:39:36 +0000 (17:39 +0300)]
KVM: x2apic interface to lapic

This patch implements MSR interface to local apic as defines by x2apic
Intel specification.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Add Directed EOI support to APIC emulation
Gleb Natapov [Sun, 5 Jul 2009 14:39:35 +0000 (17:39 +0300)]
KVM: Add Directed EOI support to APIC emulation

Directed EOI is specified by x2APIC, but is available even when lapic is
in xAPIC mode.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Trace apic registers using their symbolic names
Avi Kivity [Wed, 1 Jul 2009 15:25:44 +0000 (18:25 +0300)]
KVM: Trace apic registers using their symbolic names

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Trace mmio
Avi Kivity [Wed, 1 Jul 2009 13:01:02 +0000 (16:01 +0300)]
KVM: Trace mmio

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Ignore PCI ECS I/O enablement
Andre Przywara [Wed, 24 Jun 2009 13:37:05 +0000 (15:37 +0200)]
KVM: Ignore PCI ECS I/O enablement

Linux guests will try to enable access to the extended PCI config space
via the I/O ports 0xCF8/0xCFC on AMD Fam10h CPU. Since we (currently?)
don't use ECS, simply ignore write and read attempts.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Trace irq level and source id
Avi Kivity [Wed, 1 Jul 2009 09:09:41 +0000 (12:09 +0300)]
KVM: Trace irq level and source id

Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: fix lock imbalance
Jiri Slaby [Mon, 29 Jun 2009 16:05:10 +0000 (18:05 +0200)]
KVM: fix lock imbalance

There is a missing unlock on one fail path in ioapic_mmio_write,
fix that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: document lock nesting rule
Michael S. Tsirkin [Mon, 29 Jun 2009 19:24:45 +0000 (22:24 +0300)]
KVM: document lock nesting rule

Document kvm->lock nesting within kvm->slots_lock

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: remove in_range from io devices
Michael S. Tsirkin [Mon, 29 Jun 2009 19:24:32 +0000 (22:24 +0300)]
KVM: remove in_range from io devices

This changes bus accesses to use high-level kvm_io_bus_read/kvm_io_bus_write
functions. in_range now becomes unused so it is removed from device ops in
favor of read/write callbacks performing range checks internally.

This allows aliasing (mostly for in-kernel virtio), as well as better error
handling by making it possible to pass errors up to userspace.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: convert bus to slots_lock
Michael S. Tsirkin [Mon, 29 Jun 2009 19:24:26 +0000 (22:24 +0300)]
KVM: convert bus to slots_lock

Use slots_lock to protect device list on the bus.  slots_lock is already
taken for read everywhere, so we only need to take it for write when
registering devices.  This is in preparation to removing in_range and
kvm->lock around it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: switch pit creation to slots_lock
Michael S. Tsirkin [Mon, 29 Jun 2009 19:24:21 +0000 (22:24 +0300)]
KVM: switch pit creation to slots_lock

switch pit creation to slots_lock. slots_lock is already taken for read
everywhere, so we only need to take it for write when creating pit.
This is in preparation to removing in_range and kvm->lock around it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: switch coalesced mmio changes to slots_lock
Michael S. Tsirkin [Mon, 29 Jun 2009 19:24:14 +0000 (22:24 +0300)]
KVM: switch coalesced mmio changes to slots_lock

switch coalesced mmio slots_lock.  slots_lock is already taken for read
everywhere, so we only need to take it for write when changing zones.
This is in preparation to removing in_range and kvm->lock around it.

[avi: fix build]

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: document locking for kvm_io_device_ops
Michael S. Tsirkin [Mon, 29 Jun 2009 19:24:07 +0000 (22:24 +0300)]
KVM: document locking for kvm_io_device_ops

slots_lock is taken everywhere when device ops are called.
Document this as we will use this to rework locking for io.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: use vcpu_id instead of bsp_vcpu pointer in kvm_vcpu_is_bsp
Marcelo Tosatti [Wed, 17 Jun 2009 13:07:59 +0000 (10:07 -0300)]
KVM: use vcpu_id instead of bsp_vcpu pointer in kvm_vcpu_is_bsp

Change kvm_vcpu_is_bsp to use vcpu_id instead of bsp_vcpu pointer, which
is only initialized at the end of kvm_vm_ioctl_create_vcpu.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: remove old KVMTRACE support code
Marcelo Tosatti [Thu, 18 Jun 2009 14:47:28 +0000 (11:47 -0300)]
KVM: remove old KVMTRACE support code

Return EOPNOTSUPP for KVM_TRACE_ENABLE/PAUSE/DISABLE ioctls.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: powerpc: convert marker probes to event trace
Marcelo Tosatti [Thu, 18 Jun 2009 14:47:27 +0000 (11:47 -0300)]
KVM: powerpc: convert marker probes to event trace

[avi: make it build]
[avi: fold trace-arch.h into trace.h]

CC: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>