1. 08 Jul, 2023 12 commits
    • Geoff Levand's avatar
      ntb_netdev: Fix module_init problem · ce946519
      Geoff Levand authored
      With both the ntb_transport_init and the ntb_netdev_init_module routines in the
      module_init init group, the ntb_netdev_init_module routine can be called before
      the ntb_transport_init routine that it depends on is called.  To assure the
      proper initialization order put ntb_netdev_init_module in the late_initcall
      group.
      
      Fixes runtime errors where the ntb_netdev_init_module call fails with ENODEV.
      Signed-off-by: default avatarGeoff Levand <geoff@infradead.org>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      ce946519
    • Cai Huoqing's avatar
      ntb: intel: Remove redundant pci_clear_master · d353fb4b
      Cai Huoqing authored
      Remove pci_clear_master to simplify the code,
      the bus-mastering is also cleared in do_pci_disable_device,
      like this:
      ./drivers/pci/pci.c:2197
      static void do_pci_disable_device(struct pci_dev *dev)
      {
      	u16 pci_command;
      
      	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
      	if (pci_command & PCI_COMMAND_MASTER) {
      		pci_command &= ~PCI_COMMAND_MASTER;
      		pci_write_config_word(dev, PCI_COMMAND, pci_command);
      	}
      
      	pcibios_disable_device(dev);
      }.
      And dev->is_busmaster is set to 0 in pci_disable_device.
      Signed-off-by: default avatarCai Huoqing <cai.huoqing@linux.dev>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      d353fb4b
    • Cai Huoqing's avatar
      ntb: epf: Remove redundant pci_clear_master · f2748c6d
      Cai Huoqing authored
      Remove pci_clear_master to simplify the code,
      the bus-mastering is also cleared in do_pci_disable_device,
      like this:
      ./drivers/pci/pci.c:2197
      static void do_pci_disable_device(struct pci_dev *dev)
      {
      	u16 pci_command;
      
      	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
      	if (pci_command & PCI_COMMAND_MASTER) {
      		pci_command &= ~PCI_COMMAND_MASTER;
      		pci_write_config_word(dev, PCI_COMMAND, pci_command);
      	}
      
      	pcibios_disable_device(dev);
      }.
      And dev->is_busmaster is set to 0 in pci_disable_device.
      Signed-off-by: default avatarCai Huoqing <cai.huoqing@linux.dev>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      f2748c6d
    • Cai Huoqing's avatar
      ntb_hw_amd: Remove redundant pci_clear_master · da6b4dc4
      Cai Huoqing authored
      Remove pci_clear_master to simplify the code,
      the bus-mastering is also cleared in do_pci_disable_device,
      like this:
      ./drivers/pci/pci.c:2197
      static void do_pci_disable_device(struct pci_dev *dev)
      {
      	u16 pci_command;
      
      	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
      	if (pci_command & PCI_COMMAND_MASTER) {
      		pci_command &= ~PCI_COMMAND_MASTER;
      		pci_write_config_word(dev, PCI_COMMAND, pci_command);
      	}
      
      	pcibios_disable_device(dev);
      }.
      And dev->is_busmaster is set to 0 in pci_disable_device.
      Signed-off-by: default avatarCai Huoqing <cai.huoqing@linux.dev>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      da6b4dc4
    • Bjorn Helgaas's avatar
      ntb: idt: drop redundant pci_enable_pcie_error_reporting() · cb2a6d17
      Bjorn Helgaas authored
      pci_enable_pcie_error_reporting() enables the device to send ERR_*
      Messages.  Since f26e58bf ("PCI/AER: Enable error reporting when AER is
      native"), the PCI core does this for all devices during enumeration, so the
      driver doesn't need to do it itself.
      
      Remove the redundant pci_enable_pcie_error_reporting() call from the
      driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
      from the driver .remove() path.
      
      Note that this only controls ERR_* Messages from the device.  An ERR_*
      Message may cause the Root Port to generate an interrupt, depending on the
      AER Root Error Command register managed by the AER service driver.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      cb2a6d17
    • Palmer Dabbelt's avatar
      MAINTAINERS: git://github -> https://github.com for jonmason · ce2188ac
      Palmer Dabbelt authored
      Github deprecated the git:// links about a year ago, so let's move to
      the https:// URLs instead.
      Reported-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://github.blog/2021-09-01-improving-git-protocol-security-github/Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      ce2188ac
    • ruanjinjie's avatar
      NTB: EPF: fix possible memory leak in pci_vntb_probe() · 956578e3
      ruanjinjie authored
      As ntb_register_device() don't handle error of device_register(),
      if ntb_register_device() returns error in pci_vntb_probe(), name of kobject
      which is allocated in dev_set_name() called in device_add() is leaked.
      
      As comment of device_add() says, it should call put_device() to drop the
      reference count that was set in device_initialize()
      when it fails, so the name can be freed in kobject_cleanup().
      Signed-off-by: default avatarruanjinjie <ruanjinjie@huawei.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      956578e3
    • Jiasheng Jiang's avatar
      NTB: ntb_tool: Add check for devm_kcalloc · 2790143f
      Jiasheng Jiang authored
      As the devm_kcalloc may return NULL pointer,
      it should be better to add check for the return
      value, as same as the others.
      
      Fixes: 7f46c8b3 ("NTB: ntb_tool: Add full multi-port NTB API support")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      2790143f
    • Yang Yingliang's avatar
      NTB: ntb_transport: fix possible memory leak while device_register() fails · 8623ccbf
      Yang Yingliang authored
      If device_register() returns error, the name allocated by
      dev_set_name() need be freed. As comment of device_register()
      says, it should use put_device() to give up the reference in
      the error path. So fix this by calling put_device(), then the
      name can be freed in kobject_cleanup(), and client_dev is freed
      in ntb_transport_client_release().
      
      Fixes: fce8a7bb ("PCI-Express Non-Transparent Bridge Support")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      8623ccbf
    • Yuan Can's avatar
      ntb: intel: Fix error handling in intel_ntb_pci_driver_init() · 4c3c796a
      Yuan Can authored
      A problem about ntb_hw_intel create debugfs failed is triggered with the
      following log given:
      
       [  273.112733] Intel(R) PCI-E Non-Transparent Bridge Driver 2.0
       [  273.115342] debugfs: Directory 'ntb_hw_intel' with parent '/' already present!
      
      The reason is that intel_ntb_pci_driver_init() returns
      pci_register_driver() directly without checking its return value, if
      pci_register_driver() failed, it returns without destroy the newly created
      debugfs, resulting the debugfs of ntb_hw_intel can never be created later.
      
       intel_ntb_pci_driver_init()
         debugfs_create_dir() # create debugfs directory
         pci_register_driver()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without destroy debugfs directory
      
      Fix by removing debugfs when pci_register_driver() returns error.
      
      Fixes: e26a5843 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      4c3c796a
    • Yuan Can's avatar
      NTB: amd: Fix error handling in amd_ntb_pci_driver_init() · 98af0a33
      Yuan Can authored
      A problem about ntb_hw_amd create debugfs failed is triggered with the
      following log given:
      
       [  618.431232] AMD(R) PCI-E Non-Transparent Bridge Driver 1.0
       [  618.433284] debugfs: Directory 'ntb_hw_amd' with parent '/' already present!
      
      The reason is that amd_ntb_pci_driver_init() returns pci_register_driver()
      directly without checking its return value, if pci_register_driver()
      failed, it returns without destroy the newly created debugfs, resulting
      the debugfs of ntb_hw_amd can never be created later.
      
       amd_ntb_pci_driver_init()
         debugfs_create_dir() # create debugfs directory
         pci_register_driver()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without destroy debugfs directory
      
      Fix by removing debugfs when pci_register_driver() returns error.
      
      Fixes: a1b36958 ("NTB: Add support for AMD PCI-Express Non-Transparent Bridge")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      98af0a33
    • Yuan Can's avatar
      ntb: idt: Fix error handling in idt_pci_driver_init() · c0129682
      Yuan Can authored
      A problem about ntb_hw_idt create debugfs failed is triggered with the
      following log given:
      
       [ 1236.637636] IDT PCI-E Non-Transparent Bridge Driver 2.0
       [ 1236.639292] debugfs: Directory 'ntb_hw_idt' with parent '/' already present!
      
      The reason is that idt_pci_driver_init() returns pci_register_driver()
      directly without checking its return value, if pci_register_driver()
      failed, it returns without destroy the newly created debugfs, resulting
      the debugfs of ntb_hw_idt can never be created later.
      
       idt_pci_driver_init()
         debugfs_create_dir() # create debugfs directory
         pci_register_driver()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without destroy debugfs directory
      
      Fix by removing debugfs when pci_register_driver() returns error.
      
      Fixes: bf2a952d ("NTB: Add IDT 89HPESxNTx PCIe-switches support")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      c0129682
  2. 25 Jun, 2023 5 commits
  3. 23 Jun, 2023 21 commits
  4. 22 Jun, 2023 2 commits