--- /dev/null
+From e65f131a14726e5f1b880a528271a52428e5b3a5 Mon Sep 17 00:00:00 2001
+From: Aaro Koskinen <aaro.koskinen@iki.fi>
+Date: Wed, 8 May 2013 16:48:00 -0700
+Subject: ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices
+
+From: Aaro Koskinen <aaro.koskinen@iki.fi>
+
+commit e65f131a14726e5f1b880a528271a52428e5b3a5 upstream.
+
+Commit 9fdca9df (spi: omap2-mcspi: convert to module_platform_driver)
+broke the SPI display/panel driver probe on RX-51/N900. The exact cause is
+not fully understood, but it seems to be related to the probe order. SPI
+communication to the panel driver (spi1.2) fails unless the touchscreen
+(spi1.0) has been probed/initialized before. When the omap2-mcspi driver
+was converted to a platform driver, it resulted in that the devices are
+probed immediately after the board registers them in the order they are
+listed in the board file.
+
+Fix the issue by moving the touchscreen before the panel in the SPI
+device list.
+
+The patch fixes the following failure:
+
+[ 1.260955] acx565akm spi1.2: invalid display ID
+[ 1.265899] panel-acx565akm display0: acx_panel_probe panel detect error
+[ 1.273071] omapdss CORE error: driver probe failed: -19
+
+Tested-by: Sebastian Reichel <sre@debian.org>
+Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
+Cc: Pali Rohár <pali.rohar@gmail.com>
+Cc: Joni Lapilainen <joni.lapilainen@gmail.com>
+Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Cc: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-omap2/board-rx51-peripherals.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
++++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
+@@ -73,11 +73,11 @@
+ #define LIS302_IRQ1_GPIO 181
+ #define LIS302_IRQ2_GPIO 180 /* Not yet in use */
+
+-/* list all spi devices here */
++/* List all SPI devices here. Note that the list/probe order seems to matter! */
+ enum {
+ RX51_SPI_WL1251,
+- RX51_SPI_MIPID, /* LCD panel */
+ RX51_SPI_TSC2005, /* Touch Controller */
++ RX51_SPI_MIPID, /* LCD panel */
+ };
+
+ static struct wl12xx_platform_data wl1251_pdata;
--- /dev/null
+From c1e0ac192b48b37f31801c17534ab3d2a9282d84 Mon Sep 17 00:00:00 2001
+From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
+Date: Wed, 1 May 2013 09:26:23 +0900
+Subject: HID: reintroduce fix-up for certain Sony RF receivers
+
+From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
+
+commit c1e0ac192b48b37f31801c17534ab3d2a9282d84 upstream.
+
+It looks like the manual merge 0d69a3c731e120b05b7da9fb976830475a3fbc01 ("Merge
+branches 'for-3.9/sony' and 'for-3.9/steelseries' into for-linus") accidentally
+removed Sony RF receiver with USB product id 0x0374 from the "have special
+driver" list, effectively nullifying a464918419f94a0043d2f549d6defb4c3f69f68a
+("HID: add support for Sony RF receiver with USB product id 0x0374"). Add the
+device back to the list.
+
+Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/hid/hid-core.c
++++ b/drivers/hid/hid-core.c
+@@ -1702,6 +1702,7 @@ static const struct hid_device_id hid_ha
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
++ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
--- /dev/null
+From a035d5c64d08a8ac12d81b596e7fa6d95a73c347 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Thu, 9 May 2013 11:32:49 +0200
+Subject: KVM: emulator: emulate AAM
+
+From: Paolo Bonzini <pbonzini@redhat.com>
+
+commit a035d5c64d08a8ac12d81b596e7fa6d95a73c347 upstream.
+
+This is used by SGABIOS, KVM breaks with emulate_invalid_guest_state=1.
+
+AAM needs the source operand to be unsigned; do the same in AAD as well
+for consistency, even though it does not affect the result.
+
+Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Gleb Natapov <gleb@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/emulate.c | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -2986,6 +2986,28 @@ static int em_das(struct x86_emulate_ctx
+ return X86EMUL_CONTINUE;
+ }
+
++static int em_aam(struct x86_emulate_ctxt *ctxt)
++{
++ u8 al, ah;
++
++ if (ctxt->src.val == 0)
++ return emulate_de(ctxt);
++
++ al = ctxt->dst.val & 0xff;
++ ah = al / ctxt->src.val;
++ al %= ctxt->src.val;
++
++ ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al | (ah << 8);
++
++ /* Set PF, ZF, SF */
++ ctxt->src.type = OP_IMM;
++ ctxt->src.val = 0;
++ ctxt->src.bytes = 1;
++ fastop(ctxt, em_or);
++
++ return X86EMUL_CONTINUE;
++}
++
+ static int em_aad(struct x86_emulate_ctxt *ctxt)
+ {
+ u8 al = ctxt->dst.val & 0xff;
+@@ -3926,7 +3948,8 @@ static const struct opcode opcode_table[
+ /* 0xD0 - 0xD7 */
+ G(Src2One | ByteOp, group2), G(Src2One, group2),
+ G(Src2CL | ByteOp, group2), G(Src2CL, group2),
+- N, I(DstAcc | SrcImmByte | No64, em_aad), N, N,
++ I(DstAcc | SrcImmUByte | No64, em_aam),
++ I(DstAcc | SrcImmUByte | No64, em_aad), N, N,
+ /* 0xD8 - 0xDF */
+ N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N,
+ /* 0xE0 - 0xE7 */
--- /dev/null
+From 326f578f7e1443bac2333712dd130a261ec15288 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Thu, 9 May 2013 11:32:51 +0200
+Subject: KVM: emulator: emulate SALC
+
+From: Paolo Bonzini <pbonzini@redhat.com>
+
+commit 326f578f7e1443bac2333712dd130a261ec15288 upstream.
+
+This is an almost-undocumented instruction available in 32-bit mode.
+I say "almost" undocumented because AMD documents it in their opcode
+maps just to say that it is unavailable in 64-bit mode (sections
+"A.2.1 One-Byte Opcodes" and "B.3 Invalid and Reassigned Instructions
+in 64-Bit Mode").
+
+It is roughly equivalent to "sbb %al, %al" except it does not
+set the flags. Use fastop to emulate it, but do not use the opcode
+directly because it would fail if the host is 64-bit!
+
+Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Gleb Natapov <gleb@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/emulate.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -534,6 +534,9 @@ FOP_SETCC(setle)
+ FOP_SETCC(setnle)
+ FOP_END;
+
++FOP_START(salc) "pushf; sbb %al, %al; popf \n\t" FOP_RET
++FOP_END;
++
+ #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \
+ do { \
+ unsigned long _tmp; \
+@@ -3951,7 +3954,8 @@ static const struct opcode opcode_table[
+ G(Src2One | ByteOp, group2), G(Src2One, group2),
+ G(Src2CL | ByteOp, group2), G(Src2CL, group2),
+ I(DstAcc | SrcImmUByte | No64, em_aam),
+- I(DstAcc | SrcImmUByte | No64, em_aad), N,
++ I(DstAcc | SrcImmUByte | No64, em_aad),
++ F(DstAcc | ByteOp | No64, em_salc),
+ I(DstAcc | SrcXLat | ByteOp, em_mov),
+ /* 0xD8 - 0xDF */
+ N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N,
--- /dev/null
+From 7fa57952d70f5737513d8319395e471d107e4e0d Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Thu, 9 May 2013 11:32:50 +0200
+Subject: KVM: emulator: emulate XLAT
+
+From: Paolo Bonzini <pbonzini@redhat.com>
+
+commit 7fa57952d70f5737513d8319395e471d107e4e0d upstream.
+
+This is used by SGABIOS, KVM breaks with emulate_invalid_guest_state=1.
+It is just a MOV in disguise, with a funny source address.
+
+Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Gleb Natapov <gleb@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/emulate.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -60,6 +60,7 @@
+ #define OpGS 25ull /* GS */
+ #define OpMem8 26ull /* 8-bit zero extended memory operand */
+ #define OpImm64 27ull /* Sign extended 16/32/64-bit immediate */
++#define OpXLat 28ull /* memory at BX/EBX/RBX + zero-extended AL */
+
+ #define OpBits 5 /* Width of operand field */
+ #define OpMask ((1ull << OpBits) - 1)
+@@ -99,6 +100,7 @@
+ #define SrcImmUByte (OpImmUByte << SrcShift)
+ #define SrcImmU (OpImmU << SrcShift)
+ #define SrcSI (OpSI << SrcShift)
++#define SrcXLat (OpXLat << SrcShift)
+ #define SrcImmFAddr (OpImmFAddr << SrcShift)
+ #define SrcMemFAddr (OpMemFAddr << SrcShift)
+ #define SrcAcc (OpAcc << SrcShift)
+@@ -3949,7 +3951,8 @@ static const struct opcode opcode_table[
+ G(Src2One | ByteOp, group2), G(Src2One, group2),
+ G(Src2CL | ByteOp, group2), G(Src2CL, group2),
+ I(DstAcc | SrcImmUByte | No64, em_aam),
+- I(DstAcc | SrcImmUByte | No64, em_aad), N, N,
++ I(DstAcc | SrcImmUByte | No64, em_aad), N,
++ I(DstAcc | SrcXLat | ByteOp, em_mov),
+ /* 0xD8 - 0xDF */
+ N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N,
+ /* 0xE0 - 0xE7 */
+@@ -4211,6 +4214,16 @@ static int decode_operand(struct x86_emu
+ op->val = 0;
+ op->count = 1;
+ break;
++ case OpXLat:
++ op->type = OP_MEM;
++ op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
++ op->addr.mem.ea =
++ register_address(ctxt,
++ reg_read(ctxt, VCPU_REGS_RBX) +
++ (reg_read(ctxt, VCPU_REGS_RAX) & 0xff));
++ op->addr.mem.seg = seg_override(ctxt);
++ op->val = 0;
++ break;
+ case OpImmFAddr:
+ op->type = OP_IMM;
+ op->addr.mem.ea = ctxt->_eip;
--- /dev/null
+From 8d76c49e9ffeee839bc0b7a3278a23f99101263e Mon Sep 17 00:00:00 2001
+From: Gleb Natapov <gleb@redhat.com>
+Date: Wed, 8 May 2013 18:38:44 +0300
+Subject: KVM: VMX: fix halt emulation while emulating invalid guest sate
+
+From: Gleb Natapov <gleb@redhat.com>
+
+commit 8d76c49e9ffeee839bc0b7a3278a23f99101263e upstream.
+
+The invalid guest state emulation loop does not check halt_request
+which causes 100% cpu loop while guest is in halt and in invalid
+state, but more serious issue is that this leaves halt_request set, so
+random instruction emulated by vm86 #GP exit can be interpreted
+as halt which causes guest hang. Fix both problems by handling
+halt_request in emulation loop.
+
+Reported-by: Tomas Papan <tomas.papan@gmail.com>
+Tested-by: Tomas Papan <tomas.papan@gmail.com>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Gleb Natapov <gleb@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/vmx.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -5197,6 +5197,12 @@ static int handle_invalid_guest_state(st
+ return 0;
+ }
+
++ if (vcpu->arch.halt_request) {
++ vcpu->arch.halt_request = 0;
++ ret = kvm_emulate_halt(vcpu);
++ goto out;
++ }
++
+ if (signal_pending(current))
+ goto out;
+ if (need_resched())
--- /dev/null
+kvm-vmx-fix-halt-emulation-while-emulating-invalid-guest-sate.patch
+kvm-emulator-emulate-aam.patch
+kvm-emulator-emulate-xlat.patch
+kvm-emulator-emulate-salc.patch
+hid-reintroduce-fix-up-for-certain-sony-rf-receivers.patch
+arm-omap-rx-51-change-probe-order-of-touchscreen-and-panel-spi-devices.patch