summaryrefslogtreecommitdiff
path: root/drivers/ntb/hw/amd/ntb_hw_amd.c
diff options
context:
space:
mode:
authorSerge Semin <fancer.lancer@gmail.com>2017-12-06 17:31:53 +0300
committerJon Mason <jdmason@kudzu.us>2018-01-29 06:17:23 +0300
commit417cf39cfea9c680aa7c278c8d8a0ca879cacf0a (patch)
treeb53d025c691ee2a7c5a12d0a48d19e2640c45f32 /drivers/ntb/hw/amd/ntb_hw_amd.c
parentb87ab21935d76922362ff98a5a78f16e2e956ead (diff)
downloadlinux-417cf39cfea9c680aa7c278c8d8a0ca879cacf0a.tar.xz
NTB: Set dma mask and dma coherent mask to NTB devices
The dma_mask and dma_coherent_mask fields of the NTB struct device weren't initialized in hardware drivers. In fact it should be done instead of PCIe interface usage, since NTB clients are supposed to use NTB API and left unaware of real hardware implementation. In addition to that ntb_device_register() method shouldn't clear the passed ntb_dev structure, since it dma_mask is initialized by hardware drivers. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
Diffstat (limited to 'drivers/ntb/hw/amd/ntb_hw_amd.c')
-rw-r--r--drivers/ntb/hw/amd/ntb_hw_amd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index f0788aae05c9..3cfa46876239 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -1020,6 +1020,10 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev,
goto err_dma_mask;
dev_warn(&pdev->dev, "Cannot DMA consistent highmem\n");
}
+ rc = dma_coerce_mask_and_coherent(&ndev->ntb.dev,
+ dma_get_mask(&pdev->dev));
+ if (rc)
+ goto err_dma_mask;
ndev->self_mmio = pci_iomap(pdev, 0, 0);
if (!ndev->self_mmio) {