summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | KVM: x86: Rework request for immediate exitJan Kiszka2013-04-285-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | The VMX implementation of enable_irq_window raised KVM_REQ_IMMEDIATE_EXIT after we checked it in vcpu_enter_guest. This caused infinite loops on vmentry. Fix it by letting enable_irq_window signal the need for an immediate exit via its return value and drop KVM_REQ_IMMEDIATE_EXIT. This issue only affects nested VMX scenarios. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | kvm, svm: Fix typo in printk messageBorislav Petkov2013-04-281-1/+1
| | | | | | | | | | | | | | | | It is "exit_int_info". It is actually EXITINTINFO in the official docs but we don't like screaming docs. Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: VMX: remove unprintable characters from commentJan Kiszka2013-04-281-1/+1
| | | | | | | | | | | | | | Slipped in while copy&pasting from the SDM. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | Merge branch 'kvm-arm-cleanup' from git://github.com/columbia/linux-kvm-arm.gitGleb Natapov2013-04-2519-387/+585
|\ \ | |/ |/|
| * ARM: KVM: Fix length of mmio accessMarc Zyngier2013-03-061-3/+4
| | | | | | | | | | | | | | | | | | | | | | Instead of hardcoding the maximum MMIO access to be 4 bytes, compare it to sizeof(unsigned long), which will do the right thing on both 32 and 64bit systems. Same thing for sign extention. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: sanitize freeing of HYP page tablesMarc Zyngier2013-03-061-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | Instead of trying to free everything from PAGE_OFFSET to the top of memory, use the virt_addr_valid macro to check the upper limit. Also do the same for the vmalloc region where the IO mappings are allocated. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: move kvm_handle_wfi to handle_exit.cMarc Zyngier2013-03-063-17/+19
| | | | | | | | | | | | It has little to do in emulate.c these days... Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: change kvm_tlb_flush_vmid to kvm_tlb_flush_vmid_ipaMarc Zyngier2013-03-063-8/+11
| | | | | | | | | | | | | | | | | | | | | | v8 is capable of invalidating Stage-2 by IPA, but v7 is not. Change kvm_tlb_flush_vmid() to take an IPA parameter, which is then ignored by the invalidation code (and nuke the whole TLB as it always did). This allows v8 to implement a more optimized strategy. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: move include of asm/idmap.h to kvm_mmu.hMarc Zyngier2013-03-062-1/+1
| | | | | | | | | | | | | | Since the arm64 code doesn't have a global asm/idmap.h file, move the inclusion to asm/kvm_mmu.h. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: vgic: decouple alignment restriction from page sizeMarc Zyngier2013-03-061-1/+1
| | | | | | | | | | | | | | | | | | The virtual GIC is supposed to be 4kB aligned. On a 64kB page system, comparing the alignment to PAGE_SIZE is wrong. Use SZ_4K instead. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: fix fault_ipa computingMarc Zyngier2013-03-061-2/+7
| | | | | | | | | | | | | | | | | | | | | | The ARM ARM says that HPFAR reports bits [39:12] of the faulting IPA, and we need to complement it with the bottom 12 bits of the faulting VA. This is always 12 bits, irrespective of the page size. Makes it clearer in the code. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: move kvm_target_cpu to guest.cMarc Zyngier2013-03-062-17/+17
| | | | | | | | | | | | | | guest.c already contains some target-specific checks. Let's move kvm_target_cpu() over there so arm.c is mostly target agnostic. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: fix address validation for HYP mappingsMarc Zyngier2013-03-061-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __create_hyp_mappings() performs some kind of address validation before creating the mapping, by verifying that the start address is above PAGE_OFFSET. This check is not completely correct for kernel memory (the upper boundary has to be checked as well so we do not end up with highmem pages), and wrong for IO mappings (the mapping must exist in the vmalloc region). Fix this by using the proper predicates (virt_addr_valid and is_vmalloc_addr), which also work correctly on ARM64 (where the vmalloc region is below PAGE_OFFSET). Also change the BUG_ON() into a less agressive error return. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: allow HYP mappings to be at an offset from kernel mappingsMarc Zyngier2013-03-062-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arm64 cannot represent the kernel VAs in HYP mode, because of the lack of TTBR1 at EL2. A way to cope with this situation is to have HYP VAs to be an offset from the kernel VAs. Introduce macros to convert a kernel VA to a HYP VA, make the HYP mapping functions use these conversion macros. Also change the documentation to reflect the existence of the offset. On ARM, where we can have an identity mapping between kernel and HYP, the macros are without any effect. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: use kvm_kernel_vfp_t as an abstract type for VFP containersMarc Zyngier2013-03-062-5/+7
| | | | | | | | | | | | | | In order to keep the VFP allocation code common, use an abstract type for the VFP containers. Maps onto struct vfp_hard_struct on ARM. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: move hyp init to kvm_host.hMarc Zyngier2013-03-062-11/+20
| | | | | | | | | | | | | | Make the split of the pgd_ptr an implementation specific thing by moving the init call to an inline function. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: remove superfluous include from kvm_vgic.hMarc Zyngier2013-03-061-1/+0
| | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: abstract most MMU operationsMarc Zyngier2013-03-062-46/+70
| | | | | | | | | | | | | | Move low level MMU-related operations to kvm_mmu.h. This makes the MMU code reusable by the arm64 port. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * KVM: ARM: Reintroduce trace_kvm_hvcChristoffer Dall2013-03-062-0/+10
| | | | | | | | | | | | | | This one got lost in the move to handle_exit, so let's reintroduce it using an accessor to the immediate value field like the other ones. Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: move exit handler selection to a separate fileMarc Zyngier2013-03-064-114/+144
| | | | | | | | | | | | | | | | | | | | The exit handler selection code cannot be shared with arm64 (two different modes, more exception classes...). Move it to a separate file (handle_exit.c). Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: move kvm_condition_valid to emulate.cMarc Zyngier2013-03-063-45/+46
| | | | | | | | | | | | | | This is really hardware emulation, and as such it better be with its little friends. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: abstract HSR_EC_IABT awayMarc Zyngier2013-03-062-5/+8
| | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: abstract fault decoding awayMarc Zyngier2013-03-062-1/+6
| | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: abstract exception class decoding awayMarc Zyngier2013-03-063-3/+8
| | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: abstract IL decoding awayMarc Zyngier2013-03-064-4/+9
| | | | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract SAS decoding awayMarc Zyngier2013-03-062-14/+19
| | | | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract S1TW abort detection awayMarc Zyngier2013-03-063-1/+7
| | | | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract (and fix) external abort detection awayMarc Zyngier2013-03-063-1/+9
| | | | | | | | | | | | | | Bit 8 is cache maintenance, bit 9 is external abort. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract HSR_SRT_{MASK,SHIFT} awayMarc Zyngier2013-03-062-1/+6
| | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: abstract HSR_SSE awayMarc Zyngier2013-03-062-1/+6
| | | | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract HSR_WNR awayMarc Zyngier2013-03-062-1/+6
| | | | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract HSR_ISV awayMarc Zyngier2013-03-062-1/+6
| | | | | | | | | | Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
| * ARM: KVM: abstract fault register accessesMarc Zyngier2013-03-067-55/+78
| | | | | | | | | | | | | | Instead of directly accessing the fault registers, use proper accessors so the core code can be shared. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * ARM: KVM: convert GP registers from u32 to unsigned longMarc Zyngier2013-03-066-28/+28
| | | | | | | | | | | | | | | | | | | | | | On 32bit ARM, unsigned long is guaranteed to be a 32bit quantity. On 64bit ARM, it is a 64bit quantity. In order to be able to share code between the two architectures, convert the registers to be unsigned long, so the core code can be oblivious of the change. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
| * KVM: ARM: Fix wrong address in commentJonghwan Choi2013-03-061-2/+2
| | | | | | | | | | | | | | hyp_hvc vector offset is 0x14 and hyp_svc vector offset is 0x8. Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
* | KVM: X86 emulator: fix source operand decoding for 8bit mov[zs]x instructionsGleb Natapov2013-04-251-0/+4
| | | | | | | | | | | | | | | | Source operand for one byte mov[zs]x is decoded incorrectly if it is in high byte register. Fix that. Cc: stable@vger.kernel.org Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: VM_ENTRY/EXIT_LOAD_IA32_EFER overrides EFER.LMA settingsJan Kiszka2013-04-221-2/+2
| | | | | | | | | | | | | | | | | | | | If we load the complete EFER MSR on entry or exit, EFER.LMA (and LME) loading is skipped. Their consistency is already checked now before starting the transition. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Validate EFER values for VM_ENTRY/EXIT_LOAD_IA32_EFERJan Kiszka2013-04-223-10/+60
| | | | | | | | | | | | | | | | | | | | | | As we may emulate the loading of EFER on VM-entry and VM-exit, implement the checks that VMX performs on the guest and host values on vmlaunch/ vmresume. Factor out kvm_valid_efer for this purpose which checks for set reserved bits. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Fix conditions for NMI injectionJan Kiszka2013-04-221-0/+26
| | | | | | | | | | | | | | | | | | The logic for checking if interrupts can be injected has to be applied also on NMIs. The difference is that if NMI interception is on these events are consumed and blocked by the VM exit. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: VMX: Move vmx_nmi_allowed after vmx_set_nmi_maskJan Kiszka2013-04-221-10/+10
| | | | | | | | | | | | | | | | vmx_set_nmi_mask will soon be used by vmx_nmi_allowed. No functional changes. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: x86: Fix memory leak in vmx.cAndrew Honig2013-04-221-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If userspace creates and destroys multiple VMs within the same process we leak 20k of memory in the userspace process context per VM. This patch frees the memory in kvm_arch_destroy_vm. If the process exits without closing the VM file descriptor or the file descriptor has been shared with another process then we don't free the memory. It's still possible for a user space process to leak memory if the last process to close the fd for the VM is not the process that created it. However, this is an unexpected case that's only caused by a user space process that's misbehaving. Signed-off-by: Andrew Honig <ahonig@google.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: x86: fix error return code in kvm_arch_vcpu_init()Wei Yongjun2013-04-221-1/+3
| | | | | | | | | | | | | | | | | | Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Enable and disable shadow vmcs functionalityAbel Gordon2013-04-221-0/+11
| | | | | | | | | | | | | | | | | | | | Once L1 loads VMCS12 we enable shadow-vmcs capability and copy all the VMCS12 shadowed fields to the shadow vmcs. When we release the VMCS12, we also disable shadow-vmcs capability. Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Synchronize VMCS12 content with the shadow vmcsAbel Gordon2013-04-221-0/+32
| | | | | | | | | | | | | | | | | | Synchronize between the VMCS12 software controlled structure and the processor-specific shadow vmcs Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcsAbel Gordon2013-04-221-0/+45
| | | | | | | | | | | | | | | | | | Introduce a function used to copy fields from the software controlled VMCS12 to the processor-specific shadow vmcs Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12Abel Gordon2013-04-221-0/+35
| | | | | | | | | | | | | | | | | | Introduce a function used to copy fields from the processor-specific shadow vmcs to the software controlled VMCS12 Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Release shadow vmcsAbel Gordon2013-04-221-8/+12
| | | | | | | | | | | | | | | | Unmap vmcs12 and release the corresponding shadow vmcs Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Allocate shadow vmcsAbel Gordon2013-04-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | Allocate a shadow vmcs used by the processor to shadow part of the fields stored in the software defined VMCS12 (let L1 access fields without causing exits). Note we keep a shadow vmcs only for the current vmcs12. Once a vmcs12 becomes non-current, its shadow vmcs is released. Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Fix VMXON emulationAbel Gordon2013-04-221-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | handle_vmon doesn't check if L1 is already in root mode (VMXON was previously called). This patch adds this missing check and calls nested_vmx_failValid if VMX is already ON. We need this check because L0 will allocate the shadow vmcs when L1 executes VMXON and we want to avoid host leaks (due to shadow vmcs allocation) if L1 executes VMXON repeatedly. Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | KVM: nVMX: Refactor handle_vmwriteAbel Gordon2013-04-221-24/+28
| | | | | | | | | | | | | | | | | | | | | | Refactor existent code so we re-use vmcs12_write_any to copy fields from the shadow vmcs specified by the link pointer (used by the processor, implementation-specific) to the VMCS12 software format used by L0 to hold the fields in L1 memory address space. Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>