19 Feb, 2012

2 commits

  • After all the FPU state cleanups and finally finding the problem that
    caused all our FPU save/restore problems, this re-introduces the
    preloading of FPU state that was removed in commit b3b0870ef3ff ("i387:
    do not preload FPU state at task switch time").

    However, instead of simply reverting the removal, this reimplements
    preloading with several fixes, most notably

    - properly abstracted as a true FPU state switch, rather than as
    open-coded save and restore with various hacks.

    In particular, implementing it as a proper FPU state switch allows us
    to optimize the CR0.TS flag accesses: there is no reason to set the
    TS bit only to then almost immediately clear it again. CR0 accesses
    are quite slow and expensive, don't flip the bit back and forth for
    no good reason.

    - Make sure that the same model works for both x86-32 and x86-64, so
    that there are no gratuitous differences between the two due to the
    way they save and restore segment state differently due to
    architectural differences that really don't matter to the FPU state.

    - Avoid exposing the "preload" state to the context switch routines,
    and in particular allow the concept of lazy state restore: if nothing
    else has used the FPU in the meantime, and the process is still on
    the same CPU, we can avoid restoring state from memory entirely, just
    re-expose the state that is still in the FPU unit.

    That optimized lazy restore isn't actually implemented here, but the
    infrastructure is set up for it. Of course, older CPU's that use
    'fnsave' to save the state cannot take advantage of this, since the
    state saving also trashes the state.

    In other words, there is now an actual _design_ to the FPU state saving,
    rather than just random historical baggage. Hopefully it's easier to
    follow as a result.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • This moves the bit that indicates whether a thread has ownership of the
    FPU from the TS_USEDFPU bit in thread_info->status to a word of its own
    (called 'has_fpu') in task_struct->thread.has_fpu.

    This fixes two independent bugs at the same time:

    - changing 'thread_info->status' from the scheduler causes nasty
    problems for the other users of that variable, since it is defined to
    be thread-synchronous (that's what the "TS_" part of the naming was
    supposed to indicate).

    So perfectly valid code could (and did) do

    ti->status |= TS_RESTORE_SIGMASK;

    and the compiler was free to do that as separate load, or and store
    instructions. Which can cause problems with preemption, since a task
    switch could happen in between, and change the TS_USEDFPU bit. The
    change to TS_USEDFPU would be overwritten by the final store.

    In practice, this seldom happened, though, because the 'status' field
    was seldom used more than once, so gcc would generally tend to
    generate code that used a read-modify-write instruction and thus
    happened to avoid this problem - RMW instructions are naturally low
    fat and preemption-safe.

    - On x86-32, the current_thread_info() pointer would, during interrupts
    and softirqs, point to a *copy* of the real thread_info, because
    x86-32 uses %esp to calculate the thread_info address, and thus the
    separate irq (and softirq) stacks would cause these kinds of odd
    thread_info copy aliases.

    This is normally not a problem, since interrupts aren't supposed to
    look at thread information anyway (what thread is running at
    interrupt time really isn't very well-defined), but it confused the
    heck out of irq_fpu_usable() and the code that tried to squirrel
    away the FPU state.

    (It also caused untold confusion for us poor kernel developers).

    It also turns out that using 'task_struct' is actually much more natural
    for most of the call sites that care about the FPU state, since they
    tend to work with the task struct for other reasons anyway (ie
    scheduling). And the FPU data that we are going to save/restore is
    found there too.

    Thanks to Arjan Van De Ven for pointing us to
    the %esp issue.

    Cc: Arjan van de Ven
    Reported-and-tested-by: Raphael Prevost
    Acked-and-tested-by: Suresh Siddha
    Tested-by: Peter Anvin
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

17 Feb, 2012

5 commits

  • The AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception is
    pending. In order to not leak FIP state from one process to another, we
    need to do a floating point load after the fxsave of the old process,
    and before the fxrstor of the new FPU state. That resets the state to
    the (uninteresting) kernel load, rather than some potentially sensitive
    user information.

    We used to do this directly after the FPU state save, but that is
    actually very inconvenient, since it

    (a) corrupts what is potentially perfectly good FPU state that we might
    want to lazy avoid restoring later and

    (b) on x86-64 it resulted in a very annoying ordering constraint, where
    "__unlazy_fpu()" in the task switch needs to be delayed until after
    the DS segment has been reloaded just to get the new DS value.

    Coupling it to the fxrstor instead of the fxsave automatically avoids
    both of these issues, and also ensures that we only do it when actually
    necessary (the FP state after a save may never actually get used). It's
    simply a much more natural place for the leaked state cleanup.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Yes, taking the trap to re-load the FPU/MMX state is expensive, but so
    is spending several days looking for a bug in the state save/restore
    code. And the preload code has some rather subtle interactions with
    both paravirtualization support and segment state restore, so it's not
    nearly as simple as it should be.

    Also, now that we no longer necessarily depend on a single bit (ie
    TS_USEDFPU) for keeping track of the state of the FPU, we migth be able
    to do better. If we are really switching between two processes that
    keep touching the FP state, save/restore is inevitable, but in the case
    of having one process that does most of the FPU usage, we may actually
    be able to do much better than the preloading.

    In particular, we may be able to keep track of which CPU the process ran
    on last, and also per CPU keep track of which process' FP state that CPU
    has. For modern CPU's that don't destroy the FPU contents on save time,
    that would allow us to do a lazy restore by just re-enabling the
    existing FPU state - with no restore cost at all!

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • This creates three helper functions that do the TS_USEDFPU accesses, and
    makes everybody that used to do it by hand use those helpers instead.

    In addition, there's a couple of helper functions for the "change both
    CR0.TS and TS_USEDFPU at the same time" case, and the places that do
    that together have been changed to use those. That means that we have
    fewer random places that open-code this situation.

    The intent is partly to clarify the code without actually changing any
    semantics yet (since we clearly still have some hard to reproduce bug in
    this area), but also to make it much easier to use another approach
    entirely to caching the CR0.TS bit for software accesses.

    Right now we use a bit in the thread-info 'status' variable (this patch
    does not change that), but we might want to make it a full field of its
    own or even make it a per-cpu variable.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Touching TS_USEDFPU without touching CR0.TS is confusing, so don't do
    it. By moving it into the callers, we always do the TS_USEDFPU next to
    the CR0.TS accesses in the source code, and it's much easier to see how
    the two go hand in hand.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Commit 5b1cbac37798 ("i387: make irq_fpu_usable() tests more robust")
    added a sanity check to the #NM handler to verify that we never cause
    the "Device Not Available" exception in kernel mode.

    However, that check actually pinpointed a (fundamental) race where we do
    cause that exception as part of the signal stack FPU state save/restore
    code.

    Because we use the floating point instructions themselves to save and
    restore state directly from user mode, we cannot do that atomically with
    testing the TS_USEDFPU bit: the user mode access itself may cause a page
    fault, which causes a task switch, which saves and restores the FP/MMX
    state from the kernel buffers.

    This kind of "recursive" FP state save is fine per se, but it means that
    when the signal stack save/restore gets restarted, it will now take the
    '#NM' exception we originally tried to avoid. With preemption this can
    happen even without the page fault - but because of the user access, we
    cannot just disable preemption around the save/restore instruction.

    There are various ways to solve this, including using the
    "enable/disable_page_fault()" helpers to not allow page faults at all
    during the sequence, and fall back to copying things by hand without the
    use of the native FP state save/restore instructions.

    However, the simplest thing to do is to just allow the #NM from kernel
    space, but fix the race in setting and clearing CR0.TS that this all
    exposed: the TS bit changes and the TS_USEDFPU bit absolutely have to be
    atomic wrt scheduling, so while the actual state save/restore can be
    interrupted and restarted, the act of actually clearing/setting CR0.TS
    and the TS_USEDFPU bit together must not.

    Instead of just adding random "preempt_disable/enable()" calls to what
    is already excessively ugly code, this introduces some helper functions
    that mostly mirror the "kernel_fpu_begin/end()" functionality, just for
    the user state instead.

    Those helper functions should probably eventually replace the other
    ad-hoc CR0.TS and TS_USEDFPU tests too, but I'll need to think about it
    some more: the task switching functionality in particular needs to
    expose the difference between the 'prev' and 'next' threads, while the
    new helper functions intentionally were written to only work with
    'current'.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

16 Feb, 2012

1 commit

  • The check for save_init_fpu() (introduced in commit 5b1cbac37798: "i387:
    make irq_fpu_usable() tests more robust") was the wrong way around, but
    I hadn't noticed, because my "tests" were bogus: the FPU exceptions are
    disabled by default, so even doing a divide by zero never actually
    triggers this code at all unless you do extra work to enable them.

    So if anybody did enable them, they'd get one spurious warning.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

15 Feb, 2012

5 commits

  • One small bug fix from Axel plus a fix for a build failure in unrealistic
    but commonly built configs which for some reason manage to survive for
    an awfully long time in -next without any reports.

    * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
    regulator: Fix getting voltage in max8649_enable_time()
    regulator: Fix mc13xxx regulator modular build (again)

    Linus Torvalds
     
  • Quoth BenH:
    "Here are a few powerpc fixes for 3.3, all pretty trivial. I also
    added the patch to define GET_IP/SET_IP so we can use some more
    asm-generic goodness."

    * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
    powerpc/pseries/eeh: Fix crash when error happens during device probe
    powerpc/pseries: Fix partition migration hang in stop_topology_update
    powerpc/powernv: Disable interrupts while taking phb->lock
    powerpc: Fix WARN_ON in decrementer_check_overflow
    powerpc/wsp: Fix IRQ affinity setting
    powerpc: Implement GET_IP/SET_IP
    powerpc/wsp: Permanently enable PCI class code workaround

    Linus Torvalds
     
  • MMC fixes for 3.3-rc4:
    * The most visible fix here is against a regression introduced in 3.3-rc1
    that ran cards in Ultra High Speed mode even when they failed to initialize
    in that mode, leading to lower-speed cards failing to mount.
    * A lockdep warning introduced in 3.3-rc1 is fixed.
    * Various other small driver fixes, most notably for a NULL dereference
    when using highmem with dw_mmc.

    * tag 'mmc-fixes-for-3.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc:
    mmc: dw_mmc: Fix PIO mode with support of highmem
    mmc: atmel-mci: save and restore sdioirq when soft reset is performed
    mmc: block: Init ro_lock sysfs attr to fix lockdep warnings
    mmc: sh_mmcif: fix late delayed work initialisation
    mmc: tmio_mmc: fix card eject during IO with DMA
    mmc: core: Fix comparison issue in mmc_compare_ext_csds
    mmc: core: Fix PowerOff Notify suspend/resume
    mmc: sdhci-pci: set Medfield SDIO as non-removable
    mmc: core: add the capability for broken voltage
    mmc: core: Fix low speed mmc card detection failure
    mmc: esdhc: set the timeout to the max value
    mmc: esdhc: add PIO mode support
    mmc: core: Ensure clocks are always enabled before host interaction
    mmc: of_mmc_spi: fix little endian support
    mmc: core: UHS sdio card that fails should not exceed 50MHz
    mmc: esdhc: fix errors when booting kernel on Freescale eSDHC version 2.3

    Linus Torvalds
     
  • …/kernel/git/konrad/xen

    Two fixes for VCPU offlining; One to fix the string format exposed
    by the xen-pci[front|back] to conform to the one used in majority of
    PCI drivers; Two fixes to make the code more resilient to invalid
    configurations.

    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

    * tag 'stable/for-linus-fixes-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xenbus_dev: add missing error check to watch handling
    xen/pci[front|back]: Use %d instead of %1x for displaying PCI devfn.
    xen pvhvm: do not remap pirqs onto evtchns if !xen_have_vector_callback
    xen/smp: Fix CPU online/offline bug triggering a BUG: scheduling while atomic.
    xen/bootup: During bootup suppress XENBUS: Unable to read cpu state

    Linus Torvalds
     
  • sound fixes for 3.3-rc4

    Basically all small fixes suited as rc4: a few HD-audio regression fixes,
    a stable fix for an old Dell laptop with intel8x0, and a simple fix for
    ASoC fsi.

    * tag 'sound-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: intel8x0: Fix default inaudible sound on Gateway M520
    ALSA: hda - Fix silent speaker output on Acer Aspire 6935
    ALSA: hda - Fix initialization of secondary capture source on VT1705
    ASoC: fsi: fixup fsi_pointer() calculation method
    ALSA: hda - Fix mute-LED VREF value for new HP laptops

    Linus Torvalds
     

14 Feb, 2012

27 commits

  • BugLink: https://bugs.launchpad.net/bugs/930842

    The reporter states that audio is inaudible by default without muting
    'External Amplifier'. Add a quirk to handle his SSID so that changing
    the control is not necessary.

    Reported-and-tested-by: Benjamin Carlson
    Cc:
    Signed-off-by: Daniel T Chen
    Signed-off-by: Takashi Iwai

    Daniel T Chen
     
  • A simple fix from Morimoto-san for the pointer() operation in the FSI
    driver.

    Takashi Iwai
     
  • * git://git.samba.org/sfrench/cifs-2.6:
    cifs: don't return error from standard_receive3 after marking response malformed
    cifs: request oplock when doing open on lookup
    cifs: fix error handling when cifscreds key payload is an error

    Linus Torvalds
     
  • This updates the sha512 fix so that it doesn't cause excessive stack
    usage on i386. This is done by reverting to the original code, and
    avoiding the W duplication by moving its initialisation into the loop.

    As the underlying code is in fact the one that we have used for years,
    I'm pushing this now instead of postponing to the next cycle.

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: sha512 - Avoid stack bloat on i386
    crypto: sha512 - Use binary and instead of modulus

    Linus Torvalds
     
  • EEH may happen during a PCI driver probe. If the driver is trying to
    access some register in a loop, the EEH code will try to print the
    driver name. But the driver pointer in struct pci_dev is not set until
    probe returns successfully.

    Use a function to test if the device and the driver pointer is NULL
    before accessing the driver's name.

    Signed-off-by: Thadeu Lima de Souza Cascardo
    Signed-off-by: Benjamin Herrenschmidt

    Thadeu Lima de Souza Cascardo
     
  • This fixes a hang that was observed during live partition migration.
    Since stop_topology_update must not be called from an interrupt
    context, call it earlier in the migration process. The hang observed
    can be seen below:

    WARNING: at kernel/timer.c:1011
    Modules linked in: ip6t_LOG xt_tcpudp xt_pkttype ipt_LOG xt_limit ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw xt_NOTRACK ipt_REJECT xt_state iptable_raw iptable_filter ip6table_mangle nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 ip_tables ip6table_filter ip6_tables x_tables ipv6 fuse loop ibmveth sg ext3 jbd mbcache raid456 async_raid6_recov async_pq raid6_pq async_xor xor async_memcpy async_tx raid10 raid1 raid0 scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc dm_round_robin dm_multipath scsi_dh sd_mod crc_t10dif ibmvfc scsi_transport_fc scsi_tgt scsi_mod dm_snapshot dm_mod
    NIP: c0000000000c52d8 LR: c00000000004be28 CTR: 0000000000000000
    REGS: c00000005ffd77d0 TRAP: 0700 Not tainted (3.2.0-git-00001-g07d106d)
    MSR: 8000000000021032 CR: 48000084 XER: 00000001
    CFAR: c00000000004be20
    TASK = c00000005ec78860[0] 'swapper/3' THREAD: c00000005ec98000 CPU: 3
    GPR00: 0000000000000001 c00000005ffd7a50 c000000000fbbc98 c000000000ec8340
    GPR04: 00000000282a0020 0000000000000000 0000000000004000 0000000000000101
    GPR08: 0000000000000012 c00000005ffd4000 0000000000000020 c000000000f3ba88
    GPR12: 0000000000000000 c000000007f40900 0000000000000001 0000000000000004
    GPR16: 0000000000000001 0000000000000000 0000000000000000 c000000001022310
    GPR20: 0000000000000001 0000000000000000 0000000000200200 c000000001029e14
    GPR24: 0000000000000000 0000000000000001 0000000000000040 c00000003f74bc80
    GPR28: c00000003f74bc84 c000000000f38038 c000000000f16b58 c000000000ec8340
    NIP [c0000000000c52d8] .del_timer_sync+0x28/0x60
    LR [c00000000004be28] .stop_topology_update+0x20/0x38
    Call Trace:
    [c00000005ffd7a50] [c00000005ec78860] 0xc00000005ec78860 (unreliable)
    [c00000005ffd7ad0] [c00000000004be28] .stop_topology_update+0x20/0x38
    [c00000005ffd7b40] [c000000000028378] .__rtas_suspend_last_cpu+0x58/0x260
    [c00000005ffd7bf0] [c0000000000fa230] .generic_smp_call_function_interrupt+0x160/0x358
    [c00000005ffd7cf0] [c000000000036ec8] .smp_ipi_demux+0x88/0x100
    [c00000005ffd7d80] [c00000000005c154] .icp_hv_ipi_action+0x5c/0x80
    [c00000005ffd7e00] [c00000000012a088] .handle_irq_event_percpu+0x100/0x318
    [c00000005ffd7f00] [c00000000012e774] .handle_percpu_irq+0x84/0xd0
    [c00000005ffd7f90] [c000000000022ba8] .call_handle_irq+0x1c/0x2c
    [c00000005ec9ba20] [c00000000001157c] .do_IRQ+0x22c/0x2a8
    [c00000005ec9bae0] [c0000000000054bc] hardware_interrupt_entry+0x18/0x1c
    Exception: 501 at .cpu_idle+0x194/0x2f8
    LR = .cpu_idle+0x194/0x2f8
    [c00000005ec9bdd0] [c000000000017e58] .cpu_idle+0x188/0x2f8 (unreliable)
    [c00000005ec9be90] [c00000000067ec18] .start_secondary+0x3e4/0x524
    [c00000005ec9bf90] [c0000000000093e8] .start_secondary_prolog+0x10/0x14
    Instruction dump:
    ebe1fff8 4e800020 fbe1fff8 7c0802a6 f8010010 7c7f1b78 f821ff81 78290464
    80090014 5400019e 7c0000d0 78000fe0 4800000c 7c210b78 7c421378

    Signed-off-by: Brian King
    Signed-off-by: Benjamin Herrenschmidt

    Brian King
     
  • We need to disable interrupts when taking the phb->lock. Otherwise
    we could deadlock with pci_lock taken from an interrupt.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Benjamin Herrenschmidt

    Michael Ellerman
     
  • We use __get_cpu_var() which triggers a false positive warning
    in smp_processor_id() thinking interrupts are enabled (at this
    point, they are soft-enabled but hard-disabled).

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     
  • We call the cache_hwirq_map() function with a linux IRQ number
    but it expects a HW irq number. This triggers a BUG on multic-chip
    setups in addition to not doing the right thing.

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     
  • With this change, helpers such as instruction_pointer() et al, get defined
    in the generic header in terms of GET_IP

    Removed the unnecessary definition of profile_pc in !CONFIG_SMP case as
    suggested by Mike Frysinger.

    Signed-off-by: Srikar Dronamraju
    Signed-off-by: Ananth N Mavinakayanahalli
    Acked-by: Mike Frysinger
    Signed-off-by: Benjamin Herrenschmidt

    Srikar Dronamraju
     
  • It appears that on the Chroma card, the class code of the root
    complex is still wrong even on DD2 or later chips. This could
    be a firmware issue, but that breaks resource allocation so let's
    unconditionally fix it up.

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     
  • Current PIO mode makes a kernel crash with CONFIG_HIGHMEM.
    Highmem pages have a NULL from sg_virt(sg).
    This patch fixes the following problem.

    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = c0004000
    [00000000] *pgd=00000000
    Internal error: Oops: 817 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 0 Not tainted (3.0.15-01423-gdbf465f #589)
    PC is at dw_mci_pull_data32+0x4c/0x9c
    LR is at dw_mci_read_data_pio+0x54/0x1f0
    pc : [] lr : [] psr: 20000193
    sp : c0619d48 ip : c0619d70 fp : c0619d6c
    r10: 00000000 r9 : 00000002 r8 : 00001000
    r7 : 00000200 r6 : 00000000 r5 : e1dd3100 r4 : 00000000
    r3 : 65622023 r2 : 0000007f r1 : eeb96000 r0 : e1dd3100
    Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment
    xkernel
    Control: 10c5387d Table: 61e2004a DAC: 00000015
    Process swapper (pid: 0, stack limit = 0xc06182f0)
    Stack: (0xc0619d48 to 0xc061a000)
    9d40: e1dd3100 e1a4f000 00000000 e1dd3100 e1a4f000 00000200
    9d60: c0619da4 c0619d70 c035988c c03587e4 c0619d9c e18158f4 e1dd3100 e1dd3100
    9d80: 00000020 00000000 00000000 00000020 c06e8a84 00000000 c0619e04 c0619da8
    9da0: c0359b24 c0359844 e18158f4 e1dd3164 e1dd3168 e1dd3150 3d02fc79 e1dd3154
    9dc0: e1dd3178 00000000 00000020 00000000 e1dd3150 00000000 c10dd7e8 e1a84900
    9de0: c061e7cc 00000000 00000000 0000008d c06e8a84 c061e780 c0619e4c c0619e08
    9e00: c00c4738 c0359a34 3d02fc79 00000000 c0619e4c c05a1698 c05a1670 c05a165c
    9e20: c04de8b0 c061e780 c061e7cc e1a84900 ffffed68 0000008d c0618000 00000000
    9e40: c0619e6c c0619e50 c00c48b4 c00c46c8 c061e780 c00423ac c061e7cc ffffed68
    9e60: c0619e8c c0619e70 c00c7358 c00c487c 0000008d ffffee38 c0618000 ffffed68
    9e80: c0619ea4 c0619e90 c00c4258 c00c72b0 c00423ac ffffee38 c0619ecc c0619ea8
    9ea0: c004241c c00c4234 ffffffff f8810000 0000006d 00000002 00000001 7fffffff
    9ec0: c0619f44 c0619ed0 c0048bc0 c00423c4 220ae7a9 00000000 386f0d30 0005d3a4
    9ee0: c00423ac c10dd0b8 c06f2cd8 c0618000 c0594778 c003a674 7fffffff c0619f44
    9f00: 386f0d30 c0619f18 c00a6f94 c005be3c 80000013 ffffffff 386f0d30 0005d3a4
    9f20: 386f0d30 0005d2d1 c10dd0a8 c10dd0b8 c06f2cd8 c0618000 c0619f74 c0619f48
    9f40: c0345858 c005be00 c00a2440 c0618000 c0618000 c00410d8 c06c1944 c00410fc
    9f60: c0594778 c003a674 c0619f9c c0619f78 c004a7e8 c03457b4 c0618000 c06c18f8
    9f80: 00000000 c0039c70 c06c18d4 c003a674 c0619fb4 c0619fa0 c04ceafc c004a714
    9fa0: c06287b4 c06c18f8 c0619ff4 c0619fb8 c0008b68 c04cea68 c0008578 00000000
    9fc0: 00000000 c003a674 00000000 10c5387d c0628658 c003aa78 c062f1c4 4000406a
    9fe0: 413fc090 00000000 00000000 c0619ff8 40008044 c0008858 00000000 00000000
    Backtrace:
    [] (dw_mci_pull_data32+0x0/0x9c) from [] (dw_mci_read_data_pio+0x54/0x1f0)
    r6:00000200 r5:e1a4f000 r4:e1dd3100
    [] (dw_mci_read_data_pio+0x0/0x1f0) from [] (dw_mci_interrupt+0xfc/0x4a4)
    [] (dw_mci_interrupt+0x0/0x4a4) from [] (handle_irq_event_percpu+0x7c/0x1b4)
    [] (handle_irq_event_percpu+0x0/0x1b4) from [] (handle_irq_event+0x44/0x64)
    [] (handle_irq_event+0x0/0x64) from [] (handle_fasteoi_irq+0xb4/0x124)
    r7:ffffed68 r6:c061e7cc r5:c00423ac r4:c061e780
    [] (handle_fasteoi_irq+0x0/0x124) from [] (generic_handle_irq+0x30/0x38)
    r7:ffffed68 r6:c0618000 r5:ffffee38 r4:0000008d
    [] (generic_handle_irq+0x0/0x38) from [] (asm_do_IRQ+0x64/0xe0)
    r5:ffffee38 r4:c00423ac
    [] (asm_do_IRQ+0x0/0xe0) from [] (__irq_svc+0x80/0x14c)
    Exception stack(0xc0619ed0 to 0xc0619f18)

    Signed-off-by: Seungwon Jeon
    Acked-by: Will Newton
    Cc: stable
    Signed-off-by: Chris Ball

    Seungwon Jeon
     
  • Sometimes a software reset is needed. Then some registers are saved and
    restored but the interrupt mask register is missing. It causes issues
    with sdio devices whose interrupts are masked after reset.

    Signed-off-by: Ludovic Desroches
    Cc: stable
    Signed-off-by: Nicolas Ferre
    Signed-off-by: Chris Ball

    Ludovic Desroches
     
  • Signed-off-by: Rabin Vincent
    Signed-off-by: Johan Rudholm
    Signed-off-by: Ulf Hansson
    Acked-by: Linus Walleij
    Reviewed-by: Namjae Jeon
    Signed-off-by: Chris Ball

    Rabin Vincent
     
  • If the driver is loaded with a card in the slot, mmc_add_host() will
    schedule an immediate card-detection work, which will start IO and wait
    for command completion. Usually the kernel first returns to the sh_mmcif
    probe function, lets it finish and only then schedules the rescan work.
    But sometimes, expecially under heavy system load, the work will be
    scheduled immediately before returning to the probe method. In this case
    it is important for the driver to be fully prepared for IO. For sh_mmcif
    this means, that also the timeout work has to be initialised before
    calling mmc_add_host(). It is also better to prepare interrupts
    beforehand. Besides, since mmc_add_host() does card-detection itself,
    there is no need to do it again immediately afterwards.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Chris Ball

    Guennadi Liakhovetski
     
  • When DMA is in use and the card is ejected during IO, DMA transfers have to
    be terminated, otherwise the dmaengine driver fails to operate properly,
    when the card is re-inserted.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Chris Ball

    Guennadi Liakhovetski
     
  • Found this issue during code review. Actually, there are two issues which
    both compensate together in lucky case. In unlucky case the bus width
    probing might not work as expected.

    Signed-off-by: Jurgen Heeks
    Reviewed-by: Namjae Jeon
    Signed-off-by: Chris Ball

    Jurgen Heeks
     
  • Modified the mmc_poweroff to resume before sending the poweroff
    notification command. In sleep mode only AWAKE and RESET commands are
    allowed, so before sending the poweroff notification command resume from
    sleep mode and then send the notification command.

    PowerOff Notify is tested on a Synopsis Designware Host Controller
    (eMMC 4.5). The suspend to RAM and resume works fine.

    Signed-off-by: Girish K S
    Tested-by: Girish K S
    Reviewed-by: Saugata Das
    Signed-off-by: Chris Ball

    Girish K S
     
  • Set Medfield SDIO as non-removable to avoid un-necessary
    card detect activity.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Chris Ball

    Adrian Hunter
     
  • There is an understood mismatch between the voltage the host controller is
    set to and the voltage supplied to the card by a fixed voltage regulator.
    Teaching the driver to accept the mismatch is overly complicated. Instead
    just accept the regulator's voltage.

    This patch adds MMC_CAP2_BROKEN_VOLTAGE.

    If the voltage didn't satisfy between min_uV and max_uV, try to change
    the voltage in core.c. When changing the voltage, maybe use
    regulator_set_voltage().

    In regulator_set_voltage(), check the below condition.

    /* sanity check */
    if (!rdev->desc->ops->set_voltage &&
    !rdev->desc->ops->set_voltage_sel) {
    ret = -EINVAL;
    goto out;
    }

    If some board should use the fixed-regulator, always return -EINVAL.
    Then, eMMC didn't initialize always.

    So if use a fixed-regulator, we need to add the MMC_CAP2_BROKEN_VOLTAGE.

    Signed-off-by: Jaehoon Chung
    Signed-off-by: Kyungmin Park
    Acked-by: Adrian Hunter
    Signed-off-by: Chris Ball

    Jaehoon Chung
     
  • This patch fixes the failure of low speed mmc card detection.

    Signed-off-by: Girish K S
    Signed-off-by: Chris Ball

    Girish K S
     
  • When accessing the card on some FSL platform boards (e.g p2020, p1010,
    mpc8536), the following error is reported with the timeout value calculated:

    mmc0: Got data interrupt 0x00000020 even though no data operation was
    in progress.
    mmc0: Got data interrupt 0x00000020 even though no data operation was
    in progress.

    So we skip the calculation of timeout and use the max value to fix it.

    Signed-off-by: Jerry Huang
    Signed-off-by: Gao Guanhua
    Signed-off-by: Xie Xiaobo
    Acked-by: Anton Vorontsov
    Signed-off-by: Chris Ball

    Jerry Huang
     
  • For some FSL ESDHC controllers (e.g. P2020E, Rev1.0), the SDHC can not
    work on DMA mode because of the hardware bug, so we set a broken dma flag
    and use PIO mode.

    Signed-off-by: Jerry Huang
    Signed-off-by: Gao Guanhua
    Acked-by: Anton Vorontsov
    Signed-off-by: Chris Ball

    Jerry Huang
     
  • Ensure clocks are always enabled before any interaction with the
    host controller driver. This makes sure that there is no race
    between host execution and the core layer turning off clocks
    in different context with clock gating framework.

    Signed-off-by: Sujit Reddy Thumma
    Acked-by: Linus Walleij
    Acked-by: Per Forlin
    Signed-off-by: Chris Ball

    Sujit Reddy Thumma
     
  • The voltage_ranges is supposed to switch from big endian to little endian.

    Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD
    Acked-by: Grant Likely
    Signed-off-by: Chris Ball

    Jean-Christophe PLAGNIOL-VILLARD
     
  • A UHS sdio card that fails initialization at 1.8v signaling is not in
    UHS mode. We cannot use the speed in the the cis to reflect the bus
    speed as this is the maxiumum value and will not reflect the fact
    that the host is operating at a lower (non uhs) bus speed.

    Signed-off-by: Philip Rakity
    Signed-off-by: Bing Zhao
    Reviewed-by: Aaron Lu
    Signed-off-by: Chris Ball

    Philip Rakity
     
  • * tag 'for-linus' of git://github.com/rustyrussell/linux:
    module: fix broken isapnp handling in file2alias
    module: make module param bint handle nul value

    Linus Torvalds