mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
dmaengine: idxd: removal of pcim managed mmio mapping
The devm managed lifetime is incompatible with 'struct device' objects that
resides in idxd context. This is one of the series that clean up the idxd
driver 'struct device' lifetime. Remove pcim_* management of the PCI device
and the ioremap of MMIO BAR and replace with unmanaged versions. This is
for consistency of removing all the pcim/devm based calls.
Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Fixes: bfe1d56091
("dmaengine: idxd: Init and probe for Intel data accelerators")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/161852984150.2203940.8043988289748519056.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
5fc8e85ff1
commit
a39c7cd043
1 changed files with 23 additions and 10 deletions
|
@ -384,32 +384,36 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
struct idxd_device *idxd;
|
||||
int rc;
|
||||
|
||||
rc = pcim_enable_device(pdev);
|
||||
rc = pci_enable_device(pdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
dev_dbg(dev, "Alloc IDXD context\n");
|
||||
idxd = idxd_alloc(pdev);
|
||||
if (!idxd)
|
||||
return -ENOMEM;
|
||||
if (!idxd) {
|
||||
rc = -ENOMEM;
|
||||
goto err_idxd_alloc;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "Mapping BARs\n");
|
||||
idxd->reg_base = pcim_iomap(pdev, IDXD_MMIO_BAR, 0);
|
||||
if (!idxd->reg_base)
|
||||
return -ENOMEM;
|
||||
idxd->reg_base = pci_iomap(pdev, IDXD_MMIO_BAR, 0);
|
||||
if (!idxd->reg_base) {
|
||||
rc = -ENOMEM;
|
||||
goto err_iomap;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "Set DMA masks\n");
|
||||
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
|
||||
if (rc)
|
||||
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||
if (rc)
|
||||
return rc;
|
||||
goto err;
|
||||
|
||||
rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
|
||||
if (rc)
|
||||
rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||
if (rc)
|
||||
return rc;
|
||||
goto err;
|
||||
|
||||
idxd_set_type(idxd);
|
||||
|
||||
|
@ -423,13 +427,13 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
rc = idxd_probe(idxd);
|
||||
if (rc) {
|
||||
dev_err(dev, "Intel(R) IDXD DMA Engine init failed\n");
|
||||
return -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
rc = idxd_setup_sysfs(idxd);
|
||||
if (rc) {
|
||||
dev_err(dev, "IDXD sysfs setup failed\n");
|
||||
return -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
idxd->state = IDXD_DEV_CONF_READY;
|
||||
|
@ -438,6 +442,13 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
idxd->hw.version);
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
pci_iounmap(pdev, idxd->reg_base);
|
||||
err_iomap:
|
||||
err_idxd_alloc:
|
||||
pci_disable_device(pdev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void idxd_flush_pending_llist(struct idxd_irq_entry *ie)
|
||||
|
@ -493,6 +504,8 @@ static void idxd_shutdown(struct pci_dev *pdev)
|
|||
|
||||
idxd_msix_perm_clear(idxd);
|
||||
pci_free_irq_vectors(pdev);
|
||||
pci_iounmap(pdev, idxd->reg_base);
|
||||
pci_disable_device(pdev);
|
||||
destroy_workqueue(idxd->wq);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue