pandora-kernel.git
13 years agoMerge branch 'ieee1394-removal' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 25 Oct 2010 15:05:29 +0000 (08:05 -0700)]
Merge branch 'ieee1394-removal' of git://git./linux/kernel/git/ieee1394/linux1394-2.6

* 'ieee1394-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  ieee1394: remove the old IEEE 1394 driver stack
  ieee1394: move init_ohci1394_dma to drivers/firewire/

Fix trivial change/delete conflict: drivers/ieee1394/eth1394.c is
getting removed, but was modified by the networking merge.

13 years agoCoda: replace BKL with mutex
Yoshihisa Abe [Mon, 25 Oct 2010 06:03:46 +0000 (02:03 -0400)]
Coda: replace BKL with mutex

Replace the BKL with a mutex to protect the venus_comm structure which
binds the mountpoint with the character device and holds the upcall
queues.

Signed-off-by: Yoshihisa Abe <yoshiabe@cs.cmu.edu>
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoCoda: push BKL regions into coda_upcall()
Yoshihisa Abe [Mon, 25 Oct 2010 06:03:45 +0000 (02:03 -0400)]
Coda: push BKL regions into coda_upcall()

Now that shared inode state is locked using the cii->c_lock, the BKL is
only used to protect the upcall queues used to communicate with the
userspace cache manager. The remaining state is all local and we can
push the lock further down into coda_upcall().

Signed-off-by: Yoshihisa Abe <yoshiabe@cs.cmu.edu>
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoCoda: add spin lock to protect accesses to struct coda_inode_info.
Yoshihisa Abe [Mon, 25 Oct 2010 06:03:44 +0000 (02:03 -0400)]
Coda: add spin lock to protect accesses to struct coda_inode_info.

We mostly need it to protect cached user permissions. The c_flags field
is advisory, reading the wrong value is harmless and in the worst case
we hit a slow path where we have to make an extra upcall to the
userspace cache manager when revalidating a dentry or inode.

Signed-off-by: Yoshihisa Abe <yoshiabe@cs.cmu.edu>
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Mon, 25 Oct 2010 14:59:01 +0000 (07:59 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (75 commits)
  Input: wacom - specify Cinitq supported tools
  Input: ab8500-ponkey - fix IRQ freeing in error path
  Input: adp5588-keys - use more obvious i2c_device_id name string
  Input: ad7877 - switch to using threaded IRQ
  Input: ad7877 - use attribute group to control visibility of attributes
  Input: serio - add support for PS2Mult multiplexer protocol
  Input: wacom - properly enable runtime PM
  Input: ad7877 - filter events where pressure is beyond the maximum
  Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting
  Input: ad7877 - implement specified chip select behavior
  Input: hp680_ts_input - use cancel_delayed_work_sync()
  Input: mousedev - correct lockdep annotation
  Input: ads7846 - switch to using threaded IRQ
  Input: serio - support multiple child devices per single parent
  Input: synaptics - simplify pass-through port handling
  Input: add ROHM BU21013 touch panel controller support
  Input: omap4-keypad - wake-up on events & long presses
  Input: omap4-keypad - fix interrupt line configuration
  Input: omap4-keypad - SYSCONFIG register configuration
  Input: omap4-keypad - use platform device helpers
  ...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
Linus Torvalds [Mon, 25 Oct 2010 14:51:49 +0000 (07:51 -0700)]
Merge git://git./linux/kernel/git/lethal/sh-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (110 commits)
  sh: i2c-sh7760: Replase from ctrl_* to __raw_*
  sh: clkfwk: Shuffle around to match the intc split up.
  sh: clkfwk: modify for_each_frequency end condition
  sh: fix clk_get() error handling
  sh: clkfwk: Fix fault in frequency iterator.
  sh: clkfwk: Add a helper for rate rounding by divisor ranges.
  sh: clkfwk: Abstract rate rounding helper.
  sh: clkfwk: support clock remapping.
  sh: pci: Convert to upper/lower_32_bits() helpers.
  sh: mach-sdk7786: Add support for the FPGA SRAM.
  sh: Provide a generic SRAM pool for tiny memories.
  sh: pci: Support secondary FPGA-driven PCIe clocks on SDK7786.
  sh: pci: Support slot 4 routing on SDK7786.
  sh: Fix up PMB locking.
  sh: mach-sdk7786: Add support for fpga gpios.
  sh: use pr_fmt for clock framework, too.
  sh: remove name and id from struct clk
  sh: free-without-alloc fix for sh_mobile_lcdcfb
  sh: perf: Set up perf_max_events.
  sh: perf: Support SH-X3 hardware counters.
  ...

Fix up trivial conflicts (perf_max_events got removed) in arch/sh/kernel/perf_event.c

13 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Mon, 25 Oct 2010 14:45:10 +0000 (07:45 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  Revert "block: fix accounting bug on cross partition merges"

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
Linus Torvalds [Mon, 25 Oct 2010 14:44:27 +0000 (07:44 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/gerg/m68knommu

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu: (21 commits)
  m68knommu: convert to using tracehook_report_syscall_*
  m68knommu: some boards use fixed phy for FEC ethernet
  m68knommu: support the external GPIO based interrupts of the 5272
  m68knommu: mask of vector bits in exception word properly
  m68knommu: change to new flag variables
  m68knommu: Fix MCFUART_TXFIFOSIZE for m548x.
  m68knommu: add basic mmu-less m548x support
  m68knommu: .gitignore vmlinux.lds
  m68knommu: stop using __do_IRQ
  m68knommu: rename PT_OFF_VECTOR to PT_OFF_FORMATVEC.
  m68knommu: add support for Coldfire 547x/548x interrupt controller
  m68k{nommu}: Remove unused DEFINE's from asm-offsets.c
  m68knommu: whitespace cleanup in 68328/entry.S
  m68knommu: Document supported chips in intc-2.c and intc-simr.c.
  m68knommu: fix strace support for 68328/68360
  m68knommu: fix default starting date
  arch/m68knommu: Removing dead 68328_SERIAL_UART2 config option
  arch/m68knommu: Removing dead RAM_{16,32}_MB config option
  arch/m68knommu: Removing dead M68KFPU_EMU config option
  arch/m68knommu: Removing dead RELOCATE config option
  ...

13 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Mon, 25 Oct 2010 05:11:17 +0000 (22:11 -0700)]
Merge branch 'next' into for-linus

13 years agoInput: wacom - specify Cinitq supported tools
Ping Cheng [Mon, 25 Oct 2010 04:53:40 +0000 (21:53 -0700)]
Input: wacom - specify Cinitq supported tools

Cintiq, being a display tablet, doesn't have mouse and associated BTN_s.
Make sure we do not specify them when registering Cintiq's input device
so that userland can retrieve the exact tool set the device supports.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
13 years agoInput: ab8500-ponkey - fix IRQ freeing in error path
Nicolas Kaiser [Mon, 25 Oct 2010 04:48:11 +0000 (21:48 -0700)]
Input: ab8500-ponkey - fix IRQ freeing in error path

Looks like an obvious typo to me.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
13 years agosh: i2c-sh7760: Replase from ctrl_* to __raw_*
Nobuhiro Iwamatsu [Fri, 22 Oct 2010 22:07:00 +0000 (07:07 +0900)]
sh: i2c-sh7760: Replase from ctrl_* to __raw_*

ctrl_* is deprecated. We should to use __raw_*.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoMerge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Linus Torvalds [Sun, 24 Oct 2010 20:41:39 +0000 (13:41 -0700)]
Merge branch 'for-next' of git://git./linux/kernel/git/jikos/trivial

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
  Update broken web addresses in arch directory.
  Update broken web addresses in the kernel.
  Revert "drivers/usb: Remove unnecessary return's from void functions" for musb gadget
  Revert "Fix typo: configuation => configuration" partially
  ida: document IDA_BITMAP_LONGS calculation
  ext2: fix a typo on comment in ext2/inode.c
  drivers/scsi: Remove unnecessary casts of private_data
  drivers/s390: Remove unnecessary casts of private_data
  net/sunrpc/rpc_pipe.c: Remove unnecessary casts of private_data
  drivers/infiniband: Remove unnecessary casts of private_data
  drivers/gpu/drm: Remove unnecessary casts of private_data
  kernel/pm_qos_params.c: Remove unnecessary casts of private_data
  fs/ecryptfs: Remove unnecessary casts of private_data
  fs/seq_file.c: Remove unnecessary casts of private_data
  arm: uengine.c: remove C99 comments
  arm: scoop.c: remove C99 comments
  Fix typo configue => configure in comments
  Fix typo: configuation => configuration
  Fix typo interrest[ing|ed] => interest[ing|ed]
  Fix various typos of valid in comments
  ...

Fix up trivial conflicts in:
drivers/char/ipmi/ipmi_si_intf.c
drivers/usb/gadget/rndis.c
net/irda/irnet/irnet_ppp.c

13 years agoMerge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/edac
Linus Torvalds [Sun, 24 Oct 2010 20:06:57 +0000 (13:06 -0700)]
Merge branch 'devel' of git://git./linux/kernel/git/mchehab/edac

* 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/edac: (25 commits)
  i7300_edac: Properly initialize per-csrow memory size
  V4L/DVB: i7300_edac: better initialize page counts
  MAINTAINERS: Add maintainer for i7300-edac driver
  i7300-edac: CodingStyle cleanup
  i7300_edac: Improve comments
  i7300_edac: Cleanup: reorganize the file contents
  i7300_edac: Properly detect channel on CE errors
  i7300_edac: enrich FBD error info for corrected errors
  i7300_edac: enrich FBD error info for fatal errors
  i7300_edac: pre-allocate a buffer used to prepare err messages
  i7300_edac: Fix MTR x4/x8 detection logic
  i7300_edac: Make the debug messages coherent with the others
  i7300_edac: Cleanup: remove get_error_info logic
  i7300_edac: Add a code to cleanup error registers
  i7300_edac: Add support for reporting FBD errors
  i7300_edac: Properly detect the type of error correction
  i7300_edac: Detect if the device is on single mode
  i7300_edac: Adds detection for enhanced scrub mode on x8
  i7300_edac: Clear the error bit after reading
  i7300_edac: Add error detection code for global errors
  ...

13 years agoRevert "block: fix accounting bug on cross partition merges"
Jens Axboe [Sun, 24 Oct 2010 20:06:02 +0000 (22:06 +0200)]
Revert "block: fix accounting bug on cross partition merges"

This reverts commit 7681bfeeccff5efa9eb29bf09249a3c400b15327.

Conflicts:

include/linux/genhd.h

It has numerous issues with the cleanup path and non-elevator
devices. Revert it for now so we can come up with a clean
version without rushing things.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg...
Linus Torvalds [Sun, 24 Oct 2010 19:47:55 +0000 (12:47 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/penberg/slab-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6: (27 commits)
  SLUB: Fix memory hotplug with !NUMA
  slub: Move functions to reduce #ifdefs
  slub: Enable sysfs support for !CONFIG_SLUB_DEBUG
  SLUB: Optimize slab_free() debug check
  slub: Move NUMA-related functions under CONFIG_NUMA
  slub: Add lock release annotation
  slub: Fix signedness warnings
  slub: extract common code to remove objects from partial list without locking
  SLUB: Pass active and inactive redzone flags instead of boolean to debug functions
  slub: reduce differences between SMP and NUMA
  Revert "Slub: UP bandaid"
  percpu: clear memory allocated with the km allocator
  percpu: use percpu allocator on UP too
  percpu: reduce PCPU_MIN_UNIT_SIZE to 32k
  vmalloc: pcpu_get/free_vm_areas() aren't needed on UP
  SLUB: Fix merged slab cache names
  Slub: UP bandaid
  slub: fix SLUB_RESILIENCY_TEST for dynamic kmalloc caches
  slub: Fix up missing kmalloc_cache -> kmem_cache_node case for memoryhotplug
  slub: Add dummy functions for the !SLUB_DEBUG case
  ...

13 years agoMerge branch 'kvm-updates/2.6.37' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 24 Oct 2010 19:47:25 +0000 (12:47 -0700)]
Merge branch 'kvm-updates/2.6.37' of git://git./virt/kvm/kvm

* 'kvm-updates/2.6.37' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (321 commits)
  KVM: Drop CONFIG_DMAR dependency around kvm_iommu_map_pages
  KVM: Fix signature of kvm_iommu_map_pages stub
  KVM: MCE: Send SRAR SIGBUS directly
  KVM: MCE: Add MCG_SER_P into KVM_MCE_CAP_SUPPORTED
  KVM: fix typo in copyright notice
  KVM: Disable interrupts around get_kernel_ns()
  KVM: MMU: Avoid sign extension in mmu_alloc_direct_roots() pae root address
  KVM: MMU: move access code parsing to FNAME(walk_addr) function
  KVM: MMU: audit: check whether have unsync sps after root sync
  KVM: MMU: audit: introduce audit_printk to cleanup audit code
  KVM: MMU: audit: unregister audit tracepoints before module unloaded
  KVM: MMU: audit: fix vcpu's spte walking
  KVM: MMU: set access bit for direct mapping
  KVM: MMU: cleanup for error mask set while walk guest page table
  KVM: MMU: update 'root_hpa' out of loop in PAE shadow path
  KVM: x86 emulator: Eliminate compilation warning in x86_decode_insn()
  KVM: x86: Fix constant type in kvm_get_time_scale
  KVM: VMX: Add AX to list of registers clobbered by guest switch
  KVM guest: Move a printk that's using the clock before it's ready
  KVM: x86: TSC catchup mode
  ...

13 years agoMerge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
Linus Torvalds [Sun, 24 Oct 2010 19:46:24 +0000 (12:46 -0700)]
Merge branch 'i2c-for-linus' of git://git./linux/kernel/git/jdelvare/staging

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-viapro: Don't log nacks
  i2c/pca954x: Remove __devinit and __devexit from probe and remove functions
  MAINTAINERS: Add maintainer for PCA9541 I2C bus master selector driver
  i2c/mux: Driver for PCA9541 I2C Master Selector
  i2c: Optimize function i2c_detect()
  i2c: Discard warning message on device instantiation from user-space
  i2c-amd8111: Add proper error handling
  i2c: Change to new flag variable
  i2c: Remove unneeded inclusions of <linux/i2c-id.h>
  i2c: Let i2c_parent_is_i2c_adapter return the parent adapter
  i2c: Simplify i2c_parent_is_i2c_adapter
  i2c-pca-platform: Change device name of request_irq
  i2c: Fix Kconfig dependencies

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Sun, 24 Oct 2010 19:44:59 +0000 (12:44 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (47 commits)
  HID: fix mismerge in hid-lg
  HID: hidraw: fix window in hidraw_release
  HID: hid-sony: override usbhid_output_raw_report for Sixaxis
  HID: add absolute axis resolution calculation
  HID: force feedback support for Logitech RumblePad gamepad
  HID: support STmicroelectronics and Sitronix with hid-stantuml driver
  HID: magicmouse: Adjust major / minor axes to scale
  HID: Fix for problems with eGalax/DWAV multi-touch-screen
  HID: waltop: add support for Waltop Slim Tablet 12.1 inch
  HID: add NOGET quirk for AXIS 295 Video Surveillance Joystick
  HID: usbhid: remove unused hiddev_driver
  HID: magicmouse: Use hid-input parsing rather than bypassing it
  HID: trivial formatting fix
  HID: Add support for Logitech Speed Force Wireless gaming wheel
  HID: don't Send Feature Reports on Interrupt Endpoint
  HID: 3m: Adjust major / minor axes to scale
  HID: 3m: Correct touchscreen emulation
  HID: 3m: Convert to MT slots
  HID: 3m: Output proper orientation range
  HID: 3m: Adjust to sequential MT HID protocol
  ...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Sun, 24 Oct 2010 19:44:34 +0000 (12:44 -0700)]
Merge git://git./linux/kernel/git/herbert/crypto-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: Makefile - replace the use of <module>-objs with <module>-y
  crypto: hifn_795x - use cancel_delayed_work_sync()
  crypto: talitos - sparse check endian fixes
  crypto: talitos - fix checkpatch warning
  crypto: talitos - fix warning: 'alg' may be used uninitialized in this function
  crypto: cryptd - Adding the AEAD interface type support to cryptd
  crypto: n2_crypto - Niagara2 driver needs to depend upon CRYPTO_DES
  crypto: Kconfig - update broken web addresses
  crypto: omap-sham - Adjust DMA parameters
  crypto: fips - FIPS requires algorithm self-tests
  crypto: omap-aes - OMAP2/3 AES hw accelerator driver
  crypto: updates to enable omap aes
  padata: add missing __percpu markup in include/linux/padata.h
  MAINTAINERS: Add maintainer entries for padata/pcrypt

13 years agoMerge branch 'master' into for-linus
Pekka Enberg [Sun, 24 Oct 2010 16:57:05 +0000 (19:57 +0300)]
Merge branch 'master' into for-linus

Conflicts:
include/linux/percpu.h
mm/percpu.c

13 years agoi2c-viapro: Don't log nacks
Jean Delvare [Sun, 24 Oct 2010 16:16:59 +0000 (18:16 +0200)]
i2c-viapro: Don't log nacks

Transactions not acked can happen every now and then, in particular
during device detection, and various transaction types can be used for
this purpose. So stop logging this event, except when debugging is
enabled. This is what other similar drivers (e.g. i2c-i801 or
i2c-piix4) do.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
13 years agoi2c/pca954x: Remove __devinit and __devexit from probe and remove functions
Guenter Roeck [Sun, 24 Oct 2010 16:16:59 +0000 (18:16 +0200)]
i2c/pca954x: Remove __devinit and __devexit from probe and remove functions

The underlying I2C adapter may or may not be present when this driver
gets initialized, and may disappear later, so there is no safe time at
which the probe and remove functions can be discarded.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
13 years agoMAINTAINERS: Add maintainer for PCA9541 I2C bus master selector driver
Guenter Roeck [Sun, 24 Oct 2010 16:16:59 +0000 (18:16 +0200)]
MAINTAINERS: Add maintainer for PCA9541 I2C bus master selector driver

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
13 years agoi2c/mux: Driver for PCA9541 I2C Master Selector
Guenter Roeck [Sun, 24 Oct 2010 16:16:58 +0000 (18:16 +0200)]
i2c/mux: Driver for PCA9541 I2C Master Selector

This patch adds support for PCA9541, an I2C Bus Master Selector.
The driver is modeled as single channel I2C Multiplexer to be able to utilize
the I2C multiplexer framework.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Tom Grennan <tom.grennan@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
13 years agoi2c: Optimize function i2c_detect()
Jean Delvare [Sun, 24 Oct 2010 16:16:58 +0000 (18:16 +0200)]
i2c: Optimize function i2c_detect()

Check the class flags before allocating the temporary i2c_client
structure, to avoid allocating it when we don't need it.

Also optimize the inner loop a bit.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
13 years agoi2c: Discard warning message on device instantiation from user-space
Jean Delvare [Sun, 24 Oct 2010 16:16:58 +0000 (18:16 +0200)]
i2c: Discard warning message on device instantiation from user-space

The "new_device" sysfs interface has been there for quite some time
now, nobody complained about it so it must be good enough. Time to
remove the warning and call it stable.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Michael Lawnick <ml.lawnick@gmx.de>
13 years agoi2c-amd8111: Add proper error handling
Julia Lawall [Sun, 24 Oct 2010 16:16:58 +0000 (18:16 +0200)]
i2c-amd8111: Add proper error handling

The functions the functions amd_ec_wait_write and amd_ec_wait_read have an
unsigned return type, but return a negative constant to indicate an error
condition.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

 unsigned f(...)
 { <+...
*  return -C;
 ...+> }
// </smpl>

Fixing amd_ec_wait_write and amd_ec_wait_read leads to the need to adjust
the return type of the functions amd_ec_write and amd_ec_read, which are
the only functions that call amd_ec_wait_write and amd_ec_wait_read.
amd_ec_write and amd_ec_read, in turn, are only called from within the
function amd8111_access, which already returns a signed typed value.  Each
of the calls to amd_ec_write and amd_ec_read are updated using the
following semantic patch:

// <smpl>
@@
@@

+ status = amd_ec_write
- amd_ec_write
  (...);
+ if (status) return status;

@@
@@

+ status = amd_ec_read
- amd_ec_read
  (...);
+ if (status) return status;
// </smpl>

The patch also adds the declaration of the status variable.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
13 years agoi2c: Change to new flag variable
matt mooney [Sun, 24 Oct 2010 16:16:58 +0000 (18:16 +0200)]
i2c: Change to new flag variable

Replace EXTRA_CFLAGS with ccflags-y.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
13 years agoi2c: Remove unneeded inclusions of <linux/i2c-id.h>
Jean Delvare [Sun, 24 Oct 2010 16:16:58 +0000 (18:16 +0200)]
i2c: Remove unneeded inclusions of <linux/i2c-id.h>

These drivers don't use anything which is defined in <linux/i2c-id.h>.
This header file was never meant to be included directly anyway, and
will be deleted soon.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Acked-by: Dave Airlie <airlied@linux.ie>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
13 years agoi2c: Let i2c_parent_is_i2c_adapter return the parent adapter
Jean Delvare [Sun, 24 Oct 2010 16:16:57 +0000 (18:16 +0200)]
i2c: Let i2c_parent_is_i2c_adapter return the parent adapter

This makes the calling site's code clearer IMHO.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Michael Lawnick <ml.lawnick@gmx.de>
13 years agoi2c: Simplify i2c_parent_is_i2c_adapter
Jean Delvare [Sun, 24 Oct 2010 16:16:57 +0000 (18:16 +0200)]
i2c: Simplify i2c_parent_is_i2c_adapter

Only i2c devices can have their type set to i2c_adapter_type, so
testing the bus type is redundant.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Michael Lawnick <ml.lawnick@gmx.de>
13 years agoi2c-pca-platform: Change device name of request_irq
Nobuhiro Iwamatsu [Sun, 24 Oct 2010 16:16:57 +0000 (18:16 +0200)]
i2c-pca-platform: Change device name of request_irq

i2c->adap.name shouldn't be used in request_irq.
Instead the driver name "i2c-pca-platform" should be used.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: stable@kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
13 years agoi2c: Fix Kconfig dependencies
Jean Delvare [Sun, 24 Oct 2010 16:16:57 +0000 (18:16 +0200)]
i2c: Fix Kconfig dependencies

drivers/i2c/algos/Kconfig makes all the algorithms dependent on
!I2C_HELPER_AUTO, which triggers a Kconfig warning about broken
dependencies when some driver selects one of the algorithms. Ideally
we would make only the prompts dependent on !I2C_HELPER_AUTO, however
Kconfig doesn't currently support that. So we have to redefine the
symbols separately for the I2C_HELPER_AUTO=y case.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Michal Marek <mmarek@suse.cz>
13 years agoKVM: Drop CONFIG_DMAR dependency around kvm_iommu_map_pages
Jan Kiszka [Mon, 18 Oct 2010 13:38:40 +0000 (15:38 +0200)]
KVM: Drop CONFIG_DMAR dependency around kvm_iommu_map_pages

We also have to call kvm_iommu_map_pages for CONFIG_AMD_IOMMU. So drop
the dependency on Intel IOMMU, kvm_iommu_map_pages will be a nop anyway
if CONFIG_IOMMU_API is not defined.

KVM-Stable-Tag.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: Fix signature of kvm_iommu_map_pages stub
Jan Kiszka [Thu, 14 Oct 2010 11:59:04 +0000 (13:59 +0200)]
KVM: Fix signature of kvm_iommu_map_pages stub

Breaks otherwise if CONFIG_IOMMU_API is not set.

KVM-Stable-Tag.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: MCE: Send SRAR SIGBUS directly
Huang Ying [Fri, 8 Oct 2010 08:24:15 +0000 (16:24 +0800)]
KVM: MCE: Send SRAR SIGBUS directly

Originally, SRAR SIGBUS is sent to QEMU-KVM via touching the poisoned
page. But commit 96054569190bdec375fe824e48ca1f4e3b53dd36 prevents the
signal from being sent. So now the signal is sent via
force_sig_info_fault directly.

[marcelo: use send_sig_info instead]

Reported-by: Dean Nelson <dnelson@redhat.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: MCE: Add MCG_SER_P into KVM_MCE_CAP_SUPPORTED
Huang Ying [Fri, 8 Oct 2010 08:24:14 +0000 (16:24 +0800)]
KVM: MCE: Add MCG_SER_P into KVM_MCE_CAP_SUPPORTED

Now we have MCG_SER_P (and corresponding SRAO/SRAR MCE) support in
kernel and QEMU-KVM, the MCG_SER_P should be added into
KVM_MCE_CAP_SUPPORTED to make all these code really works.

Reported-by: Dean Nelson <dnelson@redhat.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: fix typo in copyright notice
Nicolas Kaiser [Wed, 6 Oct 2010 12:23:22 +0000 (14:23 +0200)]
KVM: fix typo in copyright notice

Fix typo in copyright notice.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: Disable interrupts around get_kernel_ns()
Avi Kivity [Mon, 4 Oct 2010 10:55:49 +0000 (12:55 +0200)]
KVM: Disable interrupts around get_kernel_ns()

get_kernel_ns() wants preemption disabled.  It doesn't make a lot of sense
during the get/set ioctls (no way to make them non-racy) but the callee wants
it.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Avoid sign extension in mmu_alloc_direct_roots() pae root address
Avi Kivity [Sun, 3 Oct 2010 16:51:39 +0000 (18:51 +0200)]
KVM: MMU: Avoid sign extension in mmu_alloc_direct_roots() pae root address

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: move access code parsing to FNAME(walk_addr) function
Xiao Guangrong [Tue, 28 Sep 2010 09:03:14 +0000 (17:03 +0800)]
KVM: MMU: move access code parsing to FNAME(walk_addr) function

Move access code parsing from caller site to FNAME(walk_addr) function

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: audit: check whether have unsync sps after root sync
Xiao Guangrong [Mon, 27 Sep 2010 10:09:29 +0000 (18:09 +0800)]
KVM: MMU: audit: check whether have unsync sps after root sync

After root synced, all unsync sps are synced, this patch add a check to make
sure it's no unsync sps in VCPU's page table

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: audit: introduce audit_printk to cleanup audit code
Xiao Guangrong [Mon, 27 Sep 2010 10:07:59 +0000 (18:07 +0800)]
KVM: MMU: audit: introduce audit_printk to cleanup audit code

Introduce audit_printk, and record audit point instead audit name

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: audit: unregister audit tracepoints before module unloaded
Xiao Guangrong [Mon, 27 Sep 2010 10:07:07 +0000 (18:07 +0800)]
KVM: MMU: audit: unregister audit tracepoints before module unloaded

fix:

Call Trace:
 [<ffffffffa01e46ba>] ? kvm_mmu_pte_write+0x229/0x911 [kvm]
 [<ffffffffa01c6ba9>] ? gfn_to_memslot+0x39/0xa0 [kvm]
 [<ffffffffa01c6c26>] ? mark_page_dirty+0x16/0x2e [kvm]
 [<ffffffffa01c6d6f>] ? kvm_write_guest_page+0x67/0x7f [kvm]
 [<ffffffff81066fbd>] ? local_clock+0x2a/0x3b
 [<ffffffffa01d52ce>] emulator_write_phys+0x46/0x54 [kvm]
 ......
Code:  Bad RIP value.
RIP  [<ffffffffa0172056>] 0xffffffffa0172056
 RSP <ffff880134f69a70>
CR2: ffffffffa0172056

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: audit: fix vcpu's spte walking
Xiao Guangrong [Mon, 27 Sep 2010 10:06:16 +0000 (18:06 +0800)]
KVM: MMU: audit: fix vcpu's spte walking

After nested nested paging, it may using long mode to shadow 32/PAE paging
guest, so this patch fix it

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: set access bit for direct mapping
Xiao Guangrong [Mon, 27 Sep 2010 10:05:00 +0000 (18:05 +0800)]
KVM: MMU: set access bit for direct mapping

Set access bit while setup up direct page table if it's nonpaing or npt enabled,
it's good for CPU's speculate access

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: cleanup for error mask set while walk guest page table
Xiao Guangrong [Mon, 27 Sep 2010 10:03:27 +0000 (18:03 +0800)]
KVM: MMU: cleanup for error mask set while walk guest page table

Small cleanup for set page fault error code

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: update 'root_hpa' out of loop in PAE shadow path
Xiao Guangrong [Mon, 27 Sep 2010 10:02:12 +0000 (18:02 +0800)]
KVM: MMU: update 'root_hpa' out of loop in PAE shadow path

The value of 'vcpu->arch.mmu.pae_root' is not modified, so we can update
'root_hpa' out of the loop.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Eliminate compilation warning in x86_decode_insn()
Sheng Yang [Tue, 28 Sep 2010 08:33:32 +0000 (16:33 +0800)]
KVM: x86 emulator: Eliminate compilation warning in x86_decode_insn()

Eliminate:
arch/x86/kvm/emulate.c:801: warning: â€˜sv’ may be used uninitialized in this
function

on gcc 4.1.2

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: x86: Fix constant type in kvm_get_time_scale
Jan Kiszka [Sun, 26 Sep 2010 11:00:53 +0000 (13:00 +0200)]
KVM: x86: Fix constant type in kvm_get_time_scale

Older gcc versions complain about the improper type (for x86-32), 4.5
seems to fix this silently. However, we should better use the right type
initially.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: VMX: Add AX to list of registers clobbered by guest switch
Jan Kiszka [Tue, 28 Sep 2010 14:37:42 +0000 (16:37 +0200)]
KVM: VMX: Add AX to list of registers clobbered by guest switch

By chance this caused no harm so far. We overwrite AX during switch
to/from guest context, so we must declare this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM guest: Move a printk that's using the clock before it's ready
Arjan Koers [Mon, 2 Aug 2010 21:35:28 +0000 (23:35 +0200)]
KVM guest: Move a printk that's using the clock before it's ready

Fix a hang during SMP kernel boot on KVM that showed up
after commit 489fb490dbf8dab0249ad82b56688ae3842a79e8
(2.6.35) and 59aab522154a2f17b25335b63c1cf68a51fb6ae0
(2.6.34.1). The problem only occurs when
CONFIG_PRINTK_TIME is set.

KVM-Stable-Tag.
Signed-off-by: Arjan Koers <0h61vkll2ly8@xutrox.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86: TSC catchup mode
Zachary Amsden [Sun, 19 Sep 2010 00:38:15 +0000 (14:38 -1000)]
KVM: x86: TSC catchup mode

Negate the effects of AN TYM spell while kvm thread is preempted by tracking
conversion factor to the highest TSC rate and catching the TSC up when it has
fallen behind the kernel view of time.  Note that once triggered, we don't
turn off catchup mode.

A slightly more clever version of this is possible, which only does catchup
when TSC rate drops, and which specifically targets only CPUs with broken
TSC, but since these all are considered unstable_tsc(), this patch covers
all necessary cases.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: x86: Rename timer function
Zachary Amsden [Sun, 19 Sep 2010 00:38:14 +0000 (14:38 -1000)]
KVM: x86: Rename timer function

This just changes some names to better reflect the usage they
will be given.  Separated out to keep confusion to a minimum.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: x86: Make math work for other scales
Zachary Amsden [Sun, 19 Sep 2010 00:38:13 +0000 (14:38 -1000)]
KVM: x86: Make math work for other scales

The math in kvm_get_time_scale relies on the fact that
NSEC_PER_SEC < 2^32.  To use the same function to compute
arbitrary time scales, we must extend the first reduction
step to shrink the base rate to a 32-bit value, and
possibly reduce the scaled rate into a 32-bit as well.

Note we must take care to avoid an arithmetic overflow
when scaling up the tps32 value (this could not happen
with the fixed scaled value of NSEC_PER_SEC, but can
happen with scaled rates above 2^31.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: cpu_relax() during spin waiting for reboot
Avi Kivity [Tue, 21 Sep 2010 17:59:44 +0000 (19:59 +0200)]
KVM: cpu_relax() during spin waiting for reboot

It doesn't really matter, but if we spin, we should spin in a more relaxed
manner.  This way, if something goes wrong at least it won't contribute to
global warming.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: VMX: Respect interrupt window in big real mode
Avi Kivity [Sun, 19 Sep 2010 12:34:08 +0000 (14:34 +0200)]
KVM: VMX: Respect interrupt window in big real mode

If an interrupt is pending, we need to stop emulation so we
can inject it.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: VMX: Emulated real mode interrupt injection
Mohammed Gamal [Sun, 19 Sep 2010 12:34:07 +0000 (14:34 +0200)]
KVM: VMX: Emulated real mode interrupt injection

Replace the inject-as-software-interrupt hack we currently have with
emulated injection.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: Add kvm_inject_realmode_interrupt() wrapper
Mohammed Gamal [Sun, 19 Sep 2010 12:34:06 +0000 (14:34 +0200)]
KVM: Add kvm_inject_realmode_interrupt() wrapper

This adds a wrapper function kvm_inject_realmode_interrupt() around the
emulator function emulate_int_real() to allow real mode interrupt injection.

[avi: initialize operand and address sizes before emulating interrupts]
[avi: initialize rip for real mode interrupt injection]
[avi: clear interrupt pending flag after emulating interrupt injection]

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: x86 emulator: Expose emulate_int_real()
Mohammed Gamal [Sun, 19 Sep 2010 12:34:05 +0000 (14:34 +0200)]
KVM: x86 emulator: Expose emulate_int_real()

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: MMU: fix counting of rmap entries in rmap_add()
Hillf Danton [Sat, 18 Sep 2010 00:41:02 +0000 (08:41 +0800)]
KVM: MMU: fix counting of rmap entries in rmap_add()

It seems that rmap entries are under counted.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: document 'kvm.mmu_audit' parameter
Xiao Guangrong [Mon, 20 Sep 2010 14:17:48 +0000 (22:17 +0800)]
KVM: document 'kvm.mmu_audit' parameter

Document this parameter into Documentation/kernel-parameters.txt

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: fix the description of kvm-amd.nested in documentation
Xiao Guangrong [Mon, 20 Sep 2010 14:16:45 +0000 (22:16 +0800)]
KVM: fix the description of kvm-amd.nested in documentation

The default state of 'kvm-amd.nested' is enabled now, so fix the documentation

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: SVM: do not generate "external interrupt exit" if other exit is pending
Gleb Natapov [Mon, 20 Sep 2010 08:15:32 +0000 (10:15 +0200)]
KVM: SVM: do not generate "external interrupt exit" if other exit is pending

Nested SVM checks for external interrupt after injecting nested exception.
In case there is external interrupt pending the code generates "external
interrupt exit" and overwrites previous exit info. If previously injected
exception already generated exit it will be lost.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: Convert PIC lock from raw spinlock to ordinary spinlock
Avi Kivity [Sun, 19 Sep 2010 16:44:07 +0000 (18:44 +0200)]
KVM: Convert PIC lock from raw spinlock to ordinary spinlock

The PIC code used to be called from preempt_disable() context, which
wasn't very good for PREEMPT_RT.  That is no longer the case, so move
back from raw_spinlock_t to spinlock_t.

Signed-off-by: Avi Kivity <avi@redhat.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: x86: Fix kvmclock bug
Zachary Amsden [Sun, 19 Sep 2010 00:38:12 +0000 (14:38 -1000)]
KVM: x86: Fix kvmclock bug

If preempted after kvmclock values are updated, but before hardware
virtualization is entered, the last tsc time as read by the guest is
never set.  It underflows the next time kvmclock is updated if there
has not yet been a successful entry / exit into hardware virt.

Fix this by simply setting last_tsc to the newly read tsc value so
that any computed nsec advance of kvmclock is nulled.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: MMU: Don't track nested fault info in error-code
Joerg Roedel [Tue, 14 Sep 2010 15:46:12 +0000 (17:46 +0200)]
KVM: MMU: Don't track nested fault info in error-code

This patch moves the detection whether a page-fault was
nested or not out of the error code and moves it into a
separate variable in the fault struct.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: VMX: Move fixup_rmode_irq() to avoid forward declaration
Avi Kivity [Thu, 22 Jul 2010 10:09:54 +0000 (13:09 +0300)]
KVM: VMX: Move fixup_rmode_irq() to avoid forward declaration

No code changes.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Non-atomic interrupt injection
Avi Kivity [Tue, 20 Jul 2010 12:06:17 +0000 (15:06 +0300)]
KVM: Non-atomic interrupt injection

Change the interrupt injection code to work from preemptible, interrupts
enabled context.  This works by adding a ->cancel_injection() operation
that undoes an injection in case we were not able to actually enter the guest
(this condition could never happen with atomic injection).

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: VMX: Parameterize vmx_complete_interrupts() for both exit and entry
Avi Kivity [Tue, 20 Jul 2010 11:43:23 +0000 (14:43 +0300)]
KVM: VMX: Parameterize vmx_complete_interrupts() for both exit and entry

Currently vmx_complete_interrupts() can decode event information from vmx
exit fields into the generic kvm event queues.  Make it able to decode
the information from the entry fields as well by parametrizing it.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: VMX: Move real-mode interrupt injection fixup to vmx_complete_interrupts()
Avi Kivity [Thu, 22 Jul 2010 09:54:21 +0000 (12:54 +0300)]
KVM: VMX: Move real-mode interrupt injection fixup to vmx_complete_interrupts()

This allows reuse of vmx_complete_interrupts() for cancelling injections.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: VMX: Split up vmx_complete_interrupts()
Avi Kivity [Tue, 20 Jul 2010 11:31:20 +0000 (14:31 +0300)]
KVM: VMX: Split up vmx_complete_interrupts()

vmx_complete_interrupts() does too much, split it up:
 - vmx_vcpu_run() gets the "cache important vmcs fields" part
 - a new vmx_complete_atomic_exit() gets the parts that must be done atomically
 - a new vmx_recover_nmi_blocking() does what its name says
 - vmx_complete_interrupts() retains the event injection recovery code

This helps in reducing the work done in atomic context.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Check for pending events before attempting injection
Avi Kivity [Tue, 27 Jul 2010 09:30:24 +0000 (12:30 +0300)]
KVM: Check for pending events before attempting injection

Instead of blindly attempting to inject an event before each guest entry,
check for a possible event first in vcpu->requests.  Sites that can trigger
event injection are modified to set KVM_REQ_EVENT:

- interrupt, nmi window opening
- ppr updates
- i8259 output changes
- local apic irr changes
- rflags updates
- gif flag set
- event set on exit

This improves non-injecting entry performance, and sets the stage for
non-atomic injection.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Fix regression with ept memory types merged into non-ept page tables
Avi Kivity [Mon, 13 Sep 2010 14:45:28 +0000 (16:45 +0200)]
KVM: MMU: Fix regression with ept memory types merged into non-ept page tables

Commit "KVM: MMU: Make tdp_enabled a mmu-context parameter" made real-mode
set ->direct_map, and changed the code that merges in the memory type depend
on direct_map instead of tdp_enabled.  However, in this case what really
matters is tdp, not direct_map, since tdp changes the pte format regardless
of whether the mapping is direct or not.

As a result, real-mode shadow mappings got corrupted with ept memory types.
The result was a huge slowdown, likely due to the cache being disabled.

Change it back as the simplest fix for the regression (real fix is to move
all that to vmx code, and not use tdp_enabled as a synonym for ept).

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Document that KVM_GET_SUPPORTED_CPUID may return emulated values
Avi Kivity [Sun, 12 Sep 2010 14:39:11 +0000 (16:39 +0200)]
KVM: Document that KVM_GET_SUPPORTED_CPUID may return emulated values

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: X86: Report SVM bit to userspace only when supported
Joerg Roedel [Fri, 10 Sep 2010 15:31:06 +0000 (17:31 +0200)]
KVM: X86: Report SVM bit to userspace only when supported

This patch fixes a bug in KVM where it _always_ reports the
support of the SVM feature to userspace. But KVM only
supports SVM on AMD hardware and only when it is enabled in
the kernel module. This patch fixes the wrong reporting.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: SVM: Report Nested Paging support to userspace
Joerg Roedel [Fri, 10 Sep 2010 15:31:05 +0000 (17:31 +0200)]
KVM: SVM: Report Nested Paging support to userspace

This patch implements the reporting of the nested paging
feature support to userspace.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: SVM: Expect two more candiates for exit_int_info
Joerg Roedel [Fri, 10 Sep 2010 15:31:04 +0000 (17:31 +0200)]
KVM: SVM: Expect two more candiates for exit_int_info

This patch adds INTR and NMI intercepts to the list of
expected intercepts with an exit_int_info set. While this
can't happen on bare metal it is architectural legal and may
happen with KVMs SVM emulation.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: SVM: Initialize Nested Nested MMU context on VMRUN
Joerg Roedel [Fri, 10 Sep 2010 15:31:03 +0000 (17:31 +0200)]
KVM: SVM: Initialize Nested Nested MMU context on VMRUN

This patch adds code to initialize the Nested Nested Paging
MMU context when the L1 guest executes a VMRUN instruction
and has nested paging enabled in its VMCB.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: SVM: Implement MMU helper functions for Nested Nested Paging
Joerg Roedel [Fri, 10 Sep 2010 15:31:02 +0000 (17:31 +0200)]
KVM: SVM: Implement MMU helper functions for Nested Nested Paging

This patch adds the helper functions which will be used in
the mmu context for handling nested nested page faults.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Track NX state in struct kvm_mmu
Joerg Roedel [Fri, 10 Sep 2010 15:31:01 +0000 (17:31 +0200)]
KVM: MMU: Track NX state in struct kvm_mmu

With Nested Paging emulation the NX state between the two
MMU contexts may differ. To make sure that always the right
fault error code is recorded this patch moves the NX state
into struct kvm_mmu so that the code can distinguish between
L1 and L2 NX state.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Allow long mode shadows for legacy page tables
Joerg Roedel [Fri, 10 Sep 2010 15:31:00 +0000 (17:31 +0200)]
KVM: MMU: Allow long mode shadows for legacy page tables

Currently the KVM softmmu implementation can not shadow a 32
bit legacy or PAE page table with a long mode page table.
This is a required feature for nested paging emulation
because the nested page table must alway be in host format.
So this patch implements the missing pieces to allow long
mode page tables for page table types.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Refactor mmu_alloc_roots function
Joerg Roedel [Fri, 10 Sep 2010 15:30:59 +0000 (17:30 +0200)]
KVM: MMU: Refactor mmu_alloc_roots function

This patch factors out the direct-mapping paths of the
mmu_alloc_roots function into a seperate function. This
makes it a lot easier to avoid all the unnecessary checks
done in the shadow path which may break when running direct.
In fact, this patch already fixes a problem when running PAE
guests on a PAE shadow page table.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Introduce kvm_pdptr_read_mmu
Joerg Roedel [Fri, 10 Sep 2010 15:30:58 +0000 (17:30 +0200)]
KVM: MMU: Introduce kvm_pdptr_read_mmu

This function is implemented to load the pdptr pointers of
the currently running guest (l1 or l2 guest). Therefore it
takes care about the current paging mode and can read pdptrs
out of l2 guest physical memory.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Add kvm_mmu parameter to load_pdptrs function
Joerg Roedel [Fri, 10 Sep 2010 15:30:57 +0000 (17:30 +0200)]
KVM: MMU: Add kvm_mmu parameter to load_pdptrs function

This function need to be able to load the pdptrs from any
mmu context currently in use. So change this function to
take an kvm_mmu parameter to fit these needs.
As a side effect this patch also moves the cached pdptrs
from vcpu_arch into the kvm_mmu struct.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: X86: Propagate fetch faults
Joerg Roedel [Fri, 10 Sep 2010 15:30:56 +0000 (17:30 +0200)]
KVM: X86: Propagate fetch faults

KVM currently ignores fetch faults in the instruction
emulator. With nested-npt we could have such faults. This
patch adds the code to handle these.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Propagate the right fault back to the guest after gva_to_gpa
Joerg Roedel [Fri, 10 Sep 2010 15:30:55 +0000 (17:30 +0200)]
KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa

This patch implements logic to make sure that either a
page-fault/page-fault-vmexit or a nested-page-fault-vmexit
is propagated back to the guest.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Introduce init_kvm_nested_mmu()
Joerg Roedel [Fri, 10 Sep 2010 15:30:54 +0000 (17:30 +0200)]
KVM: MMU: Introduce init_kvm_nested_mmu()

This patch introduces the init_kvm_nested_mmu() function
which is used to re-initialize the nested mmu when the l2
guest changes its paging mode.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Introduce kvm_read_nested_guest_page()
Joerg Roedel [Fri, 10 Sep 2010 15:30:53 +0000 (17:30 +0200)]
KVM: MMU: Introduce kvm_read_nested_guest_page()

This patch introduces the kvm_read_guest_page_x86 function
which reads from the physical memory of the guest. If the
guest is running in guest-mode itself with nested paging
enabled it will read from the guest's guest physical memory
instead.
The patch also changes changes the code to use this function
where it is necessary.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Make walk_addr_generic capable for two-level walking
Joerg Roedel [Fri, 10 Sep 2010 15:30:52 +0000 (17:30 +0200)]
KVM: MMU: Make walk_addr_generic capable for two-level walking

This patch uses kvm_read_guest_page_tdp to make the
walk_addr_generic functions suitable for two-level page
table walking.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: X86: Add kvm_read_guest_page_mmu function
Joerg Roedel [Fri, 10 Sep 2010 15:30:51 +0000 (17:30 +0200)]
KVM: X86: Add kvm_read_guest_page_mmu function

This patch adds a function which can read from the guests
physical memory or from the guest's guest physical memory.
This will be used in the two-dimensional page table walker.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Implement nested gva_to_gpa functions
Joerg Roedel [Fri, 10 Sep 2010 15:30:50 +0000 (17:30 +0200)]
KVM: MMU: Implement nested gva_to_gpa functions

This patch adds the functions to do a nested l2_gva to
l1_gpa page table walk.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: X86: Introduce pointer to mmu context used for gva_to_gpa
Joerg Roedel [Fri, 10 Sep 2010 15:30:49 +0000 (17:30 +0200)]
KVM: X86: Introduce pointer to mmu context used for gva_to_gpa

This patch introduces the walk_mmu pointer which points to
the mmu-context currently used for gva_to_gpa translations.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Add infrastructure for two-level page walker
Joerg Roedel [Fri, 10 Sep 2010 15:30:48 +0000 (17:30 +0200)]
KVM: MMU: Add infrastructure for two-level page walker

This patch introduces a mmu-callback to translate gpa
addresses in the walk_addr code. This is later used to
translate l2_gpa addresses into l1_gpa addresses.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Introduce generic walk_addr function
Joerg Roedel [Fri, 10 Sep 2010 15:30:47 +0000 (17:30 +0200)]
KVM: MMU: Introduce generic walk_addr function

This is the first patch in the series towards a generic
walk_addr implementation which could walk two-dimensional
page tables in the end. In this first step the walk_addr
function is renamed into walk_addr_generic which takes a
mmu context as an additional parameter.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Track page fault data in struct vcpu
Joerg Roedel [Fri, 10 Sep 2010 15:30:46 +0000 (17:30 +0200)]
KVM: MMU: Track page fault data in struct vcpu

This patch introduces a struct with two new fields in
vcpu_arch for x86:

* fault.address
* fault.error_code

This will be used to correctly propagate page faults back
into the guest when we could have either an ordinary page
fault or a nested page fault. In the case of a nested page
fault the fault-address is different from the original
address that should be walked. So we need to keep track
about the real fault-address.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Let is_rsvd_bits_set take mmu context instead of vcpu
Joerg Roedel [Fri, 10 Sep 2010 15:30:45 +0000 (17:30 +0200)]
KVM: MMU: Let is_rsvd_bits_set take mmu context instead of vcpu

This patch changes is_rsvd_bits_set() function prototype to
take only a kvm_mmu context instead of a full vcpu.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Introduce kvm_init_shadow_mmu helper function
Joerg Roedel [Fri, 10 Sep 2010 15:30:44 +0000 (17:30 +0200)]
KVM: MMU: Introduce kvm_init_shadow_mmu helper function

Some logic of the init_kvm_softmmu function is required to
build the Nested Nested Paging context. So factor the
required logic into a seperate function and export it.
Also make the whole init path suitable for more than one mmu
context.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Introduce inject_page_fault function pointer
Joerg Roedel [Fri, 10 Sep 2010 15:30:43 +0000 (17:30 +0200)]
KVM: MMU: Introduce inject_page_fault function pointer

This patch introduces an inject_page_fault function pointer
into struct kvm_mmu which will be used to inject a page
fault. This will be used later when Nested Nested Paging is
implemented.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>