mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
Fixes for pci_clean_master, error handling in driver inits, and various
other issues/bugs. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoE9b9c3U2JxX98mqbmZLrHqL0iMFAmSpuR8ACgkQbmZLrHqL 0iOnrg/9FT/mEyLZXfI/sAZWyCKvydvbFL78Id9JVKxqQ00tlLlMtRFlLG7gtagn GrOf0HSM6RJxeWo8gqGjb1tM0L1qO/Bt9MlqZf7jIJTyL8DBUMz5sFdzqQ5TZo6j krKRjzjiNIyPlSUWGBBt2MIVUbJwfFu6f1dnpAVTWjyc2CNEYa5r3FvAqOTVYTMS IiNJyCaGwdPOXQVxOWwJnT4aPcWZzOMf4GYWX2hi8HczcEh1bHcBtHL6UGk5CiG9 igj1e4Q3865lDp9eFIrQEtW2BSf1igzILpT3WmSxMXvufzILLAl6pOq/s/ziTEM2 Hrg/JnU1W1Iozpyzd5A1lVIy5+NFN3AEHM3iBI0aZ5Qj1yBhNv4CJ/WLqPABBs+D cmuea+gOJjKKVGqdLNZ9+rDGtIV+SRQA+0GGoBhBXvVqH5C7qUxx5ZJMD26mC9lS L0dQTbgVyJc3Zv8/FHNGuKvp+xq+vgeZmt8zDViNPlmB9bjz3XikCE7D0lr74coD Vvmn4dUo65EqvWfKqLR8fXDZ9pdaTqF19xddNPiZS4p3/CDtKWqXIuBdTKiqq1s4 Lx78R8wU/uifWSf/9+cPyJ7UCCyPpUdj/SahzZLE4ACfmdfYWIHNf0REt+kGn7Vv uCoe7rXBccrz03Fv5mHHuNGS24dfdMim2LXYb3GN2A5atIT0Nko= =xPW1 -----END PGP SIGNATURE----- Merge tag 'ntb-6.5' of https://github.com/jonmason/ntb Pull NTB updates from Jon Mason: "Fixes for pci_clean_master, error handling in driver inits, and various other issues/bugs" * tag 'ntb-6.5' of https://github.com/jonmason/ntb: ntb: hw: amd: Fix debugfs_create_dir error checking ntb.rst: Fix copy and paste error ntb_netdev: Fix module_init problem ntb: intel: Remove redundant pci_clear_master ntb: epf: Remove redundant pci_clear_master ntb_hw_amd: Remove redundant pci_clear_master ntb: idt: drop redundant pci_enable_pcie_error_reporting() MAINTAINERS: git://github -> https://github.com for jonmason NTB: EPF: fix possible memory leak in pci_vntb_probe() NTB: ntb_tool: Add check for devm_kcalloc NTB: ntb_transport: fix possible memory leak while device_register() fails ntb: intel: Fix error handling in intel_ntb_pci_driver_init() NTB: amd: Fix error handling in amd_ntb_pci_driver_init() ntb: idt: Fix error handling in idt_pci_driver_init()
This commit is contained in:
commit
cff0687396
@ -207,9 +207,9 @@ The MSI test client serves to test and debug the MSI library which
|
||||
allows for passing MSI interrupts across NTB memory windows. The
|
||||
test client is interacted with through the debugfs filesystem:
|
||||
|
||||
* *debugfs*/ntb\_tool/*hw*/
|
||||
* *debugfs*/ntb\_msi\_test/*hw*/
|
||||
A directory in debugfs will be created for each
|
||||
NTB device probed by the tool. This directory is shortened to *hw*
|
||||
NTB device probed by the msi test. This directory is shortened to *hw*
|
||||
below.
|
||||
* *hw*/port
|
||||
This file describes the local port number
|
||||
|
@ -15010,7 +15010,7 @@ M: Allen Hubbe <allenbh@gmail.com>
|
||||
L: ntb@lists.linux.dev
|
||||
S: Supported
|
||||
W: https://github.com/jonmason/ntb/wiki
|
||||
T: git git://github.com/jonmason/ntb.git
|
||||
T: git https://github.com/jonmason/ntb.git
|
||||
F: drivers/net/ntb_netdev.c
|
||||
F: drivers/ntb/
|
||||
F: drivers/pci/endpoint/functions/pci-epf-*ntb.c
|
||||
|
@ -493,7 +493,7 @@ static int __init ntb_netdev_init_module(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(ntb_netdev_init_module);
|
||||
late_initcall(ntb_netdev_init_module);
|
||||
|
||||
static void __exit ntb_netdev_exit_module(void)
|
||||
{
|
||||
|
@ -941,7 +941,7 @@ static void ndev_init_debugfs(struct amd_ntb_dev *ndev)
|
||||
ndev->debugfs_dir =
|
||||
debugfs_create_dir(pci_name(ndev->ntb.pdev),
|
||||
debugfs_dir);
|
||||
if (!ndev->debugfs_dir)
|
||||
if (IS_ERR(ndev->debugfs_dir))
|
||||
ndev->debugfs_info = NULL;
|
||||
else
|
||||
ndev->debugfs_info =
|
||||
@ -1194,7 +1194,6 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev,
|
||||
return 0;
|
||||
|
||||
err_dma_mask:
|
||||
pci_clear_master(pdev);
|
||||
pci_release_regions(pdev);
|
||||
err_pci_regions:
|
||||
pci_disable_device(pdev);
|
||||
@ -1209,7 +1208,6 @@ static void amd_ntb_deinit_pci(struct amd_ntb_dev *ndev)
|
||||
|
||||
pci_iounmap(pdev, ndev->self_mmio);
|
||||
|
||||
pci_clear_master(pdev);
|
||||
pci_release_regions(pdev);
|
||||
pci_disable_device(pdev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
@ -1338,12 +1336,17 @@ static struct pci_driver amd_ntb_pci_driver = {
|
||||
|
||||
static int __init amd_ntb_pci_driver_init(void)
|
||||
{
|
||||
int ret;
|
||||
pr_info("%s %s\n", NTB_DESC, NTB_VER);
|
||||
|
||||
if (debugfs_initialized())
|
||||
debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
|
||||
return pci_register_driver(&amd_ntb_pci_driver);
|
||||
ret = pci_register_driver(&amd_ntb_pci_driver);
|
||||
if (ret)
|
||||
debugfs_remove_recursive(debugfs_dir);
|
||||
|
||||
return ret;
|
||||
}
|
||||
module_init(amd_ntb_pci_driver_init);
|
||||
|
||||
|
@ -591,7 +591,7 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev,
|
||||
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
|
||||
if (ret) {
|
||||
dev_err(dev, "Cannot set DMA mask\n");
|
||||
goto err_dma_mask;
|
||||
goto err_pci_regions;
|
||||
}
|
||||
dev_warn(&pdev->dev, "Cannot DMA highmem\n");
|
||||
}
|
||||
@ -599,14 +599,14 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev,
|
||||
ndev->ctrl_reg = pci_iomap(pdev, ndev->ctrl_reg_bar, 0);
|
||||
if (!ndev->ctrl_reg) {
|
||||
ret = -EIO;
|
||||
goto err_dma_mask;
|
||||
goto err_pci_regions;
|
||||
}
|
||||
|
||||
if (ndev->peer_spad_reg_bar) {
|
||||
ndev->peer_spad_reg = pci_iomap(pdev, ndev->peer_spad_reg_bar, 0);
|
||||
if (!ndev->peer_spad_reg) {
|
||||
ret = -EIO;
|
||||
goto err_dma_mask;
|
||||
goto err_pci_regions;
|
||||
}
|
||||
} else {
|
||||
spad_sz = 4 * readl(ndev->ctrl_reg + NTB_EPF_SPAD_COUNT);
|
||||
@ -617,14 +617,11 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev,
|
||||
ndev->db_reg = pci_iomap(pdev, ndev->db_reg_bar, 0);
|
||||
if (!ndev->db_reg) {
|
||||
ret = -EIO;
|
||||
goto err_dma_mask;
|
||||
goto err_pci_regions;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_dma_mask:
|
||||
pci_clear_master(pdev);
|
||||
|
||||
err_pci_regions:
|
||||
pci_disable_device(pdev);
|
||||
|
||||
@ -642,7 +639,6 @@ static void ntb_epf_deinit_pci(struct ntb_epf_dev *ndev)
|
||||
pci_iounmap(pdev, ndev->peer_spad_reg);
|
||||
pci_iounmap(pdev, ndev->db_reg);
|
||||
|
||||
pci_clear_master(pdev);
|
||||
pci_release_regions(pdev);
|
||||
pci_disable_device(pdev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
|
@ -2651,20 +2651,18 @@ static int idt_init_pci(struct idt_ntb_dev *ndev)
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the device advanced error reporting. It's not critical to
|
||||
* The PCI core enables device error reporting. It's not critical to
|
||||
* have AER disabled in the kernel.
|
||||
*
|
||||
* Cleanup nonfatal error status before getting to init.
|
||||
*/
|
||||
ret = pci_enable_pcie_error_reporting(pdev);
|
||||
if (ret != 0)
|
||||
dev_warn(&pdev->dev, "PCIe AER capability disabled\n");
|
||||
else /* Cleanup nonfatal error status before getting to init */
|
||||
pci_aer_clear_nonfatal_status(pdev);
|
||||
pci_aer_clear_nonfatal_status(pdev);
|
||||
|
||||
/* First enable the PCI device */
|
||||
ret = pcim_enable_device(pdev);
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Failed to enable PCIe device\n");
|
||||
goto err_disable_aer;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2692,8 +2690,6 @@ static int idt_init_pci(struct idt_ntb_dev *ndev)
|
||||
|
||||
err_clear_master:
|
||||
pci_clear_master(pdev);
|
||||
err_disable_aer:
|
||||
(void)pci_disable_pcie_error_reporting(pdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -2714,9 +2710,6 @@ static void idt_deinit_pci(struct idt_ntb_dev *ndev)
|
||||
/* Clear the bus master disabling the Request TLPs translation */
|
||||
pci_clear_master(pdev);
|
||||
|
||||
/* Disable the AER capability */
|
||||
(void)pci_disable_pcie_error_reporting(pdev);
|
||||
|
||||
dev_dbg(&pdev->dev, "NT-function PCIe interface cleared");
|
||||
}
|
||||
|
||||
@ -2891,6 +2884,7 @@ static struct pci_driver idt_pci_driver = {
|
||||
|
||||
static int __init idt_pci_driver_init(void)
|
||||
{
|
||||
int ret;
|
||||
pr_info("%s %s\n", NTB_DESC, NTB_VER);
|
||||
|
||||
/* Create the top DebugFS directory if the FS is initialized */
|
||||
@ -2898,7 +2892,11 @@ static int __init idt_pci_driver_init(void)
|
||||
dbgfs_topdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
|
||||
/* Register the NTB hardware driver to handle the PCI device */
|
||||
return pci_register_driver(&idt_pci_driver);
|
||||
ret = pci_register_driver(&idt_pci_driver);
|
||||
if (ret)
|
||||
debugfs_remove_recursive(dbgfs_topdir);
|
||||
|
||||
return ret;
|
||||
}
|
||||
module_init(idt_pci_driver_init);
|
||||
|
||||
|
@ -1791,7 +1791,6 @@ static int intel_ntb_init_pci(struct intel_ntb_dev *ndev, struct pci_dev *pdev)
|
||||
|
||||
err_mmio:
|
||||
err_dma_mask:
|
||||
pci_clear_master(pdev);
|
||||
pci_release_regions(pdev);
|
||||
err_pci_regions:
|
||||
pci_disable_device(pdev);
|
||||
@ -1808,7 +1807,6 @@ static void intel_ntb_deinit_pci(struct intel_ntb_dev *ndev)
|
||||
pci_iounmap(pdev, ndev->peer_mmio);
|
||||
pci_iounmap(pdev, ndev->self_mmio);
|
||||
|
||||
pci_clear_master(pdev);
|
||||
pci_release_regions(pdev);
|
||||
pci_disable_device(pdev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
@ -2064,12 +2062,17 @@ static struct pci_driver intel_ntb_pci_driver = {
|
||||
|
||||
static int __init intel_ntb_pci_driver_init(void)
|
||||
{
|
||||
int ret;
|
||||
pr_info("%s %s\n", NTB_DESC, NTB_VER);
|
||||
|
||||
if (debugfs_initialized())
|
||||
debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
|
||||
return pci_register_driver(&intel_ntb_pci_driver);
|
||||
ret = pci_register_driver(&intel_ntb_pci_driver);
|
||||
if (ret)
|
||||
debugfs_remove_recursive(debugfs_dir);
|
||||
|
||||
return ret;
|
||||
}
|
||||
module_init(intel_ntb_pci_driver_init);
|
||||
|
||||
|
@ -410,7 +410,7 @@ int ntb_transport_register_client_dev(char *device_name)
|
||||
|
||||
rc = device_register(dev);
|
||||
if (rc) {
|
||||
kfree(client_dev);
|
||||
put_device(dev);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -998,6 +998,8 @@ static int tool_init_mws(struct tool_ctx *tc)
|
||||
tc->peers[pidx].outmws =
|
||||
devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmw_cnt,
|
||||
sizeof(*tc->peers[pidx].outmws), GFP_KERNEL);
|
||||
if (tc->peers[pidx].outmws == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
for (widx = 0; widx < tc->peers[pidx].outmw_cnt; widx++) {
|
||||
tc->peers[pidx].outmws[widx].pidx = pidx;
|
||||
|
@ -1285,6 +1285,7 @@ static int pci_vntb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
return 0;
|
||||
|
||||
err_register_dev:
|
||||
put_device(&ndev->ntb.dev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user