Skip to content
Snippets Groups Projects
  1. Sep 05, 2021
    • Christophe JAILLET's avatar
      NTB: switch from 'pci_' to 'dma_' API · 38de3aff
      Christophe JAILLET authored
      
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      The patch has been generated with the coccinelle script below.
      
      It has been compile tested.
      
      @@
      @@
      -    PCI_DMA_BIDIRECTIONAL
      +    DMA_BIDIRECTIONAL
      
      @@
      @@
      -    PCI_DMA_TODEVICE
      +    DMA_TO_DEVICE
      
      @@
      @@
      -    PCI_DMA_FROMDEVICE
      +    DMA_FROM_DEVICE
      
      @@
      @@
      -    PCI_DMA_NONE
      +    DMA_NONE
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_alloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_zalloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_free_consistent(e1, e2, e3, e4)
      +    dma_free_coherent(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_single(e1, e2, e3, e4)
      +    dma_map_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_single(e1, e2, e3, e4)
      +    dma_unmap_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4, e5;
      @@
      -    pci_map_page(e1, e2, e3, e4, e5)
      +    dma_map_page(&e1->dev, e2, e3, e4, e5)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_page(e1, e2, e3, e4)
      +    dma_unmap_page(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_sg(e1, e2, e3, e4)
      +    dma_map_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_sg(e1, e2, e3, e4)
      +    dma_unmap_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
      +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
      +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
      +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
      +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2;
      @@
      -    pci_dma_mapping_error(e1, e2)
      +    dma_mapping_error(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_dma_mask(e1, e2)
      +    dma_set_mask(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_consistent_dma_mask(e1, e2)
      +    dma_set_coherent_mask(&e1->dev, e2)
      
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      38de3aff
    • Colin Ian King's avatar
      ntb: ntb_pingpong: remove redundant initialization of variables msg_data and spad_data · e6315480
      Colin Ian King authored
      
      The variables msg_data and spad_data are being initialized with values
      that are never read, they are being updated later on. The initializations
      are redundant and can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      e6315480
  2. Sep 04, 2021
  3. Jul 21, 2021
    • Uwe Kleine-König's avatar
      bus: Make remove callback return void · fc7a6209
      Uwe Kleine-König authored
      
      The driver core ignores the return value of this callback because there
      is only little it can do when a device disappears.
      
      This is the final bit of a long lasting cleanup quest where several
      buses were converted to also return void from their remove callback.
      Additionally some resource leaks were fixed that were caused by drivers
      returning an error code in the expectation that the driver won't go
      away.
      
      With struct bus_type::remove returning void it's prevented that newly
      implemented buses return an ignored error code and so don't anticipate
      wrong expectations for driver authors.
      
      Reviewed-by: Tom Rix <trix@redhat.com> (For fpga)
      Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Reviewed-by: Cornelia Huck <cohuck@redhat.com> (For drivers/s390 and drivers/vfio)
      Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> (For ARM, Amba and related parts)
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Acked-by: Chen-Yu Tsai <wens@csie.org> (for sunxi-rsb)
      Acked-by: default avatarPali Rohár <pali@kernel.org>
      Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> (for media)
      Acked-by: Hans de Goede <hdegoede@redhat.com> (For drivers/platform)
      Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Acked-By: default avatarVinod Koul <vkoul@kernel.org>
      Acked-by: Juergen Gross <jgross@suse.com> (For xen)
      Acked-by: Lee Jones <lee.jones@linaro.org> (For mfd)
      Acked-by: Johannes Thumshirn <jth@kernel.org> (For mcb)
      Acked-by: default avatarJohan Hovold <johan@kernel.org>
      Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> (For slimbus)
      Acked-by: Kirti Wankhede <kwankhede@nvidia.com> (For vfio)
      Acked-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> (For ulpi and typec)
      Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> (For ipack)
      Acked-by: Geoff Levand <geoff@infradead.org> (For ps3)
      Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com> (For thunderbolt)
      Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> (For intel_th)
      Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> (For pcmcia)
      Acked-by: Rafael J. Wysocki <rafael@kernel.org> (For ACPI)
      Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> (rpmsg and apr)
      Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> (For intel-ish-hid)
      Acked-by: Dan Williams <dan.j.williams@intel.com> (For CXL, DAX, and NVDIMM)
      Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> (For isa)
      Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (For firewire)
      Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> (For hid)
      Acked-by: Thorsten Scherer <t.scherer@eckelmann.de> (For siox)
      Acked-by: Sven Van Asbroeck <TheSven73@gmail.com> (For anybuss)
      Acked-by: Ulf Hansson <ulf.hansson@linaro.org> (For MMC)
      Acked-by: Wolfram Sang <wsa@kernel.org> # for I2C
      Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Acked-by: default avatarFinn Thain <fthain@linux-m68k.org>
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc7a6209
  4. Feb 23, 2021
  5. Dec 15, 2020
  6. Dec 06, 2020
  7. Aug 24, 2020
  8. Aug 23, 2020
  9. Aug 15, 2020
  10. Jun 06, 2020
  11. Apr 20, 2020
  12. Apr 13, 2020
  13. Mar 28, 2020
  14. Mar 13, 2020
    • Arindam Nath's avatar
      NTB: add pci shutdown handler for AMD NTB · b350f0a3
      Arindam Nath authored
      
      The PCI shutdown handler is invoked in response
      to system reboot or shutdown. A data transfer
      might still be in flight when this happens. So
      the very first action we take here is to send
      a link down notification, so that any pending
      data transfer is terminated. Rest of the actions
      are same as that of PCI remove handler.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      b350f0a3
    • Arindam Nath's avatar
      NTB: send DB event when driver is loaded or un-loaded · ac10d4f6
      Arindam Nath authored
      
      When the driver on the local side is loaded, it sets
      SIDE_READY bit in SIDE_INFO register. Likewise, when
      it is un-loaded, it clears the bit.
      
      Also just after being loaded, the driver polls for
      peer SIDE_READY bit to be set. Since that bit is set
      when the peer side driver has loaded, the polling on
      local side breaks as soon as this condition is met.
      
      But the situation is different when the driver is
      un-loaded. Since the polling has already been stopped
      as mentioned before, if the peer side driver gets
      un-loaded, the driver on the local side is not notified
      implicitly.
      
      So, we improvise using existing doorbell mechanism.
      We reserve the highest order bit of the DB register to
      send a notification to peer when the driver on local
      side is un-loaded. This also means that now we are one
      short of 16 DB events and that is taken care of in the
      valid DB mask.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      ac10d4f6
    • Arindam Nath's avatar
      NTB: remove redundant setting of DB valid mask · 41dfc3f7
      Arindam Nath authored
      
      db_valid_mask is set at two places, once within
      amd_init_ntb(), and again within amd_init_dev().
      Since amd_init_ntb() is actually called from
      amd_init_dev(), setting db_valid_mask from
      former does not really make sense. So remove it.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      41dfc3f7
    • Arindam Nath's avatar
      NTB: return link up status correctly for PRI and SEC · 5f0856be
      Arindam Nath authored
      
      Since NTB connects two physically separate systems,
      there can be scenarios where one system goes down
      while the other one remains active. In case of NTB
      primary, if the NTB secondary goes down, a Link-Down
      event is received. For the NTB secondary, if the
      NTB primary goes down, the PCIe hotplug mechanism
      ensures that the driver on the secondary side is also
      unloaded.
      
      But there are other scenarios to consider as well,
      when suppose the physical link remains active, but
      the driver on primary or secondary side is loaded
      or un-loaded.
      
      When the driver is loaded, on either side, it sets
      SIDE_READY bit(bit-1) of SIDE_INFO register. Similarly,
      when the driver is un-loaded, it resets the same bit.
      
      We consider the NTB link to be up and operational
      only when the driver on both sides of link are loaded
      and ready. But we also need to take account of
      Link Up and Down events which signify the physical
      link status. So amd_link_is_up() is modified to take
      care of the above scenarios.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      5f0856be
    • Arindam Nath's avatar
      NTB: add helper functions to set and clear sideinfo · ae5f4bdc
      Arindam Nath authored
      
      We define two new helper functions to set and clear
      sideinfo registers respectively. These functions
      take an additional boolean parameter which signifies
      whether we want to set/clear the sideinfo register
      of the peer(true) or local host(false).
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      ae5f4bdc
    • Arindam Nath's avatar
      NTB: move ntb_ctrl handling to init and deinit · 92abf4cb
      Arindam Nath authored
      
      It does not really make sense to enable or disable
      the bits of NTB_CTRL register only during enable
      and disable link callbacks. They should be done
      independent of these callbacks. The correct placement
      for that is during the amd_init_side_info() and
      amd_deinit_side_info() functions, which are invoked
      during probe and remove respectively.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      92abf4cb
    • Arindam Nath's avatar
      NTB: handle link up, D0 and D3 events correctly · 673dd0c2
      Arindam Nath authored
      
      Just like for Link-Down event, Link-Up and D3 events
      are also mutually exclusive to Link-Down and D0 events
      respectively. So we clear the bitmasks in peer_sta
      depending on event type.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      673dd0c2
    • Arindam Nath's avatar
      NTB: handle link down event correctly · 60ceafd1
      Arindam Nath authored
      
      Link-Up and Link-Down are mutually exclusive events.
      So when we receive a Link-Down event, we should also
      clear the bitmask for Link-Up event in peer_sta.
      
      Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      60ceafd1
Loading