Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1dfa3f1 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Support adding VA padding for global allocations



Most of the global buffers are allocated sequentially in the GPU virtual
memory space. Some buffers might want to have a bit of breathing room to
try to detect buffer overwrites. Allow specific buffers to allocate some
additional virtual address padding. To start, add a 4K gap between
ringbuffers and a 16K space after the preemption records.

Change-Id: Ic0dedbadb7bdd39a87228e222990700f3727f51e
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 1afcce83
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ int adreno_get_firmware(struct adreno_device *adreno_dev,
		return ret;
	}

	firmware->memdesc = kgsl_allocate_global(device, fw->size - 4,
	firmware->memdesc = kgsl_allocate_global(device, fw->size - 4, 0,
				KGSL_MEMFLAGS_GPUREADONLY, KGSL_MEMDESC_UCODE,
				"ucode");

@@ -1397,7 +1397,7 @@ int adreno_device_probe(struct platform_device *pdev,
		priv |= KGSL_MEMDESC_PRIVILEGED;

	device->memstore = kgsl_allocate_global(device,
		KGSL_MEMSTORE_SIZE, 0, priv, "memstore");
		KGSL_MEMSTORE_SIZE, 0, 0, priv, "memstore");

	status = PTR_ERR_OR_ZERO(device->memstore);
	if (status) {
@@ -1722,7 +1722,7 @@ static int adreno_init(struct kgsl_device *device)
			priv |= KGSL_MEMDESC_PRIVILEGED;

		adreno_dev->profile_buffer =
			kgsl_allocate_global(device, PAGE_SIZE, 0, priv,
			kgsl_allocate_global(device, PAGE_SIZE, 0, 0, priv,
				"alwayson");

		adreno_dev->profile_index = 0;
+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ static int _a3xx_pwron_fixup(struct adreno_device *adreno_dev)
		return 0;

	adreno_dev->pwron_fixup = kgsl_allocate_global(KGSL_DEVICE(adreno_dev),
		PAGE_SIZE, KGSL_MEMFLAGS_GPUREADONLY, 0, "pwron_fixup");
		PAGE_SIZE, 0, KGSL_MEMFLAGS_GPUREADONLY, 0, "pwron_fixup");

	if (IS_ERR(adreno_dev->pwron_fixup))
		return PTR_ERR(adreno_dev->pwron_fixup);
+2 −2
Original line number Diff line number Diff line
@@ -155,12 +155,12 @@ static int a5xx_critical_packet_construct(struct adreno_device *adreno_dev)
	uint64_t gpuaddrs[4];

	adreno_dev->critpkts = kgsl_allocate_global(device,
		PAGE_SIZE * 4, 0, 0, "crit_pkts");
		PAGE_SIZE * 4, 0, 0, 0, "crit_pkts");
	if (IS_ERR(adreno_dev->critpkts))
		return PTR_ERR(adreno_dev->critpkts);

	adreno_dev->critpkts_secure = kgsl_allocate_global(device,
		PAGE_SIZE, KGSL_MEMFLAGS_SECURE, 0, "crit_pkts_secure");
		PAGE_SIZE, 0, KGSL_MEMFLAGS_SECURE, 0, "crit_pkts_secure");
	if (IS_ERR(adreno_dev->critpkts_secure))
		return PTR_ERR(adreno_dev->critpkts_secure);

+3 −3
Original line number Diff line number Diff line
@@ -484,7 +484,7 @@ static int a5xx_preemption_ringbuffer_init(struct adreno_device *adreno_dev,

	if (IS_ERR_OR_NULL(rb->preemption_desc))
		rb->preemption_desc = kgsl_allocate_global(device,
			A5XX_CP_CTXRECORD_SIZE_IN_BYTES, 0,
			A5XX_CP_CTXRECORD_SIZE_IN_BYTES, SZ_16K, 0,
			KGSL_MEMDESC_PRIVILEGED, "preemption_desc");

	if (IS_ERR(rb->preemption_desc))
@@ -533,7 +533,7 @@ int a5xx_preemption_init(struct adreno_device *adreno_dev)
	if (IS_ERR_OR_NULL(preempt->scratch))
		preempt->scratch = kgsl_allocate_global(device,
			adreno_dev->num_ringbuffers *
			A5XX_CP_CTXRECORD_PREEMPTION_COUNTER_SIZE, 0, 0,
			A5XX_CP_CTXRECORD_PREEMPTION_COUNTER_SIZE, 0, 0, 0,
			"preemption_counters");

	ret = PTR_ERR_OR_ZERO(preempt->scratch);
@@ -553,7 +553,7 @@ int a5xx_preemption_init(struct adreno_device *adreno_dev)

	/* Allocate mem for storing preemption smmu record */
	if (IS_ERR_OR_NULL(iommu->smmu_info))
		iommu->smmu_info = kgsl_allocate_global(device, PAGE_SIZE,
		iommu->smmu_info = kgsl_allocate_global(device, PAGE_SIZE, 0,
			KGSL_MEMFLAGS_GPUREADONLY, KGSL_MEMDESC_PRIVILEGED,
			"smmu_info");

+2 −2
Original line number Diff line number Diff line
@@ -1134,14 +1134,14 @@ void a5xx_crashdump_init(struct adreno_device *adreno_dev)
	/* The script buffers needs 2 extra qwords on the end */
	if (!IS_ERR_OR_NULL(capturescript))
		capturescript = kgsl_allocate_global(device,
			script_size + 16, KGSL_MEMFLAGS_GPUREADONLY,
			script_size + 16, 0, KGSL_MEMFLAGS_GPUREADONLY,
			KGSL_MEMDESC_PRIVILEGED, "capturescript");

	if (IS_ERR(capturescript))
		return;

	if (!IS_ERR_OR_NULL(registers))
		registers = kgsl_allocate_global(device, data_size, 0,
		registers = kgsl_allocate_global(device, data_size, 0, 0,
			KGSL_MEMDESC_PRIVILEGED, "capturescript_regs");

	if (IS_ERR(registers))
Loading