drm/msm: Disallow relocs on a6xx+
Subsystems (4)
RFC 1/1 drm/msm: Disallow relocs on a6xx+
From: Rob Clark <[email protected]>
Mesa stopped using these pretty early in a6xx bringup. Take advantage of this to disallow some legacy UABI.
---
So, it was late 2018 when mesa stopped using relocs. At that point a6xx support was still in a pretty early state. I guess you _could_ use such an old version of mesa with a6xx hw.. but you really shouldn't.
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 ++ drivers/gpu/drm/msm/msm_gem_submit.c | 10 ++++++++++ drivers/gpu/drm/msm/msm_gpu.h | 9 +++++++++ 3 files changed, 21 insertions(+)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +2 -0
@@ -1078,6 +1078,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, adreno_gpu->info = config->info; adreno_gpu->chip_id = config->chip_id; + gpu->allow_relocs = config->info->family <ADRENO_6XX_GEN1 ; +/* Only handle the core clock when GMU is not in use (or is absent). */ if (adreno_has_gmu_wrapper (adreno_gpu) || adreno_gpu->info->family <ADRENO_6XX_GEN1 ) {
drivers/gpu/drm/msm/msm_gem_submit.c +10 -0
@@ -882,6 +882,16 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,if (submit->valid)continue ; +if (!gpu->allow_relocs) { +if (submit->cmd[i].nr_relocs) { +DRM_ERROR ("relocs not allowed\n" ); + ret = -EINVAL ; + goto out; + } + +continue ; + } + ret =submit_reloc (submit, msm_obj, submit->cmd[i].offset *4 , submit->cmd[i].nr_relocs, submit->cmd[i].relocs);if (ret)
drivers/gpu/drm/msm/msm_gpu.h +9 -0
@@ -285,6 +285,15 @@ struct msm_gpu {/* True if the hardware supports expanded apriv (a650 and newer) */ bool hw_apriv; +/** +* @allow_relocs: allow relocs in SUBMIT ioctl +* +* Mesa won't use relocs for driver version 1.4.0 and later. This +* switch-over happened early enough in mesa a6xx bringup that we +* can disallow relocs for a6xx and newer. +*/ +bool allow_relocs; +struct thermal_cooling_device *cooling; };
Signature · 1 line
2.41.0
Quoted 10 lines · Rob Clark
From: Rob Clark <[email protected]>
Mesa stopped using these pretty early in a6xx bringup. Take advantage of this to disallow some legacy UABI.
Signed-off-by Rob Clark <[email protected]>---
So, it was late 2018 when mesa stopped using relocs. At that point a6xx support was still in a pretty early state. I guess you _could_ use such an old version of mesa with a6xx hw.. but you really shouldn't.
Might be good to cite the mesa commit that removed the a6xx reloc code in the commit message.
-Sima
Quoted 63 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 ++ drivers/gpu/drm/msm/msm_gem_submit.c | 10 ++++++++++ drivers/gpu/drm/msm/msm_gpu.h | 9 +++++++++ 3 files changed, 21 insertions(+)drivers/gpu/drm/msm/adreno/adreno_gpu.c +2
-0@@ -1078,6 +1078,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, adreno_gpu->info = config->info; adreno_gpu->chip_id = config->chip_id; + gpu->allow_relocs = config->info->family <ADRENO_6XX_GEN1 ; +/* Only handle the core clock when GMU is not in use (or is absent). */ if (adreno_has_gmu_wrapper (adreno_gpu) || adreno_gpu->info->family <ADRENO_6XX_GEN1 ) {drivers/gpu/drm/msm/msm_gem_submit.c +10
-0@@ -882,6 +882,16 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,if (submit->valid)continue ; +if (!gpu->allow_relocs) { +if (submit->cmd[i].nr_relocs) { +DRM_ERROR ("relocs not allowed\n" ); + ret = -EINVAL ; + goto out; + } + +continue ; + } + ret =submit_reloc (submit, msm_obj, submit->cmd[i].offset *4 , submit->cmd[i].nr_relocs, submit->cmd[i].relocs);if (ret)drivers/gpu/drm/msm/msm_gpu.h +9
-0@@ -285,6 +285,15 @@ struct msm_gpu {/* True if the hardware supports expanded apriv (a650 and newer) */ bool hw_apriv; +/** +* @allow_relocs: allow relocs in SUBMIT ioctl +* +* Mesa won't use relocs for driver version 1.4.0 and later. This +* switch-over happened early enough in mesa a6xx bringup that we +* can disallow relocs for a6xx and newer. +*/ +bool allow_relocs; +struct thermal_cooling_device *cooling; };Signature · 1 line
2.41.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch