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

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
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -534,9 +534,11 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev)

	if (!gpu->aspace) {
		dev_err(dev->dev, "No memory protection without MMU\n");
		if (!allow_vram_carveout) {
			ret = -ENXIO;
			goto fail;
		}
	}

	return gpu;

+4 −2
Original line number Diff line number Diff line
@@ -564,9 +564,11 @@ 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");
		if (!allow_vram_carveout) {
			ret = -ENXIO;
			goto fail;
		}
	}

	icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem");
	ret = IS_ERR(icc_path);
+4 −2
Original line number Diff line number Diff line
@@ -692,9 +692,11 @@ 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");
		if (!allow_vram_carveout) {
			ret = -ENXIO;
			goto fail;
		}
	}

	icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem");
	ret = IS_ERR(icc_path);
+4 −0
Original line number Diff line number Diff line
@@ -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),
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "adreno_pm4.xml.h"

extern bool snapshot_debugbus;
extern bool allow_vram_carveout;

enum {
	ADRENO_FW_PM4 = 0,