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

Commit 12dee699 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes I11aa5fa4,I1d4b668a into msm-4.14

* changes:
  msm: kgsl: Do not mark microcode buffers as NOEXEC
  msm: kgsl: Set up DMA map ops and DMA mask for KGSL
parents 8118120a 906661c1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1278,7 +1278,8 @@ static int _load_firmware(struct kgsl_device *device, const char *fwfile,
	}

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

	if (!ret) {
		memcpy(firmware->memdesc.hostptr, &fw->data[4], fw->size - 4);
+6 −2
Original line number Diff line number Diff line
@@ -2549,6 +2549,8 @@ static int kgsl_setup_dma_buf(struct kgsl_device *device,
		return -ENOMEM;

	attach = dma_buf_attach(dmabuf, device->dev);
	attach->dma_map_attrs |= DMA_ATTR_SKIP_CPU_SYNC;

	if (IS_ERR_OR_NULL(attach)) {
		ret = attach ? PTR_ERR(attach) : -EINVAL;
		goto out;
@@ -2557,8 +2559,6 @@ static int kgsl_setup_dma_buf(struct kgsl_device *device,
	meta->dmabuf = dmabuf;
	meta->attach = attach;

	attach->priv = entry;

	entry->priv_data = meta;
	entry->memdesc.pagetable = pagetable;
	entry->memdesc.size = 0;
@@ -4587,6 +4587,7 @@ static void _unregister_device(struct kgsl_device *device)

static int _register_device(struct kgsl_device *device)
{
	static u64 dma_mask = DMA_BIT_MASK(64);
	int minor, ret;
	dev_t dev;

@@ -4622,6 +4623,9 @@ static int _register_device(struct kgsl_device *device)
		return ret;
	}

	device->dev->dma_mask = &dma_mask;
	arch_setup_dma_ops(device->dev, 0, 0, NULL, false);

	dev_set_drvdata(&device->pdev->dev, device);
	return 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -196,6 +196,8 @@ struct kgsl_memdesc_ops {
#define KGSL_MEMDESC_TZ_LOCKED BIT(7)
/* The memdesc is allocated through contiguous memory */
#define KGSL_MEMDESC_CONTIG BIT(8)
/* This is an instruction buffer */
#define KGSL_MEMDESC_UCODE BIT(9)

/**
 * struct kgsl_memdesc - GPU memory object descriptor
+3 −0
Original line number Diff line number Diff line
@@ -1778,6 +1778,9 @@ static unsigned int _get_protection_flags(struct kgsl_memdesc *memdesc)
	if (memdesc->flags & KGSL_MEMFLAGS_IOCOHERENT)
		flags |= IOMMU_CACHE;

	if (memdesc->priv & KGSL_MEMDESC_UCODE)
		flags &= ~IOMMU_NOEXEC;

	return flags;
}