1. 08 May, 2013 40 commits
    • Daniel Mack's avatar
      ALSA: snd-usb: try harder to find USB_DT_CS_ENDPOINT · 2e481f00
      Daniel Mack authored
      commit ebfc594c upstream.
      
      The USB_DT_CS_ENDPOINT class-specific endpoint descriptor is usually
      stuffed directly after the standard USB endpoint descriptor, and this is
      where the driver currently expects it to be.
      
      There are, however, devices in the wild that have it the other way
      around in their descriptor sets, so the USB_DT_CS_ENDPOINT comes
      *before* the standard enpoint. Devices known to implement it that way
      are "Sennheiser BTD-500" and Plantronics USB headsets.
      
      When the driver can't find the USB_DT_CS_ENDPOINT, it won't be able to
      change sample rates, as the bitmask for the validity of this command is
      storen in bmAttributes of that descriptor.
      
      Fix this by searching the entire interface instead of just the extra
      bytes of the first endpoint, in case the latter fails.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Reported-and-tested-by: default avatarTorstein Hegge <hegge@resisty.net>
      Reported-and-tested-by: default avatarYves G <alsa-user@vivigatt.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e481f00
    • Takashi Iwai's avatar
      ALSA: emu10k1: Fix dock firmware loading · 53fca514
      Takashi Iwai authored
      commit e08b34e8 upstream.
      
      The commit [b209c4df: ALSA: emu10k1: cache emu1010 firmware] broke the
      firmware loading of the dock, just (mistakenly) ignoring a different
      firmware for docks on some models.  This patch revives them again.
      
      Bugzilla: https://bugs.archlinux.org/task/34865Reported-and-tested-by: default avatarTobias Powalowski <tobias.powalowski@googlemail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      53fca514
    • Duncan Laurie's avatar
      TPM: Retry SaveState command in suspend path · 9bcb7573
      Duncan Laurie authored
      commit 32d33b29 upstream.
      
      If the TPM has already been sent a SaveState command before the driver
      is loaded it may have problems sending that same command again later.
      
      This issue is seen with the Chromebook Pixel due to a firmware bug in
      the legacy mode boot path which is sending the SaveState command
      before booting the kernel.  More information is available at
      http://crbug.com/203524
      
      This change introduces a retry of the SaveState command in the suspend
      path in order to work around this issue.  A future firmware update
      should fix this but this is also a trivial workaround in the driver
      that has no effect on systems that do not show this problem.
      
      When this does happen the TPM responds with a non-fatal TPM_RETRY code
      that is defined in the specification:
      
        The TPM is too busy to respond to the command immediately, but the
        command could be resubmitted at a later time.  The TPM MAY return
        TPM_RETRY for any command at any time.
      
      It can take several seconds before the TPM will respond again.  I
      measured a typical time between 3 and 4 seconds and the timeout is set
      at a safe 5 seconds.
      
      It is also possible to reproduce this with commands via /dev/tpm0.
      The bug linked above has a python script attached which can be used to
      test for this problem.  I tested a variety of TPMs from Infineon,
      Nuvoton, Atmel, and STMicro but was only able to reproduce this with
      LPC and I2C TPMs from Infineon.
      
      The TPM specification only loosely defines this behavior:
      
        TPM Main Level 2 Part 3 v1.2 r116, section 3.3. TPM_SaveState:
        The TPM MAY declare all preserved values invalid in response to any
        command other than TPM_Init.
      
        TCG PC Client BIOS Spec 1.21 section 8.3.1.
        After issuing a TPM_SaveState command, the OS SHOULD NOT issue TPM
        commands before transitioning to S3 without issuing another
        TPM_SaveState command.
      
        TCG PC Client TIS 1.21, section 4. Power Management:
        The TPM_SaveState command allows a Static OS to indicate to the TPM
        that the platform may enter a low power state where the TPM will be
        required to enter into the D3 power state.  The use of the term "may"
        is significant in that there is no requirement for the platform to
        actually enter the low power state after sending the TPM_SaveState
        command.  The software may, in fact, send subsequent commands after
        sending the TPM_SaveState command.
      
      Change-Id: I52b41e826412688e5b6c8ddd3bb16409939704e9
      Signed-off-by: default avatarDuncan Laurie <dlaurie@chromium.org>
      Signed-off-by: default avatarKent Yoder <key@linux.vnet.ibm.com>
      Cc: Dirk Hohndel <dirk@hohndel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9bcb7573
    • Hugh Dickins's avatar
      mm: allow arch code to control the user page table ceiling · 258497d1
      Hugh Dickins authored
      commit 6ee8630e upstream.
      
      On architectures where a pgd entry may be shared between user and kernel
      (e.g.  ARM+LPAE), freeing page tables needs a ceiling other than 0.
      This patch introduces a generic USER_PGTABLES_CEILING that arch code can
      override.  It is the responsibility of the arch code setting the ceiling
      to ensure the complete freeing of the page tables (usually in
      pgd_free()).
      
      [catalin.marinas@arm.com: commit log; shift_arg_pages(), asm-generic/pgtables.h changes]
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      258497d1
    • Anurup m's avatar
      fs/fscache/stats.c: fix memory leak · d340c737
      Anurup m authored
      commit ec686c92 upstream.
      
      There is a kernel memory leak observed when the proc file
      /proc/fs/fscache/stats is read.
      
      The reason is that in fscache_stats_open, single_open is called and the
      respective release function is not called during release.  Hence fix
      with correct release function - single_release().
      
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=57101Signed-off-by: default avatarAnurup m <anurup.m@huawei.com>
      Cc: shyju pv <shyju.pv@huawei.com>
      Cc: Sanil kumar <sanil.kumar@huawei.com>
      Cc: Nataraj m <nataraj.m@huawei.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d340c737
    • Stephan Schreiber's avatar
      Wrong asm register contraints in the kvm implementation · ed34a287
      Stephan Schreiber authored
      commit de53e9ca upstream.
      
      The Linux Kernel contains some inline assembly source code which has
      wrong asm register constraints in arch/ia64/kvm/vtlb.c.
      
      I observed this on Kernel 3.2.35 but it is also true on the most
      recent Kernel 3.9-rc1.
      
      File arch/ia64/kvm/vtlb.c:
      
      u64 guest_vhpt_lookup(u64 iha, u64 *pte)
      {
      	u64 ret;
      	struct thash_data *data;
      
      	data = __vtr_lookup(current_vcpu, iha, D_TLB);
      	if (data != NULL)
      		thash_vhpt_insert(current_vcpu, data->page_flags,
      			data->itir, iha, D_TLB);
      
      	asm volatile (
      			"rsm psr.ic|psr.i;;"
      			"srlz.d;;"
      			"ld8.s r9=[%1];;"
      			"tnat.nz p6,p7=r9;;"
      			"(p6) mov %0=1;"
      			"(p6) mov r9=r0;"
      			"(p7) extr.u r9=r9,0,53;;"
      			"(p7) mov %0=r0;"
      			"(p7) st8 [%2]=r9;;"
      			"ssm psr.ic;;"
      			"srlz.d;;"
      			"ssm psr.i;;"
      			"srlz.d;;"
      			: "=r"(ret) : "r"(iha), "r"(pte):"memory");
      
      	return ret;
      }
      
      The list of output registers is
      			: "=r"(ret) : "r"(iha), "r"(pte):"memory");
      The constraint "=r" means that the GCC has to maintain that these vars
      are in registers and contain valid info when the program flow leaves
      the assembly block (output registers).
      But "=r" also means that GCC can put them in registers that are used
      as input registers. Input registers are iha, pte on the example.
      If the predicate p7 is true, the 8th assembly instruction
      			"(p7) mov %0=r0;"
      is the first one which writes to a register which is maintained by the
      register constraints; it sets %0. %0 means the first register operand;
      it is ret here.
      This instruction might overwrite the %2 register (pte) which is needed
      by the next instruction:
      			"(p7) st8 [%2]=r9;;"
      Whether it really happens depends on how GCC decides what registers it
      uses and how it optimizes the code.
      
      The attached patch  fixes the register operand constraints in
      arch/ia64/kvm/vtlb.c.
      The register constraints should be
      			: "=&r"(ret) : "r"(iha), "r"(pte):"memory");
      The & means that GCC must not use any of the input registers to place
      this output register in.
      
      This is Debian bug#702639
      (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702639).
      
      The patch is applicable on Kernel 3.9-rc1, 3.2.35 and many other versions.
      Signed-off-by: default avatarStephan Schreiber <info@fs-driver.org>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed34a287
    • Stephan Schreiber's avatar
      Wrong asm register contraints in the futex implementation · 7b5b8170
      Stephan Schreiber authored
      commit 136f39dd upstream.
      
      The Linux Kernel contains some inline assembly source code which has
      wrong asm register constraints in arch/ia64/include/asm/futex.h.
      
      I observed this on Kernel 3.2.23 but it is also true on the most
      recent Kernel 3.9-rc1.
      
      File arch/ia64/include/asm/futex.h:
      
      static inline int
      futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
      			      u32 oldval, u32 newval)
      {
      	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
      		return -EFAULT;
      
      	{
      		register unsigned long r8 __asm ("r8");
      		unsigned long prev;
      		__asm__ __volatile__(
      			"	mf;;					\n"
      			"	mov %0=r0				\n"
      			"	mov ar.ccv=%4;;				\n"
      			"[1:]	cmpxchg4.acq %1=[%2],%3,ar.ccv		\n"
      			"	.xdata4 \"__ex_table\", 1b-., 2f-.	\n"
      			"[2:]"
      			: "=r" (r8), "=r" (prev)
      			: "r" (uaddr), "r" (newval),
      			  "rO" ((long) (unsigned) oldval)
      			: "memory");
      		*uval = prev;
      		return r8;
      	}
      }
      
      The list of output registers is
      			: "=r" (r8), "=r" (prev)
      The constraint "=r" means that the GCC has to maintain that these vars
      are in registers and contain valid info when the program flow leaves
      the assembly block (output registers).
      But "=r" also means that GCC can put them in registers that are used
      as input registers. Input registers are uaddr, newval, oldval on the
      example.
      The second assembly instruction
      			"	mov %0=r0				\n"
      is the first one which writes to a register; it sets %0 to 0. %0 means
      the first register operand; it is r8 here. (The r0 is read-only and
      always 0 on the Itanium; it can be used if an immediate zero value is
      needed.)
      This instruction might overwrite one of the other registers which are
      still needed.
      Whether it really happens depends on how GCC decides what registers it
      uses and how it optimizes the code.
      
      The objdump utility can give us disassembly.
      The futex_atomic_cmpxchg_inatomic() function is inline, so we have to
      look for a module that uses the funtion. This is the
      cmpxchg_futex_value_locked() function in
      kernel/futex.c:
      
      static int cmpxchg_futex_value_locked(u32 *curval, u32 __user *uaddr,
      				      u32 uval, u32 newval)
      {
      	int ret;
      
      	pagefault_disable();
      	ret = futex_atomic_cmpxchg_inatomic(curval, uaddr, uval, newval);
      	pagefault_enable();
      
      	return ret;
      }
      
      Now the disassembly. At first from the Kernel package 3.2.23 which has
      been compiled with GCC 4.4, remeber this Kernel seemed to work:
      objdump -d linux-3.2.23/debian/build/build_ia64_none_mckinley/kernel/futex.o
      
      0000000000000230 <cmpxchg_futex_value_locked>:
            230:	0b 18 80 1b 18 21 	[MMI]       adds r3=3168,r13;;
            236:	80 40 0d 00 42 00 	            adds r8=40,r3
            23c:	00 00 04 00       	            nop.i 0x0;;
            240:	0b 50 00 10 10 10 	[MMI]       ld4 r10=[r8];;
            246:	90 08 28 00 42 00 	            adds r9=1,r10
            24c:	00 00 04 00       	            nop.i 0x0;;
            250:	09 00 00 00 01 00 	[MMI]       nop.m 0x0
            256:	00 48 20 20 23 00 	            st4 [r8]=r9
            25c:	00 00 04 00       	            nop.i 0x0;;
            260:	08 10 80 06 00 21 	[MMI]       adds r2=32,r3
            266:	00 00 00 02 00 00 	            nop.m 0x0
            26c:	02 08 f1 52       	            extr.u r16=r33,0,61
            270:	05 40 88 00 08 e0 	[MLX]       addp4 r8=r34,r0
            276:	ff ff 0f 00 00 e0 	            movl r15=0xfffffffbfff;;
            27c:	f1 f7 ff 65
            280:	09 70 00 04 18 10 	[MMI]       ld8 r14=[r2]
            286:	00 00 00 02 00 c0 	            nop.m 0x0
            28c:	f0 80 1c d0       	            cmp.ltu p6,p7=r15,r16;;
            290:	08 40 fc 1d 09 3b 	[MMI]       cmp.eq p8,p9=-1,r14
            296:	00 00 00 02 00 40 	            nop.m 0x0
            29c:	e1 08 2d d0       	            cmp.ltu p10,p11=r14,r33
            2a0:	56 01 10 00 40 10 	[BBB] (p10) br.cond.spnt.few 2e0
      <cmpxchg_futex_value_locked+0xb0>
            2a6:	02 08 00 80 21 03 	      (p08) br.cond.dpnt.few 2b0
      <cmpxchg_futex_value_locked+0x80>
            2ac:	40 00 00 41       	      (p06) br.cond.spnt.few 2e0
      <cmpxchg_futex_value_locked+0xb0>
            2b0:	0a 00 00 00 22 00 	[MMI]       mf;;
            2b6:	80 00 00 00 42 00 	            mov r8=r0
            2bc:	00 00 04 00       	            nop.i 0x0
            2c0:	0b 00 20 40 2a 04 	[MMI]       mov.m ar.ccv=r8;;
            2c6:	10 1a 85 22 20 00 	            cmpxchg4.acq r33=[r33],r35,ar.ccv
            2cc:	00 00 04 00       	            nop.i 0x0;;
            2d0:	10 00 84 40 90 11 	[MIB]       st4 [r32]=r33
            2d6:	00 00 00 02 00 00 	            nop.i 0x0
            2dc:	20 00 00 40       	            br.few 2f0
      <cmpxchg_futex_value_locked+0xc0>
            2e0:	09 40 c8 f9 ff 27 	[MMI]       mov r8=-14
            2e6:	00 00 00 02 00 00 	            nop.m 0x0
            2ec:	00 00 04 00       	            nop.i 0x0;;
            2f0:	0b 58 20 1a 19 21 	[MMI]       adds r11=3208,r13;;
            2f6:	20 01 2c 20 20 00 	            ld4 r18=[r11]
            2fc:	00 00 04 00       	            nop.i 0x0;;
            300:	0b 88 fc 25 3f 23 	[MMI]       adds r17=-1,r18;;
            306:	00 88 2c 20 23 00 	            st4 [r11]=r17
            30c:	00 00 04 00       	            nop.i 0x0;;
            310:	11 00 00 00 01 00 	[MIB]       nop.m 0x0
            316:	00 00 00 02 00 80 	            nop.i 0x0
            31c:	08 00 84 00       	            br.ret.sptk.many b0;;
      
      The lines
            2b0:	0a 00 00 00 22 00 	[MMI]       mf;;
            2b6:	80 00 00 00 42 00 	            mov r8=r0
            2bc:	00 00 04 00       	            nop.i 0x0
            2c0:	0b 00 20 40 2a 04 	[MMI]       mov.m ar.ccv=r8;;
            2c6:	10 1a 85 22 20 00 	            cmpxchg4.acq r33=[r33],r35,ar.ccv
            2cc:	00 00 04 00       	            nop.i 0x0;;
      are the instructions of the assembly block.
      The line
            2b6:	80 00 00 00 42 00 	            mov r8=r0
      sets the r8 register to 0 and after that
            2c0:	0b 00 20 40 2a 04 	[MMI]       mov.m ar.ccv=r8;;
      prepares the 'oldvalue' for the cmpxchg but it takes it from r8. This
      is wrong.
      What happened here is what I explained above: An input register is
      overwritten which is still needed.
      The register operand constraints in futex.h are wrong.
      
      (The problem doesn't occur when the Kernel is compiled with GCC 4.6.)
      
      The attached patch fixes the register operand constraints in futex.h.
      The code after patching of it:
      
      static inline int
      futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
      			      u32 oldval, u32 newval)
      {
      	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
      		return -EFAULT;
      
      	{
      		register unsigned long r8 __asm ("r8") = 0;
      		unsigned long prev;
      		__asm__ __volatile__(
      			"	mf;;					\n"
      			"	mov ar.ccv=%4;;				\n"
      			"[1:]	cmpxchg4.acq %1=[%2],%3,ar.ccv		\n"
      			"	.xdata4 \"__ex_table\", 1b-., 2f-.	\n"
      			"[2:]"
      			: "+r" (r8), "=&r" (prev)
      			: "r" (uaddr), "r" (newval),
      			  "rO" ((long) (unsigned) oldval)
      			: "memory");
      		*uval = prev;
      		return r8;
      	}
      }
      
      I also initialized the 'r8' var with the C programming language.
      The _asm qualifier on the definition of the 'r8' var forces GCC to use
      the r8 processor register for it.
      I don't believe that we should use inline assembly for zeroing out a
      local variable.
      The constraint is
      "+r" (r8)
      what means that it is both an input register and an output register.
      Note that the page fault handler will modify the r8 register which
      will be the return value of the function.
      The real fix is
      "=&r" (prev)
      The & means that GCC must not use any of the input registers to place
      this output register in.
      
      Patched the Kernel 3.2.23 and compiled it with GCC4.4:
      
      0000000000000230 <cmpxchg_futex_value_locked>:
            230:	0b 18 80 1b 18 21 	[MMI]       adds r3=3168,r13;;
            236:	80 40 0d 00 42 00 	            adds r8=40,r3
            23c:	00 00 04 00       	            nop.i 0x0;;
            240:	0b 50 00 10 10 10 	[MMI]       ld4 r10=[r8];;
            246:	90 08 28 00 42 00 	            adds r9=1,r10
            24c:	00 00 04 00       	            nop.i 0x0;;
            250:	09 00 00 00 01 00 	[MMI]       nop.m 0x0
            256:	00 48 20 20 23 00 	            st4 [r8]=r9
            25c:	00 00 04 00       	            nop.i 0x0;;
            260:	08 10 80 06 00 21 	[MMI]       adds r2=32,r3
            266:	20 12 01 10 40 00 	            addp4 r34=r34,r0
            26c:	02 08 f1 52       	            extr.u r16=r33,0,61
            270:	05 40 00 00 00 e1 	[MLX]       mov r8=r0
            276:	ff ff 0f 00 00 e0 	            movl r15=0xfffffffbfff;;
            27c:	f1 f7 ff 65
            280:	09 70 00 04 18 10 	[MMI]       ld8 r14=[r2]
            286:	00 00 00 02 00 c0 	            nop.m 0x0
            28c:	f0 80 1c d0       	            cmp.ltu p6,p7=r15,r16;;
            290:	08 40 fc 1d 09 3b 	[MMI]       cmp.eq p8,p9=-1,r14
            296:	00 00 00 02 00 40 	            nop.m 0x0
            29c:	e1 08 2d d0       	            cmp.ltu p10,p11=r14,r33
            2a0:	56 01 10 00 40 10 	[BBB] (p10) br.cond.spnt.few 2e0
      <cmpxchg_futex_value_locked+0xb0>
            2a6:	02 08 00 80 21 03 	      (p08) br.cond.dpnt.few 2b0
      <cmpxchg_futex_value_locked+0x80>
            2ac:	40 00 00 41       	      (p06) br.cond.spnt.few 2e0
      <cmpxchg_futex_value_locked+0xb0>
            2b0:	0b 00 00 00 22 00 	[MMI]       mf;;
            2b6:	00 10 81 54 08 00 	            mov.m ar.ccv=r34
            2bc:	00 00 04 00       	            nop.i 0x0;;
            2c0:	09 58 8c 42 11 10 	[MMI]       cmpxchg4.acq r11=[r33],r35,ar.ccv
            2c6:	00 00 00 02 00 00 	            nop.m 0x0
            2cc:	00 00 04 00       	            nop.i 0x0;;
            2d0:	10 00 2c 40 90 11 	[MIB]       st4 [r32]=r11
            2d6:	00 00 00 02 00 00 	            nop.i 0x0
            2dc:	20 00 00 40       	            br.few 2f0
      <cmpxchg_futex_value_locked+0xc0>
            2e0:	09 40 c8 f9 ff 27 	[MMI]       mov r8=-14
            2e6:	00 00 00 02 00 00 	            nop.m 0x0
            2ec:	00 00 04 00       	            nop.i 0x0;;
            2f0:	0b 88 20 1a 19 21 	[MMI]       adds r17=3208,r13;;
            2f6:	30 01 44 20 20 00 	            ld4 r19=[r17]
            2fc:	00 00 04 00       	            nop.i 0x0;;
            300:	0b 90 fc 27 3f 23 	[MMI]       adds r18=-1,r19;;
            306:	00 90 44 20 23 00 	            st4 [r17]=r18
            30c:	00 00 04 00       	            nop.i 0x0;;
            310:	11 00 00 00 01 00 	[MIB]       nop.m 0x0
            316:	00 00 00 02 00 80 	            nop.i 0x0
            31c:	08 00 84 00       	            br.ret.sptk.many b0;;
      
      Much better.
      There is a
            270:	05 40 00 00 00 e1 	[MLX]       mov r8=r0
      which was generated by C code r8 = 0. Below
            2b6:	00 10 81 54 08 00 	            mov.m ar.ccv=r34
      what means that oldval is no longer overwritten.
      
      This is Debian bug#702641
      (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702641).
      
      The patch is applicable on Kernel 3.9-rc1, 3.2.23 and many other versions.
      Signed-off-by: default avatarStephan Schreiber <info@fs-driver.org>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b5b8170
    • Alex A. Mihaylov's avatar
      rt2x00: Fix transmit power troubles on some Ralink RT30xx cards · 4a277ad6
      Alex A. Mihaylov authored
      commit 7e9dafd8 upstream.
      
      Some cards on Ralink RT30xx chipset not have correctly TX_MIXER_GAIN
      value in them EEPROM/EFUSE. In this case, we must use default value,
      but always used EEPROM/EFUSE value. As result we have tranmitt power
      range from -10dBm to +6dBm instead 0dBm to +16dBm.
      
      Correctly value in EEPROM/EFUSE is one or more for RT3070 and two or
      more for other RT30xx chips.
      
      Tested on Canyon CNP-WF518N1 usb Wi-Fi dongle and Jorjin WN8020 usb
      embedded Wi-Fi module.
      Signed-off-by: default avatarAlex A. Mihaylov <minimumlaw@rambler.ru>
      Acked-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
      Acked-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a277ad6
    • Rafael J. Wysocki's avatar
      PCI/PM: Fix fallback to PCI_D0 in pci_platform_power_transition() · a91a151f
      Rafael J. Wysocki authored
      commit 769ba721 upstream.
      
      Commit b51306c6 (PCI: Set device power state to PCI_D0 for device
      without native PM support) modified pci_platform_power_transition()
      by adding code causing dev->current_state for devices that don't
      support native PCI PM but are power-manageable by the platform to be
      changed to PCI_D0 regardless of the value returned by the preceding
      platform_pci_set_power_state().  In particular, that also is done
      if the platform_pci_set_power_state() has been successful, which
      causes the correct power state of the device set by
      pci_update_current_state() in that case to be overwritten by PCI_D0.
      
      Fix that mistake by making the fallback to PCI_D0 only happen if
      the platform_pci_set_power_state() has returned an error.
      
      [bhelgaas: folded in Yinghai's simplification, added URL & stable info]
      Reference: http://lkml.kernel.org/r/27806FC4E5928A408B78E88BBC67A2306F466BBA@ORSMSX101.amr.corp.intel.comReported-by: default avatarChris J. Benenati <chris.j.benenati@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a91a151f
    • Yinghai Lu's avatar
      PCI / ACPI: Don't query OSC support with all possible controls · aebbd5d3
      Yinghai Lu authored
      commit 545d6e18 upstream.
      
      Found problem on system that firmware that could handle pci aer.
      Firmware get error reporting after pci injecting error, before os boots.
      But after os boots, firmware can not get report anymore, even pci=noaer
      is passed.
      
      Root cause: BIOS _OSC has problem with query bit checking.
      It turns out that BIOS vendor is copying example code from ACPI Spec.
      In ACPI Spec 5.0, page 290:
      
      	If (Not(And(CDW1,1))) // Query flag clear?
      	{	// Disable GPEs for features granted native control.
      		If (And(CTRL,0x01)) // Hot plug control granted?
      		{
      			Store(0,HPCE) // clear the hot plug SCI enable bit
      			Store(1,HPCS) // clear the hot plug SCI status bit
      		}
      	...
      	}
      
      When Query flag is set, And(CDW1,1) will be 1, Not(1) will return 0xfffffffe.
      So it will get into code path that should be for control set only.
      BIOS acpi code should be changed to "If (LEqual(And(CDW1,1), 0)))"
      
      Current kernel code is using _OSC query to notify firmware about support
      from OS and then use _OSC to set control bits.
      During query support, current code is using all possible controls.
      So will execute code that should be only for control set stage.
      
      That will have problem when pci=noaer or aer firmware_first is used.
      As firmware have that control set for os aer already in query support stage,
      but later will not os aer handling.
      
      We should avoid passing all possible controls, just use osc_control_set
      instead.
      That should workaround BIOS bugs with affected systems on the field
      as more bios vendors are copying sample code from ACPI spec.
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aebbd5d3
    • Tony Luck's avatar
      Fix initialization of CMCI/CMCP interrupts · 8ca53c6c
      Tony Luck authored
      commit d303e9e9 upstream.
      
      Back 2010 during a revamp of the irq code some initializations
      were moved from ia64_mca_init() to ia64_mca_late_init() in
      
      	commit c75f2aa1
      	Cannot use register_percpu_irq() from ia64_mca_init()
      
      But this was hideously wrong. First of all these initializations
      are now down far too late. Specifically after all the other cpus
      have been brought up and initialized their own CMC vectors from
      smp_callin(). Also ia64_mca_late_init() may be called from any cpu
      so the line:
      	ia64_mca_cmc_vector_setup();       /* Setup vector on BSP */
      is generally not executed on the BSP, and so the CMC vector isn't
      setup at all on that processor.
      
      Make use of the arch_early_irq_init() hook to get this code executed
      at just the right moment: not too early, not too late.
      Reported-by: default avatarFred Hartnett <fred.hartnett@hp.com>
      Tested-by: default avatarFred Hartnett <fred.hartnett@hp.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ca53c6c
    • Ming Lei's avatar
      sysfs: fix use after free in case of concurrent read/write and readdir · 38f05ab3
      Ming Lei authored
      commit f7db5e76 upstream.
      
      The inode->i_mutex isn't hold when updating filp->f_pos
      in read()/write(), so the filp->f_pos might be read as
      0 or 1 in readdir() when there is concurrent read()/write()
      on this same file, then may cause use after free in readdir().
      
      The bug can be reproduced with Li Zefan's test code on the
      link:
      
      	https://patchwork.kernel.org/patch/2160771/
      
      This patch fixes the use after free under this situation.
      Reported-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38f05ab3
    • K. Y. Srinivasan's avatar
      Drivers: hv: vmbus: Fix a bug in hv_need_to_signal() · 8c7fc2f0
      K. Y. Srinivasan authored
      commit 288fa3e0 upstream.
      
      As part of updating the vmbus protocol, the function hv_need_to_signal()
      was introduced. This functions helps optimize signalling from guest to
      host. The newly added memory barrier is needed to ensure that we correctly
      decide when to signal the host.
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Reported-by: default avatarOlaf Hering <olh@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c7fc2f0
    • Sandy Wu's avatar
      crypto: crc32-pclmul - Use gas macro for pclmulqdq · 5504e827
      Sandy Wu authored
      commit 57ae1b05 upstream.
      
      Occurs when CONFIG_CRYPTO_CRC32C_INTEL=y and CONFIG_CRYPTO_CRC32C_INTEL=y.
      Older versions of bintuils do not support the pclmulqdq instruction. The
      PCLMULQDQ gas macro is used instead.
      Signed-off-by: default avatarSandy Wu <sandyw@twitter.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5504e827
    • Steven A. Falco's avatar
      i2c: xiic: must always write 16-bit words to TX_FIFO · 022c3731
      Steven A. Falco authored
      commit c39e8e43 upstream.
      
      The TX_FIFO register is 10 bits wide.  The lower 8 bits are the data to be
      written, while the upper two bits are flags to indicate stop/start.
      
      The driver apparently attempted to optimize write access, by only writing a
      byte in those cases where the stop/start bits are zero.  However, we have
      seen cases where the lower byte is duplicated onto the upper byte by the
      hardware, which causes inadvertent stop/starts.
      
      This patch changes the write access to the transmit FIFO to always be 16 bits
      wide.
      
      Signed off by: Steven A. Falco <sfalco@harris.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      022c3731
    • Namhyung Kim's avatar
      tracing: Reset ftrace_graph_filter_enabled if count is zero · a8bbee2c
      Namhyung Kim authored
      commit 9f50afcc upstream.
      
      The ftrace_graph_count can be decreased with a "!" pattern, so that
      the enabled flag should be updated too.
      
      Link: http://lkml.kernel.org/r/1365663698-2413-1-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8bbee2c
    • Namhyung Kim's avatar
      tracing: Check return value of tracing_init_dentry() · c8a6694f
      Namhyung Kim authored
      commit ed6f1c99 upstream.
      
      Check return value and bail out if it's NULL.
      
      Link: http://lkml.kernel.org/r/1365553093-10180-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c8a6694f
    • Namhyung Kim's avatar
      tracing: Fix off-by-one on allocating stat->pages · 7c6d8df0
      Namhyung Kim authored
      commit 39e30cd1 upstream.
      
      The first page was allocated separately, so no need to start from 0.
      
      Link: http://lkml.kernel.org/r/1364820385-32027-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c6d8df0
    • Steven Rostedt (Red Hat)'s avatar
      tracing: Remove most or all of stack tracer stack size from stack_max_size · d0dcb91a
      Steven Rostedt (Red Hat) authored
      commit 4df29712 upstream.
      
      Currently, the depth reported in the stack tracer stack_trace file
      does not match the stack_max_size file. This is because the stack_max_size
      includes the overhead of stack tracer itself while the depth does not.
      
      The first time a max is triggered, a calculation is not performed that
      figures out the overhead of the stack tracer and subtracts it from
      the stack_max_size variable. The overhead is stored and is subtracted
      from the reported stack size for comparing for a new max.
      
      Now the stack_max_size corresponds to the reported depth:
      
       # cat stack_max_size
      4640
      
       # cat stack_trace
              Depth    Size   Location    (48 entries)
              -----    ----   --------
        0)     4640      32   _raw_spin_lock+0x18/0x24
        1)     4608     112   ____cache_alloc+0xb7/0x22d
        2)     4496      80   kmem_cache_alloc+0x63/0x12f
        3)     4416      16   mempool_alloc_slab+0x15/0x17
      [...]
      
      While testing against and older gcc on x86 that uses mcount instead
      of fentry, I found that pasing in ip + MCOUNT_INSN_SIZE let the
      stack trace show one more function deep which was missing before.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0dcb91a
    • Steven Rostedt (Red Hat)'s avatar
      tracing: Fix stack tracer with fentry use · 8bcd8831
      Steven Rostedt (Red Hat) authored
      commit d4ecbfc4 upstream.
      
      When gcc 4.6 on x86 is used, the function tracer will use the new
      option -mfentry which does a call to "fentry" at every function
      instead of "mcount". The significance of this is that fentry is
      called as the first operation of the function instead of the mcount
      usage of being called after the stack.
      
      This causes the stack tracer to show some bogus results for the size
      of the last function traced, as well as showing "ftrace_call" instead
      of the function. This is due to the stack frame not being set up
      by the function that is about to be traced.
      
       # cat stack_trace
              Depth    Size   Location    (48 entries)
              -----    ----   --------
        0)     4824     216   ftrace_call+0x5/0x2f
        1)     4608     112   ____cache_alloc+0xb7/0x22d
        2)     4496      80   kmem_cache_alloc+0x63/0x12f
      
      The 216 size for ftrace_call includes both the ftrace_call stack
      (which includes the saving of registers it does), as well as the
      stack size of the parent.
      
      To fix this, if CC_USING_FENTRY is defined, then the stack_tracer
      will reserve the first item in stack_dump_trace[] array when
      calling save_stack_trace(), and it will fill it in with the parent ip.
      Then the code will look for the parent pointer on the stack and
      give the real size of the parent's stack pointer:
      
       # cat stack_trace
              Depth    Size   Location    (14 entries)
              -----    ----   --------
        0)     2640      48   update_group_power+0x26/0x187
        1)     2592     224   update_sd_lb_stats+0x2a5/0x4ac
        2)     2368     160   find_busiest_group+0x31/0x1f1
        3)     2208     256   load_balance+0xd9/0x662
      
      I'm Cc'ing stable, although it's not urgent, as it only shows bogus
      size for item #0, the rest of the trace is legit. It should still be
      corrected in previous stable releases.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8bcd8831
    • Steven Rostedt (Red Hat)'s avatar
      tracing: Use stack of calling function for stack tracer · 2fbd7c15
      Steven Rostedt (Red Hat) authored
      commit 87889501 upstream.
      
      Use the stack of stack_trace_call() instead of check_stack() as
      the test pointer for max stack size. It makes it a bit cleaner
      and a little more accurate.
      
      Adding stable, as a later fix depends on this patch.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2fbd7c15
    • Mika Kuoppala's avatar
      fbcon: when font is freed, clear also vc_font.data · d9d89e45
      Mika Kuoppala authored
      commit e6637d54 upstream.
      
      commit ae128786
      Author: Dave Airlie <airlied@redhat.com>
      Date:   Thu Jan 24 16:12:41 2013 +1000
      
          fbcon: don't lose the console font across generic->chip driver switch
      
      uses a pointer in vc->vc_font.data to load font into the new driver.
      However if the font is actually freed, we need to clear the data
      so that we don't reload font from dangling pointer.
      
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=892340Signed-off-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9d89e45
    • Linus Torvalds's avatar
      tty: fix up atime/mtime mess, take three · c00bbdc6
      Linus Torvalds authored
      commit b0b88565 upstream.
      
      We first tried to avoid updating atime/mtime entirely (commit
      b0de59b5: "TTY: do not update atime/mtime on read/write"), and then
      limited it to only update it occasionally (commit 37b7f3c7: "TTY:
      fix atime/mtime regression"), but it turns out that this was both
      insufficient and overkill.
      
      It was insufficient because we let people attach to the shared ptmx node
      to see activity without even reading atime/mtime, and it was overkill
      because the "only once a minute" means that you can't really tell an
      idle person from an active one with 'w'.
      
      So this tries to fix the problem properly.  It marks the shared ptmx
      node as un-notifiable, and it lowers the "only once a minute" to a few
      seconds instead - still long enough that you can't time individual
      keystrokes, but short enough that you can tell whether somebody is
      active or not.
      Reported-by: default avatarSimon Kirby <sim@hostway.ca>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c00bbdc6
    • Richard Cochran's avatar
      gianfar: do not advertise any alarm capability. · 96557fc5
      Richard Cochran authored
      commit cd4baaaa upstream.
      
      An early draft of the PHC patch series included an alarm in the
      gianfar driver. During the review process, the alarm code was dropped,
      but the capability removal was overlooked. This patch fixes the issue
      by advertising zero alarms.
      
      This patch should be applied to every 3.x stable kernel.
      Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Reported-by: default avatarChris LaRocque <clarocq@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96557fc5
    • Catalin Marinas's avatar
      arm: set the page table freeing ceiling to TASK_SIZE · 87855fa6
      Catalin Marinas authored
      commit 104ad3b3 upstream.
      
      ARM processors with LPAE enabled use 3 levels of page tables, with an
      entry in the top level (pgd) covering 1GB of virtual space.  Because of
      the branch relocation limitations on ARM, the loadable modules are
      mapped 16MB below PAGE_OFFSET, making the corresponding 1GB pgd shared
      between kernel modules and user space.
      
      If free_pgtables() is called with the default ceiling 0,
      free_pgd_range() (and subsequently called functions) also frees the page
      table shared between user space and kernel modules (which is normally
      handled by the ARM-specific pgd_free() function).  This patch changes
      defines the ARM USER_PGTABLES_CEILING to TASK_SIZE when CONFIG_ARM_LPAE
      is enabled.
      
      Note that the pgd_free() function already checks the presence of the
      shared pmd page allocated by pgd_alloc() and frees it, though with
      ceiling 0 this wasn't necessary.
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Hugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87855fa6
    • Federico Vaga's avatar
      serial_core.c: add put_device() after device_find_child() · be629bd7
      Federico Vaga authored
      commit 5a65dcc0 upstream.
      
      The serial core uses device_find_child() but does not drop the reference to
      the retrieved child after using it. This patch add the missing put_device().
      
      What I have done to test this issue.
      
      I used a machine with an AMBA PL011 serial driver. I tested the patch on
      next-20120408 because the last branch [next-20120415] does not boot on this
      board.
      
      For test purpose, I added some pr_info() messages to print the refcount
      after device_find_child() (lines: 1937,2009), and after put_device()
      (lines: 1947, 2021).
      
      Boot the machine *without* put_device(). Then:
      
      echo reboot > /sys/power/disk
      echo disk > /sys/power/state
      [   87.058575] uart_suspend_port:1937 refcount 4
      [   87.058582] uart_suspend_port:1947 refcount 4
      [   87.098083] uart_resume_port:2009refcount 5
      [   87.098088] uart_resume_port:2021 refcount 5
      
      echo disk > /sys/power/state
      [  103.055574] uart_suspend_port:1937 refcount 6
      [  103.055580] uart_suspend_port:1947 refcount 6
      [  103.095322] uart_resume_port:2009 refcount 7
      [  103.095327] uart_resume_port:2021 refcount 7
      
      echo disk > /sys/power/state
      [  252.459580] uart_suspend_port:1937 refcount 8
      [  252.459586] uart_suspend_port:1947 refcount 8
      [  252.499611] uart_resume_port:2009 refcount 9
      [  252.499616] uart_resume_port:2021 refcount 9
      
      The refcount continuously increased.
      
      Boot the machine *with* this patch. Then:
      
      echo reboot > /sys/power/disk
      echo disk > /sys/power/state
      [  159.333559] uart_suspend_port:1937 refcount 4
      [  159.333566] uart_suspend_port:1947 refcount 3
      [  159.372751] uart_resume_port:2009 refcount 4
      [  159.372755] uart_resume_port:2021 refcount 3
      
      echo disk > /sys/power/state
      [  185.713614] uart_suspend_port:1937 refcount 4
      [  185.713621] uart_suspend_port:1947 refcount 3
      [  185.752935] uart_resume_port:2009 refcount 4
      [  185.752940] uart_resume_port:2021 refcount 3
      
      echo disk > /sys/power/state
      [  207.458584] uart_suspend_port:1937 refcount 4
      [  207.458591] uart_suspend_port:1947 refcount 3
      [  207.498598] uart_resume_port:2009 refcount 4
      [  207.498605] uart_resume_port:2021 refcount 3
      
      The refcount correctly handled.
      Signed-off-by: default avatarFederico Vaga <federico.vaga@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be629bd7
    • Konrad Rzeszutek Wilk's avatar
      xen/smp/spinlock: Fix leakage of the spinlock interrupt line for every CPU online/offline · dab83881
      Konrad Rzeszutek Wilk authored
      commit 66ff0fe9 upstream.
      
      While we don't use the spinlock interrupt line (see for details
      commit f10cd522 -
      xen: disable PV spinlocks on HVM) - we should still do the proper
      init / deinit sequence. We did not do that correctly and for the
      CPU init for PVHVM guest we would allocate an interrupt line - but
      failed to deallocate the old interrupt line.
      
      This resulted in leakage of an irq_desc but more importantly this splat
      as we online an offlined CPU:
      
      genirq: Flags mismatch irq 71. 0002cc20 (spinlock1) vs. 0002cc20 (spinlock1)
      Pid: 2542, comm: init.late Not tainted 3.9.0-rc6upstream #1
      Call Trace:
       [<ffffffff811156de>] __setup_irq+0x23e/0x4a0
       [<ffffffff81194191>] ? kmem_cache_alloc_trace+0x221/0x250
       [<ffffffff811161bb>] request_threaded_irq+0xfb/0x160
       [<ffffffff8104c6f0>] ? xen_spin_trylock+0x20/0x20
       [<ffffffff813a8423>] bind_ipi_to_irqhandler+0xa3/0x160
       [<ffffffff81303758>] ? kasprintf+0x38/0x40
       [<ffffffff8104c6f0>] ? xen_spin_trylock+0x20/0x20
       [<ffffffff810cad35>] ? update_max_interval+0x15/0x40
       [<ffffffff816605db>] xen_init_lock_cpu+0x3c/0x78
       [<ffffffff81660029>] xen_hvm_cpu_notify+0x29/0x33
       [<ffffffff81676bdd>] notifier_call_chain+0x4d/0x70
       [<ffffffff810bb2a9>] __raw_notifier_call_chain+0x9/0x10
       [<ffffffff8109402b>] __cpu_notify+0x1b/0x30
       [<ffffffff8166834a>] _cpu_up+0xa0/0x14b
       [<ffffffff816684ce>] cpu_up+0xd9/0xec
       [<ffffffff8165f754>] store_online+0x94/0xd0
       [<ffffffff8141d15b>] dev_attr_store+0x1b/0x20
       [<ffffffff81218f44>] sysfs_write_file+0xf4/0x170
       [<ffffffff811a2864>] vfs_write+0xb4/0x130
       [<ffffffff811a302a>] sys_write+0x5a/0xa0
       [<ffffffff8167ada9>] system_call_fastpath+0x16/0x1b
      cpu 1 spinlock event irq -16
      smpboot: Booting Node 0 Processor 1 APIC 0x2
      
      And if one looks at the /proc/interrupts right after
      offlining (CPU1):
      
        70:          0          0  xen-percpu-ipi       spinlock0
        71:          0          0  xen-percpu-ipi       spinlock1
        77:          0          0  xen-percpu-ipi       spinlock2
      
      There is the oddity of the 'spinlock1' still being present.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dab83881
    • Konrad Rzeszutek Wilk's avatar
      xen/smp: Fix leakage of timer interrupt line for every CPU online/offline. · 4a605ff6
      Konrad Rzeszutek Wilk authored
      commit 888b65b4 upstream.
      
      In the PVHVM path when we do CPU online/offline path we would
      leak the timer%d IRQ line everytime we do a offline event. The
      online path (xen_hvm_setup_cpu_clockevents via
      x86_cpuinit.setup_percpu_clockev) would allocate a new interrupt
      line for the timer%d.
      
      But we would still use the old interrupt line leading to:
      
      kernel BUG at /home/konrad/ssd/konrad/linux/kernel/hrtimer.c:1261!
      invalid opcode: 0000 [#1] SMP
      RIP: 0010:[<ffffffff810b9e21>]  [<ffffffff810b9e21>] hrtimer_interrupt+0x261/0x270
      .. snip..
       <IRQ>
       [<ffffffff810445ef>] xen_timer_interrupt+0x2f/0x1b0
       [<ffffffff81104825>] ? stop_machine_cpu_stop+0xb5/0xf0
       [<ffffffff8111434c>] handle_irq_event_percpu+0x7c/0x240
       [<ffffffff811175b9>] handle_percpu_irq+0x49/0x70
       [<ffffffff813a74a3>] __xen_evtchn_do_upcall+0x1c3/0x2f0
       [<ffffffff813a760a>] xen_evtchn_do_upcall+0x2a/0x40
       [<ffffffff8167c26d>] xen_hvm_callback_vector+0x6d/0x80
       <EOI>
       [<ffffffff81666d01>] ? start_secondary+0x193/0x1a8
       [<ffffffff81666cfd>] ? start_secondary+0x18f/0x1a8
      
      There is also the oddity (timer1) in the /proc/interrupts after
      offlining CPU1:
      
        64:       1121          0  xen-percpu-virq      timer0
        78:          0          0  xen-percpu-virq      timer1
        84:          0       2483  xen-percpu-virq      timer2
      
      This patch fixes it.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a605ff6
    • Konrad Rzeszutek Wilk's avatar
      xen/time: Fix kasprintf splat when allocating timer%d IRQ line. · 3672f122
      Konrad Rzeszutek Wilk authored
      commit 7918c92a upstream.
      
      When we online the CPU, we get this splat:
      
      smpboot: Booting Node 0 Processor 1 APIC 0x2
      installing Xen timer for CPU 1
      BUG: sleeping function called from invalid context at /home/konrad/ssd/konrad/linux/mm/slab.c:3179
      in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper/1
      Pid: 0, comm: swapper/1 Not tainted 3.9.0-rc6upstream-00001-g3884fad #1
      Call Trace:
       [<ffffffff810c1fea>] __might_sleep+0xda/0x100
       [<ffffffff81194617>] __kmalloc_track_caller+0x1e7/0x2c0
       [<ffffffff81303758>] ? kasprintf+0x38/0x40
       [<ffffffff813036eb>] kvasprintf+0x5b/0x90
       [<ffffffff81303758>] kasprintf+0x38/0x40
       [<ffffffff81044510>] xen_setup_timer+0x30/0xb0
       [<ffffffff810445af>] xen_hvm_setup_cpu_clockevents+0x1f/0x30
       [<ffffffff81666d0a>] start_secondary+0x19c/0x1a8
      
      The solution to that is use kasprintf in the CPU hotplug path
      that 'online's the CPU. That is, do it in in xen_hvm_cpu_notify,
      and remove the call to in xen_hvm_setup_cpu_clockevents.
      
      Unfortunatly the later is not a good idea as the bootup path
      does not use xen_hvm_cpu_notify so we would end up never allocating
      timer%d interrupt lines when booting. As such add the check for
      atomic() to continue.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3672f122
    • Heiko Carstens's avatar
      s390/memory hotplug: prevent offline of active memory increments · 5e5d3ee6
      Heiko Carstens authored
      commit 94c16366 upstream.
      
      In case a machine supports memory hotplug all active memory increments
      present at IPL time have been initialized with a "usecount" of 1.
      This is wrong if the memory increment size is larger than the memory
      section size of the memory hotplug code. If that is the case the
      usecount must be initialized with the number of memory sections that
      fit into one memory increment.
      Otherwise it is possible to put a memory increment into standby state
      even if there are still active sections.
      Afterwards addressing exceptions might happen which cause the kernel
      to panic.
      However even worse, if a memory increment was put into standby state
      and afterwards into active state again, it's contents would have been
      zeroed, leading to memory corruption.
      
      This was only an issue for machines that support standby memory and
      have at least 256GB memory.
      
      This is broken since commit fdb1bb15 "[S390] sclp/memory hotplug: fix
      initial usecount of increments".
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Reviewed-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e5d3ee6
    • Tormod Volden's avatar
      usb-storage: CY7C68300A chips do not support Cypress ATACB · 498f9e0f
      Tormod Volden authored
      commit 671b4b2b upstream.
      
      Many cards based on CY7C68300A/B/C use the USB ID 04b4:6830 but only the
      B and C variants (EZ-USB AT2LP) support the ATA Command Block
      functionality, according to the data sheets. The A variant (EZ-USB AT2)
      locks up if ATACB is attempted, until a typical 30 seconds timeout runs
      out and a USB reset is performed.
      
      https://bugs.launchpad.net/bugs/428469
      
      It seems that one way to spot a CY7C68300A (at least where the card
      manufacturer left Cypress' EEPROM default vaules, against Cypress'
      recommendations) is to look at the USB string descriptor indices.
      
      A http://media.digikey.com/pdf/Data%20Sheets/Cypress%20PDFs/CY7C68300A.pdf
      B http://www.farnell.com/datasheets/43456.pdf
      C http://www.cypress.com/?rID=14189
      
      Note that a CY7C68300B/C chip appears as CY7C68300A if it is running
      in Backward Compatibility Mode, and if ATACB would be supported in this
      case there is anyway no way to tell which chip it really is.
      
      For 5 years my external USB drive has been locking up for half a minute
      when plugged in and ata_id is run by udev, or anytime hdparm or similar
      is run on it.
      
      Finally looking at the /correct/ datasheet I think I found the reason. I
      am aware the quirk in this patch is a bit hacky, but the hardware
      manufacturers haven't made it easy for us.
      Signed-off-by: default avatarTormod Volden <debian.tormod@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      498f9e0f
    • Shengzhou Liu's avatar
      usb: remove redundant tdi_reset · 1edc182a
      Shengzhou Liu authored
      commit 61ac6ac8 upstream.
      
      We remove the redundant tdi_reset in ehci_setup since there
      is already it in ehci_reset.
      It was observed that the duplicated tdi_reset was causing
      the PHY_CLK_VALID bit unstable.
      Reported-by: default avatarMichael Braun <michael-dev@fami-braun.de>
      Signed-off-by: default avatarShengzhou Liu <Shengzhou.Liu@freescale.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1edc182a
    • Michael Grzeschik's avatar
      usb: chipidea: udc: fix memory leak in _ep_nuke · 062e3257
      Michael Grzeschik authored
      commit 7ca2cd29 upstream.
      
      In hardware_enqueue code adds one extra td with dma_pool_alloc if
      mReq->req.zero is true. When _ep_nuke will be called for that endpoint,
      dma_pool_free will not be called to free that memory again. That patch
      fixes this.
      Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      062e3257
    • Michael Grzeschik's avatar
      usb: chipidea: udc: fix memory access of shared memory on armv5 machines · d7a47d57
      Michael Grzeschik authored
      commit a9c17430 upstream.
      
      The udc uses an shared dma memory space between hard and software. This
      memory layout is described in ci13xxx_qh and ci13xxx_td which are marked
      with the attribute ((packed)).
      
      The compiler currently does not know about the alignment of the memory
      layout, and will create strb and ldrb operations.
      
      The Datasheet of the synopsys core describes, that some operations on
      the mapped memory need to be atomic double word operations. I.e. the
      next pointer addressing in the qhead, as otherwise the hardware will
      read wrong data and totally stuck.
      
      This is also possible while working with the current active td queue,
      and preparing the td->ptr.next in software while the hardware is still
      working with the current active td which is supposed to be changed:
      
      writeb(0xde, &td->ptr.next + 0x0); /* strb */
      writeb(0xad, &td->ptr.next + 0x1); /* strb */
      
      <----- hardware reads value of td->ptr.next and get stuck!
      
      writeb(0xbe, &td->ptr.next + 0x2); /* strb */
      writeb(0xef, &td->ptr.next + 0x3); /* strb */
      
      This appeares on armv5 machines where the hardware does not support
      unaligned 32bit operations.
      
      This patch adds the attribute ((aligned(4))) to the structures to tell
      the compiler to use 32bit operations. It also adds an wmb() for the
      prepared TD data before it gets enqueued into the qhead.
      Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
      Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7a47d57
    • Hans de Goede's avatar
      usbfs: Always allow ctrl requests with USB_RECIP_ENDPOINT on the ctrl ep · 09c7efab
      Hans de Goede authored
      commit 1361bf4b upstream.
      
      When usbfs receives a ctrl-request from userspace it calls check_ctrlrecip,
      which for a request with USB_RECIP_ENDPOINT tries to map this to an interface
      to see if this interface is claimed, except for ctrl-requests with a type of
      USB_TYPE_VENDOR.
      
      When trying to use this device: http://www.akaipro.com/eiepro
      redirected to a Windows vm running on qemu on top of Linux.
      
      The windows driver makes a ctrl-req with USB_TYPE_CLASS and
      USB_RECIP_ENDPOINT with index 0, and the mapping of the endpoint (0) to
      the interface fails since ep 0 is the ctrl endpoint and thus never is
      part of an interface.
      
      This patch fixes this ctrl-req failing by skipping the checkintf call for
      USB_RECIP_ENDPOINT ctrl-reqs on the ctrl endpoint.
      Reported-by: default avatarDave Stikkolorum <d.r.stikkolorum@hhs.nl>
      Tested-by: default avatarDave Stikkolorum <d.r.stikkolorum@hhs.nl>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09c7efab
    • Johan Hovold's avatar
      USB: io_ti: fix TIOCGSERIAL · 2d1d424a
      Johan Hovold authored
      commit b6fd35ee upstream.
      
      Fix regression introduced by commit f40d7815 ("USB: io_ti: kill custom
      closing_wait implementation") which made TIOCGSERIAL return the wrong
      value for closing_wait.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d1d424a
    • Adrian Thomasset's avatar
      USB: ftdi_sio: enable two UART ports on ST Microconnect Lite · c2704477
      Adrian Thomasset authored
      commit 71d9a2b9 upstream.
      
      The FT4232H used in the ST Micro Connect Lite has four hi-speed UART ports.
      The first two ports are reserved for the JTAG interface.
      
      We enable by default ports 2 and 3 as UARTs (where port 2 is a
      conventional RS-232 UART)
      Signed-off-by: default avatarAdrian Thomasset <adrian.thomasset@st.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c2704477
    • Adrian Thomasset's avatar
      USB: ftdi_sio: correct ST Micro Connect Lite PIDs · ad3b8a54
      Adrian Thomasset authored
      commit 9f06d15f upstream.
      
      The current ST Micro Connect Lite uses the FT4232H hi-speed quad USB
      UART FTDI chip. It is also possible to drive STM reference targets
      populated with an on-board JTAG debugger based on the FT2232H chip with
      the same STMicroelectronics tools.
      
      For this reason, the ST Micro Connect Lite PIDs should be
      ST_STMCLT_2232_PID: 0x3746
      ST_STMCLT_4232_PID: 0x3747
      Signed-off-by: default avatarAdrian Thomasset <adrian.thomasset@st.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad3b8a54
    • Stefani Seibold's avatar
      USB: add ftdi_sio USB ID for GDM Boost V1.x · 6e67a7f3
      Stefani Seibold authored
      commit 58f8b6c4 upstream.
      
      This patch add a missing usb device id for the GDMBoost V1.x device
      
      The patch is against 3.9-rc5
      Signed-off-by: default avatarStefani Seibold <stefani@seibold.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e67a7f3
    • Ben Jencks's avatar
      usb/misc/appledisplay: Add 24" LED Cinema display · d6dc6b28
      Ben Jencks authored
      commit e7d3b6e2 upstream.
      
      Add the Apple 24" LED Cinema display to the supported devices.
      Signed-off-by: default avatarBen Jencks <ben@bjencks.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6dc6b28