1. 16 9月, 2020 1 次提交
    • J
      serial: core: fix console port-lock regression · e0830dbf
      Johan Hovold 提交于
      Fix the port-lock initialisation regression introduced by commit
      a3cb39d2 ("serial: core: Allow detach and attach serial device for
      console") by making sure that the lock is again initialised during
      console setup.
      
      The console may be registered before the serial controller has been
      probed in which case the port lock needs to be initialised during
      console setup by a call to uart_set_options(). The console-detach
      changes introduced a regression in several drivers by effectively
      removing that initialisation by not initialising the lock when the port
      is used as a console (which is always the case during console setup).
      
      Add back the early lock initialisation and instead use a new
      console-reinit flag to handle the case where a console is being
      re-attached through sysfs.
      
      The question whether the console-detach interface should have been added
      in the first place is left for another discussion.
      
      Note that the console-enabled check in uart_set_options() is not
      redundant because of kgdboc, which can end up reinitialising an already
      enabled console (see commit 42b6a1ba ("serial_core: Don't
      re-initialize a previously initialized spinlock.")).
      
      Fixes: a3cb39d2 ("serial: core: Allow detach and attach serial device for console")
      Cc: stable <stable@vger.kernel.org>     # 5.7
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20200909143101.15389-3-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0830dbf
  2. 27 6月, 2020 4 次提交
  3. 29 5月, 2020 1 次提交
  4. 15 5月, 2020 1 次提交
  5. 13 3月, 2020 1 次提交
  6. 07 3月, 2020 1 次提交
    • D
      serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE · 68af4317
      Dmitry Safonov 提交于
      Many embedded boards have a disconnected TTL level serial which can
      generate some garbage that can lead to spurious false sysrq detects.
      
      Currently, sysrq can be either completely disabled for serial console
      or always disabled (with CONFIG_MAGIC_SYSRQ_SERIAL), since
      commit 732dbf3a ("serial: do not accept sysrq characters via serial port")
      
      At Arista, we have such boards that can generate BREAK and random
      garbage. While disabling sysrq for serial console would solve
      the problem with spurious false sysrq triggers, it's also desirable
      to have a way to enable sysrq back.
      
      As a measure of balance between on and off options, add
      MAGIC_SYSRQ_SERIAL_SEQUENCE which is a string sequence that can enable
      sysrq if it follows BREAK on a serial line. The longer the string - the
      less likely it may be in the garbage.
      
      Having the way to enable sysrq was beneficial to debug lockups with
      a manual investigation in field and on the other side preventing false
      sysrq detections.
      Based-on-patch-by: NVasiliy Khoruzhick <vasilykh@arista.com>
      Signed-off-by: NDmitry Safonov <dima@arista.com>
      Link: https://lore.kernel.org/r/20200302175135.269397-3-dima@arista.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68af4317
  7. 15 1月, 2020 1 次提交
  8. 11 1月, 2020 1 次提交
  9. 18 12月, 2019 1 次提交
  10. 17 12月, 2019 2 次提交
  11. 15 7月, 2019 1 次提交
  12. 31 5月, 2019 1 次提交
  13. 25 4月, 2019 1 次提交
  14. 10 11月, 2018 2 次提交
    • D
      serial: core: Include console.h from serial_core.h · 3e6f8806
      Douglas Anderson 提交于
      In the static inline function uart_handle_break() in serial_core.h we
      dereference port->cons.  That gives an error unless console.h is also
      included.
      
      This error hasn't shown up till now because everyone who has defined
      SUPPORT_SYSRQ has also included console.h, but it's a bit ugly to make
      this requirement.  Let's make the include explicit.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e6f8806
    • D
      serial: core: Allow processing sysrq at port unlock time · d6e19358
      Douglas Anderson 提交于
      Right now serial drivers process sysrq keys deep in their character
      receiving code.  This means that they've already grabbed their
      port->lock spinlock.  This can end up getting in the way if we've go
      to do serial stuff (especially kgdb) in response to the sysrq.
      
      Serial drivers have various hacks in them to handle this.  Looking at
      '8250_port.c' you can see that the console_write() skips locking if
      we're in the sysrq handler.  Looking at 'msm_serial.c' you can see
      that the port lock is dropped around uart_handle_sysrq_char().
      
      It turns out that these hacks aren't exactly perfect.  If you have
      lockdep turned on and use something like the 8250_port hack you'll get
      a splat that looks like:
      
        WARNING: possible circular locking dependency detected
        [...] is trying to acquire lock:
        ... (console_owner){-.-.}, at: console_unlock+0x2e0/0x5e4
      
        but task is already holding lock:
        ... (&port_lock_key){-.-.}, at: serial8250_handle_irq+0x30/0xe4
      
        which lock already depends on the new lock.
      
        the existing dependency chain (in reverse order) is:
      
        -> #1 (&port_lock_key){-.-.}:
               _raw_spin_lock_irqsave+0x58/0x70
               serial8250_console_write+0xa8/0x250
               univ8250_console_write+0x40/0x4c
               console_unlock+0x528/0x5e4
               register_console+0x2c4/0x3b0
               uart_add_one_port+0x350/0x478
               serial8250_register_8250_port+0x350/0x3a8
               dw8250_probe+0x67c/0x754
               platform_drv_probe+0x58/0xa4
               really_probe+0x150/0x294
               driver_probe_device+0xac/0xe8
               __driver_attach+0x98/0xd0
               bus_for_each_dev+0x84/0xc8
               driver_attach+0x2c/0x34
               bus_add_driver+0xf0/0x1ec
               driver_register+0xb4/0x100
               __platform_driver_register+0x60/0x6c
               dw8250_platform_driver_init+0x20/0x28
      	 ...
      
        -> #0 (console_owner){-.-.}:
               lock_acquire+0x1e8/0x214
               console_unlock+0x35c/0x5e4
               vprintk_emit+0x230/0x274
               vprintk_default+0x7c/0x84
               vprintk_func+0x190/0x1bc
               printk+0x80/0xa0
               __handle_sysrq+0x104/0x21c
               handle_sysrq+0x30/0x3c
               serial8250_read_char+0x15c/0x18c
               serial8250_rx_chars+0x34/0x74
               serial8250_handle_irq+0x9c/0xe4
               dw8250_handle_irq+0x98/0xcc
               serial8250_interrupt+0x50/0xe8
               ...
      
        other info that might help us debug this:
      
         Possible unsafe locking scenario:
      
               CPU0                    CPU1
               ----                    ----
          lock(&port_lock_key);
                                       lock(console_owner);
                                       lock(&port_lock_key);
          lock(console_owner);
      
         *** DEADLOCK ***
      
      The hack used in 'msm_serial.c' doesn't cause the above splats but it
      seems a bit ugly to unlock / lock our spinlock deep in our irq
      handler.
      
      It seems like we could defer processing the sysrq until the end of the
      interrupt handler right after we've unlocked the port.  With this
      scheme if a whole batch of sysrq characters comes in one irq then we
      won't handle them all, but that seems like it should be a fine
      compromise.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6e19358
  15. 05 10月, 2018 1 次提交
  16. 03 10月, 2018 2 次提交
  17. 12 7月, 2018 1 次提交
  18. 23 4月, 2018 3 次提交
    • D
      serial: core: Make sure compiler barfs for 16-byte earlycon names · c1c734cb
      Douglas Anderson 提交于
      As part of bringup I ended up wanting to call an earlycon driver by a
      name that was exactly 16-bytes big, specifically "qcom_geni_serial".
      
      Unfortunately, when I tried this I found that things compiled just
      fine.  They just didn't work.
      
      Specifically the compiler felt perfectly justified in initting the
      ".name" field of "struct earlycon_id" with the full 16-bytes and just
      skipping the '\0'.  Needless to say, that behavior didn't seem ideal,
      but I guess someone must have allowed it for a reason.
      
      One way to fix this is to shorten the name field to 15 bytes and then
      add an extra byte after that nobody touches.  This should always be
      initted to 0 and we're golden.
      
      There are, of course, other ways to fix this too.  We could audit all
      the users of the "name" field and make them stop at both null
      termination or at 16 bytes.  We could also just make the name field
      much bigger so that we're not likely to run into this.  ...but both
      seem like we'll just hit the bug again.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1c734cb
    • J
      serial: Introduce UPSTAT_SYNC_FIFO for synchronised FIFOs · c5f78b1f
      Jeremy Kerr 提交于
      This change adds a flag to indicate that a UART is has an external means
      of synchronising its FIFO, without needing CTSRTS or XON/XOFF.
      
      This allows us to use the throttle/unthrottle callbacks, without having
      to claim other methods of flow control.
      Signed-off-by: NJeremy Kerr <jk@ozlabs.org>
      Tested-by: NEddie James <eajames@linux.vnet.ibm.com>
      Tested-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c5f78b1f
    • D
      earlycon: Use a pointer table to fix __earlycon_table stride · dd709e72
      Daniel Kurtz 提交于
      Commit 99492c39 ("earlycon: Fix __earlycon_table stride") tried to fix
      __earlycon_table stride by forcing the earlycon_id struct alignment to 32
      and asking the linker to 32-byte align the __earlycon_table symbol.  This
      fix was based on commit 07fca0e5 ("tracing: Properly align linker
      defined symbols") which tried a similar fix for the tracing subsystem.
      
      However, this fix doesn't quite work because there is no guarantee that
      gcc will place structures packed into an array format.  In fact, gcc 4.9
      chooses to 64-byte align these structs by inserting additional padding
      between the entries because it has no clue that they are supposed to be in
      an array.  If we are unlucky, the linker will assign symbol
      "__earlycon_table" to a 32-byte aligned address which does not correspond
      to the 64-byte aligned contents of section "__earlycon_table".
      
      To address this same problem, the fix to the tracing system was
      subsequently re-implemented using a more robust table of pointers approach
      by commits:
       3d56e331 ("tracing: Replace syscall_meta_data struct array with pointer array")
       65498646 ("tracepoints: Fix section alignment using pointer array")
       e4a9ea5e ("tracing: Replace trace_event struct array with pointer array")
      
      Let's use this same "array of pointers to structs" approach for
      EARLYCON_TABLE.
      
      Fixes: 99492c39 ("earlycon: Fix __earlycon_table stride")
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Suggested-by: NAaron Durbin <adurbin@chromium.org>
      Reviewed-by: NRob Herring <robh@kernel.org>
      Tested-by: NGuenter Roeck <groeck@chromium.org>
      Reviewed-by: NGuenter Roeck <groeck@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd709e72
  19. 16 3月, 2018 1 次提交
  20. 07 2月, 2018 1 次提交
  21. 09 1月, 2018 1 次提交
  22. 28 11月, 2017 1 次提交
    • L
      serial: Make retrieval of rs485 properties platform-agnostic · 743f93f8
      Lukas Wunner 提交于
      Commit ef838a81 ("serial: Add common rs485 device tree parsing
      function") consolidated retrieval of rs485 OF properties in a common
      helper function but did not #ifdef it to CONFIG_OF.  The function is
      therefore included on ACPI platforms as well even though it's not used.
      
      On the other hand ACPI platforms with rs485 do exist (e.g. Siemens
      IOT2040) and they may leverage _DSD to store rs485 properties.  Likewise,
      UART platform devices instantiated from an MFD should be able to specify
      rs485 properties.  In fact, the tty subsystem maintainer had asked for
      a "generic" function during review of commit ef838a81:
      https://marc.info/?l=linux-serial&m=150143441725194&w=4
      
      Thus, instead of constraining the helper to OF platforms, make it
      platform-agnostic by converting it to device_property_*() functions
      and renaming it accordingly.
      
      In imx.c, move the invocation of uart_get_rs485_mode() from
      serial_imx_probe_dt() to serial_imx_probe() so that it also gets called
      for non-OF devices.
      
      In omap-serial.c, move its invocation further up within
      serial_omap_probe_rs485() so that the RTS polarity can be overridden
      with the driver-specific "rs485-rts-active-high" property once we
      introduce a generic "rs485-rts-active-low" property.
      
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Cc: Richard Genoud <richard.genoud@gmail.com>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      743f93f8
  23. 19 9月, 2017 1 次提交
  24. 29 8月, 2017 1 次提交
  25. 30 7月, 2017 1 次提交
  26. 18 5月, 2017 1 次提交
  27. 09 4月, 2017 1 次提交
  28. 31 3月, 2017 1 次提交
  29. 12 1月, 2017 1 次提交
  30. 16 12月, 2016 1 次提交
  31. 16 11月, 2016 1 次提交
  32. 28 9月, 2016 1 次提交