--- /dev/null
+From dd12ed144e9797094c04736f97aa27d5fe401476 Mon Sep 17 00:00:00 2001
+From: Eric Sandeen <sandeen@redhat.com>
+Date: Fri, 26 Jul 2013 15:21:11 -0400
+Subject: ext4: destroy ext4_es_cachep on module unload
+
+From: Eric Sandeen <sandeen@redhat.com>
+
+commit dd12ed144e9797094c04736f97aa27d5fe401476 upstream.
+
+Without this, module can't be reloaded.
+
+[ 500.521980] kmem_cache_sanity_check (ext4_extent_status): Cache name already exists.
+
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/super.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -5400,6 +5400,7 @@ static void __exit ext4_exit_fs(void)
+ kset_unregister(ext4_kset);
+ ext4_exit_system_zone();
+ ext4_exit_pageio();
++ ext4_exit_es();
+ }
+
+ MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
--- /dev/null
+From 94eec0fc3520c759831763d866421b4d60b599b4 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Mon, 29 Jul 2013 12:12:56 -0400
+Subject: ext4: fix retry handling in ext4_ext_truncate()
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit 94eec0fc3520c759831763d866421b4d60b599b4 upstream.
+
+We tested for ENOMEM instead of -ENOMEM. Oops.
+
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/extents.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/ext4/extents.c
++++ b/fs/ext4/extents.c
+@@ -4389,7 +4389,7 @@ void ext4_ext_truncate(handle_t *handle,
+ retry:
+ err = ext4_es_remove_extent(inode, last_block,
+ EXT_MAX_BLOCKS - last_block);
+- if (err == ENOMEM) {
++ if (err == -ENOMEM) {
+ cond_resched();
+ congestion_wait(BLK_RW_ASYNC, HZ/50);
+ goto retry;
--- /dev/null
+From a34eb503742fd25155fd6cff6163daacead9fbc3 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Fri, 26 Jul 2013 15:15:46 -0400
+Subject: ext4: make sure group number is bumped after a inode allocation race
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit a34eb503742fd25155fd6cff6163daacead9fbc3 upstream.
+
+When we try to allocate an inode, and there is a race between two
+CPU's trying to grab the same inode, _and_ this inode is the last free
+inode in the block group, make sure the group number is bumped before
+we continue searching the rest of the block groups. Otherwise, we end
+up searching the current block group twice, and we end up skipping
+searching the last block group. So in the unlikely situation where
+almost all of the inodes are allocated, it's possible that we will
+return ENOSPC even though there might be free inodes in that last
+block group.
+
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/ialloc.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/fs/ext4/ialloc.c
++++ b/fs/ext4/ialloc.c
+@@ -734,11 +734,8 @@ repeat_in_this_group:
+ ino = ext4_find_next_zero_bit((unsigned long *)
+ inode_bitmap_bh->b_data,
+ EXT4_INODES_PER_GROUP(sb), ino);
+- if (ino >= EXT4_INODES_PER_GROUP(sb)) {
+- if (++group == ngroups)
+- group = 0;
+- continue;
+- }
++ if (ino >= EXT4_INODES_PER_GROUP(sb))
++ goto next_group;
+ if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
+ ext4_error(sb, "reserved inode found cleared - "
+ "inode=%lu", ino + 1);
+@@ -768,6 +765,9 @@ repeat_in_this_group:
+ goto got; /* we grabbed the inode! */
+ if (ino < EXT4_INODES_PER_GROUP(sb))
+ goto repeat_in_this_group;
++next_group:
++ if (++group == ngroups)
++ group = 0;
+ }
+ err = -ENOSPC;
+ goto out;
--- /dev/null
+From 93d783bcca69bfacc8dc739d8a050498402587b5 Mon Sep 17 00:00:00 2001
+From: Curt Brune <curt@cumulusnetworks.com>
+Date: Thu, 8 Aug 2013 12:11:03 -0700
+Subject: hwmon: (adt7470) Fix incorrect return code check
+
+From: Curt Brune <curt@cumulusnetworks.com>
+
+commit 93d783bcca69bfacc8dc739d8a050498402587b5 upstream.
+
+In adt7470_write_word_data(), which writes two bytes using
+i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
+together when they should be OR-ed together.
+
+The return code of i2c_smbus_write_byte_data() is zero for success.
+
+The upshot is only the first byte was ever written to the hardware.
+The 2nd byte was never written out.
+
+I noticed that trying to set the fan speed limits was not working
+correctly on my system. Setting the fan speed limits is the only
+code that uses adt7470_write_word_data(). After making the change
+the limit settings work and the alarms work also.
+
+Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hwmon/adt7470.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/hwmon/adt7470.c
++++ b/drivers/hwmon/adt7470.c
+@@ -215,7 +215,7 @@ static inline int adt7470_write_word_dat
+ u16 value)
+ {
+ return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
+- && i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
++ || i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
+ }
+
+ static void adt7470_init_client(struct i2c_client *client)
--- /dev/null
+From f813b5775b471b656382ae8f087bb34dc894261f Mon Sep 17 00:00:00 2001
+From: Alban Browaeys <alban.browaeys@gmail.com>
+Date: Tue, 16 Jul 2013 18:57:53 -0300
+Subject: media: em28xx: fix assignment of the eeprom data
+
+From: Alban Browaeys <alban.browaeys@gmail.com>
+
+commit f813b5775b471b656382ae8f087bb34dc894261f upstream.
+
+Set the config structure pointer to the eeprom data pointer (data,
+here eedata dereferenced) not the pointer to the pointer to
+the eeprom data (eedata itself).
+
+Signed-off-by: Alban Browaeys <prahal@yahoo.com>
+Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/em28xx/em28xx-i2c.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/em28xx/em28xx-i2c.c
++++ b/drivers/media/usb/em28xx/em28xx-i2c.c
+@@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28
+
+ *eedata = data;
+ *eedata_len = len;
+- dev_config = (void *)eedata;
++ dev_config = (void *)*eedata;
+
+ switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) {
+ case 0:
--- /dev/null
+From 2517617e0de65f8f7cfe75cae745d06b1fa98586 Mon Sep 17 00:00:00 2001
+From: Michael Neuling <mikey@neuling.org>
+Date: Fri, 9 Aug 2013 17:29:29 +1000
+Subject: powerpc: Fix context switch DSCR on POWER8
+
+From: Michael Neuling <mikey@neuling.org>
+
+commit 2517617e0de65f8f7cfe75cae745d06b1fa98586 upstream.
+
+POWER8 allows the DSCR to be accessed directly from userspace via a new SPR
+number 0x3 (Rather than 0x11. DSCR SPR number 0x11 is still used on POWER8 but
+like POWER7, is only accessible in HV and OS modes). Currently, we allow this
+by setting H/FSCR DSCR bit on boot.
+
+Unfortunately this doesn't work, as the kernel needs to see the DSCR change so
+that it knows to no longer restore the system wide version of DSCR on context
+switch (ie. to set thread.dscr_inherit).
+
+This clears the H/FSCR DSCR bit initially. If a process then accesses the DSCR
+(via SPR 0x3), it'll trap into the kernel where we set thread.dscr_inherit in
+facility_unavailable_exception().
+
+We also change _switch() so that we set or clear the H/FSCR DSCR bit based on
+the thread.dscr_inherit.
+
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/entry_64.S | 27 ++++++++++++++++++-
+ arch/powerpc/kernel/traps.c | 58 ++++++++++++++++++++++++-----------------
+ 2 files changed, 60 insertions(+), 25 deletions(-)
+
+--- a/arch/powerpc/kernel/entry_64.S
++++ b/arch/powerpc/kernel/entry_64.S
+@@ -584,9 +584,34 @@ BEGIN_FTR_SECTION
+ ld r7,DSCR_DEFAULT@toc(2)
+ ld r0,THREAD_DSCR(r4)
+ cmpwi r6,0
++ li r8, FSCR_DSCR
+ bne 1f
+ ld r0,0(r7)
+-1: cmpd r0,r25
++ b 3f
++1:
++ BEGIN_FTR_SECTION_NESTED(70)
++ mfspr r6, SPRN_FSCR
++ or r6, r6, r8
++ mtspr SPRN_FSCR, r6
++ BEGIN_FTR_SECTION_NESTED(69)
++ mfspr r6, SPRN_HFSCR
++ or r6, r6, r8
++ mtspr SPRN_HFSCR, r6
++ END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)
++ b 4f
++ END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)
++3:
++ BEGIN_FTR_SECTION_NESTED(70)
++ mfspr r6, SPRN_FSCR
++ andc r6, r6, r8
++ mtspr SPRN_FSCR, r6
++ BEGIN_FTR_SECTION_NESTED(69)
++ mfspr r6, SPRN_HFSCR
++ andc r6, r6, r8
++ mtspr SPRN_HFSCR, r6
++ END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)
++ END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)
++4: cmpd r0,r25
+ beq 2f
+ mtspr SPRN_DSCR,r0
+ 2:
+--- a/arch/powerpc/kernel/traps.c
++++ b/arch/powerpc/kernel/traps.c
+@@ -44,9 +44,7 @@
+ #include <asm/machdep.h>
+ #include <asm/rtas.h>
+ #include <asm/pmc.h>
+-#ifdef CONFIG_PPC32
+ #include <asm/reg.h>
+-#endif
+ #ifdef CONFIG_PMAC_BACKLIGHT
+ #include <asm/backlight.h>
+ #endif
+@@ -1282,43 +1280,54 @@ void vsx_unavailable_exception(struct pt
+ die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT);
+ }
+
++#ifdef CONFIG_PPC64
+ void facility_unavailable_exception(struct pt_regs *regs)
+ {
+ static char *facility_strings[] = {
+- "FPU",
+- "VMX/VSX",
+- "DSCR",
+- "PMU SPRs",
+- "BHRB",
+- "TM",
+- "AT",
+- "EBB",
+- "TAR",
++ [FSCR_FP_LG] = "FPU",
++ [FSCR_VECVSX_LG] = "VMX/VSX",
++ [FSCR_DSCR_LG] = "DSCR",
++ [FSCR_PM_LG] = "PMU SPRs",
++ [FSCR_BHRB_LG] = "BHRB",
++ [FSCR_TM_LG] = "TM",
++ [FSCR_EBB_LG] = "EBB",
++ [FSCR_TAR_LG] = "TAR",
+ };
+- char *facility, *prefix;
++ char *facility = "unknown";
+ u64 value;
++ u8 status;
++ bool hv;
+
+- if (regs->trap == 0xf60) {
+- value = mfspr(SPRN_FSCR);
+- prefix = "";
+- } else {
++ hv = (regs->trap == 0xf80);
++ if (hv)
+ value = mfspr(SPRN_HFSCR);
+- prefix = "Hypervisor ";
++ else
++ value = mfspr(SPRN_FSCR);
++
++ status = value >> 56;
++ if (status == FSCR_DSCR_LG) {
++ /* User is acessing the DSCR. Set the inherit bit and allow
++ * the user to set it directly in future by setting via the
++ * H/FSCR DSCR bit.
++ */
++ current->thread.dscr_inherit = 1;
++ if (hv)
++ mtspr(SPRN_HFSCR, value | HFSCR_DSCR);
++ else
++ mtspr(SPRN_FSCR, value | FSCR_DSCR);
++ return;
+ }
+
+- value = value >> 56;
++ if ((status < ARRAY_SIZE(facility_strings)) &&
++ facility_strings[status])
++ facility = facility_strings[status];
+
+ /* We restore the interrupt state now */
+ if (!arch_irq_disabled_regs(regs))
+ local_irq_enable();
+
+- if (value < ARRAY_SIZE(facility_strings))
+- facility = facility_strings[value];
+- else
+- facility = "unknown";
+-
+ pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",
+- prefix, facility, regs->nip, regs->msr);
++ hv ? "Hypervisor " : "", facility, regs->nip, regs->msr);
+
+ if (user_mode(regs)) {
+ _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
+@@ -1327,6 +1336,7 @@ void facility_unavailable_exception(stru
+
+ die("Unexpected facility unavailable exception", regs, SIGABRT);
+ }
++#endif
+
+ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+
--- /dev/null
+From 88f094120bd2f012ff494ae50a8d4e0d8af8f69e Mon Sep 17 00:00:00 2001
+From: Michael Neuling <mikey@neuling.org>
+Date: Fri, 9 Aug 2013 17:29:27 +1000
+Subject: powerpc: Fix hypervisor facility unavaliable vector number
+
+From: Michael Neuling <mikey@neuling.org>
+
+commit 88f094120bd2f012ff494ae50a8d4e0d8af8f69e upstream.
+
+Currently if we take hypervisor facility unavaliable (from 0xf80/0x4f80) we
+mark it as an OS facility unavaliable (0xf60) as the two share the same code
+path.
+
+The becomes a problem in facility_unavailable_exception() as we aren't able to
+see the hypervisor facility unavailable exceptions.
+
+Below fixes this by duplication the required macros.
+
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/exceptions-64s.S | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -848,7 +848,7 @@ hv_facility_unavailable_relon_trampoline
+ . = 0x4f80
+ SET_SCRATCH0(r13)
+ EXCEPTION_PROLOG_0(PACA_EXGEN)
+- b facility_unavailable_relon_hv
++ b hv_facility_unavailable_relon_hv
+
+ STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
+ #ifdef CONFIG_PPC_DENORMALISATION
+@@ -1175,6 +1175,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
+ b .ret_from_except
+
+ STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
++ STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception)
+
+ .align 7
+ .globl __end_handlers
+@@ -1188,7 +1189,7 @@ __end_handlers:
+ STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
+ STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
+ STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
+- STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable)
++ STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable)
+
+ #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
+ /*
--- /dev/null
+From 4e90a2a7375e86827541bda9393414c03e7721c6 Mon Sep 17 00:00:00 2001
+From: Anton Blanchard <anton@samba.org>
+Date: Wed, 31 Jul 2013 16:31:26 +1000
+Subject: powerpc: On POWERNV enable PPC_DENORMALISATION by default
+
+From: Anton Blanchard <anton@samba.org>
+
+commit 4e90a2a7375e86827541bda9393414c03e7721c6 upstream.
+
+We want PPC_DENORMALISATION enabled when POWERNV is enabled,
+so update the Kconfig.
+
+Signed-off-by: Anton Blanchard <anton@samba.org>
+Acked-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/powerpc/Kconfig
++++ b/arch/powerpc/Kconfig
+@@ -572,7 +572,7 @@ config SCHED_SMT
+ config PPC_DENORMALISATION
+ bool "PowerPC denormalisation exception handling"
+ depends on PPC_BOOK3S_64
+- default "n"
++ default "y" if PPC_POWERNV
+ ---help---
+ Add support for handling denormalisation of single precision
+ values. Useful for bare metal only. If unsure say Y here.
--- /dev/null
+From 74e400cee6c0266ba2d940ed78d981f1e24a8167 Mon Sep 17 00:00:00 2001
+From: Michael Neuling <mikey@neuling.org>
+Date: Fri, 9 Aug 2013 17:29:28 +1000
+Subject: powerpc: Rework setting up H/FSCR bit definitions
+
+From: Michael Neuling <mikey@neuling.org>
+
+commit 74e400cee6c0266ba2d940ed78d981f1e24a8167 upstream.
+
+This reworks the Facility Status and Control Regsiter (FSCR) config bit
+definitions so that we can access the bit numbers. This is needed for a
+subsequent patch to fix the userspace DSCR handling.
+
+HFSCR and FSCR bit definitions are the same, so reuse them.
+
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/include/asm/reg.h | 31 ++++++++++++++++++++-----------
+ 1 file changed, 20 insertions(+), 11 deletions(-)
+
+--- a/arch/powerpc/include/asm/reg.h
++++ b/arch/powerpc/include/asm/reg.h
+@@ -254,19 +254,28 @@
+ #define SPRN_HRMOR 0x139 /* Real mode offset register */
+ #define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */
+ #define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */
++/* HFSCR and FSCR bit numbers are the same */
++#define FSCR_TAR_LG 8 /* Enable Target Address Register */
++#define FSCR_EBB_LG 7 /* Enable Event Based Branching */
++#define FSCR_TM_LG 5 /* Enable Transactional Memory */
++#define FSCR_PM_LG 4 /* Enable prob/priv access to PMU SPRs */
++#define FSCR_BHRB_LG 3 /* Enable Branch History Rolling Buffer*/
++#define FSCR_DSCR_LG 2 /* Enable Data Stream Control Register */
++#define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */
++#define FSCR_FP_LG 0 /* Enable Floating Point */
+ #define SPRN_FSCR 0x099 /* Facility Status & Control Register */
+-#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */
+-#define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */
+-#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */
++#define FSCR_TAR __MASK(FSCR_TAR_LG)
++#define FSCR_EBB __MASK(FSCR_EBB_LG)
++#define FSCR_DSCR __MASK(FSCR_DSCR_LG)
+ #define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */
+-#define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */
+-#define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */
+-#define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */
+-#define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */
+-#define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/
+-#define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */
+-#define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */
+-#define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */
++#define HFSCR_TAR __MASK(FSCR_TAR_LG)
++#define HFSCR_EBB __MASK(FSCR_EBB_LG)
++#define HFSCR_TM __MASK(FSCR_TM_LG)
++#define HFSCR_PM __MASK(FSCR_PM_LG)
++#define HFSCR_BHRB __MASK(FSCR_BHRB_LG)
++#define HFSCR_DSCR __MASK(FSCR_DSCR_LG)
++#define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG)
++#define HFSCR_FP __MASK(FSCR_FP_LG)
+ #define SPRN_TAR 0x32f /* Target Address Register */
+ #define SPRN_LPCR 0x13E /* LPAR Control Register */
+ #define LPCR_VPM0 (1ul << (63-0))
--- /dev/null
+From c2d52644e2da8a07ecab5ca62dd0bc563089e8dc Mon Sep 17 00:00:00 2001
+From: Michael Neuling <mikey@neuling.org>
+Date: Fri, 9 Aug 2013 17:29:30 +1000
+Subject: powerpc: Save the TAR register earlier
+
+From: Michael Neuling <mikey@neuling.org>
+
+commit c2d52644e2da8a07ecab5ca62dd0bc563089e8dc upstream.
+
+This moves us to save the Target Address Register (TAR) a earlier in
+__switch_to. It introduces a new function save_tar() to do this.
+
+We need to save the TAR earlier as we will overwrite it in the transactional
+memory reclaim/recheckpoint path. We are going to do this in a subsequent
+patch which will fix saving the TAR register when it's modified inside a
+transaction.
+
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/include/asm/switch_to.h | 9 +++++++++
+ arch/powerpc/kernel/entry_64.S | 9 ---------
+ arch/powerpc/kernel/process.c | 10 ++++++++++
+ 3 files changed, 19 insertions(+), 9 deletions(-)
+
+--- a/arch/powerpc/include/asm/switch_to.h
++++ b/arch/powerpc/include/asm/switch_to.h
+@@ -15,6 +15,15 @@ extern struct task_struct *__switch_to(s
+ struct thread_struct;
+ extern struct task_struct *_switch(struct thread_struct *prev,
+ struct thread_struct *next);
++#ifdef CONFIG_PPC_BOOK3S_64
++static inline void save_tar(struct thread_struct *prev)
++{
++ if (cpu_has_feature(CPU_FTR_ARCH_207S))
++ prev->tar = mfspr(SPRN_TAR);
++}
++#else
++static inline void save_tar(struct thread_struct *prev) {}
++#endif
+
+ extern void giveup_fpu(struct task_struct *);
+ extern void load_up_fpu(void);
+--- a/arch/powerpc/kernel/entry_64.S
++++ b/arch/powerpc/kernel/entry_64.S
+@@ -449,15 +449,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR)
+
+ #ifdef CONFIG_PPC_BOOK3S_64
+ BEGIN_FTR_SECTION
+- /*
+- * Back up the TAR across context switches. Note that the TAR is not
+- * available for use in the kernel. (To provide this, the TAR should
+- * be backed up/restored on exception entry/exit instead, and be in
+- * pt_regs. FIXME, this should be in pt_regs anyway (for debug).)
+- */
+- mfspr r0,SPRN_TAR
+- std r0,THREAD_TAR(r3)
+-
+ /* Event based branch registers */
+ mfspr r0, SPRN_BESCR
+ std r0, THREAD_BESCR(r3)
+--- a/arch/powerpc/kernel/process.c
++++ b/arch/powerpc/kernel/process.c
+@@ -600,6 +600,16 @@ struct task_struct *__switch_to(struct t
+ struct ppc64_tlb_batch *batch;
+ #endif
+
++ /* Back up the TAR across context switches.
++ * Note that the TAR is not available for use in the kernel. (To
++ * provide this, the TAR should be backed up/restored on exception
++ * entry/exit instead, and be in pt_regs. FIXME, this should be in
++ * pt_regs anyway (for debug).)
++ * Save the TAR here before we do treclaim/trecheckpoint as these
++ * will change the TAR.
++ */
++ save_tar(&prev->thread);
++
+ __switch_to_tm(prev);
+
+ #ifdef CONFIG_SMP
--- /dev/null
+From 28e61cc466d8daace4b0f04ba2b83e0bd68f5832 Mon Sep 17 00:00:00 2001
+From: Michael Neuling <mikey@neuling.org>
+Date: Fri, 9 Aug 2013 17:29:31 +1000
+Subject: powerpc/tm: Fix context switching TAR, PPR and DSCR SPRs
+
+From: Michael Neuling <mikey@neuling.org>
+
+commit 28e61cc466d8daace4b0f04ba2b83e0bd68f5832 upstream.
+
+If a transaction is rolled back, the Target Address Register (TAR), Processor
+Priority Register (PPR) and Data Stream Control Register (DSCR) should be
+restored to the checkpointed values before the transaction began. Any changes
+to these SPRs inside the transaction should not be visible in the abort
+handler.
+
+Currently Linux doesn't save or restore the checkpointed TAR, PPR or DSCR. If
+we preempt a processes inside a transaction which has modified any of these, on
+process restore, that same transaction may be aborted we but we won't see the
+checkpointed versions of these SPRs.
+
+This adds checkpointed versions of these SPRs to the thread_struct and adds the
+save/restore of these three SPRs to the treclaim/trechkpt code.
+
+Without this if any of these SPRs are modified during a transaction, users may
+incorrectly see a speculated SPR value even if the transaction is aborted.
+
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/include/asm/processor.h | 4 ++++
+ arch/powerpc/kernel/asm-offsets.c | 3 +++
+ arch/powerpc/kernel/tm.S | 20 ++++++++++++++++++++
+ 3 files changed, 27 insertions(+)
+
+--- a/arch/powerpc/include/asm/processor.h
++++ b/arch/powerpc/include/asm/processor.h
+@@ -247,6 +247,10 @@ struct thread_struct {
+ unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */
+ struct pt_regs ckpt_regs; /* Checkpointed registers */
+
++ unsigned long tm_tar;
++ unsigned long tm_ppr;
++ unsigned long tm_dscr;
++
+ /*
+ * Transactional FP and VSX 0-31 register set.
+ * NOTE: the sense of these is the opposite of the integer ckpt_regs!
+--- a/arch/powerpc/kernel/asm-offsets.c
++++ b/arch/powerpc/kernel/asm-offsets.c
+@@ -139,6 +139,9 @@ int main(void)
+ DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar));
+ DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr));
+ DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar));
++ DEFINE(THREAD_TM_TAR, offsetof(struct thread_struct, tm_tar));
++ DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr));
++ DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr));
+ DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs));
+ DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct,
+ transact_vr[0]));
+--- a/arch/powerpc/kernel/tm.S
++++ b/arch/powerpc/kernel/tm.S
+@@ -224,6 +224,16 @@ dont_backup_fp:
+ std r5, _CCR(r7)
+ std r6, _XER(r7)
+
++
++ /* ******************** TAR, PPR, DSCR ********** */
++ mfspr r3, SPRN_TAR
++ mfspr r4, SPRN_PPR
++ mfspr r5, SPRN_DSCR
++
++ std r3, THREAD_TM_TAR(r12)
++ std r4, THREAD_TM_PPR(r12)
++ std r5, THREAD_TM_DSCR(r12)
++
+ /* MSR and flags: We don't change CRs, and we don't need to alter
+ * MSR.
+ */
+@@ -338,6 +348,16 @@ dont_restore_fp:
+ mtmsr r6 /* FP/Vec off again! */
+
+ restore_gprs:
++
++ /* ******************** TAR, PPR, DSCR ********** */
++ ld r4, THREAD_TM_TAR(r3)
++ ld r5, THREAD_TM_PPR(r3)
++ ld r6, THREAD_TM_DSCR(r3)
++
++ mtspr SPRN_TAR, r4
++ mtspr SPRN_PPR, r5
++ mtspr SPRN_DSCR, r6
++
+ /* ******************** CR,LR,CCR,MSR ********** */
+ ld r3, _CTR(r7)
+ ld r4, _LINK(r7)
--- /dev/null
+From 49ccc142f9cbc33fdda18e8fa90c1c5b4a79c0ad Mon Sep 17 00:00:00 2001
+From: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
+Date: Tue, 6 Aug 2013 18:34:40 +0200
+Subject: regmap: Add missing header for !CONFIG_REGMAP stubs
+
+From: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
+
+commit 49ccc142f9cbc33fdda18e8fa90c1c5b4a79c0ad upstream.
+
+regmap.h requires linux/err.h if CONFIG_REGMAP is not defined. Without it I get
+error.
+CC drivers/media/platform/exynos4-is/fimc-reg.o
+In file included from drivers/media/platform/exynos4-is/fimc-reg.c:14:0:
+include/linux/regmap.h: In function ‘regmap_write’:
+include/linux/regmap.h:525:10: error: ‘EINVAL’ undeclared (first use in this function)
+include/linux/regmap.h:525:10: note: each undeclared identifier is reported only once for each function it appears in
+
+Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
+Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/regmap.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/include/linux/regmap.h
++++ b/include/linux/regmap.h
+@@ -15,6 +15,7 @@
+
+ #include <linux/list.h>
+ #include <linux/rbtree.h>
++#include <linux/err.h>
+
+ struct module;
+ struct device;
--- /dev/null
+From 2d49b5987561e480bdbd8692b27fc5f49a1e2f0b Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Mon, 5 Aug 2013 11:21:29 +0200
+Subject: regmap: cache: Make sure to sync the last register in a block
+
+From: Lars-Peter Clausen <lars@metafoo.de>
+
+commit 2d49b5987561e480bdbd8692b27fc5f49a1e2f0b upstream.
+
+regcache_sync_block_raw_flush() expects the address of the register after last
+register that needs to be synced as its parameter. But the last call to
+regcache_sync_block_raw_flush() in regcache_sync_block_raw() passes the address
+of the last register in the block. This effectively always skips over the last
+register in a block, even if it needs to be synced. In order to fix it increase
+the address by one register.
+
+The issue was introduced in commit 75a5f89 ("regmap: cache: Write consecutive
+registers in a single block write").
+
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/regmap/regcache.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/base/regmap/regcache.c
++++ b/drivers/base/regmap/regcache.c
+@@ -644,7 +644,8 @@ static int regcache_sync_block_raw(struc
+ }
+ }
+
+- return regcache_sync_block_raw_flush(map, &data, base, regtmp);
++ return regcache_sync_block_raw_flush(map, &data, base, regtmp +
++ map->reg_stride);
+ }
+
+ int regcache_sync_block(struct regmap *map, void *block,
--- /dev/null
+From 7562523e84ddc742fe1f9db8bd76b01acca89f6b Mon Sep 17 00:00:00 2001
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+Date: Tue, 30 Jul 2013 22:58:34 -0400
+Subject: SCSI: Don't attempt to send extended INQUIRY command if skip_vpd_pages is set
+
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+
+commit 7562523e84ddc742fe1f9db8bd76b01acca89f6b upstream.
+
+If a device has the skip_vpd_pages flag set we should simply fail the
+scsi_get_vpd_page() call.
+
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Tested-by: Stuart Foster <smf.linux@ntlworld.com>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/scsi.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/scsi/scsi.c
++++ b/drivers/scsi/scsi.c
+@@ -1031,6 +1031,9 @@ int scsi_get_vpd_page(struct scsi_device
+ {
+ int i, result;
+
++ if (sdev->skip_vpd_pages)
++ goto fail;
++
+ /* Ask for all the pages supported by this device */
+ result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
+ if (result)
--- /dev/null
+From 6431f5d7c6025f8b007af06ea090de308f7e6881 Mon Sep 17 00:00:00 2001
+From: "Sumit.Saxena@lsi.com" <Sumit.Saxena@lsi.com>
+Date: Tue, 16 Jul 2013 02:26:05 +0530
+Subject: SCSI: megaraid_sas: megaraid_sas driver init fails in kdump kernel
+
+From: "Sumit.Saxena@lsi.com" <Sumit.Saxena@lsi.com>
+
+commit 6431f5d7c6025f8b007af06ea090de308f7e6881 upstream.
+
+Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails
+in kdump kernel with LSI MegaRAID controller(device id-0x73).
+
+Actually this issue needs fix in firmware, but for firmware running in field,
+this driver fix is proposed to resolve the issue. At firmware initialization
+time, if firmware does not come to ready state, driver will reset the adapter
+and retry for firmware transition to ready state unconditionally(not only
+executed for kdump kernel).
+
+Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
+Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c
+@@ -3508,11 +3508,21 @@ static int megasas_init_fw(struct megasa
+ break;
+ }
+
+- /*
+- * We expect the FW state to be READY
+- */
+- if (megasas_transition_to_ready(instance, 0))
+- goto fail_ready_state;
++ if (megasas_transition_to_ready(instance, 0)) {
++ atomic_set(&instance->fw_reset_no_pci_access, 1);
++ instance->instancet->adp_reset
++ (instance, instance->reg_set);
++ atomic_set(&instance->fw_reset_no_pci_access, 0);
++ dev_info(&instance->pdev->dev,
++ "megasas: FW restarted successfully from %s!\n",
++ __func__);
++
++ /*waitting for about 30 second before retry*/
++ ssleep(30);
++
++ if (megasas_transition_to_ready(instance, 0))
++ goto fail_ready_state;
++ }
+
+ /* Check if MSI-X is supported while in ready state */
+ msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
--- /dev/null
+scsi-don-t-attempt-to-send-extended-inquiry-command-if-skip_vpd_pages-is-set.patch
+scsi-megaraid_sas-megaraid_sas-driver-init-fails-in-kdump-kernel.patch
+virtio-scsi-fix-virtqueue-affinity-setup.patch
+powerpc-on-powernv-enable-ppc_denormalisation-by-default.patch
+powerpc-fix-hypervisor-facility-unavaliable-vector-number.patch
+powerpc-rework-setting-up-h-fscr-bit-definitions.patch
+powerpc-fix-context-switch-dscr-on-power8.patch
+powerpc-save-the-tar-register-earlier.patch
+powerpc-tm-fix-context-switching-tar-ppr-and-dscr-sprs.patch
+ext4-destroy-ext4_es_cachep-on-module-unload.patch
+ext4-make-sure-group-number-is-bumped-after-a-inode-allocation-race.patch
+ext4-fix-retry-handling-in-ext4_ext_truncate.patch
+regmap-cache-make-sure-to-sync-the-last-register-in-a-block.patch
+regmap-add-missing-header-for-config_regmap-stubs.patch
+hwmon-adt7470-fix-incorrect-return-code-check.patch
+staging-zcache-fix-zcache-kernel-parameter.patch
+media-em28xx-fix-assignment-of-the-eeprom-data.patch
--- /dev/null
+From 02073798a6b081bf74e6c10d6f7e7a693c067ecd Mon Sep 17 00:00:00 2001
+From: Piotr Sarna <p.sarna@partner.samsung.com>
+Date: Mon, 29 Jul 2013 12:25:20 +0200
+Subject: staging: zcache: fix "zcache=" kernel parameter
+
+From: Piotr Sarna <p.sarna@partner.samsung.com>
+
+commit 02073798a6b081bf74e6c10d6f7e7a693c067ecd upstream.
+
+Commit 835f2f5 ("staging: zcache: enable zcache to be built/loaded as
+a module") introduced an incorrect handling of "zcache=" parameter.
+
+Inside zcache_comp_init() function, zcache_comp_name variable is
+checked for being empty. If not empty, the above variable is tested
+for being compatible with Crypto API. Unfortunately, after that
+function ends unconditionally (by the "goto out" directive) and returns:
+- non-zero value if verification succeeded, wrongly indicating an error
+- zero value if verification failed, falsely informing that function
+ zcache_comp_init() ended properly.
+
+A solution to this problem is as following:
+1. Move the "goto out" directive inside the "if (!ret)" statement
+2. In case that crypto_has_comp() returned 0, change the value of ret
+ to non-zero before "goto out" to indicate an error.
+
+This patch replaces an earlier one from Michal Hocko (based on report
+from Cristian Rodriguez):
+
+ http://permalink.gmane.org/gmane.linux.kernel.mm/102484
+
+It also addressed the same issue but didn't fix the zcache_comp_init()
+for case when the compressor data passed to "zcache=" option was invalid
+or unsupported.
+
+Signed-off-by: Piotr Sarna <p.sarna@partner.samsung.com>
+[bzolnier: updated patch description]
+Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
+Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Acked-by: Michal Hocko <mhocko@suse.cz>
+Cc: Cristian Rodriguez <crrodriguez@opensuse.org>
+Cc: Bob Liu <bob.liu@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/zcache/zcache-main.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/staging/zcache/zcache-main.c
++++ b/drivers/staging/zcache/zcache-main.c
+@@ -1811,10 +1811,12 @@ static int zcache_comp_init(void)
+ #else
+ if (*zcache_comp_name != '\0') {
+ ret = crypto_has_comp(zcache_comp_name, 0, 0);
+- if (!ret)
++ if (!ret) {
+ pr_info("zcache: %s not supported\n",
+ zcache_comp_name);
+- goto out;
++ ret = 1;
++ goto out;
++ }
+ }
+ if (!ret)
+ strcpy(zcache_comp_name, "lzo");
--- /dev/null
+From aa52aeea2725839bdd3dcce394486e9a043065e0 Mon Sep 17 00:00:00 2001
+From: Asias He <asias@redhat.com>
+Date: Thu, 1 Aug 2013 11:07:18 +0930
+Subject: virtio-scsi: Fix virtqueue affinity setup
+
+From: Asias He <asias@redhat.com>
+
+commit aa52aeea2725839bdd3dcce394486e9a043065e0 upstream.
+
+vscsi->num_queues counts the number of request virtqueue which does not
+include the control and event virtqueue. It is wrong to subtract
+VIRTIO_SCSI_VQ_BASE from vscsi->num_queues.
+
+This patch fixes the following panic.
+
+(qemu) device_del scsi0
+
+ BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
+ IP: [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120
+ PGD 0
+ Oops: 0000 [#1] SMP
+ Modules linked in:
+ CPU: 0 PID: 659 Comm: kworker/0:1 Not tainted 3.11.0-rc2+ #1172
+ Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
+ Workqueue: kacpi_hotplug _handle_hotplug_event_func
+ task: ffff88007bee1cc0 ti: ffff88007bfe4000 task.ti: ffff88007bfe4000
+ RIP: 0010:[<ffffffff8179b29f>] [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120
+ RSP: 0018:ffff88007bfe5a38 EFLAGS: 00010202
+ RAX: 0000000000000010 RBX: ffff880077fd0d28 RCX: 0000000000000050
+ RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000000
+ RBP: ffff88007bfe5a58 R08: ffff880077f6ff00 R09: 0000000000000001
+ R10: ffffffff8143e673 R11: 0000000000000001 R12: 0000000000000001
+ R13: ffff880077fd0800 R14: 0000000000000000 R15: ffff88007bf489b0
+ FS: 0000000000000000(0000) GS:ffff88007ea00000(0000) knlGS:0000000000000000
+ CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
+ CR2: 0000000000000020 CR3: 0000000079f8b000 CR4: 00000000000006f0
+ Stack:
+ ffff880077fd0d28 0000000000000000 ffff880077fd0800 0000000000000008
+ ffff88007bfe5a78 ffffffff8179b37d ffff88007bccc800 ffff88007bccc800
+ ffff88007bfe5a98 ffffffff8179b3b6 ffff88007bccc800 ffff880077fd0d28
+ Call Trace:
+ [<ffffffff8179b37d>] virtscsi_set_affinity+0x2d/0x40
+ [<ffffffff8179b3b6>] virtscsi_remove_vqs+0x26/0x50
+ [<ffffffff8179c7d2>] virtscsi_remove+0x82/0xa0
+ [<ffffffff814cb6b2>] virtio_dev_remove+0x22/0x70
+ [<ffffffff8167ca49>] __device_release_driver+0x69/0xd0
+ [<ffffffff8167cb9d>] device_release_driver+0x2d/0x40
+ [<ffffffff8167bb96>] bus_remove_device+0x116/0x150
+ [<ffffffff81679936>] device_del+0x126/0x1e0
+ [<ffffffff81679a06>] device_unregister+0x16/0x30
+ [<ffffffff814cb889>] unregister_virtio_device+0x19/0x30
+ [<ffffffff814cdad6>] virtio_pci_remove+0x36/0x80
+ [<ffffffff81464ae7>] pci_device_remove+0x37/0x70
+ [<ffffffff8167ca49>] __device_release_driver+0x69/0xd0
+ [<ffffffff8167cb9d>] device_release_driver+0x2d/0x40
+ [<ffffffff8167bb96>] bus_remove_device+0x116/0x150
+ [<ffffffff81679936>] device_del+0x126/0x1e0
+ [<ffffffff8145edfc>] pci_stop_bus_device+0x9c/0xb0
+ [<ffffffff8145f036>] pci_stop_and_remove_bus_device+0x16/0x30
+ [<ffffffff81474a9e>] acpiphp_disable_slot+0x8e/0x150
+ [<ffffffff81474f6a>] hotplug_event_func+0xba/0x1a0
+ [<ffffffff814906c8>] ? acpi_os_release_object+0xe/0x12
+ [<ffffffff81475911>] _handle_hotplug_event_func+0x31/0x70
+ [<ffffffff810b5333>] process_one_work+0x183/0x500
+ [<ffffffff810b66e2>] worker_thread+0x122/0x400
+ [<ffffffff810b65c0>] ? manage_workers+0x2d0/0x2d0
+ [<ffffffff810bc5de>] kthread+0xce/0xe0
+ [<ffffffff810bc510>] ? kthread_freezable_should_stop+0x70/0x70
+ [<ffffffff81ca045c>] ret_from_fork+0x7c/0xb0
+ [<ffffffff810bc510>] ? kthread_freezable_should_stop+0x70/0x70
+ Code: 01 00 00 00 74 59 45 31 e4 83 bb c8 01 00 00 02 74 46 66 2e 0f 1f 84 00 00 00 00 00 49 63 c4 48 c1 e0 04 48 8b bc 0
+3 10 02 00 00 <48> 8b 47 20 48 8b 80 d0 01 00 00 48 8b 40 50 48 85 c0 74 07 be
+ RIP [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120
+ RSP <ffff88007bfe5a38>
+ CR2: 0000000000000020
+ ---[ end trace 99679331a3775f48 ]---
+
+Signed-off-by: Asias He <asias@redhat.com>
+Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
+Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/virtio_scsi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/virtio_scsi.c
++++ b/drivers/scsi/virtio_scsi.c
+@@ -751,7 +751,7 @@ static void __virtscsi_set_affinity(stru
+
+ vscsi->affinity_hint_set = true;
+ } else {
+- for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++)
++ for (i = 0; i < vscsi->num_queues; i++)
+ virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1);
+
+ vscsi->affinity_hint_set = false;