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: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Michael S. Tsirkin and committed by
Roland Dreier
ce477ae4 5941d079

+11 -4
+11 -4
drivers/infiniband/hw/mthca/mthca_mr.c
··· 761 761 762 762 int __devinit mthca_init_mr_table(struct mthca_dev *dev) 763 763 { 764 + unsigned long addr; 764 765 int err, i; 765 766 766 767 err = mthca_alloc_init(&dev->mr_table.mpt_alloc, ··· 797 796 goto err_fmr_mpt; 798 797 } 799 798 799 + addr = pci_resource_start(dev->pdev, 4) + 800 + ((pci_resource_len(dev->pdev, 4) - 1) & 801 + dev->mr_table.mpt_base); 802 + 800 803 dev->mr_table.tavor_fmr.mpt_base = 801 - ioremap(dev->mr_table.mpt_base, 802 - (1 << i) * sizeof (struct mthca_mpt_entry)); 804 + ioremap(addr, (1 << i) * sizeof(struct mthca_mpt_entry)); 803 805 804 806 if (!dev->mr_table.tavor_fmr.mpt_base) { 805 807 mthca_warn(dev, "MPT ioremap for FMR failed.\n"); ··· 810 806 goto err_fmr_mpt; 811 807 } 812 808 809 + addr = pci_resource_start(dev->pdev, 4) + 810 + ((pci_resource_len(dev->pdev, 4) - 1) & 811 + dev->mr_table.mtt_base); 812 + 813 813 dev->mr_table.tavor_fmr.mtt_base = 814 - ioremap(dev->mr_table.mtt_base, 815 - (1 << i) * MTHCA_MTT_SEG_SIZE); 814 + ioremap(addr, (1 << i) * MTHCA_MTT_SEG_SIZE); 816 815 if (!dev->mr_table.tavor_fmr.mtt_base) { 817 816 mthca_warn(dev, "MTT ioremap for FMR failed.\n"); 818 817 err = -ENOMEM;