aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
Commit message (Collapse)AuthorAge
...
| * KVM: x86: Use macros for x86_emulate_ops to avoid future mistakesTakuya Yoshikawa2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The return values from x86_emulate_ops are defined in kvm_emulate.h as macros X86EMUL_*. But in emulate.c, we are comparing the return values from these ops with 0 to check if they're X86EMUL_CONTINUE or not: X86EMUL_CONTINUE is defined as 0 now. To avoid possible mistakes in the future, this patch substitutes "X86EMUL_CONTINUE" for "0" that are being compared with the return values from x86_emulate_ops. We think that there are more places we should use these macros, but the meanings of rc values in x86_emulate_insn() were not so clear at a glance. If we use proper macros in this function, we would be able to follow the flow of each emulation more easily and, maybe, more securely. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: fix cleanup_srcu_struct on vm destructionMarcelo Tosatti2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cleanup_srcu_struct on VM destruction remains broken: BUG: unable to handle kernel paging request at ffffffffffffffff IP: [<ffffffff802533d2>] srcu_read_lock+0x16/0x21 RIP: 0010:[<ffffffff802533d2>] [<ffffffff802533d2>] srcu_read_lock+0x16/0x21 Call Trace: [<ffffffffa05354c4>] kvm_arch_vcpu_uninit+0x1b/0x48 [kvm] [<ffffffffa05339c6>] kvm_vcpu_uninit+0x9/0x15 [kvm] [<ffffffffa0569f7d>] vmx_free_vcpu+0x7f/0x8f [kvm_intel] [<ffffffffa05357b5>] kvm_arch_destroy_vm+0x78/0x111 [kvm] [<ffffffffa053315b>] kvm_put_kvm+0xd4/0xfe [kvm] Move it to kvm_arch_destroy_vm. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
| * KVM: fix Hyper-V hypercall warnings and wrong mask valueGleb Natapov2010-03-01
| | | | | | | | | | | | | | Fix compilation warnings and wrong mask value. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: VMX: Remove emulation failure reportSheng Yang2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Avi noted: >There are two problems with the kernel failure report. First, it >doesn't report enough data - registers, surrounding instructions, etc. >that are needed to explain what is going on. Second, it can flood >dmesg, which is a pretty bad thing to do. So we remove the emulation failure report in handle_invalid_guest_state(), and would inspected the guest using userspace tool in the future. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: rename is_writeble_pte() to is_writable_pte()Takuya Yoshikawa2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two spellings of "writable" in arch/x86/kvm/mmu.c and paging_tmpl.h . This patch renames is_writeble_pte() to is_writable_pte() and makes grepping easy. New name is consistent with the definition of itself: return pte & PT_WRITABLE_MASK; Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Implement NotifyLongSpinWait HYPER-V hypercallGleb Natapov2010-03-01
| | | | | | | | | | | | | | | | | | Windows issues this hypercall after guest was spinning on a spinlock for too many iterations. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Add HYPER-V apic access MSRsGleb Natapov2010-03-01
| | | | | | | | | | | | | | | | | | Implement HYPER-V apic MSRs. Spec defines three MSRs that speed-up access to EOI/TPR/ICR apic registers for PV guests. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Implement bare minimum of HYPER-V MSRsGleb Natapov2010-03-01
| | | | | | | | | | | | | | | | | | | | | | Minimum HYPER-V implementation should have GUEST_OS_ID, HYPERCALL and VP_INDEX MSRs. [avi: fix build on i386] Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: SVM: Lazy fpu with nptAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | Now that we can allow the guest to play with cr0 when the fpu is loaded, we can enable lazy fpu when npt is in use. Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: SVM: Selective cr0 interceptAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If two conditions apply: - no bits outside TS and EM differ between the host and guest cr0 - the fpu is active then we can activate the selective cr0 write intercept and drop the unconditional cr0 read and write intercept, and allow the guest to run with the host fpu state. This reduces cr0 exits due to guest fpu management while the guest fpu is loaded. Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: SVM: Restore unconditional cr0 intercept under nptAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | | | Currently we don't intercept cr0 at all when npt is enabled. This improves performance but requires us to activate the fpu at all times. Remove this behaviour in preparation for adding selective cr0 intercepts. Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: SVM: Initialize fpu_active in init_vmcb()Avi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | init_vmcb() sets up the intercepts as if the fpu is active, so initialize it there. This avoids an INIT from setting up intercepts inconsistent with fpu_active. Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Set cr0.et when the guest writes cr0Avi Kivity2010-03-01
| | | | | | | | | | | | Follow the hardware. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Give the guest ownership of cr0.ts when the fpu is activeAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | If the guest fpu is loaded, there is nothing interesing about cr0.ts; let the guest play with it as it will. This makes context switches between fpu intensive guest processes faster, as we won't trap the clts and cr0 write instructions. [marcelo: fix cr0 read shadow update on fpu deactivation; kills F8 install] Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: Lazify fpu activation and deactivationAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | | | | | Defer fpu deactivation as much as possible - if the guest fpu is loaded, keep it loaded until the next heavyweight exit (where we are forced to unload it). This reduces unnecessary exits. We also defer fpu activation on clts; while clts signals the intent to use the fpu, we can't be sure the guest will actually use it. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Allow the guest to own some cr0 bitsAvi Kivity2010-03-01
| | | | | | | | | | | | We will use this later to give the guest ownership of cr0.ts. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Replace read accesses of vcpu->arch.cr0 by an accessorAvi Kivity2010-03-01
| | | | | | | | | | | | | | Since we'd like to allow the guest to own a few bits of cr0 at times, we need to know when we access those bits. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: trace clts and lmsw instructions as cr accessesAvi Kivity2010-03-01
| | | | | | | | | | | | clts writes cr0.ts; lmsw writes cr0[0:15] - record that in ftrace. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Enable EPT 1GB page supportSheng Yang2010-03-01
| | | | | | | | | | Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: x86: Rename gb_page_enable() to get_lpage_level() in kvm_x86_opsSheng Yang2010-03-01
| | | | | | | | | | | | | | | | | | | | Then the callback can provide the maximum supported large page level, which is more flexible. Also move the gb page support into x86_64 specific. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: x86: Moving PT_*_LEVEL to mmu.hSheng Yang2010-03-01
| | | | | | | | | | | | | | We can use them in x86.c and vmx.c now... Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: Fill out ftrace exit reason stringsAvi Kivity2010-03-01
| | | | | | | | | | | | | | Some exit reasons missed their strings; fill out the table. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: convert slots_lock to a mutexMarcelo Tosatti2010-03-01
| | | | | | | | Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: switch vcpu context to use SRCUMarcelo Tosatti2010-03-01
| | | | | | | | Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: convert io_bus to SRCUMarcelo Tosatti2010-03-01
| | | | | | | | Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: x86: switch kvm_set_memory_alias to SRCU updateMarcelo Tosatti2010-03-01
| | | | | | | | | | | | Using a similar two-step procedure as for memslots. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: use SRCU for dirty logMarcelo Tosatti2010-03-01
| | | | | | | | Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: introduce kvm->srcu and convert kvm_set_memory_region to SRCU updateMarcelo Tosatti2010-03-01
| | | | | | | | | | | | | | | | | | | | Use two steps for memslot deletion: mark the slot invalid (which stops instantiation of new shadow pages for that slot, but allows destruction), then instantiate the new empty slot. Also simplifies kvm_handle_hva locking. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: split kvm_arch_set_memory_region into prepare and commitMarcelo Tosatti2010-03-01
| | | | | | | | | | | | Required for SRCU convertion later. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: modify alias layout in x86s struct kvm_archMarcelo Tosatti2010-03-01
| | | | | | | | | | | | Have a pointer to an allocated region inside x86's kvm_arch. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: modify memslots layout in struct kvmMarcelo Tosatti2010-03-01
| | | | | | | | | | | | | | | | | | Have a pointer to an allocated region inside struct kvm. [alex: fix ppc book 3s] Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: Add KVM_MMIO kconfig itemAvi Kivity2010-03-01
| | | | | | | | | | | | s390 doesn't have mmio, this will simplify ifdefing it out. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: SVM: Adjust tsc_offset only if tsc_unstableJoerg Roedel2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | The tsc_offset adjustment in svm_vcpu_load is executed unconditionally even if Linux considers the host tsc as stable. This causes a Linux guest detecting an unstable tsc in any case. This patch removes the tsc_offset adjustment if the host tsc is stable. The guest will now get the benefit of a stable tsc too. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Add instruction rdtscp support for guestSheng Yang2010-03-01
| | | | | | | | | | | | | | Before enabling, execution of "rdtscp" in guest would result in #UD. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Add cpuid_update() callback to kvm_x86_opsSheng Yang2010-03-01
| | | | | | | | | | | | | | | | | | | | | | Sometime, we need to adjust some state in order to reflect guest CPUID setting, e.g. if we don't expose rdtscp to guest, we won't want to enable it on hardware. cpuid_update() is introduced for this purpose. Also export kvm_find_cpuid_entry() for later use. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Extended shared_msr_global to per CPUSheng Yang2010-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | shared_msr_global saved host value of relevant MSRs, but it have an assumption that all MSRs it tracked shared the value across the different CPUs. It's not true with some MSRs, e.g. MSR_TSC_AUX. Extend it to per CPU to provide the support of MSR_TSC_AUX, and more alike MSRs. Notice now the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Remove redundant variableSheng Yang2010-03-01
| | | | | | | | | | | | | | It's no longer necessary. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Fold ept_update_paging_mode_cr4() into its callerAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | | | ept_update_paging_mode_cr4() accesses vcpu->arch.cr4 directly, which usually needs to be accessed via kvm_read_cr4(). In this case, we can't, since cr4 is in the process of being updated. Instead of adding inane comments, fold the function into its caller (vmx_set_cr4), so it can use the not-yet-committed cr4 directly. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: When using ept, allow the guest to own cr4.pgeAvi Kivity2010-03-01
| | | | | | | | | | | | | | We make no use of cr4.pge if ept is enabled, but the guest does (to flush global mappings, as with vmap()), so give the guest ownership of this bit. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Make guest cr4 mask more conservativeAvi Kivity2010-03-01
| | | | | | | | | | | | | | | | Instead of specifying the bits which we want to trap on, specify the bits which we allow the guest to change transparently. This is safer wrt future changes to cr4. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: Add accessor for reading cr4 (or some bits of cr4)Avi Kivity2010-03-01
| | | | | | | | | | | | | | | | | | | | | | Some bits of cr4 can be owned by the guest on vmx, so when we read them, we copy them to the vcpu structure. In preparation for making the set of guest-owned bits dynamic, use helpers to access these bits so we don't need to know where the bit resides. No changes to svm since all bits are host-owned there. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Move some cr[04] related constants to vmx.cAvi Kivity2010-03-01
| | | | | | | | | | | | They have no place in common code. Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: VMX: Trap and invalid MWAIT/MONITOR instructionSheng Yang2010-03-01
| | | | | | | | | | | | | | | | | | | | We don't support these instructions, but guest can execute them even if the feature('monitor') haven't been exposed in CPUID. So we would trap and inject a #UD if guest try this way. Cc: stable@kernel.org Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: MMU: Report spte not found in rmap before BUG()Avi Kivity2010-03-01
| | | | | | | | | | | | | | In the past we've had errors of single-bit in the other two cases; the printk() may confirm it for the third case (many->many). Signed-off-by: Avi Kivity <avi@redhat.com>
| * KVM: x86: raise TSS exception for NULL CS and SS segmentsMarcelo Tosatti2010-03-01
| | | | | | | | | | | | | | Windows 2003 uses task switch to triple fault and reboot (the other exception being reserved pdptrs bits). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: x86: make double/triple fault promotion generic to all exceptionsEddie Dong2010-03-01
| | | | | | | | | | | | | | | | | | Move Double-Fault generation logic out of page fault exception generating function to cover more generic case. Signed-off-by: Eddie Dong <eddie.dong@intel.com> Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* | Merge branch 'master' of ↵David S. Miller2010-02-17
|\| | | | | | | master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
| * KVM: PIT: control word is write-onlyMarcelo Tosatti2010-02-09
| | | | | | | | | | | | | | PIT control word (address 0x43) is write-only, reads are undefined. Cc: stable@kernel.org Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * kvmclock: count total_sleep_time when updating guest clockJason Wang2010-02-09
| | | | | | | | | | | | | | | | | | | | | | Current kvm wallclock does not consider the total_sleep_time which could cause wrong wallclock in guest after host suspend/resume. This patch solve this issue by counting total_sleep_time to get the correct host boot time. Cc: stable@kernel.org Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * KVM: x86: Fix leak of free lapic date in kvm_arch_vcpu_init()Wei Yongjun2010-01-25
| | | | | | | | | | | | | | | | | | | | In function kvm_arch_vcpu_init(), if the memory malloc for vcpu->arch.mce_banks is fail, it does not free the memory of lapic date. This patch fixed it. Cc: stable@kernel.org Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>