[PATCH 14/17] media: rockchip: rga: put all cores into first core iommu domain
Sven Püschel
s.pueschel at pengutronix.de
Fri Jun 5 15:07:00 PDT 2026
Put all cores into the iommu domain of the first core to allow them to
be used by any core. All buffers accessed by the hardware are allocated
on the first core, as the scheduling to a specific core is done after
the allocation. Therefore put all cores into the same domain to have the
same iommu mapping on all cores.
Signed-off-by: Sven Püschel <s.pueschel at pengutronix.de>
---
drivers/media/platform/rockchip/rga/rga.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
index 6add6c510c127..9cebb461b3fd2 100644
--- a/drivers/media/platform/rockchip/rga/rga.c
+++ b/drivers/media/platform/rockchip/rga/rga.c
@@ -10,6 +10,7 @@
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
+#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -757,6 +758,19 @@ static int rga_core_bind(struct device *dev, struct device *master, void *data)
version.major, version.minor);
if (rga->num_cores) {
+ /* Attach to the first cores iommu */
+ struct iommu_domain *domain = iommu_get_domain_for_dev(rga->cores[0]->dev);
+
+ if (IS_ERR(domain)) {
+ dev_err(core->dev, "Couldn't get domain of the first core\n");
+ return PTR_ERR(domain);
+ }
+ ret = iommu_attach_device(domain, core->dev);
+ if (ret) {
+ dev_err(core->dev, "Couldn't attach to the domain of the first core\n");
+ return ret;
+ }
+
/* we are not the first core, expect that we have the same version */
if (rga->version.major != version.major || rga->version.minor != version.minor)
v4l2_warn(&rga->v4l2_dev, "Detected multi-core setup with different core versions!\n");
--
2.54.0
More information about the linux-arm-kernel
mailing list