diff --git a/target/linux/rockchip/patches-6.6/820-v6.16-rockchip-iommu-fix-dead-loop.patch b/target/linux/rockchip/patches-6.6/805-3-v6.16-rockchip-iommu-fix-dead-loop.patch similarity index 92% rename from target/linux/rockchip/patches-6.6/820-v6.16-rockchip-iommu-fix-dead-loop.patch rename to target/linux/rockchip/patches-6.6/805-3-v6.16-rockchip-iommu-fix-dead-loop.patch index f7e9092232..9d3f8bebc1 100644 --- a/target/linux/rockchip/patches-6.6/820-v6.16-rockchip-iommu-fix-dead-loop.patch +++ b/target/linux/rockchip/patches-6.6/805-3-v6.16-rockchip-iommu-fix-dead-loop.patch @@ -23,7 +23,7 @@ Signed-off-by: Joerg Roedel --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c -@@ -1323,7 +1323,6 @@ static int rk_iommu_of_xlate(struct devi +@@ -1290,7 +1290,6 @@ static int rk_iommu_of_xlate(struct devi iommu_dev = of_find_device_by_node(args->np); data->iommu = platform_get_drvdata(iommu_dev); @@ -31,7 +31,7 @@ Signed-off-by: Joerg Roedel dev_iommu_priv_set(dev, data); platform_device_put(iommu_dev); -@@ -1404,6 +1403,8 @@ static int rk_iommu_probe(struct platfor +@@ -1362,6 +1361,8 @@ static int rk_iommu_probe(struct platfor if (!iommu) return -ENOMEM; diff --git a/target/linux/rockchip/patches-6.6/805-4-rockchip-iommu-all-clocks.patch b/target/linux/rockchip/patches-6.6/805-4-rockchip-iommu-all-clocks.patch new file mode 100644 index 0000000000..f9bef6ae52 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/805-4-rockchip-iommu-all-clocks.patch @@ -0,0 +1,58 @@ +From 471d9a647afe9b1a770409fd4600b9cbb3c644c6 Mon Sep 17 00:00:00 2001 +From: Simon Xue +Date: Tue, 7 Sep 2021 14:50:55 +0800 +Subject: [PATCH] iommu: rockchip: optimise getting clocks + +Use devm_clk_bulk_get_all instead of devm_clk_bulk_get. So we don't need +the complicated operation. + +Change-Id: Idbe7668bd26b744f8d8b7d79d5eb99fa891bd0be +Signed-off-by: Simon Xue +--- + drivers/iommu/rockchip-iommu.c | 20 ++++---------------- + 1 file changed, 4 insertions(+), 16 deletions(-) + +--- a/drivers/iommu/rockchip-iommu.c ++++ b/drivers/iommu/rockchip-iommu.c +@@ -91,11 +91,6 @@ struct rk_iommu_domain { + struct iommu_domain domain; + }; + +-/* list of clocks required by IOMMU */ +-static const char * const rk_iommu_clocks[] = { +- "aclk", "iface", +-}; +- + struct rk_iommu_ops { + phys_addr_t (*pt_address)(u32 dte); + u32 (*mk_dtentries)(dma_addr_t pt_dma); +@@ -1409,25 +1404,18 @@ static int rk_iommu_probe(struct platfor + iommu->reset_disabled = device_property_read_bool(dev, + "rockchip,disable-mmu-reset"); + +- iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks); +- iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks, +- sizeof(*iommu->clocks), GFP_KERNEL); +- if (!iommu->clocks) +- return -ENOMEM; +- +- for (i = 0; i < iommu->num_clocks; ++i) +- iommu->clocks[i].id = rk_iommu_clocks[i]; +- + /* + * iommu clocks should be present for all new devices and devicetrees + * but there are older devicetrees without clocks out in the wild. + * So clocks as optional for the time being. + */ +- err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks); ++ err = devm_clk_bulk_get_all(dev, &iommu->clocks); + if (err == -ENOENT) + iommu->num_clocks = 0; +- else if (err) ++ else if (err < 0) + return err; ++ else ++ iommu->num_clocks = err; + + err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks); + if (err) diff --git a/target/linux/rockchip/patches-6.6/806-rockchip-iommu-no-pt.patch b/target/linux/rockchip/patches-6.6/806-rockchip-iommu-no-pt.patch index bcc4ae065a..4fdd3c1bef 100644 --- a/target/linux/rockchip/patches-6.6/806-rockchip-iommu-no-pt.patch +++ b/target/linux/rockchip/patches-6.6/806-rockchip-iommu-no-pt.patch @@ -11,7 +11,7 @@ VPU/NPU drivers do not support passthrough iommu. --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c -@@ -1298,6 +1298,13 @@ static int rk_iommu_of_xlate(struct devi +@@ -1292,6 +1292,13 @@ static int rk_iommu_of_xlate(struct devi return 0; } @@ -25,7 +25,7 @@ VPU/NPU drivers do not support passthrough iommu. void rockchip_iommu_mask_irq(struct device *dev) { struct rk_iommu *iommu = rk_iommu_from_dev(dev); -@@ -1340,6 +1347,7 @@ static const struct iommu_ops rk_iommu_o +@@ -1334,6 +1341,7 @@ static const struct iommu_ops rk_iommu_o .pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP, .of_xlate = rk_iommu_of_xlate, .owner = THIS_MODULE, diff --git a/target/linux/rockchip/patches-6.6/807-rockchip-iommu-port-flush-iotlb-all.patch b/target/linux/rockchip/patches-6.6/807-rockchip-iommu-port-flush-iotlb-all.patch index 4a29c695de..819159b4d2 100644 --- a/target/linux/rockchip/patches-6.6/807-rockchip-iommu-port-flush-iotlb-all.patch +++ b/target/linux/rockchip/patches-6.6/807-rockchip-iommu-port-flush-iotlb-all.patch @@ -11,7 +11,7 @@ fix MPP AV1 decoding --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c -@@ -910,6 +910,39 @@ static size_t rk_iommu_unmap(struct iomm +@@ -905,6 +905,39 @@ static size_t rk_iommu_unmap(struct iomm return unmap_size; } @@ -51,7 +51,7 @@ fix MPP AV1 decoding static struct rk_iommu *rk_iommu_from_dev(struct device *dev) { struct rk_iommudata *data = dev_iommu_priv_get(dev); -@@ -1352,6 +1385,7 @@ static const struct iommu_ops rk_iommu_o +@@ -1346,6 +1379,7 @@ static const struct iommu_ops rk_iommu_o .attach_dev = rk_iommu_attach_device, .map = rk_iommu_map, .unmap = rk_iommu_unmap,