12 May, 2020

1 commit

  • The threaded interrupt handler may still be called after the
    usb_gadget_disconnect is called, it causes the structures used
    at interrupt handler was freed before it uses, eg the
    usb_request. This issue usually occurs we remove the udc function
    during the transfer. Below is the example when doing stress
    test for android switch function, the EP0's request is freed
    by .unbind (configfs_composite_unbind -> composite_dev_cleanup),
    but the threaded handler accesses this request during handling
    setup packet request.

    In fact, there is no protection between unbind the udc
    and udc interrupt handling, so we have to avoid the interrupt
    handler is occurred or scheduled during the .unbind flow.

    init: Sending signal 9 to service 'adbd' (pid 18077) process group...
    android_work: did not send uevent (0 0 000000007bec2039)
    libprocessgroup: Successfully killed process cgroup uid 0 pid 18077 in 6ms
    init: Service 'adbd' (pid 18077) received signal 9
    init: Sending signal 9 to service 'adbd' (pid 18077) process group...
    libprocessgroup: Successfully killed process cgroup uid 0 pid 18077 in 0ms
    init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:14)
    init: Received control message 'start' for 'adbd' from pid: 399 (/vendor/bin/hw/android.hardware.usb@1.

    init: starting service 'adbd'...
    read descriptors
    read strings
    Unable to handle kernel read from unreadable memory at virtual address 000000000000002a
    android_work: sent uevent USB_STATE=CONNECTED
    Mem abort info:
    ESR = 0x96000004
    EC = 0x25: DABT (current EL), IL = 32 bits
    SET = 0, FnV = 0
    EA = 0, S1PTW = 0
    Data abort info:
    ISV = 0, ISS = 0x00000004
    CM = 0, WnR = 0
    user pgtable: 4k pages, 48-bit VAs, pgdp=00000000e97f1000
    using random self ethernet address
    [000000000000002a] pgd=0000000000000000
    Internal error: Oops: 96000004 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 0 PID: 232 Comm: irq/68-5b110000 Not tainted 5.4.24-06075-g94a6b52b5815 #92
    Hardware name: Freescale i.MX8QXP MEK (DT)
    pstate: 00400085 (nzcv daIf +PAN -UAO)
    using random host ethernet address
    pc : composite_setup+0x5c/0x1730
    lr : android_setup+0xc0/0x148
    sp : ffff80001349bba0
    x29: ffff80001349bba0 x28: ffff00083a50da00
    x27: ffff8000124e6000 x26: ffff800010177950
    x25: 0000000000000040 x24: ffff000834e18010
    x23: 0000000000000000 x22: 0000000000000000
    x21: ffff00083a50da00 x20: ffff00082e75ec40
    x19: 0000000000000000 x18: 0000000000000000
    x17: 0000000000000000 x16: 0000000000000000
    x15: 0000000000000000 x14: 0000000000000000
    x13: 0000000000000000 x12: 0000000000000001
    x11: ffff80001180fb58 x10: 0000000000000040
    x9 : ffff8000120fc980 x8 : 0000000000000000
    x7 : ffff00083f98df50 x6 : 0000000000000100
    x5 : 00000307e8978431 x4 : ffff800011386788
    x3 : 0000000000000000 x2 : ffff800012342000
    x1 : 0000000000000000 x0 : ffff800010c6d3a0
    Call trace:
    composite_setup+0x5c/0x1730
    android_setup+0xc0/0x148
    cdns3_ep0_delegate_req+0x64/0x90
    cdns3_check_ep0_interrupt_proceed+0x384/0x738
    cdns3_device_thread_irq_handler+0x124/0x6e0
    cdns3_thread_irq+0x94/0xa0
    irq_thread_fn+0x30/0xa0
    irq_thread+0x150/0x248
    kthread+0xfc/0x128
    ret_from_fork+0x10/0x18
    Code: 910e8000 f9400693 12001ed7 79400f79 (3940aa61)
    ---[ end trace c685db37f8773fba ]---
    Kernel panic - not syncing: Fatal exception
    SMP: stopping secondary CPUs
    Kernel Offset: disabled
    CPU features: 0x0002,20002008
    Memory Limit: none
    Rebooting in 5 seconds..

    Reviewed-by: Jun Li
    Signed-off-by: Peter Chen

    Peter Chen
     

29 Apr, 2020

3 commits

  • This adds a UIO driver the ivshmem device, found in QEMU and the
    Jailhouse hypervisor. It exposes the MMIO register region and all shared
    memory section to userspace. Interrupts are configured in one-shot mode
    so that userspace needs to re-enable them after each event via the
    Interrupt Control register. The driver registers all possible MSI-X
    vectors, coalescing them into the single notifier UIO provides.

    Note: Specification work for the interface is ongoing, so details may
    still change.

    Acked-by: Ye Li
    Signed-off-by: Jan Kiszka

    Jan Kiszka
     
  • Common defines and structures for the ivshmem device.

    Acked-by: Ye Li
    Signed-off-by: Jan Kiszka

    Jan Kiszka
     
  • This allows to tag memory regions read-only, denying userspace to map
    them writable. Default remains read/write.

    Acked-by: Ye Li
    Signed-off-by: Jan Kiszka

    Jan Kiszka
     

09 Apr, 2020

2 commits

  • Some platforms has limitation using memcpy to/from memory
    that will be used by remote processor.

    To i.MX8 Chips, TCM memory not support 64bit access, and non 64bit
    aligned access will cause issue.

    So introduce rproc_memory to let driver could have their own memcpy
    variants.

    Reviewed-by: Richard Zhu
    Signed-off-by: Peng Fan

    Peng Fan
     
  • Remote processor could boot independently or be loaded/started before
    Linux kernel by bootloader or any firmware.
    This patch introduces a new property in rproc core, named skip_fw_load,
    to be able to allocate resources and sub-devices like vdev and to
    synchronize with current state without loading firmware from file system.
    It is platform driver responsibility to implement the right firmware
    load ops according to HW specificities.

    Reviewed-by: Richard Zhu
    Signed-off-by: Loic Pallardy
    Acked-by: Mathieu Poirier

    Loic Pallardy
     

14 Mar, 2020

2 commits

  • The Security Violation module requires SC API for the SECO, RM, MISC
    and IRQ.

    This patch does:
    - imx-scu-irq: Allow reuse of imx_scu_irq_get_status
    - seco:
    - Add imx_sc_seco_secvio_enable
    - Add imx_sc_seco_secvio_config
    - Add imx_sc_seco_secvio_dgo_config

    Signed-off-by: Franck LENORMAND

    Franck LENORMAND
     
  • The implementation was limiting the size of a message which can be
    received to 4 but soem response can be bigger. For example the
    response of the 'sc_seco_secvio_config' API is 6 words.

    This patch removes this limitation relying on the count of word
    received instead of the index of the chan.
    It does so by duplicating imx_scu_call_rpc as imx_scu_call_big_rpc
    in order to cahnge the RX method using imx_scu_big_rx_callback
    instead of imx_scu_rx_callback.

    Signed-off-by: Franck LENORMAND

    Franck LENORMAND
     

08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

05 Mar, 2020

5 commits

  • [ Upstream commit c780e86dd48ef6467a1146cf7d0fe1e05a635039 ]

    KASAN is reporting that __blk_add_trace() has a use-after-free issue
    when accessing q->blk_trace. Indeed the switching of block tracing (and
    thus eventual freeing of q->blk_trace) is completely unsynchronized with
    the currently running tracing and thus it can happen that the blk_trace
    structure is being freed just while __blk_add_trace() works on it.
    Protect accesses to q->blk_trace by RCU during tracing and make sure we
    wait for the end of RCU grace period when shutting down tracing. Luckily
    that is rare enough event that we can afford that. Note that postponing
    the freeing of blk_trace to an RCU callback should better be avoided as
    it could have unexpected user visible side-effects as debugfs files
    would be still existing for a short while block tracing has been shut
    down.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=205711
    CC: stable@vger.kernel.org
    Reviewed-by: Chaitanya Kulkarni
    Reviewed-by: Ming Lei
    Tested-by: Ming Lei
    Reviewed-by: Bart Van Assche
    Reported-by: Tristan Madani
    Signed-off-by: Jan Kara
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Jan Kara
     
  • commit f66ee0410b1c3481ee75e5db9b34547b4d582465 upstream.

    In the case of huge hash:* types of sets, due to the single spinlock of
    a set the processing of the whole set under spinlock protection could take
    too long.

    There were four places where the whole hash table of the set was processed
    from bucket to bucket under holding the spinlock:

    - During resizing a set, the original set was locked to exclude kernel side
    add/del element operations (userspace add/del is excluded by the
    nfnetlink mutex). The original set is actually just read during the
    resize, so the spinlocking is replaced with rcu locking of regions.
    However, thus there can be parallel kernel side add/del of entries.
    In order not to loose those operations a backlog is added and replayed
    after the successful resize.
    - Garbage collection of timed out entries was also protected by the spinlock.
    In order not to lock too long, region locking is introduced and a single
    region is processed in one gc go. Also, the simple timer based gc running
    is replaced with a workqueue based solution. The internal book-keeping
    (number of elements, size of extensions) is moved to region level due to
    the region locking.
    - Adding elements: when the max number of the elements is reached, the gc
    was called to evict the timed out entries. The new approach is that the gc
    is called just for the matching region, assuming that if the region
    (proportionally) seems to be full, then the whole set does. We could scan
    the other regions to check every entry under rcu locking, but for huge
    sets it'd mean a slowdown at adding elements.
    - Listing the set header data: when the set was defined with timeout
    support, the garbage collector was called to clean up timed out entries
    to get the correct element numbers and set size values. Now the set is
    scanned to check non-timed out entries, without actually calling the gc
    for the whole set.

    Thanks to Florian Westphal for helping me to solve the SOFTIRQ-safe ->
    SOFTIRQ-unsafe lock order issues during working on the patch.

    Reported-by: syzbot+4b0e9d4ff3cf117837e5@syzkaller.appspotmail.com
    Reported-by: syzbot+c27b8d5010f45c666ed1@syzkaller.appspotmail.com
    Reported-by: syzbot+68a806795ac89df3aa1c@syzkaller.appspotmail.com
    Fixes: 23c42a403a9c ("netfilter: ipset: Introduction of new commands and protocol version 7")
    Signed-off-by: Jozsef Kadlecsik
    Signed-off-by: Greg Kroah-Hartman

    Jozsef Kadlecsik
     
  • commit 84a4062632462c4320704fcdf8e99e89e94c0aba upstream.

    We have a HID touch device that reports its opens and shorts test
    results in HID buffers of size 8184 bytes. The maximum size of the HID
    buffer is currently set to 4096 bytes, causing probe of this device to
    fail. With this patch we increase the maximum size of the HID buffer to
    8192 bytes, making device probe and acquisition of said buffers succeed.

    Signed-off-by: Johan Korsnes
    Cc: Alan Stern
    Cc: Armando Visconti
    Cc: Jiri Kosina
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Johan Korsnes
     
  • [ Upstream commit ebc0f83c78a2d26384401ecf2d2fa48063c0ee27 ]

    The way loadavg is tracked during nohz only pays attention to the load
    upon entering nohz. This can be particularly noticeable if full nohz is
    entered while non-idle, and then the cpu goes idle and stays that way for
    a long time.

    Use the remote tick to ensure that full nohz cpus report their deltas
    within a reasonable time.

    [ swood: Added changelog and removed recheck of stopped tick. ]

    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Scott Wood
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Link: https://lkml.kernel.org/r/1578736419-14628-3-git-send-email-swood@redhat.com
    Signed-off-by: Sasha Levin

    Peter Zijlstra (Intel)
     
  • [ Upstream commit 7151affeef8d527f50b4b68a871fd28bd660023f ]

    netdev_next_lower_dev_rcu() will be used to implement a function,
    which is to walk all lower interfaces.
    There are already functions that they walk their lower interface.
    (netdev_walk_all_lower_dev_rcu, netdev_walk_all_lower_dev()).
    But, there would be cases that couldn't be covered by given
    netdev_walk_all_lower_dev_{rcu}() function.
    So, some modules would want to implement own function,
    which is to walk all lower interfaces.

    In the next patch, netdev_next_lower_dev_rcu() will be used.
    In addition, this patch removes two unused prototypes in netdevice.h.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Taehee Yoo
     

29 Feb, 2020

5 commits

  • commit 10a663a1b15134a5a714aa515e11425a44d4fdf7 upstream.

    device_shutdown() called from reboot or power_shutdown expect
    all devices to be shutdown. Same is true for even ahci pci driver.
    As no ahci shutdown function is implemented, the ata subsystem
    always remains alive with DMA & interrupt support. File system
    related calls should not be honored after device_shutdown().

    So defining ahci pci driver shutdown to freeze hardware (mask
    interrupt, stop DMA engine and free DMA resources).

    Signed-off-by: Prabhakar Kushwaha
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Prabhakar Kushwaha
     
  • commit e7598fac323aad0e502415edeffd567315994dd6 upstream.

    The intel_svm_is_pasid_valid() needs to be marked inline, otherwise it
    causes the compile warning below:

    CC [M] drivers/dma/idxd/cdev.o
    In file included from drivers/dma/idxd/cdev.c:9:0:
    ./include/linux/intel-svm.h:125:12: warning: ‘intel_svm_is_pasid_valid’ defined but not used [-Wunused-function]
    static int intel_svm_is_pasid_valid(struct device *dev, int pasid)
    ^~~~~~~~~~~~~~~~~~~~~~~~

    Reported-by: Borislav Petkov
    Fixes: 15060aba71711 ('iommu/vt-d: Helper function to query if a pasid has any active users')
    Signed-off-by: Joerg Roedel
    Signed-off-by: Greg Kroah-Hartman

    Joerg Roedel
     
  • commit 2546287c5fb363a0165933ae2181c92f03e701d0 upstream.

    This was noticed when printing debugfs for MSIs on my ARM64 server. The
    new dstate IRQD_MSI_NOMASK_QUIRK came out surprisingly while it should only
    be the x86 stuff for the time being...

    The new MSI quirk flag uses the same bit as IRQ_DOMAIN_NAME_ALLOCATED which
    is oddly defined as bit 6 for no good reason.

    Switch it to the non used bit 1.

    Fixes: 6f1a4891a592 ("x86/apic/msi: Plug non-maskable MSI affinity race")
    Signed-off-by: Zenghui Yu
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200221020725.2038-1-yuzenghui@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    Zenghui Yu
     
  • commit 0c5aae59270fb1f827acce182786094c9ccf598e upstream.

    The serdev tty-port controller driver should reset the tty-port client
    operations also on deregistration to avoid a NULL-pointer dereference in
    case the port is later re-registered as a normal tty device.

    Note that this can only happen with tty drivers such as 8250 which have
    statically allocated port structures that can end up being reused and
    where a later registration would not register a serdev controller (e.g.
    due to registration errors or if the devicetree has been changed in
    between).

    Specifically, this can be an issue for any statically defined ports that
    would be registered by 8250 core when an 8250 driver is being unbound.

    Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
    Cc: stable # 4.11
    Reported-by: Loic Poulain
    Signed-off-by: Johan Hovold
    Link: https://lore.kernel.org/r/20200210145730.22762-1-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 73f8bda9b5dc1c69df2bc55c0cbb24461a6391a9 upstream.

    Add a new device quirk that can be used to blacklist endpoints.

    Since commit 3e4f8e21c4f2 ("USB: core: fix check for duplicate
    endpoints") USB core ignores any duplicate endpoints found during
    descriptor parsing.

    In order to handle devices where the first interfaces with duplicate
    endpoints are the ones that should have their endpoints ignored, we need
    to add a blacklist.

    Tested-by: edes
    Cc: stable
    Signed-off-by: Johan Hovold
    Link: https://lore.kernel.org/r/20200203153830.26394-2-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

26 Feb, 2020

6 commits

  • - This will enable link update event notification for
    user space USDPAA application.

    Signed-off-by: Sachin Saxena
    DPDK-2128
    (cherry picked from commit fb53c813a779cc3fc28c8ed3fc8bc0dde24db0ea)

    (cherry picked from commit 13efcd6d3c9078d22880e23c022b521935e4d78c)

    Sachin Saxena
     
  • Within the LS1028A SoC, the register map for the ENETC MDIO controller
    is instantiated a few times: for the central (external) MDIO controller,
    for the internal bus of each standalone ENETC port, and for the internal
    bus of the Felix switch.

    Refactoring is needed to support multiple MDIO buses from multiple
    drivers. The enetc_hw structure is made an opaque type and a smaller
    enetc_mdio_priv is created.

    'mdio_base' - MDIO registers base address - is being parameterized, to
    be able to work with different MDIO register bases.

    The ENETC MDIO bus operations are exported from the fsl-enetc-mdio
    kernel object, the same that registers the central MDIO controller (the
    dedicated PF). The ENETC main driver has been changed to select it, and
    use its exported helpers to further register its private MDIO bus. The
    DSA Felix driver will do the same.

    Signed-off-by: Claudiu Manoil
    Signed-off-by: Vladimir Oltean

    Conflicts:
    drivers/net/ethernet/freescale/enetc/enetc_mdio.c
    drivers/net/ethernet/freescale/enetc/enetc_mdio.h
    drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
    drivers/net/ethernet/freescale/enetc/enetc_pf.c
    drivers/net/ethernet/freescale/enetc/enetc_pf.h

    mostly with the previous (downstream version of this commit) patch
    572ee5d842da ("enetc: Make mdio accessors more generic"), which couldn't
    be reverted cleanly due to the existing downstream workaround for the
    MDIO erratum.

    (cherry picked from commit 344355a498cca71105a1de23b2b519ed2f5f914f)

    Claudiu Manoil
     
  • Some MAC PCS blocks are unable to provide interrupts when their status
    changes. As we already have support in phylink for polling status, use
    this to provide a hook for MACs to enable polling mode.

    The patch idea was picked up from Russell King's suggestion on the macb
    phylink patch thread here [0] but the implementation was changed.
    Instead of introducing a new phylink_start_poll() function, which would
    make the implementation cumbersome for common PHYLINK implementations
    for multiple types of devices, like DSA, just add a boolean property to
    the phylink_config structure, which is just as backwards-compatible.

    https://lkml.org/lkml/2019/12/16/603

    Suggested-by: Russell King
    Signed-off-by: Vladimir Oltean

    Conflicts:
    drivers/net/phy/phylink.c

    with upstream commit 24cf0e693bb5 ("net: phylink: split link_an_mode
    configured and current settings") submitted for net-next and merged
    during v5.5-rc1.

    (cherry picked from commit ac7420c5ede06ebe049c6bce8ba9e9d7d3a51d11)

    Vladimir Oltean
     
  • Typically a MAC PCS auto-configures itself after it receives the
    negotiated copper-side link settings from the PHY, but some MAC devices
    are more special and need manual interpretation of the SGMII AN result.

    In other cases, the PCS exposes the entire tx_config_reg base page as it
    is transmitted on the wire during auto-negotiation, so it makes sense to
    be able to decode the equivalent lp_advertised bit mask from the raw u16
    (of course, "lp" considering the PCS to be the local PHY).

    Therefore, add the bit definitions for the SGMII registers 4 and 5
    (local device ability, link partner ability), as well as a link_mode
    conversion helper that can be used to feed the AN results into
    phy_resolve_aneg_linkmode.

    Signed-off-by: Vladimir Oltean
    (cherry picked from commit 25138e7b9463c07eebbbcd1523b94d7e0d2d1649)

    Vladimir Oltean
     
  • This reverts commit de81e3c1ccbf27eda7584e23c713705a221a57da.

    Signed-off-by: Vladimir Oltean
    (cherry picked from commit a8e166166e9f1817b8df9040cb06a6a9a7e0fad7)

    Vladimir Oltean
     
  • This reverts commit f8d80c003b76f397696bf887ebbd37a78781c050.

    Signed-off-by: Vladimir Oltean
    (cherry picked from commit 5e3838998393dc81fb457204144b488fa7cfc968)

    Vladimir Oltean
     

24 Feb, 2020

8 commits

  • [ Upstream commit 5e5ac01c2b8802921fee680518a986011cb59820 ]

    The compilation warning is redefination showed as following:

    In file included from tables.c:2:
    ../../../include/linux/export.h:180: warning: "EXPORT_SYMBOL" redefined
    #define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "")

    In file included from tables.c:1:
    ../../../include/linux/raid/pq.h:61: note: this is the location of the previous definition
    #define EXPORT_SYMBOL(sym)

    Fixes: 69a94abb82ee ("export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols")
    Signed-off-by: Zhengyuan Liu
    Signed-off-by: Song Liu
    Signed-off-by: Sasha Levin

    Zhengyuan Liu
     
  • [ Upstream commit 860c8802ace14c646864795e057349c9fb2d60ad ]

    Eric Dumazet supplied a KCSAN report of a bug that forces use
    of hlist_unhashed_lockless() from sk_unhashed():

    ------------------------------------------------------------------------

    BUG: KCSAN: data-race in inet_unhash / inet_unhash

    write to 0xffff8880a69a0170 of 8 bytes by interrupt on cpu 1:
    __hlist_nulls_del include/linux/list_nulls.h:88 [inline]
    hlist_nulls_del_init_rcu include/linux/rculist_nulls.h:36 [inline]
    __sk_nulls_del_node_init_rcu include/net/sock.h:676 [inline]
    inet_unhash+0x38f/0x4a0 net/ipv4/inet_hashtables.c:612
    tcp_set_state+0xfa/0x3e0 net/ipv4/tcp.c:2249
    tcp_done+0x93/0x1e0 net/ipv4/tcp.c:3854
    tcp_write_err+0x7e/0xc0 net/ipv4/tcp_timer.c:56
    tcp_retransmit_timer+0x9b8/0x16d0 net/ipv4/tcp_timer.c:479
    tcp_write_timer_handler+0x42d/0x510 net/ipv4/tcp_timer.c:599
    tcp_write_timer+0xd1/0xf0 net/ipv4/tcp_timer.c:619
    call_timer_fn+0x5f/0x2f0 kernel/time/timer.c:1404
    expire_timers kernel/time/timer.c:1449 [inline]
    __run_timers kernel/time/timer.c:1773 [inline]
    __run_timers kernel/time/timer.c:1740 [inline]
    run_timer_softirq+0xc0c/0xcd0 kernel/time/timer.c:1786
    __do_softirq+0x115/0x33f kernel/softirq.c:292
    invoke_softirq kernel/softirq.c:373 [inline]
    irq_exit+0xbb/0xe0 kernel/softirq.c:413
    exiting_irq arch/x86/include/asm/apic.h:536 [inline]
    smp_apic_timer_interrupt+0xe6/0x280 arch/x86/kernel/apic/apic.c:1137
    apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
    native_safe_halt+0xe/0x10 arch/x86/kernel/paravirt.c:71
    arch_cpu_idle+0x1f/0x30 arch/x86/kernel/process.c:571
    default_idle_call+0x1e/0x40 kernel/sched/idle.c:94
    cpuidle_idle_call kernel/sched/idle.c:154 [inline]
    do_idle+0x1af/0x280 kernel/sched/idle.c:263
    cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:355
    start_secondary+0x208/0x260 arch/x86/kernel/smpboot.c:264
    secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241

    read to 0xffff8880a69a0170 of 8 bytes by interrupt on cpu 0:
    sk_unhashed include/net/sock.h:607 [inline]
    inet_unhash+0x3d/0x4a0 net/ipv4/inet_hashtables.c:592
    tcp_set_state+0xfa/0x3e0 net/ipv4/tcp.c:2249
    tcp_done+0x93/0x1e0 net/ipv4/tcp.c:3854
    tcp_write_err+0x7e/0xc0 net/ipv4/tcp_timer.c:56
    tcp_retransmit_timer+0x9b8/0x16d0 net/ipv4/tcp_timer.c:479
    tcp_write_timer_handler+0x42d/0x510 net/ipv4/tcp_timer.c:599
    tcp_write_timer+0xd1/0xf0 net/ipv4/tcp_timer.c:619
    call_timer_fn+0x5f/0x2f0 kernel/time/timer.c:1404
    expire_timers kernel/time/timer.c:1449 [inline]
    __run_timers kernel/time/timer.c:1773 [inline]
    __run_timers kernel/time/timer.c:1740 [inline]
    run_timer_softirq+0xc0c/0xcd0 kernel/time/timer.c:1786
    __do_softirq+0x115/0x33f kernel/softirq.c:292
    invoke_softirq kernel/softirq.c:373 [inline]
    irq_exit+0xbb/0xe0 kernel/softirq.c:413
    exiting_irq arch/x86/include/asm/apic.h:536 [inline]
    smp_apic_timer_interrupt+0xe6/0x280 arch/x86/kernel/apic/apic.c:1137
    apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
    native_safe_halt+0xe/0x10 arch/x86/kernel/paravirt.c:71
    arch_cpu_idle+0x1f/0x30 arch/x86/kernel/process.c:571
    default_idle_call+0x1e/0x40 kernel/sched/idle.c:94
    cpuidle_idle_call kernel/sched/idle.c:154 [inline]
    do_idle+0x1af/0x280 kernel/sched/idle.c:263
    cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:355
    rest_init+0xec/0xf6 init/main.c:452
    arch_call_rest_init+0x17/0x37
    start_kernel+0x838/0x85e init/main.c:786
    x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:490
    x86_64_start_kernel+0x72/0x76 arch/x86/kernel/head64.c:471
    secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241

    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc6+ #0
    Hardware name: Google Google Compute Engine/Google Compute Engine,
    BIOS Google 01/01/2011

    ------------------------------------------------------------------------

    This commit therefore replaces C-language assignments with WRITE_ONCE()
    in include/linux/list_nulls.h and include/linux/rculist_nulls.h.

    Reported-by: Eric Dumazet # For KCSAN
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Sasha Levin

    Paul E. McKenney
     
  • [ Upstream commit dae7a589c18a4d979d5f14b09374e871b995ceb1 ]

    dma_chan_to_owner() dereferences the driver from the struct device to
    obtain the owner and call module_[get|put](). However, if the backing
    device is unbound before the dma_device is unregistered, the driver
    will be cleared and this will cause a NULL pointer dereference.

    Instead, store a pointer to the owner module in the dma_device struct
    so the module reference can be properly put when the channel is put, even
    if the backing device was destroyed first.

    This change helps to support a safer unbind of DMA engines.
    If the dma_device is unregistered in the driver's remove function,
    there's no guarantee that there are no existing clients and a users
    action may trigger the WARN_ONCE in dma_async_device_unregister()
    which is unlikely to leave the system in a consistent state.
    Instead, a better approach is to allow the backing driver to go away
    and fail any subsequent requests to it.

    Signed-off-by: Logan Gunthorpe
    Link: https://lore.kernel.org/r/20191216190120.21374-2-logang@deltatee.com
    Signed-off-by: Vinod Koul
    Signed-off-by: Sasha Levin

    Logan Gunthorpe
     
  • [ Upstream commit 09298542cd891b43778db1f65aa3613aa5a562eb ]

    Add a "nr_devfns" parameter to pci_add_dma_alias() so it can be used to
    create DMA aliases for a range of devfns.

    [bhelgaas: incorporate nr_devfns fix from James, update
    quirk_pex_vca_alias() and setup_aliases()]
    Signed-off-by: James Sewart
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Sasha Levin

    James Sewart
     
  • [ Upstream commit 94f6345712b37e4bb23cb265ce4c65b9d177e75a ]

    For dra7 dcan and dwc3 instances we need to block clockdomain autoidle.
    Let's do this with CLKDM_NOAUTO quirk flag and enable it for dcan and
    dwc3.

    Cc: Keerthy
    Cc: Roger Quadros
    Cc: Tero Kristo
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin

    Tony Lindgren
     
  • [ Upstream commit 894c9ef9780c5cf2f143415e867ee39a33ecb75d ]

    Configuring an instance's parallel mask without any online CPUs...

    echo 2 > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
    echo 0 > /sys/devices/system/cpu/cpu1/online

    ...makes tcrypt mode=215 crash like this:

    divide error: 0000 [#1] SMP PTI
    CPU: 4 PID: 283 Comm: modprobe Not tainted 5.4.0-rc8-padata-doc-v2+ #2
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20191013_105130-anatol 04/01/2014
    RIP: 0010:padata_do_parallel+0x114/0x300
    Call Trace:
    pcrypt_aead_encrypt+0xc0/0xd0 [pcrypt]
    crypto_aead_encrypt+0x1f/0x30
    do_mult_aead_op+0x4e/0xdf [tcrypt]
    test_mb_aead_speed.constprop.0.cold+0x226/0x564 [tcrypt]
    do_test+0x28c2/0x4d49 [tcrypt]
    tcrypt_mod_init+0x55/0x1000 [tcrypt]
    ...

    cpumask_weight() in padata_cpu_hash() returns 0 because the mask has no
    CPUs. The problem is __padata_remove_cpu() checks for valid masks too
    early and so doesn't mark the instance PADATA_INVALID as expected, which
    would have made padata_do_parallel() return error before doing the
    division.

    Fix by introducing a second padata CPU hotplug state before
    CPUHP_BRINGUP_CPU so that __padata_remove_cpu() sees the online mask
    without @cpu. No need for the second argument to padata_replace() since
    @cpu is now already missing from the online mask.

    Fixes: 33e54450683c ("padata: Handle empty padata cpumasks")
    Signed-off-by: Daniel Jordan
    Cc: Eric Biggers
    Cc: Herbert Xu
    Cc: Sebastian Andrzej Siewior
    Cc: Steffen Klassert
    Cc: Thomas Gleixner
    Cc: linux-crypto@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Daniel Jordan
     
  • [ Upstream commit 6b8651aac1dca6140dd7fb4c9fec2736ed3f6223 ]

    The compilation error is redeclaration showed as following:

    In file included from ../../../include/linux/limits.h:6,
    from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
    from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
    from /usr/include/limits.h:183,
    from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/limits.h:194,
    from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/syslimits.h:7,
    from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/limits.h:34,
    from ../../../include/linux/raid/pq.h:30,
    from algos.c:14:
    ../../../include/linux/types.h:114:15: error: conflicting types for ‘int64_t’
    typedef s64 int64_t;
    ^~~~~~~
    In file included from /usr/include/stdint.h:34,
    from /usr/lib/gcc/x86_64-linux-gnu/8/include/stdint.h:9,
    from /usr/include/inttypes.h:27,
    from ../../../include/linux/raid/pq.h:29,
    from algos.c:14:
    /usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: previous \
    declaration of ‘int64_t’ was here
    typedef __int64_t int64_t;

    Fixes: 54d50897d544 ("linux/kernel.h: split *_MAX and *_MIN macros into ")
    Signed-off-by: Zhengyuan Liu
    Signed-off-by: Song Liu
    Signed-off-by: Sasha Levin

    Zhengyuan Liu
     
  • Linux kernel does not define ENOTSUP, let's use EOPNOTSUPP

    The patch fixes the following build break when use imx_v7_defconfig

    include/linux/firmware/imx/svc/rm.h: In function ‘imx_sc_rm_find_memreg’:
    include/linux/firmware/imx/svc/rm.h:79:10: error: ‘ENOTSUP’ undeclared (first use in this function)
    return -ENOTSUP;
    ^
    include/linux/firmware/imx/svc/rm.h:79:10: note: each undeclared identifier is reported only once for each function it appears in
    include/linux/firmware/imx/svc/rm.h: In function ‘imx_sc_rm_get_resource_owner’:
    include/linux/firmware/imx/svc/rm.h:85:10: error: ‘ENOTSUP’ undeclared (first use in this function)
    return -ENOTSUP;
    ^
    include/linux/firmware/imx/svc/rm.h: In function ‘imx_sc_rm_set_memreg_permissions’:
    include/linux/firmware/imx/svc/rm.h:92:10: error: ‘ENOTSUP’ undeclared (first use in this function)
    return -ENOTSUP;
    ^
    include/linux/firmware/imx/svc/rm.h: In function ‘imx_sc_rm_get_did’:
    include/linux/firmware/imx/svc/rm.h:98:10: error: ‘ENOTSUP’ undeclared (first use in this function)
    return -ENOTSUP;
    ^

    include/linux/firmware/imx/svc/seco.h: In function ‘imx_sc_seco_build_info’:
    include/linux/firmware/imx/svc/seco.h:37:10: error: ‘ENOTSUP’ undeclared (first use in this function)
    return -ENOTSUP;
    ^
    include/linux/firmware/imx/svc/seco.h: In function ‘imx_sc_seco_sab_msg’:
    include/linux/firmware/imx/svc/seco.h:43:10: error: ‘ENOTSUP’ undeclared (first use in this function)
    return -ENOTSUP;

    Fixes: 10237c7bcb174bcc("LF-824: fw: imx: scu: Add missing APIs") and
    Fixes: 9edf1255f89b9351("LF-824: fw: imx: scu: Add SECO API")

    Reviewed-by: Dong Aisheng
    Signed-off-by: Jason Liu

    Jason Liu
     

21 Feb, 2020

3 commits

  • This patch adds the driver to interact with the different
    APIs exposed by the SECO using a shared Messaging Unit.

    The driver exposes some char devices in user space allowing
    a user to send message to the SECO and read its response.

    The driver uses the mailbox framework instead of directly
    configuring the MU.

    Signed-off-by: Stephane Dion
    Signed-off-by: Silvano di Ninno
    Signed-off-by: Franck LENORMAND

    (cherry picked from commit 4985109d60164c842ee5d189621455db349b5212)
    (cherry picked from commit eb721810fdc309b6a32a7a64c7686eaa6052cdc7)
    (cherry picked from commit 4956bbf43349ab40a6a60765752a904d11bfcd18)

    Silvano di Ninno
     
  • Signed-off-by: Franck LENORMAND

    Franck LENORMAND
     
  • APIs added:
    - IMX_SC_RM_FUNC_FIND_MEMREG
    - IMX_SC_RM_FUNC_GET_RESOURCE_OWNER
    - IMX_SC_RM_FUNC_SET_MEMREG_PERMISSIONS
    - IMX_SC_RM_FUNC_GET_DID

    Signed-off-by: Franck LENORMAND

    Franck LENORMAND
     

20 Feb, 2020

2 commits

  • [ Upstream commit d3a5bcb4a17f1ad072484bb92c42519ff3aba6e1 ]

    Add possibility to toggle active-low flag of a gpio descriptor. This is
    useful for compatibility code, where defaults are inverted vs DT gpio
    flags or the active-low flag is taken from elsewhere.

    Acked-by: Linus Walleij
    Signed-off-by: Michał Mirosław
    Link: https://lore.kernel.org/r/7ce0338e01ad17fa5a227176813941b41a7c35c1.1576031637.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Michał Mirosław
     
  • commit e3728b50cd9be7d4b1469447cdf1feb93e3b7adb upstream.

    It is theoretically possible for the ACPI EC GPE to be set after the
    s2idle_ops->wake() called from s2idle_loop() has returned and before
    the subsequent pm_wakeup_pending() check is carried out. If that
    happens, the resulting wakeup event will cause the system to resume
    even though it may be a spurious one.

    To avoid that race, first make the ->wake() callback in struct
    platform_s2idle_ops return a bool value indicating whether or not
    to let the system resume and rearrange s2idle_loop() to use that
    value instad of the direct pm_wakeup_pending() call if ->wake() is
    present.

    Next, rework acpi_s2idle_wake() to process EC events and check
    pm_wakeup_pending() before re-arming the SCI for system wakeup
    to prevent it from triggering prematurely and add comments to
    that function to explain the rationale for the new code flow.

    Fixes: 56b991849009 ("PM: sleep: Simplify suspend-to-idle control flow")
    Cc: 5.4+ # 5.4+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

11 Feb, 2020

2 commits

  • [ Upstream commit 0468e667a5bead9c1b7ded92861b5a98d8d78745 ]

    Signed-off-by: Stephen Rothwell
    Link: https://lore.kernel.org/r/20200115120258.0e535fcb@canb.auug.org.au
    Acked-by: Marek Vasut
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Stephen Rothwell
     
  • commit 6f1a4891a5928a5969c87fa5a584844c983ec823 upstream.

    Evan tracked down a subtle race between the update of the MSI message and
    the device raising an interrupt internally on PCI devices which do not
    support MSI masking. The update of the MSI message is non-atomic and
    consists of either 2 or 3 sequential 32bit wide writes to the PCI config
    space.

    - Write address low 32bits
    - Write address high 32bits (If supported by device)
    - Write data

    When an interrupt is migrated then both address and data might change, so
    the kernel attempts to mask the MSI interrupt first. But for MSI masking is
    optional, so there exist devices which do not provide it. That means that
    if the device raises an interrupt internally between the writes then a MSI
    message is sent built from half updated state.

    On x86 this can lead to spurious interrupts on the wrong interrupt
    vector when the affinity setting changes both address and data. As a
    consequence the device interrupt can be lost causing the device to
    become stuck or malfunctioning.

    Evan tried to handle that by disabling MSI accross an MSI message
    update. That's not feasible because disabling MSI has issues on its own:

    If MSI is disabled the PCI device is routing an interrupt to the legacy
    INTx mechanism. The INTx delivery can be disabled, but the disablement is
    not working on all devices.

    Some devices lose interrupts when both MSI and INTx delivery are disabled.

    Another way to solve this would be to enforce the allocation of the same
    vector on all CPUs in the system for this kind of screwed devices. That
    could be done, but it would bring back the vector space exhaustion problems
    which got solved a few years ago.

    Fortunately the high address (if supported by the device) is only relevant
    when X2APIC is enabled which implies interrupt remapping. In the interrupt
    remapping case the affinity setting is happening at the interrupt remapping
    unit and the PCI MSI message is programmed only once when the PCI device is
    initialized.

    That makes it possible to solve it with a two step update:

    1) Target the MSI msg to the new vector on the current target CPU

    2) Target the MSI msg to the new vector on the new target CPU

    In both cases writing the MSI message is only changing a single 32bit word
    which prevents the issue of inconsistency.

    After writing the final destination it is necessary to check whether the
    device issued an interrupt while the intermediate state #1 (new vector,
    current CPU) was in effect.

    This is possible because the affinity change is always happening on the
    current target CPU. The code runs with interrupts disabled, so the
    interrupt can be detected by checking the IRR of the local APIC. If the
    vector is pending in the IRR then the interrupt is retriggered on the new
    target CPU by sending an IPI for the associated vector on the target CPU.

    This can cause spurious interrupts on both the local and the new target
    CPU.

    1) If the new vector is not in use on the local CPU and the device
    affected by the affinity change raised an interrupt during the
    transitional state (step #1 above) then interrupt entry code will
    ignore that spurious interrupt. The vector is marked so that the
    'No irq handler for vector' warning is supressed once.

    2) If the new vector is in use already on the local CPU then the IRR check
    might see an pending interrupt from the device which is using this
    vector. The IPI to the new target CPU will then invoke the handler of
    the device, which got the affinity change, even if that device did not
    issue an interrupt

    3) If the new vector is in use already on the local CPU and the device
    affected by the affinity change raised an interrupt during the
    transitional state (step #1 above) then the handler of the device which
    uses that vector on the local CPU will be invoked.

    expose issues in device driver interrupt handlers which are not prepared to
    handle a spurious interrupt correctly. This not a regression, it's just
    exposing something which was already broken as spurious interrupts can
    happen for a lot of reasons and all driver handlers need to be able to deal
    with them.

    Reported-by: Evan Green
    Debugged-by: Evan Green
    Signed-off-by: Thomas Gleixner
    Tested-by: Evan Green
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/87imkr4s7n.fsf@nanos.tec.linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner