Commit ce477ae4 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Roland Dreier

IB/mthca: FMR ioremap fix

Addresses for ioremap must be calculated off of pci_resource_start;
we can't directly use the bus address as seen by the HCA.  Fix the
code that remaps device memory for FMR access.

Based on patch by Klaus Smolin.
Signed-off-by: default avatarMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 5941d079
...@@ -761,6 +761,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr) ...@@ -761,6 +761,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr)
int __devinit mthca_init_mr_table(struct mthca_dev *dev) int __devinit mthca_init_mr_table(struct mthca_dev *dev)
{ {
unsigned long addr;
int err, i; int err, i;
err = mthca_alloc_init(&dev->mr_table.mpt_alloc, err = mthca_alloc_init(&dev->mr_table.mpt_alloc,
...@@ -796,9 +797,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev) ...@@ -796,9 +797,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
goto err_fmr_mpt; goto err_fmr_mpt;
} }
addr = pci_resource_start(dev->pdev, 4) +
((pci_resource_len(dev->pdev, 4) - 1) &
dev->mr_table.mpt_base);
dev->mr_table.tavor_fmr.mpt_base = dev->mr_table.tavor_fmr.mpt_base =
ioremap(dev->mr_table.mpt_base, ioremap(addr, (1 << i) * sizeof(struct mthca_mpt_entry));
(1 << i) * sizeof (struct mthca_mpt_entry));
if (!dev->mr_table.tavor_fmr.mpt_base) { if (!dev->mr_table.tavor_fmr.mpt_base) {
mthca_warn(dev, "MPT ioremap for FMR failed.\n"); mthca_warn(dev, "MPT ioremap for FMR failed.\n");
...@@ -806,9 +810,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev) ...@@ -806,9 +810,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
goto err_fmr_mpt; goto err_fmr_mpt;
} }
addr = pci_resource_start(dev->pdev, 4) +
((pci_resource_len(dev->pdev, 4) - 1) &
dev->mr_table.mtt_base);
dev->mr_table.tavor_fmr.mtt_base = dev->mr_table.tavor_fmr.mtt_base =
ioremap(dev->mr_table.mtt_base, ioremap(addr, (1 << i) * MTHCA_MTT_SEG_SIZE);
(1 << i) * MTHCA_MTT_SEG_SIZE);
if (!dev->mr_table.tavor_fmr.mtt_base) { if (!dev->mr_table.tavor_fmr.mtt_base) {
mthca_warn(dev, "MTT ioremap for FMR failed.\n"); mthca_warn(dev, "MTT ioremap for FMR failed.\n");
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment