1 From 55705ace9136e1c24d92d7ab23e513439eb766e7 Mon Sep 17 00:00:00 2001
2 From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
3 Date: Tue, 3 Apr 2018 17:55:00 +0300
4 Subject: [PATCH] soc/fsl/bman: map FBPR area in the iommu
6 Add a one-to-one iommu mapping for bman private data memory (FBPR).
7 This is required for BMAN to work without faults behind an iommu.
9 Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
11 drivers/soc/fsl/qbman/bman_ccsr.c | 11 +++++++++++
12 1 file changed, 11 insertions(+)
14 --- a/drivers/soc/fsl/qbman/bman_ccsr.c
15 +++ b/drivers/soc/fsl/qbman/bman_ccsr.c
19 #include "bman_priv.h"
20 +#include <linux/iommu.h>
23 EXPORT_SYMBOL(bman_ip_rev);
24 @@ -210,6 +211,7 @@ static int fsl_bman_probe(struct platfor
26 struct device *dev = &pdev->dev;
27 struct device_node *node = dev->of_node;
28 + struct iommu_domain *domain;
32 @@ -257,6 +259,15 @@ static int fsl_bman_probe(struct platfor
34 dev_dbg(dev, "Allocated FBPR 0x%llx 0x%zx\n", fbpr_a, fbpr_sz);
36 + /* Create an 1-to-1 iommu mapping for FBPR area */
37 + domain = iommu_get_domain_for_dev(dev);
39 + ret = iommu_map(domain, fbpr_a, fbpr_a, fbpr_sz,
40 + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
42 + dev_warn(dev, "failed to iommu_map() %d\n", ret);
45 bm_set_memory(fbpr_a, fbpr_sz);
47 err_irq = platform_get_irq(pdev, 0);