[PATCH RFC 03/13] drm/msm: look for lpac from dts
Anna Maniscalco
anna.maniscalco2000 at gmail.com
Sun Jul 5 12:13:37 PDT 2026
In order to associate the SID used by LPAC to it's own domain and
context bank we need a separate node on the DTS.
Add the code to look up that node on initialization.
Signed-off-by: Anna Maniscalco <anna.maniscalco2000 at gmail.com>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 21 ++++++++++++++++++++-
drivers/gpu/drm/msm/msm_gpu.h | 1 +
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index f3fc7032fadc..71ce4cbbf27a 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -11,6 +11,8 @@
#include <linux/firmware/qcom/qcom_scm.h>
#include <linux/kernel.h>
#include <linux/of_reserved_mem.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
#include <linux/pm_opp.h>
#include <linux/slab.h>
#include <linux/soc/qcom/mdt_loader.h>
@@ -201,7 +203,9 @@ adreno_iommu_create_vm(struct msm_gpu *gpu,
struct drm_gpuvm *vm;
u64 start, size;
- mmu = msm_iommu_gpu_new(&pdev->dev, NULL, gpu, quirks);
+ mmu = msm_iommu_gpu_new(&pdev->dev,
+ gpu->lpac_pdev ? &gpu->lpac_pdev->dev : NULL,
+ gpu, quirks);
if (IS_ERR(mmu))
return ERR_CAST(mmu);
@@ -1187,6 +1191,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
const struct adreno_gpu_funcs *funcs, int nr_rings)
{
struct device *dev = &pdev->dev;
+ struct device_node *lpac_node;
struct adreno_platform_config *config = dev->platform_data;
struct msm_gpu_config adreno_gpu_config = { 0 };
struct msm_gpu *gpu = &adreno_gpu->base;
@@ -1200,6 +1205,20 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
gpu->allow_relocs = config->info->family < ADRENO_6XX_GEN1;
gpu->pdev = pdev;
+ lpac_node = of_parse_phandle(pdev->dev.of_node, "qcom,lpac", 0);
+ if (lpac_node)
+ gpu->lpac_pdev = of_find_device_by_node(lpac_node);
+ if (gpu->lpac_pdev) {
+ of_dma_configure(&gpu->lpac_pdev->dev, lpac_node, true);
+ platform_set_drvdata(gpu->lpac_pdev, &gpu->lpac_adreno_smmu);
+ if (!device_link_add(&pdev->dev, &gpu->lpac_pdev->dev,
+ DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER))
+ dev_err(&gpu->lpac_pdev->dev, "failed to link to gpu device\n");
+ pm_runtime_enable(&gpu->lpac_pdev->dev);
+ }
+ if (lpac_node)
+ of_node_put(lpac_node);
+
/* Only handle the core clock when GMU is not in use (or is absent). */
if (adreno_has_gmu_wrapper(adreno_gpu) ||
adreno_has_rgmu(adreno_gpu) ||
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index e2291dfe3ca8..271956e7f870 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -172,6 +172,7 @@ struct msm_gpu {
const char *name;
struct drm_device *dev;
struct platform_device *pdev;
+ struct platform_device *lpac_pdev;
const struct msm_gpu_funcs *funcs;
struct adreno_smmu_priv adreno_smmu;
--
2.54.0
More information about the linux-arm-kernel
mailing list