drm/msm: Call msm_init_vram before binding the gpu
Subsystems (4)
PATCH 1/2 drm/msm: Call msm_init_vram before binding the gpu
From: Craig Tatlor <[email protected]>
vram.size is needed when binding a gpu without an iommu and is defined in msm_init_vram(), so run that before binding it.
--- drivers/gpu/drm/msm/msm_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +4 -4
@@ -457,14 +457,14 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)drm_mode_config_init (ddev); -/* Bind all our sub-components: */ - ret =component_bind_all (dev, ddev); + ret =msm_init_vram (ddev);if (ret) goto err_destroy_mdss; - ret =msm_init_vram (ddev); +/* Bind all our sub-components: */ + ret =component_bind_all (dev, ddev);if (ret) - goto err_msm_uninit; + goto err_destroy_mdss;dma_set_max_seg_size (dev,UINT_MAX );
base-commit: d7a03a44a5e93f39ece70ec75d25c6088caa0fdb
prerequisite-patch-id: aba6f684932cab35d98457c21e4ff7a5ac75c753
prerequisite-patch-id: 4884d57df1bd197896b69e115d9002d6c26ae2e2
Signature · 1 line
2.29.2
PATCH 2/2 drm/msm: Add modparam to allow vram carveout
Using the GPU with a VRAM Carveout is a security vulnerability. Nevertheless it is sometimes required, especially when no IOMMU implementation is available for a certain platform.
--- drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 6 ++++-- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 6 ++++-- drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 6 ++++-- drivers/gpu/drm/msm/adreno/adreno_device.c | 4 ++++ drivers/gpu/drm/msm/adreno/adreno_gpu.h | 1 + 5 files changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/adreno/a2xx_gpu.c +4 -2
@@ -534,8 +534,10 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev)if (!gpu->aspace) {dev_err (dev->dev,"No memory protection without MMU\n" ); - ret = -ENXIO ; - goto fail; +if (!allow_vram_carveout) { + ret = -ENXIO ; + goto fail; + } }return gpu;
drivers/gpu/drm/msm/adreno/a3xx_gpu.c +4 -2
@@ -564,8 +564,10 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)* implement a cmdstream validator. */ DRM_DEV_ERROR (dev->dev,"No memory protection without IOMMU\n" ); - ret = -ENXIO ; - goto fail; +if (!allow_vram_carveout) { + ret = -ENXIO ; + goto fail; + } } icc_path =devm_of_icc_get (&pdev->dev,"gfx-mem" );
drivers/gpu/drm/msm/adreno/a4xx_gpu.c +4 -2
@@ -692,8 +692,10 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)* implement a cmdstream validator. */ DRM_DEV_ERROR (dev->dev,"No memory protection without IOMMU\n" ); - ret = -ENXIO ; - goto fail; +if (!allow_vram_carveout) { + ret = -ENXIO ; + goto fail; + } } icc_path =devm_of_icc_get (&pdev->dev,"gfx-mem" );
drivers/gpu/drm/msm/adreno/adreno_device.c +4 -0
@@ -18,6 +18,10 @@ bool snapshot_debugbus = false;MODULE_PARM_DESC (snapshot_debugbus,"Include debugbus sections in GPU devcoredump (if not fused off)" );module_param_named (snapshot_debugbus, snapshot_debugbus, bool,0600 ); +bool allow_vram_carveout = false; +MODULE_PARM_DESC (allow_vram_carveout,"Allow using VRAM Carveout, in place of IOMMU" ); +module_param_named (allow_vram_carveout, allow_vram_carveout, bool,0600 ); +static const struct adreno_info gpulist[] = { { .rev =ADRENO_REV (2 ,0 ,0 ,0 ),
drivers/gpu/drm/msm/adreno/adreno_gpu.h +1 -0
@@ -18,6 +18,7 @@#include "adreno_pm4.xml.h" extern bool snapshot_debugbus; +extern bool allow_vram_carveout;enum {ADRENO_FW_PM4 =0 ,
Signature · 1 line
2.29.2
Quoted 6 lines · Iskren Chernev
From: Craig Tatlor <[email protected]>
vram.size is needed when binding a gpu without an iommu and is defined in
msm_init_vram(), so run that before binding it.Signed-off-by Craig Tatlor <[email protected]>
For the series:
Next time, please include a cover letter so that tags added to the cover letter can be applied to all patches in the series via patchwork.
Brian
Tested these patches on Samsung Galaxy S5 along with other patches that add panel driver and enable GPU support on this device.
Quoted 10 lines · Iskren Chernev
From: Craig Tatlor <[email protected]>
vram.size is needed when binding a gpu without an iommu and is defined in
msm_init_vram(), so run that before binding it.Signed-off-by Craig Tatlor <[email protected]>--- drivers/gpu/drm/msm/msm_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
This series was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This series was applied to qcom/linux.git (refs/heads/for-next):
Quoted 8 lines · On Wed, 30 Dec 2020 17:29:42 +0200 you wrote:
From: Craig Tatlor <[email protected]>
vram.size is needed when binding a gpu without an iommu and is defined in
msm_init_vram(), so run that before binding it.Signed-off-by Craig Tatlor <[email protected]>[...]
Here is the summary with links:
- [1/2] drm/msm: Call msm_init_vram before binding the gpu
https://git.kernel.org/qcom/c/d863f0c7b536 - [2/2] drm/msm: Add modparam to allow vram carveout https://git.kernel.org/qcom/c/3f7759e7b758
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html