1. 21 Aug, 2021 8 commits
    • Marco Chiappero's avatar
      crypto: qat - remove empty sriov_configure() · 462584ca
      Marco Chiappero authored
      Remove the empty implementation of sriov_configure() and set the
      sriov_configure member of the pci_driver structure to NULL.
      This way, if a user tries to enable VFs on a device, when kernel and
      driver are built with CONFIG_PCI_IOV=n, the kernel reports an error
      message saying that the driver does not support SRIOV configuration via
      sysfs.
      Signed-off-by: default avatarMarco Chiappero <marco.chiappero@intel.com>
      Co-developed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Reviewed-by: default avatarFiona Trahe <fiona.trahe@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      462584ca
    • Giovanni Cabiddu's avatar
      crypto: qat - use proper type for vf_mask · 462354d9
      Giovanni Cabiddu authored
      Replace vf_mask type with unsigned long to avoid a stack-out-of-bound.
      
      This is to fix the following warning reported by KASAN the first time
      adf_msix_isr_ae() gets called.
      
          [  692.091987] BUG: KASAN: stack-out-of-bounds in find_first_bit+0x28/0x50
          [  692.092017] Read of size 8 at addr ffff88afdf789e60 by task swapper/32/0
          [  692.092076] Call Trace:
          [  692.092089]  <IRQ>
          [  692.092101]  dump_stack+0x9c/0xcf
          [  692.092132]  print_address_description.constprop.0+0x18/0x130
          [  692.092164]  ? find_first_bit+0x28/0x50
          [  692.092185]  kasan_report.cold+0x7f/0x111
          [  692.092213]  ? static_obj+0x10/0x80
          [  692.092234]  ? find_first_bit+0x28/0x50
          [  692.092262]  find_first_bit+0x28/0x50
          [  692.092288]  adf_msix_isr_ae+0x16e/0x230 [intel_qat]
      
      Fixes: ed8ccaef ("crypto: qat - Add support for SRIOV")
      Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Reviewed-by: default avatarMarco Chiappero <marco.chiappero@intel.com>
      Reviewed-by: default avatarFiona Trahe <fiona.trahe@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      462354d9
    • Christophe JAILLET's avatar
      crypto: qat - fix a typo in a comment · c02b51b3
      Christophe JAILLET authored
      s/Enable/Disable/ when describing 'adf_disable_aer()'
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c02b51b3
    • Christophe JAILLET's avatar
      crypto: qat - disable AER if an error occurs in probe functions · 3660f251
      Christophe JAILLET authored
      If an error occurs after a 'adf_enable_aer()' call, it must be undone by a
      corresponding 'adf_disable_aer()' call, as already done in the remove
      function.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3660f251
    • Giovanni Cabiddu's avatar
      crypto: qat - set DMA mask to 48 bits for Gen2 · ae1f5043
      Giovanni Cabiddu authored
      Change the DMA mask from 64 to 48 for Gen2 devices as they cannot handle
      addresses greater than 48 bits.
      Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ae1f5043
    • Christophe JAILLET's avatar
      crypto: qat - simplify code and axe the use of a deprecated API · 6e422cce
      Christophe JAILLET authored
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      Replace 'pci_set_dma_mask/pci_set_consistent_dma_mask' by an equivalent
      and less verbose 'dma_set_mask_and_coherent()' call.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Co-developed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6e422cce
    • Ben Hutchings's avatar
      crypto: omap - Fix inconsistent locking of device lists · fe4d5577
      Ben Hutchings authored
      lockdep complains that in omap-aes, the list_lock is taken both with
      softirqs enabled at probe time, and also in softirq context, which
      could lead to a deadlock:
      
          ================================
          WARNING: inconsistent lock state
          5.14.0-rc1-00035-gc836005b01c5-dirty #69 Not tainted
          --------------------------------
          inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
          ksoftirqd/0/7 [HC0[0]:SC1[3]:HE1:SE0] takes:
          bf00e014 (list_lock){+.?.}-{2:2}, at: omap_aes_find_dev+0x18/0x54 [omap_aes_driver]
          {SOFTIRQ-ON-W} state was registered at:
            _raw_spin_lock+0x40/0x50
            omap_aes_probe+0x1d4/0x664 [omap_aes_driver]
            platform_probe+0x58/0xb8
            really_probe+0xbc/0x314
            __driver_probe_device+0x80/0xe4
            driver_probe_device+0x30/0xc8
            __driver_attach+0x70/0xf4
            bus_for_each_dev+0x70/0xb4
            bus_add_driver+0xf0/0x1d4
            driver_register+0x74/0x108
            do_one_initcall+0x84/0x2e4
            do_init_module+0x5c/0x240
            load_module+0x221c/0x2584
            sys_finit_module+0xb0/0xec
            ret_fast_syscall+0x0/0x2c
            0xbed90b30
          irq event stamp: 111800
          hardirqs last  enabled at (111800): [<c02a21e4>] __kmalloc+0x484/0x5ec
          hardirqs last disabled at (111799): [<c02a21f0>] __kmalloc+0x490/0x5ec
          softirqs last  enabled at (111776): [<c01015f0>] __do_softirq+0x2b8/0x4d0
          softirqs last disabled at (111781): [<c0135948>] run_ksoftirqd+0x34/0x50
      
          other info that might help us debug this:
           Possible unsafe locking scenario:
      
                 CPU0
                 ----
            lock(list_lock);
            <Interrupt>
              lock(list_lock);
      
           *** DEADLOCK ***
      
          2 locks held by ksoftirqd/0/7:
           #0: c0f5e8c8 (rcu_read_lock){....}-{1:2}, at: netif_receive_skb+0x6c/0x260
           #1: c0f5e8c8 (rcu_read_lock){....}-{1:2}, at: ip_local_deliver_finish+0x2c/0xdc
      
          stack backtrace:
          CPU: 0 PID: 7 Comm: ksoftirqd/0 Not tainted 5.14.0-rc1-00035-gc836005b01c5-dirty #69
          Hardware name: Generic AM43 (Flattened Device Tree)
          [<c010e6e0>] (unwind_backtrace) from [<c010b9d0>] (show_stack+0x10/0x14)
          [<c010b9d0>] (show_stack) from [<c017c640>] (mark_lock.part.17+0x5bc/0xd04)
          [<c017c640>] (mark_lock.part.17) from [<c017d9e4>] (__lock_acquire+0x960/0x2fa4)
          [<c017d9e4>] (__lock_acquire) from [<c0180980>] (lock_acquire+0x10c/0x358)
          [<c0180980>] (lock_acquire) from [<c093d324>] (_raw_spin_lock_bh+0x44/0x58)
          [<c093d324>] (_raw_spin_lock_bh) from [<bf00b258>] (omap_aes_find_dev+0x18/0x54 [omap_aes_driver])
          [<bf00b258>] (omap_aes_find_dev [omap_aes_driver]) from [<bf00b328>] (omap_aes_crypt+0x94/0xd4 [omap_aes_driver])
          [<bf00b328>] (omap_aes_crypt [omap_aes_driver]) from [<c08ac6d0>] (esp_input+0x1b0/0x2c8)
          [<c08ac6d0>] (esp_input) from [<c08c9e90>] (xfrm_input+0x410/0x1290)
          [<c08c9e90>] (xfrm_input) from [<c08b6374>] (xfrm4_esp_rcv+0x54/0x11c)
          [<c08b6374>] (xfrm4_esp_rcv) from [<c0838840>] (ip_protocol_deliver_rcu+0x48/0x3bc)
          [<c0838840>] (ip_protocol_deliver_rcu) from [<c0838c50>] (ip_local_deliver_finish+0x9c/0xdc)
          [<c0838c50>] (ip_local_deliver_finish) from [<c0838dd8>] (ip_local_deliver+0x148/0x1b0)
          [<c0838dd8>] (ip_local_deliver) from [<c0838f5c>] (ip_rcv+0x11c/0x180)
          [<c0838f5c>] (ip_rcv) from [<c077e3a4>] (__netif_receive_skb_one_core+0x54/0x74)
          [<c077e3a4>] (__netif_receive_skb_one_core) from [<c077e588>] (netif_receive_skb+0xa8/0x260)
          [<c077e588>] (netif_receive_skb) from [<c068d6d4>] (cpsw_rx_handler+0x224/0x2fc)
          [<c068d6d4>] (cpsw_rx_handler) from [<c0688ccc>] (__cpdma_chan_process+0xf4/0x188)
          [<c0688ccc>] (__cpdma_chan_process) from [<c068a0c0>] (cpdma_chan_process+0x3c/0x5c)
          [<c068a0c0>] (cpdma_chan_process) from [<c0690e14>] (cpsw_rx_mq_poll+0x44/0x98)
          [<c0690e14>] (cpsw_rx_mq_poll) from [<c0780810>] (__napi_poll+0x28/0x268)
          [<c0780810>] (__napi_poll) from [<c0780c64>] (net_rx_action+0xcc/0x204)
          [<c0780c64>] (net_rx_action) from [<c0101478>] (__do_softirq+0x140/0x4d0)
          [<c0101478>] (__do_softirq) from [<c0135948>] (run_ksoftirqd+0x34/0x50)
          [<c0135948>] (run_ksoftirqd) from [<c01583b8>] (smpboot_thread_fn+0xf4/0x1d8)
          [<c01583b8>] (smpboot_thread_fn) from [<c01546dc>] (kthread+0x14c/0x174)
          [<c01546dc>] (kthread) from [<c010013c>] (ret_from_fork+0x14/0x38)
          ...
      
      The omap-des and omap-sham drivers appear to have a similar issue.
      
      Fix this by using spin_{,un}lock_bh() around device list access in all
      the probe and remove functions.
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@mind.be>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      fe4d5577
    • Ben Hutchings's avatar
      crypto: omap - Avoid redundant copy when using truncated sg list · ffe3ee8b
      Ben Hutchings authored
      omap_crypto_cleanup() currently copies data from sg to orig if either
      copy flag is set.  However OMAP_CRYPTO_SG_COPIED means that sg refers
      to the same pages as orig, truncated to len bytes.  There is no need
      to copy in this case.
      
      Only copy data if the OMAP_CRYPTO_DATA_COPIED flag is set.
      
      Fixes: 74ed87e7 ("crypto: omap - add base support library for common ...")
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@mind.be>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ffe3ee8b
  2. 12 Aug, 2021 8 commits
  3. 06 Aug, 2021 9 commits
  4. 30 Jul, 2021 15 commits