Openwrt/target/linux/layerscape/patches-5.4/701-net-0006-soc-fsl-bqman-page-align-iommu-mapping-sizes.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

59 lines
2.3 KiB
Diff

From 218274ea02e908846fabb5b9a2ab7409da06a85f Mon Sep 17 00:00:00 2001
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Date: Thu, 22 Nov 2018 12:32:13 +0200
Subject: [PATCH] soc/fsl/bqman: page align iommu mapping sizes
Prior to calling iommu_map()/iommu_unmap() page align the size or
failures such as below could happen:
iommu: unaligned: iova 0x... pa 0x... size 0x4000 min_pagesz 0x10000
qman_portal 500000000.qman-portal: failed to iommu_map() -22
Seen when booted a kernel compiled with 64K page size support.
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
drivers/soc/fsl/qbman/bman_ccsr.c | 2 +-
drivers/soc/fsl/qbman/qman_ccsr.c | 4 ++--
drivers/soc/fsl/qbman/qman_portal.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/soc/fsl/qbman/bman_ccsr.c
+++ b/drivers/soc/fsl/qbman/bman_ccsr.c
@@ -262,7 +262,7 @@ static int fsl_bman_probe(struct platfor
/* Create an 1-to-1 iommu mapping for FBPR area */
domain = iommu_get_domain_for_dev(dev);
if (domain) {
- ret = iommu_map(domain, fbpr_a, fbpr_a, fbpr_sz,
+ ret = iommu_map(domain, fbpr_a, fbpr_a, PAGE_ALIGN(fbpr_sz),
IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
if (ret)
dev_warn(dev, "failed to iommu_map() %d\n", ret);
--- a/drivers/soc/fsl/qbman/qman_ccsr.c
+++ b/drivers/soc/fsl/qbman/qman_ccsr.c
@@ -839,11 +839,11 @@ static int fsl_qman_probe(struct platfor
/* Create an 1-to-1 iommu mapping for fqd and pfdr areas */
domain = iommu_get_domain_for_dev(dev);
if (domain) {
- ret = iommu_map(domain, fqd_a, fqd_a, fqd_sz,
+ ret = iommu_map(domain, fqd_a, fqd_a, PAGE_ALIGN(fqd_sz),
IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
if (ret)
dev_warn(dev, "iommu_map(fqd) failed %d\n", ret);
- ret = iommu_map(domain, pfdr_a, pfdr_a, pfdr_sz,
+ ret = iommu_map(domain, pfdr_a, pfdr_a, PAGE_ALIGN(pfdr_sz),
IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
if (ret)
dev_warn(dev, "iommu_map(pfdr) failed %d\n", ret);
--- a/drivers/soc/fsl/qbman/qman_portal.c
+++ b/drivers/soc/fsl/qbman/qman_portal.c
@@ -305,7 +305,7 @@ static int qman_portal_probe(struct plat
*/
err = iommu_map(domain,
addr_phys[0]->start, addr_phys[0]->start,
- resource_size(addr_phys[0]),
+ PAGE_ALIGN(resource_size(addr_phys[0])),
IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
if (err)
dev_warn(dev, "failed to iommu_map() %d\n", err);