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

Commit 787e1b74 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

Most notable addition this time is the support for the GPU performance
counters by Christian. This has been in the making for some time and it
has matured a lot. Since this is adding UAPI, the corresponding WIP
userspace can be found at [1] mesa/libdrm repos. I expect that
Christian sends out the final userspace patches for this once you have
pulled the kernel bits.

Philipp optimized the probe path, so etnaviv gets out of the way for
systems that want to boot real quick.

I've done mostly cleanups, disentangling etnaviv from the IOMMU API,
with some MMUv1 optimizations on the way.

* 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux: (36 commits)
  drm/etnaviv: remove unnecessary clock stabilization delay
  drm/etnaviv: reduce reset delay
  drm/etnaviv: remove unused function etnaviv_gem_new
  drm/etnaviv: remove stale comment
  drm/etnaviv: submit supports performance monitor requests
  drm/etnaviv: enable debug registers on demand
  drm/etnaviv: need to disable clock gating when doing profiling
  drm/etnaviv: add MC perf domain
  drm/etnaviv: add TX perf domain
  drm/etnaviv: add RA perf domain
  drm/etnaviv: add SE perf domain
  drm/etnaviv: add PA perf domain
  drm/etnaviv: add SH perf domain
  drm/etnaviv: add PE perf domain
  drm/etnaviv: add HI perf domain
  drm/etnaviv: use 'sync points' for performance monitor requests
  drm/etnaviv: clear alloced event
  drm/etnaviv: add 'sync point' support
  drm/etnaviv: add performance monitor request processing
  drm/etnaviv: copy pmrs from userspace
  ...
parents 972805c1 8272170f
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -7,8 +7,6 @@ config DRM_ETNAVIV
	select SHMEM
	select SYNC_FILE
	select TMPFS
	select IOMMU_API
	select IOMMU_SUPPORT
	select WANT_DEV_COREDUMP
	select CMA if HAVE_DMA_CONTIGUOUS
	select DMA_CMA if HAVE_DMA_CONTIGUOUS
+2 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ etnaviv-y := \
	etnaviv_gpu.o \
	etnaviv_iommu_v2.o \
	etnaviv_iommu.o \
	etnaviv_mmu.o
	etnaviv_mmu.o \
	etnaviv_perfmon.o

obj-$(CONFIG_DRM_ETNAVIV)	+= etnaviv.o
+36 −0
Original line number Diff line number Diff line
@@ -250,6 +250,42 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
	}
}

/* Append a 'sync point' to the ring buffer. */
void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event)
{
	struct etnaviv_cmdbuf *buffer = gpu->buffer;
	unsigned int waitlink_offset = buffer->user_size - 16;
	u32 dwords, target;

	/*
	 * We need at most 3 dwords in the return target:
	 * 1 event + 1 end + 1 wait + 1 link.
	 */
	dwords = 4;
	target = etnaviv_buffer_reserve(gpu, buffer, dwords);

	/* Signal sync point event */
	CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) |
		       VIVS_GL_EVENT_FROM_PE);

	/* Stop the FE to 'pause' the GPU */
	CMD_END(buffer);

	/* Append waitlink */
	CMD_WAIT(buffer);
	CMD_LINK(buffer, 2, etnaviv_cmdbuf_get_va(buffer) +
			    buffer->user_size - 4);

	/*
	 * Kick off the 'sync point' command by replacing the previous
	 * WAIT with a link to the address in the ring buffer.
	 */
	etnaviv_buffer_replace_wait(buffer, waitlink_offset,
				    VIV_FE_LINK_HEADER_OP_LINK |
				    VIV_FE_LINK_HEADER_PREFETCH(dwords),
				    target);
}

/* Append a command buffer to the ring buffer. */
void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
	struct etnaviv_cmdbuf *cmdbuf)
+14 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "etnaviv_cmdbuf.h"
#include "etnaviv_gpu.h"
#include "etnaviv_mmu.h"
#include "etnaviv_perfmon.h"

#define SUBALLOC_SIZE		SZ_256K
#define SUBALLOC_GRANULE	SZ_4K
@@ -87,9 +88,10 @@ void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc)

struct etnaviv_cmdbuf *
etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
		   size_t nr_bos)
		   size_t nr_bos, size_t nr_pmrs)
{
	struct etnaviv_cmdbuf *cmdbuf;
	struct etnaviv_perfmon_request *pmrs;
	size_t sz = size_vstruct(nr_bos, sizeof(cmdbuf->bo_map[0]),
				 sizeof(*cmdbuf));
	int granule_offs, order, ret;
@@ -98,6 +100,12 @@ etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
	if (!cmdbuf)
		return NULL;

	sz = sizeof(*pmrs) * nr_pmrs;
	pmrs = kzalloc(sz, GFP_KERNEL);
	if (!pmrs)
		goto out_free_cmdbuf;

	cmdbuf->pmrs = pmrs;
	cmdbuf->suballoc = suballoc;
	cmdbuf->size = size;

@@ -124,6 +132,10 @@ etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
	cmdbuf->vaddr = suballoc->vaddr + cmdbuf->suballoc_offset;

	return cmdbuf;

out_free_cmdbuf:
	kfree(cmdbuf);
	return NULL;
}

void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
@@ -139,6 +151,7 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
	suballoc->free_space = 1;
	mutex_unlock(&suballoc->lock);
	wake_up_all(&suballoc->free_event);
	kfree(cmdbuf->pmrs);
	kfree(cmdbuf);
}

+5 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

struct etnaviv_gpu;
struct etnaviv_cmdbuf_suballoc;
struct etnaviv_perfmon_request;

struct etnaviv_cmdbuf {
	/* suballocator this cmdbuf is allocated from */
@@ -38,6 +39,9 @@ struct etnaviv_cmdbuf {
	u32 exec_state;
	/* per GPU in-flight list */
	struct list_head node;
	/* perfmon requests */
	unsigned int nr_pmrs;
	struct etnaviv_perfmon_request *pmrs;
	/* BOs attached to this command buffer */
	unsigned int nr_bos;
	struct etnaviv_vram_mapping *bo_map[0];
@@ -49,7 +53,7 @@ void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);

struct etnaviv_cmdbuf *
etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
		   size_t nr_bos);
		   size_t nr_bos, size_t nr_pmrs);
void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf);

u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
Loading