aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-04-26KVM: PPC: e500: Add support for EPTCFG registerMihai Caraman5-0/+24
EPTCFG register defined by E.PT is accessed unconditionally by Linux guests in the presence of MAV 2.0. Emulate it now. Signed-off-by: Mihai Caraman <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: PPC: e500: Add support for TLBnPS registersMihai Caraman6-0/+59
Add support for TLBnPS registers available in MMU Architecture Version (MAV) 2.0. Signed-off-by: Mihai Caraman <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: PPC: e500: Move vcpu's MMU configuration to dedicated functionsMihai Caraman1-22/+38
Vcpu's MMU default configuration and geometry update logic was buried in a chunk of code. Move them to dedicated functions to add more clarity. Signed-off-by: Mihai Caraman <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: PPC: e500: Expose MMU registers via ONE_REGMihai Caraman6-4/+134
MMU registers were exposed to user-space using sregs interface. Add them to ONE_REG interface using kvmppc_get_one_reg/kvmppc_set_one_reg delegation mechanism. Signed-off-by: Mihai Caraman <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: PPC: Book3E: Refactor ONE_REG ioctl implementationMihai Caraman4-47/+91
Refactor Book3E ONE_REG ioctl implementation to use kvmppc_get_one_reg/ kvmppc_set_one_reg delegation interface introduced by Book3S. This is necessary for MMU SPRs which are platform specifics. Get rid of useless case braces in the process. Signed-off-by: Mihai Caraman <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26booke: exit to user space if emulator requestBharat Bhushan1-0/+3
This allows the exit to user space if emulator request by returning EMULATE_EXIT_USER. This will be used in subsequent patches in list Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: extend EMULATE_EXIT_USER to support different exit reasonsBharat Bhushan2-2/+2
Currently the instruction emulator code returns EMULATE_EXIT_USER and common code initializes the "run->exit_reason = .." and "vcpu->arch.hcall_needed = .." with one fixed reason. But there can be different reasons when emulator need to exit to user space. To support that the "run->exit_reason = .." and "vcpu->arch.hcall_needed = .." initialization is moved a level up to emulator. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26Rename EMULATE_DO_PAPR to EMULATE_EXIT_USERBharat Bhushan3-3/+3
Instruction emulation return EMULATE_DO_PAPR when it requires exit to userspace on book3s. Similar return is required for booke. EMULATE_DO_PAPR reads out to be confusing so it is renamed to EMULATE_EXIT_USER. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: PPC: debug stub interface parameter definedBharat Bhushan4-6/+35
This patch defines the interface parameter for KVM_SET_GUEST_DEBUG ioctl support. Follow up patches will use this for setting up hardware breakpoints, watchpoints and software breakpoints. Also kvm_arch_vcpu_ioctl_set_guest_debug() is brought one level below. This is because I am not sure what is required for book3s. So this ioctl behaviour will not change for book3s. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-26KVM: PPC: cache flush for kernel managed pagesBharat Bhushan1-1/+8
Kernel can only access pages which maps as memory. So flush only the valid kernel pages. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-25Merge branch 'kvm-arm-cleanup' from git://github.com/columbia/linux-kvm-arm.gitGleb Natapov19-387/+585
2013-04-25KVM: X86 emulator: fix source operand decoding for 8bit mov[zs]x instructionsGleb Natapov1-0/+4
Source operand for one byte mov[zs]x is decoded incorrectly if it is in high byte register. Fix that. Cc: [email protected] Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: VM_ENTRY/EXIT_LOAD_IA32_EFER overrides EFER.LMA settingsJan Kiszka1-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 <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Validate EFER values for VM_ENTRY/EXIT_LOAD_IA32_EFERJan Kiszka3-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 <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Fix conditions for NMI injectionJan Kiszka1-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 <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: VMX: Move vmx_nmi_allowed after vmx_set_nmi_maskJan Kiszka1-10/+10
vmx_set_nmi_mask will soon be used by vmx_nmi_allowed. No functional changes. Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: x86: Fix memory leak in vmx.cAndrew Honig1-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 <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: x86: fix error return code in kvm_arch_vcpu_init()Wei Yongjun1-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 <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Enable and disable shadow vmcs functionalityAbel Gordon1-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 <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Synchronize VMCS12 content with the shadow vmcsAbel Gordon1-0/+32
Synchronize between the VMCS12 software controlled structure and the processor-specific shadow vmcs Signed-off-by: Abel Gordon <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcsAbel Gordon1-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 <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12Abel Gordon1-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 <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Release shadow vmcsAbel Gordon1-8/+12
Unmap vmcs12 and release the corresponding shadow vmcs Signed-off-by: Abel Gordon <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Allocate shadow vmcsAbel Gordon1-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 <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Fix VMXON emulationAbel Gordon1-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 <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Refactor handle_vmwriteAbel Gordon1-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 <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Introduce vmread and vmwrite bitmapsAbel Gordon1-1/+89
Prepare vmread and vmwrite bitmaps according to a pre-specified list of fields. These lists are intended to specifiy most frequent accessed fields so we can minimize the number of fields that are copied from/to the software controlled VMCS12 format to/from to processor-specific shadow vmcs. The lists were built measuring the VMCS fields access rate after L2 Ubuntu 12.04 booted when it was running on top of L1 KVM, also Ubuntu 12.04. Note that during boot there were additional fields which were frequently modified but they were not added to these lists because after boot these fields were not longer accessed by L1. Signed-off-by: Abel Gordon <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Detect shadow-vmcs capabilityAbel Gordon1-1/+24
Add logic required to detect if shadow-vmcs is supported by the processor. Introduce a new kernel module parameter to specify if L0 should use shadow vmcs (or not) to run L1. Signed-off-by: Abel Gordon <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22KVM: nVMX: Shadow-vmcs control fields/bitsAbel Gordon2-0/+5
Add definitions for all the vmcs control fields/bits required to enable vmcs-shadowing Signed-off-by: Abel Gordon <[email protected]> Reviewed-by: Orit Wasserman <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
2013-04-22Merge git://github.com/agraf/linux-2.6.git kvm-ppc-next into queueGleb Natapov7-1/+22
2013-04-17KVM: ia64: Fix kvm_vm_ioctl_irq_lineYang Zhang1-2/+4
Fix the compile error with kvm_vm_ioctl_irq_line. Signed-off-by: Yang Zhang <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-17KVM: x86: Fix posted interrupt with CONFIG_SMP=nZhang, Yang Z1-0/+2
->send_IPI_mask is not defined on UP. Signed-off-by: Yang Zhang <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-17kvm/ppc: don't call complete_mmio_load when it's a storeScott Wood1-1/+0
complete_mmio_load writes back the mmio result into the destination register. Doing this on a store results in register corruption. Signed-off-by: Scott Wood <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-17KVM: PPC: emulate dcbstStuart Yoder1-0/+2
Signed-off-by: Stuart Yoder <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-17Added ONE_REG interface for debug instructionBharat Bhushan5-0/+20
This patch adds the one_reg interface to get the special instruction to be used for setting software breakpoint from userspace. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
2013-04-17Merge commit 'origin/next' into kvm-ppc-nextAlexander Graf34-453/+818
2013-04-16KVM: VMX: Fix check guest state validity if a guest is in VM86 modeGleb Natapov1-1/+1
If guest vcpu is in VM86 mode the vcpu state should be checked as if in real mode. Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: nVMX: check vmcs12 for valid activity statePaolo Bonzini1-2/+5
KVM does not use the activity state VMCS field, and does not support it in nested VMX either (the corresponding bits in the misc VMX feature MSR are zero). Fail entry if the activity state is set to anything but "active". Since the value will always be the same for L1 and L2, we do not need to read and write the corresponding VMCS field on L1/L2 transitions, either. Signed-off-by: Paolo Bonzini <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Reviewed-by: Jan Kiszka <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: ARM: Fix kvm_vm_ioctl_irq_lineAlexander Graf1-1/+2
Commit aa2fbe6d broke the ARM KVM target by introducing a new parameter to irq handling functions. Fix the function prototype to get things compiling again and ignore the parameter just like we did before Signed-off-by: Alexander Graf <[email protected]> Acked-by: Christoffer Dall <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: VMX: Use posted interrupt to deliver virtual interruptYang Zhang3-12/+21
If posted interrupt is avaliable, then uses it to inject virtual interrupt to guest. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: VMX: Add the deliver posted interrupt algorithmYang Zhang6-1/+86
Only deliver the posted interrupt when target vcpu is running and there is no previous interrupt pending in pir. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: Set TMR when programming ioapic entryYang Zhang5-11/+25
We already know the trigger mode of a given interrupt when programming the ioapice entry. So it's not necessary to set it in each interrupt delivery. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: Call common update function when ioapic entry changed.Yang Zhang9-30/+32
Both TMR and EOI exit bitmap need to be updated when ioapic changed or vcpu's id/ldr/dfr changed. So use common function instead eoi exit bitmap specific function. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: VMX: Check the posted interrupt capabilityYang Zhang2-20/+66
Detect the posted interrupt feature. If it exists, then set it in vmcs_config. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: VMX: Register a new IPI for posted interruptYang Zhang7-0/+44
Posted Interrupt feature requires a special IPI to deliver posted interrupt to guest. And it should has a high priority so the interrupt will not be blocked by others. Normally, the posted interrupt will be consumed by vcpu if target vcpu is running and transparent to OS. But in some cases, the interrupt will arrive when target vcpu is scheduled out. And host will see it. So we need to register a dump handler to handle it. Signed-off-by: Yang Zhang <[email protected]> Acked-by: Ingo Molnar <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-16KVM: VMX: Enable acknowledge interupt on vmexitYang Zhang4-5/+64
The "acknowledge interrupt on exit" feature controls processor behavior for external interrupt acknowledgement. When this control is set, the processor acknowledges the interrupt controller to acquire the interrupt vector on VM exit. After enabling this feature, an interrupt which arrived when target cpu is running in vmx non-root mode will be handled by vmx handler instead of handler in idt. Currently, vmx handler only fakes an interrupt stack and jump to idt table to let real handler to handle it. Further, we will recognize the interrupt and only delivery the interrupt which not belong to current vcpu through idt table. The interrupt which belonged to current vcpu will be handled inside vmx handler. This will reduce the interrupt handle cost of KVM. Also, interrupt enable logic is changed if this feature is turnning on: Before this patch, hypervior call local_irq_enable() to enable it directly. Now IF bit is set on interrupt stack frame, and will be enabled on a return from interrupt handler if exterrupt interrupt exists. If no external interrupt, still call local_irq_enable() to enable it. Refer to Intel SDM volum 3, chapter 33.2. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-15KVM: Use eoi to track RTC interrupt delivery statusYang Zhang1-1/+35
Current interrupt coalescing logci which only used by RTC has conflict with Posted Interrupt. This patch introduces a new mechinism to use eoi to track interrupt: When delivering an interrupt to vcpu, the pending_eoi set to number of vcpu that received the interrupt. And decrease it when each vcpu writing eoi. No subsequent RTC interrupt can deliver to vcpu until all vcpus write eoi. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-15KVM: Let ioapic know the irq line statusYang Zhang9-37/+54
Userspace may deliver RTC interrupt without query the status. So we want to track RTC EOI for this case. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-15KVM: Force vmexit with virtual interrupt deliveryYang Zhang1-1/+1
Need the EOI to track interrupt deliver status, so force vmexit on EOI for rtc interrupt when enabling virtual interrupt delivery. Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2013-04-15KVM: Add reset/restore rtc_status supportYang Zhang4-0/+70
restore rtc_status from migration or save/restore Signed-off-by: Yang Zhang <[email protected]> Reviewed-by: Gleb Natapov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>