Commit 3f7759e7 authored by Iskren Chernev's avatar Iskren Chernev Committed by Rob Clark

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.
Signed-off-by: default avatarIskren Chernev <iskren.chernev@gmail.com>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent d863f0c7
...@@ -534,8 +534,10 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev) ...@@ -534,8 +534,10 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev)
if (!gpu->aspace) { if (!gpu->aspace) {
dev_err(dev->dev, "No memory protection without MMU\n"); dev_err(dev->dev, "No memory protection without MMU\n");
ret = -ENXIO; if (!allow_vram_carveout) {
goto fail; ret = -ENXIO;
goto fail;
}
} }
return gpu; return gpu;
......
...@@ -564,8 +564,10 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev) ...@@ -564,8 +564,10 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
* implement a cmdstream validator. * implement a cmdstream validator.
*/ */
DRM_DEV_ERROR(dev->dev, "No memory protection without IOMMU\n"); DRM_DEV_ERROR(dev->dev, "No memory protection without IOMMU\n");
ret = -ENXIO; if (!allow_vram_carveout) {
goto fail; ret = -ENXIO;
goto fail;
}
} }
icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem"); icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem");
......
...@@ -692,8 +692,10 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev) ...@@ -692,8 +692,10 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
* implement a cmdstream validator. * implement a cmdstream validator.
*/ */
DRM_DEV_ERROR(dev->dev, "No memory protection without IOMMU\n"); DRM_DEV_ERROR(dev->dev, "No memory protection without IOMMU\n");
ret = -ENXIO; if (!allow_vram_carveout) {
goto fail; ret = -ENXIO;
goto fail;
}
} }
icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem"); icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem");
......
...@@ -18,6 +18,10 @@ bool snapshot_debugbus = false; ...@@ -18,6 +18,10 @@ bool snapshot_debugbus = false;
MODULE_PARM_DESC(snapshot_debugbus, "Include debugbus sections in GPU devcoredump (if not fused off)"); MODULE_PARM_DESC(snapshot_debugbus, "Include debugbus sections in GPU devcoredump (if not fused off)");
module_param_named(snapshot_debugbus, snapshot_debugbus, bool, 0600); 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[] = { static const struct adreno_info gpulist[] = {
{ {
.rev = ADRENO_REV(2, 0, 0, 0), .rev = ADRENO_REV(2, 0, 0, 0),
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "adreno_pm4.xml.h" #include "adreno_pm4.xml.h"
extern bool snapshot_debugbus; extern bool snapshot_debugbus;
extern bool allow_vram_carveout;
enum { enum {
ADRENO_FW_PM4 = 0, ADRENO_FW_PM4 = 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment