1. 27 4月, 2022 1 次提交
  2. 06 12月, 2021 1 次提交
    • S
      serial: imx: fix detach/attach of serial console · 2cadd443
      Stefan Agner 提交于
      stable inclusion
      from stable-5.10.80
      commit 068dfa570d8c36da0f1493d97695a04e8e84d8bd
      bugzilla: 185821 https://gitee.com/openeuler/kernel/issues/I4L7CG
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=068dfa570d8c36da0f1493d97695a04e8e84d8bd
      
      --------------------------------
      
      [ Upstream commit 6d0d1b5a ]
      
      If the device used as a serial console gets detached/attached at runtime,
      register_console() will try to call imx_uart_setup_console(), but this
      is not possible since it is marked as __init.
      
      For instance
      
        # cat /sys/devices/virtual/tty/console/active
        tty1 ttymxc0
        # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
        # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
      
      [   73.166649] 8<--- cut here ---
      [   73.167005] Unable to handle kernel paging request at virtual address c154d928
      [   73.167601] pgd = 55433e84
      [   73.167875] [c154d928] *pgd=8141941e(bad)
      [   73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
      [   73.168429] Modules linked in:
      [   73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf #3
      [   73.168675] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
      [   73.168791] PC is at imx_uart_console_setup+0x0/0x238
      [   73.168927] LR is at try_enable_new_console+0x98/0x124
      [   73.169056] pc : [<c154d928>]    lr : [<c0196f44>]    psr: a0000013
      [   73.169178] sp : c2ef5e70  ip : 00000000  fp : 00000000
      [   73.169281] r10: 00000000  r9 : c02cf970  r8 : 00000000
      [   73.169389] r7 : 00000001  r6 : 00000001  r5 : c1760164  r4 : c1e0fb08
      [   73.169512] r3 : c154d928  r2 : 00000000  r1 : efffcbd1  r0 : c1760164
      [   73.169641] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      [   73.169782] Control: 10c5387d  Table: 8345406a  DAC: 00000051
      [   73.169895] Register r0 information: non-slab/vmalloc memory
      [   73.170032] Register r1 information: non-slab/vmalloc memory
      [   73.170158] Register r2 information: NULL pointer
      [   73.170273] Register r3 information: non-slab/vmalloc memory
      [   73.170397] Register r4 information: non-slab/vmalloc memory
      [   73.170521] Register r5 information: non-slab/vmalloc memory
      [   73.170647] Register r6 information: non-paged memory
      [   73.170771] Register r7 information: non-paged memory
      [   73.170892] Register r8 information: NULL pointer
      [   73.171009] Register r9 information: non-slab/vmalloc memory
      [   73.171142] Register r10 information: NULL pointer
      [   73.171259] Register r11 information: NULL pointer
      [   73.171375] Register r12 information: NULL pointer
      [   73.171494] Process sh (pid: 536, stack limit = 0xcd1ba82f)
      [   73.171621] Stack: (0xc2ef5e70 to 0xc2ef6000)
      [   73.171731] 5e60:                                     ???????? ???????? ???????? ????????
      [   73.171899] 5e80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.172059] 5ea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.172217] 5ec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.172377] 5ee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.172537] 5f00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.172698] 5f20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.172856] 5f40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.173016] 5f60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.173177] 5f80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.173336] 5fa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.173496] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.173654] 5fe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
      [   73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
      [   73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
      [   73.174470] [<c0383718>] (kernfs_fop_write_iter) from [<c02cf5f4>] (vfs_write+0x31c/0x548)
      [   73.174679] [<c02cf5f4>] (vfs_write) from [<c02cf970>] (ksys_write+0x60/0xec)
      [   73.174863] [<c02cf970>] (ksys_write) from [<c0100080>] (ret_fast_syscall+0x0/0x1c)
      [   73.175052] Exception stack(0xc2ef5fa8 to 0xc2ef5ff0)
      [   73.175167] 5fa0:                   ???????? ???????? ???????? ???????? ???????? ????????
      [   73.175327] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
      [   73.175486] 5fe0: ???????? ???????? ???????? ????????
      [   73.175608] Code: 00000000 00000000 00000000 00000000 (00000000)
      [   73.175744] ---[ end trace 9b75121265109bf1 ]---
      
      A similar issue could be triggered by unbinding/binding the serial
      console device [*].
      
      Drop __init so that imx_uart_setup_console() can be safely called at
      runtime.
      
      [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
      
      Fixes: a3cb39d2 ("serial: core: Allow detach and attach serial device for console")
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NStefan Agner <stefan@agner.ch>
      Signed-off-by: NFrancesco Dolcini <francesco.dolcini@toradex.com>
      Link: https://lore.kernel.org/r/20211020192643.476895-2-francesco.dolcini@toradex.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      2cadd443
  3. 12 10月, 2021 1 次提交
  4. 12 11月, 2020 2 次提交
  5. 30 9月, 2020 1 次提交
    • M
      tty: serial: imx: disable TXDC IRQ in imx_uart_shutdown() to avoid IRQ storm · edd64f30
      Matthias Schiffer 提交于
      The IPG clock is disabled at the end of imx_uart_shutdown(); we really
      don't want to run any IRQ handlers after this point.
      
      At least on i.MX8MN, the UART will happily continue to generate interrupts
      even with its clocks disabled, but in this state, all register writes are
      ignored (which will cause the shadow registers to differ from the actual
      register values, resulting in all kinds of weirdness).
      
      In a transfer without DMA, this could lead to the following sequence of
      events:
      
      - The UART finishes its transmission while imx_uart_shutdown() is run,
        triggering the TXDC interrupt (we can trigger this fairly reliably by
        writing a single byte to the TTY and closing it right away)
      - imx_uart_shutdown() finishes, disabling the UART clocks
      - imx_uart_int() -> imx_uart_transmit_buffer() -> imx_uart_stop_tx()
      
      imx_uart_stop_tx() should now clear UCR4_TCEN to disable the TXDC
      interrupt, but this register write is ineffective. This results in an
      interrupt storm.
      
      To disable all interrupts in the same place, and to avoid setting UCR4
      twice, clearing UCR4_OREN is moved below del_timer_sync() as well; this
      should be harmless.
      Signed-off-by: NMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
      Link: https://lore.kernel.org/r/20200925082412.12960-1-matthias.schiffer@ew.tq-group.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      edd64f30
  6. 04 9月, 2020 1 次提交
  7. 29 7月, 2020 1 次提交
  8. 22 7月, 2020 3 次提交
  9. 29 5月, 2020 1 次提交
  10. 27 5月, 2020 1 次提交
  11. 15 5月, 2020 2 次提交
  12. 06 3月, 2020 1 次提交
  13. 13 2月, 2020 1 次提交
    • F
      tty: serial: imx: setup the correct sg entry for tx dma · f7670783
      Fugang Duan 提交于
      There has oops as below happen on i.MX8MP EVK platform that has
      6G bytes DDR memory.
      
      when (xmit->tail < xmit->head) && (xmit->head == 0),
      it setups one sg entry with sg->length is zero:
      	sg_set_buf(sgl + 1, xmit->buf, xmit->head);
      
      if xmit->buf is allocated from >4G address space, and SDMA only
      support <4G address space, then dma_map_sg() will call swiotlb_map()
      to do bounce buffer copying and mapping.
      
      But swiotlb_map() don't allow sg entry's length is zero, otherwise
      report BUG_ON().
      
      So the patch is to correct the tx DMA scatter list.
      
      Oops:
      [  287.675715] kernel BUG at kernel/dma/swiotlb.c:497!
      [  287.680592] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
      [  287.686075] Modules linked in:
      [  287.689133] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.3-00016-g3fdc4e0-dirty #10
      [  287.696872] Hardware name: FSL i.MX8MP EVK (DT)
      [  287.701402] pstate: 80000085 (Nzcv daIf -PAN -UAO)
      [  287.706199] pc : swiotlb_tbl_map_single+0x1fc/0x310
      [  287.711076] lr : swiotlb_map+0x60/0x148
      [  287.714909] sp : ffff800010003c00
      [  287.718221] x29: ffff800010003c00 x28: 0000000000000000
      [  287.723533] x27: 0000000000000040 x26: ffff800011ae0000
      [  287.728844] x25: ffff800011ae09f8 x24: 0000000000000000
      [  287.734155] x23: 00000001b7af9000 x22: 0000000000000000
      [  287.739465] x21: ffff000176409c10 x20: 00000000001f7ffe
      [  287.744776] x19: ffff000176409c10 x18: 000000000000002e
      [  287.750087] x17: 0000000000000000 x16: 0000000000000000
      [  287.755397] x15: 0000000000000000 x14: 0000000000000000
      [  287.760707] x13: ffff00017f334000 x12: 0000000000000001
      [  287.766018] x11: 00000000001fffff x10: 0000000000000000
      [  287.771328] x9 : 0000000000000003 x8 : 0000000000000000
      [  287.776638] x7 : 0000000000000000 x6 : 0000000000000000
      [  287.781949] x5 : 0000000000200000 x4 : 0000000000000000
      [  287.787259] x3 : 0000000000000001 x2 : 00000001b7af9000
      [  287.792570] x1 : 00000000fbfff000 x0 : 0000000000000000
      [  287.797881] Call trace:
      [  287.800328]  swiotlb_tbl_map_single+0x1fc/0x310
      [  287.804859]  swiotlb_map+0x60/0x148
      [  287.808347]  dma_direct_map_page+0xf0/0x130
      [  287.812530]  dma_direct_map_sg+0x78/0xe0
      [  287.816453]  imx_uart_dma_tx+0x134/0x2f8
      [  287.820374]  imx_uart_dma_tx_callback+0xd8/0x168
      [  287.824992]  vchan_complete+0x194/0x200
      [  287.828828]  tasklet_action_common.isra.0+0x154/0x1a0
      [  287.833879]  tasklet_action+0x24/0x30
      [  287.837540]  __do_softirq+0x120/0x23c
      [  287.841202]  irq_exit+0xb8/0xd8
      [  287.844343]  __handle_domain_irq+0x64/0xb8
      [  287.848438]  gic_handle_irq+0x5c/0x148
      [  287.852185]  el1_irq+0xb8/0x180
      [  287.855327]  cpuidle_enter_state+0x84/0x360
      [  287.859508]  cpuidle_enter+0x34/0x48
      [  287.863083]  call_cpuidle+0x18/0x38
      [  287.866571]  do_idle+0x1e0/0x280
      [  287.869798]  cpu_startup_entry+0x20/0x40
      [  287.873721]  rest_init+0xd4/0xe0
      [  287.876949]  arch_call_rest_init+0xc/0x14
      [  287.880958]  start_kernel+0x420/0x44c
      [  287.884622] Code: 9124c021 9417aff8 a94363f7 17ffffd5 (d4210000)
      [  287.890718] ---[ end trace 5bc44c4ab6b009ce ]---
      [  287.895334] Kernel panic - not syncing: Fatal exception in interrupt
      [  287.901686] SMP: stopping secondary CPUs
      [  288.905607] SMP: failed to stop secondary CPUs 0-1
      [  288.910395] Kernel Offset: disabled
      [  288.913882] CPU features: 0x0002,2000200c
      [  288.917888] Memory Limit: none
      [  288.920944] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
      Reported-by: NEagle Zhou <eagle.zhou@nxp.com>
      Tested-by: NEagle Zhou <eagle.zhou@nxp.com>
      Signed-off-by: NFugang Duan <fugang.duan@nxp.com>
      Cc: stable <stable@vger.kernel.org>
      Fixes: 7942f857 ("serial: imx: TX DMA: clean up sg initialization")
      Reviewed-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/1581401761-6378-1-git-send-email-fugang.duan@nxp.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7670783
  14. 22 1月, 2020 1 次提交
  15. 18 12月, 2019 1 次提交
  16. 13 11月, 2019 1 次提交
  17. 10 10月, 2019 1 次提交
  18. 04 10月, 2019 1 次提交
    • P
      serial: imx: adapt rx buffer and dma periods · 76c38d30
      Philipp Puschmann 提交于
      Using only 4 DMA periods for UART RX is very few if we have a high
      frequency of small transfers - like in our case using Bluetooth with
      many small packets via UART - causing many dma transfers but in each
      only filling a fraction of a single buffer. Such a case may lead to
      the situation that DMA RX transfer is triggered but no free buffer is
      available. When this happens dma channel ist stopped - with the patch
      "dmaengine: imx-sdma: fix dma freezes" temporarily only - with the
      possible consequences that:
      with disabled hw flow control:
        If enough data is incoming on UART port the RX FIFO runs over and
        characters will be lost. What then happens depends on upper layer.
      
      with enabled hw flow control:
        If enough data is incoming on UART port the RX FIFO reaches a level
        where CTS is deasserted and remote device sending the data stops.
        If it fails to stop timely the i.MX' RX FIFO may run over and data
        get lost. Otherwise it's internal TX buffer may getting filled to
        a point where it runs over and data is again lost. It depends on
        the remote device how this case is handled and if it is recoverable.
      
      Obviously we want to avoid having no free buffers available. So we
      decrease the size of the buffers and increase their number and the
      total buffer size.
      Signed-off-by: NPhilipp Puschmann <philipp.puschmann@emlix.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      Link: https://lore.kernel.org/r/20190923135916.1212-1-philipp.puschmann@emlix.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76c38d30
  19. 04 9月, 2019 8 次提交
  20. 04 7月, 2019 3 次提交
  21. 18 6月, 2019 1 次提交
  22. 11 6月, 2019 1 次提交
  23. 21 5月, 2019 1 次提交
  24. 27 11月, 2018 1 次提交
  25. 20 9月, 2018 1 次提交
  26. 18 9月, 2018 2 次提交