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

Commit 09459f2e authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Move global pagetable entries to the IOMMU driver



Global pagetable entries are exclusively for IOMMU and per-process
pagetables.  Move all the code out of the generic driver and into
the IOMMU driver and clean up a bunch of stuff along the way.

Change-Id: Ic0dedbadbb368bb2a289ba4393f729d7e6066a17
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 11569ad2
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1138,8 +1138,9 @@ out:

static void _adreno_free_memories(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = &adreno_dev->dev;
	if (test_bit(ADRENO_DEVICE_CMDBATCH_PROFILE, &adreno_dev->priv))
		kgsl_free_global(&adreno_dev->cmdbatch_profile_buffer);
		kgsl_free_global(device, &adreno_dev->cmdbatch_profile_buffer);

	/* Free local copies of firmware and other command streams */
	kfree(adreno_dev->pfp_fw);
@@ -1151,8 +1152,8 @@ static void _adreno_free_memories(struct adreno_device *adreno_dev)
	kfree(adreno_dev->gpmu_cmds);
	adreno_dev->gpmu_cmds = NULL;

	kgsl_free_global(&adreno_dev->pm4);
	kgsl_free_global(&adreno_dev->pfp);
	kgsl_free_global(device, &adreno_dev->pm4);
	kgsl_free_global(device, &adreno_dev->pfp);
}

static int adreno_remove(struct platform_device *pdev)
@@ -1196,7 +1197,7 @@ static int adreno_remove(struct platform_device *pdev)
	kgsl_device_platform_remove(device);

	if (test_bit(ADRENO_DEVICE_PWRON_FIXUP, &adreno_dev->priv)) {
		kgsl_free_global(&adreno_dev->pwron_fixup);
		kgsl_free_global(device, &adreno_dev->pwron_fixup);
		clear_bit(ADRENO_DEVICE_PWRON_FIXUP, &adreno_dev->priv);
	}
	clear_bit(ADRENO_DEVICE_INITIALIZED, &adreno_dev->priv);
+3 −1
Original line number Diff line number Diff line
@@ -905,8 +905,10 @@ void a5xx_crashdump_init(struct adreno_device *adreno_dev)
	count = count_registers();

	if (kgsl_allocate_global(device, &registers,
		count * sizeof(unsigned int), 0, 0))
		count * sizeof(unsigned int), 0, 0)) {
		kgsl_free_global(device, &capturescript);
		return;
	}

	/* Build the crash script */

+1 −1
Original line number Diff line number Diff line
@@ -1108,7 +1108,7 @@ void adreno_profile_close(struct adreno_device *adreno_dev)
	profile->log_tail = NULL;
	profile->shared_head = 0;
	profile->shared_tail = 0;
	kgsl_free_global(&profile->shared_buffer);
	kgsl_free_global(&adreno_dev->dev, &profile->shared_buffer);
	profile->shared_size = 0;

	profile->assignment_count = 0;
+5 −3
Original line number Diff line number Diff line
@@ -424,12 +424,14 @@ int adreno_ringbuffer_init(struct adreno_device *adreno_dev, bool nopreempt)

static void _adreno_ringbuffer_close(struct adreno_ringbuffer *rb)
{
	kgsl_free_global(&rb->pagetable_desc);
	kgsl_free_global(&rb->preemption_desc);
	struct kgsl_device *device = rb->device;

	kgsl_free_global(device, &rb->pagetable_desc);
	kgsl_free_global(device, &rb->preemption_desc);

	memset(&rb->pt_update_desc, 0, sizeof(struct kgsl_memdesc));

	kgsl_free_global(&rb->buffer_desc);
	kgsl_free_global(device, &rb->buffer_desc);
	kgsl_del_event_group(&rb->events);
	memset(rb, 0, sizeof(struct adreno_ringbuffer));
}
+23 −8
Original line number Diff line number Diff line
@@ -231,6 +231,19 @@ static inline void parse_ib(struct kgsl_device *device,

}

static inline bool iommu_is_setstate_addr(struct kgsl_device *device,
		uint64_t gpuaddr, uint64_t size)
{
	struct kgsl_iommu *iommu = device->mmu.priv;

	if (kgsl_mmu_get_mmutype() != KGSL_MMU_TYPE_IOMMU ||
		iommu == NULL)
		return false;

	return kgsl_gpuaddr_in_memdesc(&iommu->setstate, gpuaddr,
			size);
}

/**
 * snapshot_rb_ibs() - Dump rb data and capture the IB's in the RB as well
 * @rb: The RB to dump
@@ -352,12 +365,14 @@ static void snapshot_rb_ibs(struct adreno_ringbuffer *rb,
				ibsize = rbptr[index + 3];
			}

			/*
			 * Sometimes the kernel generates IBs in global
			 * memory. We dump the interesting global buffers,
			 * so there's no need to parse these IBs.
			 */
			if (!kgsl_search_global_pt_entries(ibaddr, ibsize))
			/* Don't parse known global IBs */
			if (iommu_is_setstate_addr(device, ibaddr, ibsize))
				continue;

			if (kgsl_gpuaddr_in_memdesc(&adreno_dev->pwron_fixup,
				ibaddr, ibsize))
				continue;

			parse_ib(device, snapshot, snapshot->process,
				ibaddr, ibsize);
		}
Loading