1. 19 12月, 2017 5 次提交
    • J
      serial: max310x: Use batched reads when reasonably safe · 2b4bac48
      Jan Kundrát 提交于
      The hardware has a 128 byte RX FIFO buffer for each independent UART.
      Previously, the code was always reading that byte-by-byte via
      independent SPI transactions and the associated overhead. In practice,
      this led to up to eight bytes over SPI for just one byte in the UART's
      RX FIFO:
      
      - reading the global IRQ register (two bytes, one for command, the other
      for data)
      - reading one UART's ISR (again two bytes)
      - reading the byte count (two bytes yet again)
      - finally, reading one byte of the FIFO via another two-byte transaction
      
      We cannot always use a batched read. If the TTY is set to intercept
      break conditions or report framing or parity errors, then it is required
      to check the Line Status Register (LSR) for each byte which is read from
      the RX FIFO. The documentation does not show a way of doing that in a
      single SPI transaction; registers 0x00 and 0x04 are separate.
      
      In my testing, this is no silver bullet. I was feeding 2MB of random
      data over four daisy-chaned UARTs of MAX14830, and this is the
      distribution that I was getting:
      
      - R <= 1: 7437322
      - R <= 2: 162093
      - R <= 4: 4093
      - R <= 8: 4196
      - R <= 16: 645
      - R <= 32: 165
      - R <= 64: 58
      - R <= 128: 0
      
      For a reference, batching the write operations works much better:
      
      - W <= 1: 2664
      - W <= 2: 1305
      - W <= 4: 627
      - W <= 8: 371
      - W <= 16: 121
      - W <= 32: 68
      - W <= 64: 33
      - W <= 128: 63139
      
      That's probably because this HW/SW combination (Clearfog Base, Armada
      388) is probably "good enough" to react to the chip's IRQ "fast enough"
      most of the time. Still, I was getting RX overruns every now and then.
      In future, I plan to improve this by letting the RX FIFO be filled a
      little more (the chip has support for that and also for a "stale
      timeout" to prevent additional starvation).
      Signed-off-by: NJan Kundrát <jan.kundrat@cesnet.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b4bac48
    • J
      serial: max310x: use a batch write op for UART transmit · d584b65c
      Jan Kundrát 提交于
      The transmit register supports batched writes. The key is simply to keep
      sending additional bytes up to the FIFO size in the same SPI
      transaction with the CS pin still being held low.
      
      This duplicates the regmap infrastructure to a certain extent. There are
      some provisions for multiple writes in there, but there does not appear
      to be any support for those writes which are destined to the *same*
      register (and also no standard for SPI bus transfers of these, anyway).
      
      This patch does not solve every case (if the UART xmit circular buffer
      wraps around, we're still doing two SPI transactions), but at least
      it's not one-byte-per-transaction anymore.
      
      This change does not touch the receive path at this time. Doing that in
      the generic case appears to be impossible in the general case, because
      the chips' status register contains data about the *current* byte in the
      HW's Rx FIFO. We cannot read these two registers in one go,
      unfortunately.
      Signed-off-by: NJan Kundrát <jan.kundrat@cesnet.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d584b65c
    • J
      serial: max310x: Support IRQ sharing with other devices · 78be70c8
      Jan Kundrát 提交于
      According to my chip's datasheet [1], the IRQ output is an open
      collector pin which is suitable for sharing with other chips. The chip
      also has a register which indicates which UART performed a change and
      the driver checks that register already, so we have everything what is
      needed to effectively share the IRQ GPIO.
      
      [1] https://datasheets.maximintegrated.com/en/ds/MAX14830.pdfSigned-off-by: NJan Kundrát <jan.kundrat@cesnet.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78be70c8
    • J
      serial: max310x: Do not hard-code the IRQ type · bceb4839
      Jan Kundrát 提交于
      As suggested by Russell King, a driver should not really care about bits
      such as the interrupt polarity or whether it is edge- or level-
      triggered. The reasons for that include:
      
      - an upstream IRQ controller which cannot support edge- or
      level-triggered interrupts,
      - board design with a built-in inverter
      
      The interrupt type is being already specified by the Device Tree,
      anyway. Other drivers (gpio/gpio-tc3589x.c for example) already work in
      this way, delegating the proper IRQ line setup to the DT and not
      specifying anything by hand.
      
      Also, there's no reason to have the IRQ flags split between two places.
      The SPI probing is the only entry point anyway.
      Signed-off-by: NJan Kundrát <jan.kundrat@cesnet.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bceb4839
    • M
      nvmem: meson-mx-efuse: fix reading from an offset other than 0 · 793ae04c
      Martin Blumenstingl 提交于
      meson_mx_efuse_read calculates the address internal to the eFuse based
      on the offset and the word size. This works fine with any given offset.
      However, the offset is also included when writing to the output buffer.
      This means that reading 4 bytes at offset 500 tries to write beyond the
      array allocated by the nvmem core as it wants to write the 4 bytes to
      "buffer address + offset (500)".
      This issue did not show up in the previous tests since no driver uses
      any value from the eFuse yet and reading the eFuse via sysfs simply
      reads the whole eFuse, starting at offset 0.
      
      Fix this by only including the offset in the internal address
      calculation.
      
      Fixes: 8caef1fa ("nvmem: add a driver for the Amlogic Meson6/Meson8/Meson8b SoCs")
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      793ae04c
  2. 18 12月, 2017 2 次提交
  3. 16 12月, 2017 12 次提交
  4. 09 12月, 2017 4 次提交
    • A
      net: mvpp2: fix the RSS table entry offset · 8a7b741e
      Antoine Tenart 提交于
      The macro used to access or set an RSS table entry was using an offset
      of 8, while it should use an offset of 0. This lead to wrongly configure
      the RSS table, not accessing the right entries.
      
      Fixes: 1d7d15d7 ("net: mvpp2: initialize the RSS tables")
      Signed-off-by: NAntoine Tenart <antoine.tenart@free-electrons.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8a7b741e
    • C
      bnxt_en: Fix sources of spurious netpoll warnings · 2edbdb31
      Calvin Owens 提交于
      After applying 2270bc5d ("bnxt_en: Fix netpoll handling") and
      903649e7 ("bnxt_en: Improve -ENOMEM logic in NAPI poll loop."),
      we still see the following WARN fire:
      
        ------------[ cut here ]------------
        WARNING: CPU: 0 PID: 1875170 at net/core/netpoll.c:165 netpoll_poll_dev+0x15a/0x160
        bnxt_poll+0x0/0xd0 exceeded budget in poll
        <snip>
        Call Trace:
         [<ffffffff814be5cd>] dump_stack+0x4d/0x70
         [<ffffffff8107e013>] __warn+0xd3/0xf0
         [<ffffffff8107e07f>] warn_slowpath_fmt+0x4f/0x60
         [<ffffffff8179519a>] netpoll_poll_dev+0x15a/0x160
         [<ffffffff81795f38>] netpoll_send_skb_on_dev+0x168/0x250
         [<ffffffff817962fc>] netpoll_send_udp+0x2dc/0x440
         [<ffffffff815fa9be>] write_ext_msg+0x20e/0x250
         [<ffffffff810c8125>] call_console_drivers.constprop.23+0xa5/0x110
         [<ffffffff810c9549>] console_unlock+0x339/0x5b0
         [<ffffffff810c9a88>] vprintk_emit+0x2c8/0x450
         [<ffffffff810c9d5f>] vprintk_default+0x1f/0x30
         [<ffffffff81173df5>] printk+0x48/0x50
         [<ffffffffa0197713>] edac_raw_mc_handle_error+0x563/0x5c0 [edac_core]
         [<ffffffffa0197b9b>] edac_mc_handle_error+0x42b/0x6e0 [edac_core]
         [<ffffffffa01c3a60>] sbridge_mce_output_error+0x410/0x10d0 [sb_edac]
         [<ffffffffa01c47cc>] sbridge_check_error+0xac/0x130 [sb_edac]
         [<ffffffffa0197f3c>] edac_mc_workq_function+0x3c/0x90 [edac_core]
         [<ffffffff81095f8b>] process_one_work+0x19b/0x480
         [<ffffffff810967ca>] worker_thread+0x6a/0x520
         [<ffffffff8109c7c4>] kthread+0xe4/0x100
         [<ffffffff81884c52>] ret_from_fork+0x22/0x40
      
      This happens because we increment rx_pkts on -ENOMEM and -EIO, resulting
      in rx_pkts > 0. Fix this by only bumping rx_pkts if we were actually
      given a non-zero budget.
      Signed-off-by: NCalvin Owens <calvinowens@fb.com>
      Acked-by: NMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2edbdb31
    • B
      sfc: pass valid pointers from efx_enqueue_unwind · d4a7a889
      Bert Kenward 提交于
      The bytes_compl and pkts_compl pointers passed to efx_dequeue_buffers
      cannot be NULL. Add a paranoid warning to check this condition and fix
      the one case where they were NULL.
      
      efx_enqueue_unwind() is called very rarely, during error handling.
      Without this fix it would fail with a NULL pointer dereference in
      efx_dequeue_buffer, with efx_enqueue_skb in the call stack.
      
      Fixes: e9117e50 ("sfc: Firmware-Assisted TSO version 2")
      Reported-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NBert Kenward <bkenward@solarflare.com>
      Tested-by: NJarod Wilson <jarod@redhat.com>
      Acked-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d4a7a889
    • C
      gianfar: Disable EEE autoneg by default · b6b5e8a6
      Claudiu Manoil 提交于
      This controller does not support EEE, but it may connect to a PHY
      which supports EEE and advertises EEE by default, while its link
      partner also advertises EEE. If this happens, the PHY enters low
      power mode when the traffic rate is low and causes packet loss.
      This patch disables EEE advertisement by default for any PHY that
      gianfar connects to, to prevent the above unwanted outcome.
      Signed-off-by: NShaohui Xie <Shaohui.Xie@nxp.com>
      Tested-by: NYangbo Lu <Yangbo.lu@nxp.com>
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b6b5e8a6
  5. 08 12月, 2017 16 次提交
  6. 07 12月, 2017 1 次提交
    • M
      drm/bridge: analogix dp: Fix runtime PM state in get_modes() callback · 510353a6
      Marek Szyprowski 提交于
      get_modes() callback might be called asynchronously from the DRM core and
      it is not synchronized with bridge_enable(), which sets proper runtime PM
      state of the main DP device. Fix this by calling pm_runtime_get_sync()
      before calling drm_get_edid(), which in turn calls drm_dp_i2c_xfer() and
      analogix_dp_transfer() to ensure that main DP device is runtime active
      when doing any access to its registers.
      
      This fixes the following kernel issue on Samsung Exynos5250 Snow board:
      Unhandled fault: imprecise external abort (0x406) at 0x00000000
      pgd = c0004000
      [00000000] *pgd=00000000
      Internal error: : 406 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 0 PID: 62 Comm: kworker/0:2 Not tainted 4.13.0-rc2-00364-g4a97a3da #3357
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      Workqueue: events output_poll_execute
      task: edc14800 task.stack: edcb2000
      PC is at analogix_dp_transfer+0x15c/0x2fc
      LR is at analogix_dp_transfer+0x134/0x2fc
      pc : [<c0468538>]    lr : [<c0468510>]    psr: 60000013
      sp : edcb3be8  ip : 0000002a  fp : 00000001
      r10: 00000000  r9 : edcb3cd8  r8 : edcb3c40
      r7 : 00000000  r6 : edd3b380  r5 : edd3b010  r4 : 00000064
      r3 : 00000000  r2 : f0ad3000  r1 : edcb3c40  r0 : edd3b010
      Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      Control: 10c5387d  Table: 4000406a  DAC: 00000051
      Process kworker/0:2 (pid: 62, stack limit = 0xedcb2210)
      Stack: (0xedcb3be8 to 0xedcb4000)
      [<c0468538>] (analogix_dp_transfer) from [<c0424ba4>] (drm_dp_i2c_do_msg+0x8c/0x2b4)
      [<c0424ba4>] (drm_dp_i2c_do_msg) from [<c0424e64>] (drm_dp_i2c_xfer+0x98/0x214)
      [<c0424e64>] (drm_dp_i2c_xfer) from [<c057b2d8>] (__i2c_transfer+0x140/0x29c)
      [<c057b2d8>] (__i2c_transfer) from [<c057b4a4>] (i2c_transfer+0x70/0xe4)
      [<c057b4a4>] (i2c_transfer) from [<c0441de4>] (drm_do_probe_ddc_edid+0xb4/0x114)
      [<c0441de4>] (drm_do_probe_ddc_edid) from [<c0441e5c>] (drm_probe_ddc+0x18/0x28)
      [<c0441e5c>] (drm_probe_ddc) from [<c0445728>] (drm_get_edid+0x124/0x2d4)
      [<c0445728>] (drm_get_edid) from [<c0465ea0>] (analogix_dp_get_modes+0x90/0x114)
      [<c0465ea0>] (analogix_dp_get_modes) from [<c0425e8c>] (drm_helper_probe_single_connector_modes+0x198/0x68c)
      [<c0425e8c>] (drm_helper_probe_single_connector_modes) from [<c04325d4>] (drm_setup_crtcs+0x1b4/0xd18)
      [<c04325d4>] (drm_setup_crtcs) from [<c04344a8>] (drm_fb_helper_hotplug_event+0x94/0xd0)
      [<c04344a8>] (drm_fb_helper_hotplug_event) from [<c0425a50>] (drm_kms_helper_hotplug_event+0x24/0x28)
      [<c0425a50>] (drm_kms_helper_hotplug_event) from [<c04263ec>] (output_poll_execute+0x6c/0x174)
      [<c04263ec>] (output_poll_execute) from [<c0136f18>] (process_one_work+0x188/0x3fc)
      [<c0136f18>] (process_one_work) from [<c01371f4>] (worker_thread+0x30/0x4b8)
      [<c01371f4>] (worker_thread) from [<c013daf8>] (kthread+0x128/0x164)
      [<c013daf8>] (kthread) from [<c0108510>] (ret_from_fork+0x14/0x24)
      Code: 0a000002 ea000009 e2544001 0a00004a (e59537c8)
      ---[ end trace cddc7919c79f7878 ]---
      Reported-by: NMisha Komarovskiy <zombah@gmail.com>
      CC: stable@vger.kernel.org # v4.10+
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171121074936.22520-1-m.szyprowski@samsung.com
      510353a6