aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-07-12KVM: nVMX: Move control field setup to functionsNadav Har'El1-33/+47
Move some of the control field setup to common functions. These functions will also be needed for running L2 guests - L0's desires (expressed in these functions) will be appropriately merged with L1's desires. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Move host-state field setup to a functionNadav Har'El1-32/+42
Move the setting of constant host-state fields (fields that do not change throughout the life of the guest) from vmx_vcpu_setup to a new common function vmx_set_constant_host_state(). This function will also be used to set the host state when running L2 guests. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Implement VMREAD and VMWRITENadav Har'El1-2/+191
Implement the VMREAD and VMWRITE instructions. With these instructions, L1 can read and write to the VMCS it is holding. The values are read or written to the fields of the vmcs12 structure introduced in a previous patch. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Implement VMPTRSTNadav Har'El3-2/+33
This patch implements the VMPTRST instruction. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Implement VMPTRLDNadav Har'El1-1/+61
This patch implements the VMPTRLD instruction. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Implement VMCLEARNadav Har'El2-1/+65
This patch implements the VMCLEAR instruction. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Success/failure of VMX instructions.Nadav Har'El2-0/+69
VMX instructions specify success or failure by setting certain RFLAGS bits. This patch contains common functions to do this, and they will be used in the following patches which emulate the various VMX instructions. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Add VMCS fields to the vmcs12Nadav Har'El1-0/+281
In this patch we add to vmcs12 (the VMCS that L1 keeps for L2) all the standard VMCS fields. Later patches will enable L1 to read and write these fields using VMREAD/ VMWRITE, and they will be used during a VMLAUNCH/VMRESUME in preparing vmcs02, a hardware VMCS for running L2. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Introduce vmcs02: VMCS used to run L2Nadav Har'El1-0/+100
We saw in a previous patch that L1 controls its L2 guest with a vcms12. L0 needs to create a real VMCS for running L2. We call that "vmcs02". A later patch will contain the code, prepare_vmcs02(), for filling the vmcs02 fields. This patch only contains code for allocating vmcs02. In this version, prepare_vmcs02() sets *all* of vmcs02's fields each time we enter from L1 to L2, so keeping just one vmcs02 for the vcpu is enough: It can be reused even when L1 runs multiple L2 guests. However, in future versions we'll probably want to add an optimization where vmcs02 fields that rarely change will not be set each time. For that, we may want to keep around several vmcs02s of L2 guests that have recently run, so that potentially we could run these L2s again more quickly because less vmwrites to vmcs02 will be needed. This patch adds to each vcpu a vmcs02 pool, vmx->nested.vmcs02_pool, which remembers the vmcs02s last used to run up to VMCS02_POOL_SIZE L2s. As explained above, in the current version we choose VMCS02_POOL_SIZE=1, I.e., one vmcs02 is allocated (and loaded onto the processor), and it is reused to enter any L2 guest. In the future, when prepare_vmcs02() is optimized not to set all fields every time, VMCS02_POOL_SIZE should be increased. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Decoding memory operands of VMX instructionsNadav Har'El3-1/+59
This patch includes a utility function for decoding pointer operands of VMX instructions issued by L1 (a guest hypervisor) Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Implement reading and writing of VMX MSRsNadav Har'El2-0/+231
When the guest can use VMX instructions (when the "nested" module option is on), it should also be able to read and write VMX MSRs, e.g., to query about VMX capabilities. This patch adds this support. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Introduce vmcs12: a VMCS structure for L1Nadav Har'El1-0/+75
An implementation of VMX needs to define a VMCS structure. This structure is kept in guest memory, but is opaque to the guest (who can only read or write it with VMX instructions). This patch starts to define the VMCS structure which our nested VMX implementation will present to L1. We call it "vmcs12", as it is the VMCS that L1 keeps for its L2 guest. We will add more content to this structure in later patches. This patch also adds the notion (as required by the VMX spec) of L1's "current VMCS", and finally includes utility functions for mapping the guest-allocated VMCSs in host memory. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Allow setting the VMXE bit in CR4Nadav Har'El4-7/+22
This patch allows the guest to enable the VMXE bit in CR4, which is a prerequisite to running VMXON. Whether to allow setting the VMXE bit now depends on the architecture (svm or vmx), so its checking has moved to kvm_x86_ops->set_cr4(). This function now returns an int: If kvm_x86_ops->set_cr4() returns 1, __kvm_set_cr4() will also return 1, and this will cause kvm_set_cr4() will throw a #GP. Turning on the VMXE bit is allowed only when the nested VMX feature is enabled, and turning it off is forbidden after a vmxon. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Implement VMXON and VMXOFFNadav Har'El1-2/+108
This patch allows a guest to use the VMXON and VMXOFF instructions, and emulates them accordingly. Basically this amounts to checking some prerequisites, and then remembering whether the guest has enabled or disabled VMX operation. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: nVMX: Add "nested" module option to kvm_intelNadav Har'El1-0/+25
This patch adds to kvm_intel a module option "nested". This option controls whether the guest can use VMX instructions, i.e., whether we allow nested virtualization. A similar, but separate, option already exists for the SVM module. This option currently defaults to 0, meaning that nested VMX must be explicitly enabled by giving nested=1. When nested VMX matures, the default should probably be changed to enable nested VMX by default - just like nested SVM is currently enabled by default. Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: x86 emulator: Avoid clearing the whole decode_cacheTakuya Yoshikawa2-4/+18
During tracing the emulator, we noticed that init_emulate_ctxt() sometimes took a bit longer time than we expected. This patch is for mitigating the problem by some degree. By looking into the function, we soon notice that it clears the whole decode_cache whose size is about 2.5K bytes now. Furthermore, most of the bytes are taken for the two read_cache arrays, which are used only by a few instructions. Considering the fact that we are not assuming the cache arrays have been cleared when we store actual data, we do not need to clear the arrays: 2K bytes elimination. In addition, we can avoid clearing the fetch_cache and regs arrays. This patch changes the initialization not to clear the arrays. On our 64-bit host, init_emulate_ctxt() becomes 0.3 to 0.5us faster with this patch applied. Signed-off-by: Takuya Yoshikawa <[email protected]> Cc: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2011-07-12KVM: x86 emulator: Clean up init_emulate_ctxt()Takuya Yoshikawa1-10/+11
Use a local pointer to the emulate_ctxt for simplicity. Then, arrange the hard-to-read mode selection lines neatly. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2011-07-12KVM: Clean up error handling during VCPU creationJan Kiszka2-10/+6
So far kvm_arch_vcpu_setup is responsible for freeing the vcpu struct if it fails. Move this confusing resonsibility back into the hands of kvm_vm_ioctl_create_vcpu. Only kvm_arch_vcpu_setup of x86 is affected, all other archs cannot fail. Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2011-07-12KVM: VMX: Keep list of loaded VMCSs, instead of vcpusNadav Har'El1-64/+86
In VMX, before we bring down a CPU we must VMCLEAR all VMCSs loaded on it because (at least in theory) the processor might not have written all of its content back to memory. Since a patch from June 26, 2008, this is done using a per-cpu "vcpus_on_cpu" linked list of vcpus loaded on each CPU. The problem is that with nested VMX, we no longer have the concept of a vcpu being loaded on a cpu: A vcpu has multiple VMCSs (one for L1, a pool for L2s), and each of those may be have been last loaded on a different cpu. So instead of linking the vcpus, we link the VMCSs, using a new structure loaded_vmcs. This structure contains the VMCS, and the information pertaining to its loading on a specific cpu (namely, the cpu number, and whether it was already launched on this cpu once). In nested we will also use the same structure to hold L2 VMCSs, and vmx->loaded_vmcs is a pointer to the currently active VMCS. Signed-off-by: Nadav Har'El <[email protected]> Acked-by: Acked-by: Kevin Tian <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2011-07-12KVM: Sanitize cpuidAvi Kivity1-2/+35
Instead of blacklisting known-unsupported cpuid leaves, whitelist known- supported leaves. This is more conservative and prevents us from reporting features we don't support. Also whitelist a few more leaves while at it. Signed-off-by: Avi Kivity <[email protected]> Acked-by: Joerg Roedel <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: MMU: cleanup for dropping parent pteXiao Guangrong1-9/+12
Introduce drop_parent_pte to remove the rmap of parent pte and clear parent pte Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: MMU: cleanup for kvm_mmu_page_unlink_childrenXiao Guangrong1-43/+23
Cleanup the same operation between kvm_mmu_page_unlink_children and mmu_pte_write_zap_pte Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: MMU: remove the arithmetic of parent pte rmapXiao Guangrong2-150/+46
Parent pte rmap and page rmap are very similar, so use the same arithmetic for them Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: MMU: abstract the operation of rmapXiao Guangrong2-122/+140
Abstract the operation of rmap to spte_list, then we can use it for the reverse mapping of parent pte in the later patch Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: fix uninitialized warningXiao Guangrong1-1/+1
Fix: warning: ‘cs_sel’ may be used uninitialized in this function warning: ‘ss_sel’ may be used uninitialized in this function Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: use __copy_to_user/__clear_user to write guest pageXiao Guangrong2-4/+4
Simply use __copy_to_user/__clear_user to write guest page since we have already verified the user address when the memslot is set Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: MMU: optimize pte write path if don't have protected spXiao Guangrong2-0/+10
Simply return from kvm_mmu_pte_write path if no shadow page is write-protected, then we can avoid to walk all shadow pages and hold mmu-lock Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: VMX: always_inline VMREADsAvi Kivity1-4/+4
vmcs_readl() and friends are really short, but gcc thinks they are long because of the out-of-line exception handlers. Mark them always_inline to clear the misunderstanding. Signed-off-by: Avi Kivity <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: VMX: Move VMREAD cleanup to exception handlerAvi Kivity2-4/+10
We clean up a failed VMREAD by clearing the output register. Do it in the exception handler instead of unconditionally. This is worthwhile since there are more than a hundred call sites. Signed-off-by: Avi Kivity <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: x86 emulator: Stop passing ctxt->ops as arg of emul functionsTakuya Yoshikawa3-146/+118
Dereference it in the actual users. This not only cleans up the emulator but also makes it easy to convert the old emulation functions to the new em_xxx() form later. Note: Remove some inline keywords to let the compiler decide inlining. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: x86 emulator: Stop passing ctxt->ops as arg of decode helpersTakuya Yoshikawa1-15/+8
Dereference it in the actual users: only do_insn_fetch_byte(). This is consistent with the way __linearize() dereferences it. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: x86 emulator: Place insn_fetch helpers togetherTakuya Yoshikawa1-19/+19
The two macros need special care to use: Assume rc, ctxt, ops and done exist outside of them. Can goto outside. Considering the fact that these are used only in decode functions, moving these right after do_insn_fetch() seems to be a right thing to improve the readability. We also rename do_fetch_insn_byte() to do_insn_fetch_byte() to be consistent. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-12KVM: Document KVM_GET_LAPIC, KVM_SET_LAPIC ioctlAvi Kivity1-0/+32
Signed-off-by: Avi Kivity <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2011-07-06Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds1-0/+2
* 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6: gpio: tps65910: add missing breaks in tps65910_gpio_init
2011-07-06Documentation: fix cgroup blkio throttle filenamesAndrea Righi1-6/+6
All the blkio.throttle.* file names are incorrectly reported without ".throttle" in the documentation. Fix it. Signed-off-by: Andrea Righi <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Acked-by: Vivek Goyal <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-07-06Documentation: update CodingStyle memory allocatorsJesper Juhl1-2/+2
The list of available general purpose memory allocators in Documentation/CodingStyle chapter 14 is incomplete. This patch adds the missing vzalloc() to the list. Signed-off-by: Jesper Juhl <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-07-06MAINTAINERS: move kernel-doc patches locationRandy Dunlap1-1/+1
Move location of quilt series for kernel-doc patches. Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-07-06Merge branch 'v4l_for_linus' of ↵Linus Torvalds40-493/+471
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (46 commits) [media] rc: call input_sync after scancode reports [media] imon: allow either proto on unknown 0xffdc [media] imon: auto-config ffdc 7e device [media] saa7134: fix raw IR timeout value [media] rc: fix ghost keypresses with certain hw [media] [staging] lirc_serial: allocate irq at init time [media] lirc_zilog: fix spinning rx thread [media] keymaps: fix table for pinnacle pctv hd devices [media] ite-cir: 8709 needs to use pnp resource 2 [media] V4L: mx1-camera: fix uninitialized variable [media] omap_vout: Added check in reqbuf & mmap for buf_size allocation [media] OMAP_VOUT: Change hardcoded device node number to -1 [media] OMAP_VOUTLIB: Fix wrong resizer calculation [media] uvcvideo: Disable the queue when failing to start [media] uvcvideo: Remove buffers from the queues when freeing [media] uvcvideo: Ignore entities for terminals with no supported format [media] v4l: Don't access media entity after is has been destroyed [media] media: omap3isp: fix a potential NULL deref [media] media: vb2: fix allocation failure check [media] media: vb2: reset queued_count value during queue reinitialization ... Fix up trivial conflict in MAINTAINERS as per Mauro
2011-07-06FDPIC: Fix memory leakDavidlohr Bueso1-0/+1
The shdr4extnum variable isn't being freed in the cleanup process of elf_fdpic_core_dump(). Signed-off-by: Davidlohr Bueso <[email protected]> Signed-off-by: David Howells <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-07-06resource: ability to resize an allocated resourceRam Pai1-18/+98
Provides the ability to resize a resource that is already allocated. This functionality is put in place to support reallocation needs of pci resources. Signed-off-by: Ram Pai <[email protected]> Acked-by: Jesse Barnes <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-07-06fs: fix lock initializationMiklos Szeredi1-10/+20
locks_alloc_lock() assumed that the allocated struct file_lock is already initialized to zero members. This is only true for the first allocation of the structure, after reuse some of the members will have random values. This will for example result in passing random fl_start values to userspace in fuse for FL_FLOCK locks, which is an information leak at best. Fix by reinitializing those members which may be non-zero after freeing. Signed-off-by: Miklos Szeredi <[email protected]> CC: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
2011-07-05gpio: tps65910: add missing breaks in tps65910_gpio_initAxel Lin1-0/+2
Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Grant Likely <[email protected]>
2011-07-05Merge branch 'usb-linus' of ↵Linus Torvalds2-12/+26
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 * 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: USB: fix regression occurring during device removal USB: fsl_udc_core: fix build breakage when building for ARM arch
2011-07-05Merge branch 'for-linus' of ↵Linus Torvalds6-12/+131
git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: mfd: Add Makefile and Kconfig Entries for tps65911 comparator mfd: Fix build error for tps65911-comparator.c Revert "mfd: Add omap-usbhs runtime PM support" input: pmic8xxx-pwrkey: Do not use mfd_get_data() input: pmic8xxx-keypad: Do not use mfd_get_data()
2011-07-05Merge branch 'for-linus' of ↵Linus Torvalds2-12/+12
git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: ceph: fix sync and dio writes across stripe boundaries libceph: fix page calculation for non-page-aligned io ceph: fix page alignment corrections
2011-07-05Merge branch 'for-linus' of ↵Linus Torvalds2-3/+6
git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus: hfsplus: Fix double iput of the same inode in hfsplus_fill_super() hfsplus: add missing call to bio_put()
2011-07-05mfd: Add Makefile and Kconfig Entries for tps65911 comparatorAxel Lin2-0/+4
Base on Mark's comment [1], I make the Kconfig entry invisible to users. [1] https://lkml.org/lkml/2011/5/14/136 Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2011-07-05mfd: Fix build error for tps65911-comparator.cAxel Lin1-1/+1
Fix below build error: CC drivers/mfd/tps65911-comparator.o drivers/mfd/tps65911-comparator.c: In function 'tps65911_comparator_probe': drivers/mfd/tps65911-comparator.c:131: error: 'struct tps65910_platform_data' has no member named 'vmbch_threshold' drivers/mfd/tps65911-comparator.c:137: error: 'struct tps65910_platform_data' has no member named 'vmbch2_threshold' make[2]: *** [drivers/mfd/tps65911-comparator.o] Error 1 make[1]: *** [drivers/mfd] Error 2 make: *** [drivers] Error 2 Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2011-07-05Revert "mfd: Add omap-usbhs runtime PM support"Keshava Munegowda1-9/+122
This reverts commit 7e6502d577106fb5b202bbaac64c5f1b065e6daa. Oops are produced during initialization of ehci and ohci drivers. This is because the run time pm apis are used by the driver but the corresponding hwmod structures and initialization is not merged. hence revering back the commit id 7e6502d577106fb5b202bbaac64c5f1b065e6daa Signed-off-by: Keshava Munegowda <[email protected]> Reported-by: Luciano Coelho <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2011-07-05input: pmic8xxx-pwrkey: Do not use mfd_get_data()Samuel Ortiz1-1/+2
mfd_get_data() has been removed from the MFD API. Cc: Anirudh Ghayal <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>