1. 14 Apr, 2020 3 commits
  2. 09 Apr, 2020 2 commits
    • Wen Gong's avatar
      ath10k: change ATH10K_SDIO_BUS_REQUEST_MAX_NUM from 64 to 1024 · c61a7483
      Wen Gong authored
      sdio bus bandwidth is low, sometimes for high performance TX test,
      it will lack of ath10k_sdio_bus_request, it will print message:
      ath10k_sdio mmc1:0001:1: unable to allocate bus request for async request
      
      change the num from 64 to 1024 will not happen it.
      
      Tested with QCA6174 SDIO with firmware
      WLAN.RMH.4.4.1-00017-QCARMSWP-1.
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200212080415.31265-3-wgong@codeaurora.org
      c61a7483
    • Wen Gong's avatar
      ath10k: disable TX complete indication of htt for sdio · d81686d3
      Wen Gong authored
      For sdio chip, it is high latency bus, all the TX packet's content will
      be tranferred from HOST memory to firmware memory via sdio bus, then it
      need much more memory in firmware than low latency bus chip, for low
      latency chip, such as PCI-E, it only need to transfer the TX descriptor
      via PCI-E bus to firmware memory. For sdio chip, reduce the complexity of
      TX logic will help TX efficiency since its memory is limited, and it will
      reduce the TX circle's time of each packet and then firmware will have more
      memory for TX since TX complete also need memeory.
      
      This patch disable TX complete indication from firmware for htt data
      packet, it will not have TX complete indication from firmware to ath10k.
      It will cut the cost of bus bandwidth of TX complete and make the TX
      logic of firmware simpler, it results in significant performance
      improvement on TX path.
      
      Udp TX throughout is 130Mbps without this patch, and it arrives
      400Mbps with this patch.
      
      The downside of this patch is the command "iw wlan0 station dump" will
      show 0 for "tx retries" and "tx failed" since all tx packet's status
      is success.
      
      This patch only effect sdio chip, it will not effect PCI, SNOC etc.
      
      Tested with QCA6174 SDIO with firmware
      WLAN.RMH.4.4.1-00017-QCARMSWPZ-1
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200212080415.31265-2-wgong@codeaurora.org
      d81686d3
  3. 07 Apr, 2020 6 commits
    • Qiujun Huang's avatar
      ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb · 2bbcaaee
      Qiujun Huang authored
      In ath9k_hif_usb_rx_cb interface number is assumed to be 0.
      usb_ifnum_to_if(urb->dev, 0)
      But it isn't always true.
      
      The case reported by syzbot:
      https://lore.kernel.org/linux-usb/000000000000666c9c05a1c05d12@google.com
      usb 2-1: new high-speed USB device number 2 using dummy_hcd
      usb 2-1: config 1 has an invalid interface number: 2 but max is 0
      usb 2-1: config 1 has no interface number 0
      usb 2-1: New USB device found, idVendor=0cf3, idProduct=9271, bcdDevice=
      1.08
      usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      general protection fault, probably for non-canonical address
      0xdffffc0000000015: 0000 [#1] SMP KASAN
      KASAN: null-ptr-deref in range [0x00000000000000a8-0x00000000000000af]
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0-rc5-syzkaller #0
      
      Call Trace
      __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650
      usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716
      dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
      call_timer_fn+0x195/0x6f0 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+0x5f9/0x1500 kernel/time/timer.c:1786
      __do_softirq+0x21e/0x950 kernel/softirq.c:292
      invoke_softirq kernel/softirq.c:373 [inline]
      irq_exit+0x178/0x1a0 kernel/softirq.c:413
      exiting_irq arch/x86/include/asm/apic.h:546 [inline]
      smp_apic_timer_interrupt+0x141/0x540 arch/x86/kernel/apic/apic.c:1146
      apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829
      
      Reported-and-tested-by: syzbot+40d5d2e8a4680952f042@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200404041838.10426-6-hqjagain@gmail.com
      2bbcaaee
    • Qiujun Huang's avatar
      ath9x: Fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb · 19d6c375
      Qiujun Huang authored
      Add barrier to accessing the stack array skb_pool.
      
      The case reported by syzbot:
      https://lore.kernel.org/linux-usb/0000000000003d7c1505a2168418@google.com
      BUG: KASAN: stack-out-of-bounds in ath9k_hif_usb_rx_stream
      drivers/net/wireless/ath/ath9k/hif_usb.c:626 [inline]
      BUG: KASAN: stack-out-of-bounds in ath9k_hif_usb_rx_cb+0xdf6/0xf70
      drivers/net/wireless/ath/ath9k/hif_usb.c:666
      Write of size 8 at addr ffff8881db309a28 by task swapper/1/0
      
      Call Trace:
      ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:626
      [inline]
      ath9k_hif_usb_rx_cb+0xdf6/0xf70
      drivers/net/wireless/ath/ath9k/hif_usb.c:666
      __usb_hcd_giveback_urb+0x1f2/0x470 drivers/usb/core/hcd.c:1648
      usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1713
      dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
      call_timer_fn+0x195/0x6f0 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+0x5f9/0x1500 kernel/time/timer.c:1786
      
      Reported-and-tested-by: syzbot+d403396d4df67ad0bd5f@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200404041838.10426-5-hqjagain@gmail.com
      19d6c375
    • Qiujun Huang's avatar
      ath9k: Fix use-after-free Write in ath9k_htc_rx_msg · e4ff08a4
      Qiujun Huang authored
      Write out of slab bounds. We should check epid.
      
      The case reported by syzbot:
      https://lore.kernel.org/linux-usb/0000000000006ac55b05a1c05d72@google.com
      BUG: KASAN: use-after-free in htc_process_conn_rsp
      drivers/net/wireless/ath/ath9k/htc_hst.c:131 [inline]
      BUG: KASAN: use-after-free in ath9k_htc_rx_msg+0xa25/0xaf0
      drivers/net/wireless/ath/ath9k/htc_hst.c:443
      Write of size 2 at addr ffff8881cea291f0 by task swapper/1/0
      
      Call Trace:
       htc_process_conn_rsp drivers/net/wireless/ath/ath9k/htc_hst.c:131
      [inline]
      ath9k_htc_rx_msg+0xa25/0xaf0
      drivers/net/wireless/ath/ath9k/htc_hst.c:443
      ath9k_hif_usb_reg_in_cb+0x1ba/0x630
      drivers/net/wireless/ath/ath9k/hif_usb.c:718
      __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650
      usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716
      dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
      call_timer_fn+0x195/0x6f0 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+0x5f9/0x1500 kernel/time/timer.c:1786
      
      Reported-and-tested-by: syzbot+b1c61e5f11be5782f192@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200404041838.10426-4-hqjagain@gmail.com
      e4ff08a4
    • Qiujun Huang's avatar
      ath9k: Fix use-after-free Read in ath9k_wmi_ctrl_rx · abeaa850
      Qiujun Huang authored
      Free wmi later after cmd urb has been killed, as urb cb will access wmi.
      
      the case reported by syzbot:
      https://lore.kernel.org/linux-usb/0000000000000002fc05a1d61a68@google.com
      BUG: KASAN: use-after-free in ath9k_wmi_ctrl_rx+0x416/0x500
      drivers/net/wireless/ath/ath9k/wmi.c:215
      Read of size 1 at addr ffff8881cef1417c by task swapper/1/0
      
      Call Trace:
      <IRQ>
      ath9k_wmi_ctrl_rx+0x416/0x500 drivers/net/wireless/ath/ath9k/wmi.c:215
      ath9k_htc_rx_msg+0x2da/0xaf0
      drivers/net/wireless/ath/ath9k/htc_hst.c:459
      ath9k_hif_usb_reg_in_cb+0x1ba/0x630
      drivers/net/wireless/ath/ath9k/hif_usb.c:718
      __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650
      usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716
      dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
      call_timer_fn+0x195/0x6f0 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+0x5f9/0x1500 kernel/time/timer.c:1786
      
      Reported-and-tested-by: syzbot+5d338854440137ea0fef@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200404041838.10426-3-hqjagain@gmail.com
      abeaa850
    • Qiujun Huang's avatar
      ath9k: Fix use-after-free Read in htc_connect_service · ced21a4c
      Qiujun Huang authored
      The skb is consumed by htc_send_epid, so it needn't release again.
      
      The case reported by syzbot:
      
      https://lore.kernel.org/linux-usb/000000000000590f6b05a1c05d15@google.com
      usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
      usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size:
      51008
      usb 1-1: Service connection timeout for: 256
      ==================================================================
      BUG: KASAN: use-after-free in atomic_read
      include/asm-generic/atomic-instrumented.h:26 [inline]
      BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:134
      [inline]
      BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:1042
      [inline]
      BUG: KASAN: use-after-free in kfree_skb+0x32/0x3d0 net/core/skbuff.c:692
      Read of size 4 at addr ffff8881d0957994 by task kworker/1:2/83
      
      Call Trace:
      kfree_skb+0x32/0x3d0 net/core/skbuff.c:692
      htc_connect_service.cold+0xa9/0x109
      drivers/net/wireless/ath/ath9k/htc_hst.c:282
      ath9k_wmi_connect+0xd2/0x1a0 drivers/net/wireless/ath/ath9k/wmi.c:265
      ath9k_init_htc_services.constprop.0+0xb4/0x650
      drivers/net/wireless/ath/ath9k/htc_drv_init.c:146
      ath9k_htc_probe_device+0x25a/0x1d80
      drivers/net/wireless/ath/ath9k/htc_drv_init.c:959
      ath9k_htc_hw_init+0x31/0x60
      drivers/net/wireless/ath/ath9k/htc_hst.c:501
      ath9k_hif_usb_firmware_cb+0x26b/0x500
      drivers/net/wireless/ath/ath9k/hif_usb.c:1187
      request_firmware_work_func+0x126/0x242
      drivers/base/firmware_loader/main.c:976
      process_one_work+0x94b/0x1620 kernel/workqueue.c:2264
      worker_thread+0x96/0xe20 kernel/workqueue.c:2410
      kthread+0x318/0x420 kernel/kthread.c:255
      ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
      
      Allocated by task 83:
      kmem_cache_alloc_node+0xdc/0x330 mm/slub.c:2814
      __alloc_skb+0xba/0x5a0 net/core/skbuff.c:198
      alloc_skb include/linux/skbuff.h:1081 [inline]
      htc_connect_service+0x2cc/0x840
      drivers/net/wireless/ath/ath9k/htc_hst.c:257
      ath9k_wmi_connect+0xd2/0x1a0 drivers/net/wireless/ath/ath9k/wmi.c:265
      ath9k_init_htc_services.constprop.0+0xb4/0x650
      drivers/net/wireless/ath/ath9k/htc_drv_init.c:146
      ath9k_htc_probe_device+0x25a/0x1d80
      drivers/net/wireless/ath/ath9k/htc_drv_init.c:959
      ath9k_htc_hw_init+0x31/0x60
      drivers/net/wireless/ath/ath9k/htc_hst.c:501
      ath9k_hif_usb_firmware_cb+0x26b/0x500
      drivers/net/wireless/ath/ath9k/hif_usb.c:1187
      request_firmware_work_func+0x126/0x242
      drivers/base/firmware_loader/main.c:976
      process_one_work+0x94b/0x1620 kernel/workqueue.c:2264
      worker_thread+0x96/0xe20 kernel/workqueue.c:2410
      kthread+0x318/0x420 kernel/kthread.c:255
      ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
      
      Freed by task 0:
      kfree_skb+0x102/0x3d0 net/core/skbuff.c:690
      ath9k_htc_txcompletion_cb+0x1f8/0x2b0
      drivers/net/wireless/ath/ath9k/htc_hst.c:356
      hif_usb_regout_cb+0x10b/0x1b0
      drivers/net/wireless/ath/ath9k/hif_usb.c:90
      __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650
      usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716
      dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
      call_timer_fn+0x195/0x6f0 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+0x5f9/0x1500 kernel/time/timer.c:1786
      __do_softirq+0x21e/0x950 kernel/softirq.c:292
      
      Reported-and-tested-by: syzbot+9505af1ae303dabdc646@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200404041838.10426-2-hqjagain@gmail.com
      ced21a4c
    • Venkateswara Naralasetty's avatar
      ath10k: fix kernel null pointer dereference · acb31476
      Venkateswara Naralasetty authored
      Currently sta airtime is updated without any lock in case of
      host based airtime calculation. Which may result in accessing the
      invalid sta pointer in case of continuous station connect/disconnect.
      
      This patch fix the kernel null pointer dereference by updating the
      station airtime with proper RCU lock in case of host based airtime
      calculation.
      
      Proceeding with the analysis of "ARM Kernel Panic".
      The APSS crash happened due to OOPS on CPU 0.
      Crash Signature : Unable to handle kernel NULL pointer dereference
      at virtual address 00000300
      During the crash,
      PC points to "ieee80211_sta_register_airtime+0x1c/0x448 [mac80211]"
      LR points to "ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]".
      The Backtrace obtained is as follows:
      [<bf880238>] (ieee80211_sta_register_airtime [mac80211]) from
      [<bf945a38>] (ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core])
      [<bf945a38>] (ath10k_txrx_tx_unref [ath10k_core]) from
      [<bf9428e4>] (ath10k_htt_txrx_compl_task+0xa50/0xfc0 [ath10k_core])
      [<bf9428e4>] (ath10k_htt_txrx_compl_task [ath10k_core]) from
      [<bf9b9bc8>] (ath10k_pci_napi_poll+0x50/0xf8 [ath10k_pci])
      [<bf9b9bc8>] (ath10k_pci_napi_poll [ath10k_pci]) from
      [<c059e3b0>] (net_rx_action+0xac/0x160)
      [<c059e3b0>] (net_rx_action) from [<c02329a4>] (__do_softirq+0x104/0x294)
      [<c02329a4>] (__do_softirq) from [<c0232b64>] (run_ksoftirqd+0x30/0x90)
      [<c0232b64>] (run_ksoftirqd) from [<c024e358>] (smpboot_thread_fn+0x25c/0x274)
      [<c024e358>] (smpboot_thread_fn) from [<c02482fc>] (kthread+0xd8/0xec)
      
      Tested HW: QCA9888
      Tested FW: 10.4-3.10-00047
      Signed-off-by: default avatarVenkateswara Naralasetty <vnaralas@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1585736290-17661-1-git-send-email-vnaralas@codeaurora.org
      acb31476
  4. 06 Apr, 2020 8 commits
  5. 26 Mar, 2020 10 commits
  6. 24 Mar, 2020 11 commits
    • Jakub Kicinski's avatar
      devlink: expand the devlink-info documentation · cd556e40
      Jakub Kicinski authored
      We are having multiple review cycles with all vendors trying
      to implement devlink-info. Let's expand the documentation with
      more information about what's implemented and motivation behind
      this interface in an attempt to make the implementations easier.
      
      Describe what each info section is supposed to contain, and make
      some references to other HW interfaces (PCI caps).
      
      Document how firmware management is expected to look, to make
      it clear how devlink-info and devlink-flash work in concert.
      
      Name some future work.
      
      v2: - improve wording
      v3: - improve wording
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd556e40
    • Vladimir Oltean's avatar
      net: phy: mscc: consolidate a common RGMII delay implementation · 2283a02b
      Vladimir Oltean authored
      It looks like the VSC8584 PHY driver is rolling its own RGMII delay
      configuration code, despite the fact that the logic is mostly the same.
      
      In fact only the register layout and position for the RGMII controls has
      changed. So we need to adapt and parameterize the PHY-dependent bit
      fields when calling the new generic function.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Tested-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2283a02b
    • David S. Miller's avatar
      Merge branch 'axienet-Update-error-handling-and-add-64-bit-DMA-support' · 148aa2a8
      David S. Miller authored
      Andre Przywara says:
      
      ====================
      net: axienet: Update error handling and add 64-bit DMA support
      
      a minor update, fixing the 32-bit build breakage, and brightening up
      Dave's christmas tree. Rebased against latest net-next/master.
      
      This series is based on net-next as of today (9970de8b), which
      includes Russell's fixes [1], solving the SGMII issues I have had.
      
      [1] https://lore.kernel.org/netdev/E1j6trA-0003GY-N1@rmk-PC.armlinux.org.uk/
      
      Changelog v2 .. v3:
      - Use two "left-shifts by 16" to fix builds with 32-bit phys_addr_t
      - reorder variable declarations
      
      Changelog v1 .. v2:
      - Add Reviewed-by: tags from Radhey
      - Extend kerndoc documentation
      - Convert DMA error handler tasklet to work queue
      - log DMA mapping errors
      - mark DMA mapping error checks as unlikely (in "hot" paths)
      - return NETDEV_TX_OK on TX DMA mapping error (increasing TX drop counter)
      - Request eth IRQ as an optional IRQ
      - Remove no longer needed MDIO IRQ register names
      - Drop DT propery check for address width, assume full 64 bit
      
      This series updates the Xilinx Axienet driver to work on our board
      here. One big issue was broken SGMII support, which Russell fixed already
      (in net-next).
      While debugging and understanding the driver, I found several problems
      in the error handling and cleanup paths, which patches 2-7 address.
      Patch 8 removes a annoying error message, patch 9 paves the way for newer
      revisions of the IP. The next patch adds mii-tool support, just for good
      measure.
      
      The next four patches add support for 64-bit DMA. This is an integration
      option on newer IP revisions (>= v7.1), and expects MSB bits in formerly
      reserved registers. Without writing to those MSB registers, the state
      machine won't trigger, so it's mandatory to access them, even if they
      are zero. Patches 11 and 12 prepare the code by adding accessors, to
      wrap this properly and keep it working on older IP revisions.
      Patch 13 enables access to the MSB registers, by trying to write a
      non-zero value to them and checking if that sticks. Older IP revisions
      always read those registers as zero.
      Patch 14 then adjusts the DMA mask, based on the autodetected MSB
      feature. It uses the full 64 bits in this case, the rest of the system
      (actual physical addresses in use) should provide a natural limit if the
      chip has connected fewer address lines. If not, the parent DT node can
      use a dma-range property.
      
      The Xilinx PG138 and PG021 documents (in versions 7.1 in both cases)
      were used for this series.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      148aa2a8
    • Andre Przywara's avatar
      net: axienet: Allow DMA to beyond 4GB · 5fff0151
      Andre Przywara authored
      With all DMA address accesses wrapped, we can actually support 64-bit
      DMA if this option was chosen at IP integration time.
      If the IP has been configured for an address width greater than 32 bits,
      we assume the full 64 bit DMA width is working. In practise this will be
      limited by the actual system address bus width, which will ideally be the
      same as the DMA IP address width.
      If this is not the case, the actual width can still be configured using a
      dma-ranges property in the parent of the MAC node.
      
      This increases the DMA mask on those systems to let the kernel choose
      buffers from memory at higher addresses.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5fff0151
    • Andre Przywara's avatar
      net: axienet: Autodetect 64-bit DMA capability · f735c40e
      Andre Przywara authored
      When newer revisions of the Axienet IP are configured for a 64-bit bus,
      we *need* to write to the MSB part of the an address registers,
      otherwise the IP won't recognise this as a DMA start condition.
      This is even true when the actual DMA address comes from the lower 4 GB.
      
      To autodetect this configuration, at probe time we write all 1's to such
      an MSB register, and see if any bits stick. If this is configured for a
      32-bit bus, those MSB registers are RES0, so reading back 0 indicates
      that no MSB writes are necessary.
      On the other hands reading anything other than 0 indicated the need to
      write the MSB registers, so we set the respective flag.
      
      The actual DMA mask stays at 32-bit for now. To help bisecting, a
      separate patch will enable allocations from higher addresses.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f735c40e
    • Andre Przywara's avatar
      net: axienet: Upgrade descriptors to hold 64-bit addresses · 4e958f33
      Andre Przywara authored
      Newer revisions of the AXI DMA IP (>= v7.1) support 64-bit addresses,
      both for the descriptors itself, as well as for the buffers they are
      pointing to.
      This is realised by adding "MSB" words for the next and phys pointer
      right behind the existing address word, now named "LSB". These MSB words
      live in formerly reserved areas of the descriptor.
      
      If the hardware supports it, write both words when setting an address.
      The buffer address is handled by two wrapper functions, the two
      occasions where we set the next pointers are open coded.
      
      For now this is guarded by a flag which we don't set yet.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e958f33
    • Andre Przywara's avatar
      net: axienet: Wrap DMA pointer writes to prepare for 64 bit · 6a00d0dd
      Andre Przywara authored
      Newer versions of the Xilink DMA IP support busses with more than 32
      address bits, by introducing an MSB word for the registers holding DMA
      pointers (tail/current, RX/TX descriptor addresses).
      On IP configured for more than 32 bits, it is also *required* to write
      both words, to let the IP recognise this as a start condition for an
      MM2S request, for instance.
      
      Wrap the DMA pointer writes with a separate function, to add this
      functionality later. For now we stick to the lower 32 bits.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6a00d0dd
    • Andre Przywara's avatar
      net: axienet: Add mii-tool support · 2a9b65ea
      Andre Przywara authored
      mii-tool is useful for debugging, and all it requires to work is to wire
      up the ioctl ops function pointer.
      Add this to the axienet driver to enable mii-tool.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a9b65ea
    • Andre Przywara's avatar
      net: axienet: Drop MDIO interrupt registers from ethtools dump · c30cb8f0
      Andre Przywara authored
      Newer revisions of the IP don't have these registers. Since we don't
      really use them, just drop them from the ethtools dump.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c30cb8f0
    • Andre Przywara's avatar
      net: axienet: Mark eth_irq as optional · d6349e3e
      Andre Przywara authored
      According to the DT binding, the Ethernet core interrupt is optional.
      
      Use platform_get_irq_optional() to avoid the error message when the
      IRQ is not specified.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6349e3e
    • Andre Przywara's avatar
      net: axienet: Check for DMA mapping errors · 71791dc8
      Andre Przywara authored
      Especially with the default 32-bit DMA mask, DMA buffers are a limited
      resource, so their allocation can fail.
      So as the DMA API documentation requires, add error checking code after
      dma_map_single() calls to catch the case where we run out of "low" memory.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71791dc8