Commit 85ba57ad authored by Gert Wollny's avatar Gert Wollny Committed by Christian Gmeiner
Browse files

drm/etnaviv: Add PPU flop reset



The PPU flop reset is required on some hardware to clear the
temporary registers. This code follows the implementation
of the PPU flop reset as found in the public galcore kernel
module. Compared to that code some superfluous parts were
removed and only the code path for SoC chip_model = 0x8000
and revision = 0x6205 is implemented and tested.

v2: - Move flop reset data to etnaviv_drm_private and initialize it
      from etnaviv_gpu_bind (Lucas)
    - Prepare code for more chip IDs and other flop reset types
    - Do some cleanups and rename some functions

v3: - Move initialization of flop reset data to etnaviv_gpu_init (Lucas)
    - Free PPU data suballocation (Lucas)

v4: As suggested by
    - replace "asm-generic/int-ll64.h" with "linux/types.h"
    - drop flop reset type enum since we only support one type here
    - move function return parameters on same line with function name
    - replace open coded for loop with memset32
    - add cnost to local static values
    - add a return value to etnaviv_flop_reset_ppu_init; handle and
      pass errors on to the caller
    - handle etnaviv_flop_reset_ppu_init return value
    - use dev_err for flop reset error message
    - fix include guard to be consistent with the other driver code
    - fix license header and formatting

v5: As suggested by Christian Gmeiner:
    - add required header that is no longer pulled in by etnaviv_buffer.h
    - fix include style of linux headers
    - free flop_reset_data_ppu when command buffer initialization fails
    - fix typo in error message

[cgmeiner: fix SPDX comment style, fix line end with a '(' and fix typo]

Signed-off-by: default avatarGert Wollny <gert.wollny@collabora.com>
Reviewed-by: default avatarChristian Gmeiner <cgmeiner@igalia.com>
Tested-by: Marek Vasut <marek.vasut@mailbox.org> # STM32MP255C DHCOS DHSBC
Link: https://patch.msgid.link/20251119164624.9297-5-gert.wollny@collabora.com


Signed-off-by: default avatarChristian Gmeiner <cgmeiner@igalia.com>
parent 9fcdece1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ etnaviv-y := \
	etnaviv_iommu.o \
	etnaviv_mmu.o \
	etnaviv_perfmon.o \
	etnaviv_flop_reset.o \
	etnaviv_sched.o

obj-$(CONFIG_DRM_ETNAVIV)	+= etnaviv.o
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
#include "state_3d.xml.h"
#include "cmdstream.xml.h"

#include "etnaviv_flop_reset.h"

static void etnaviv_cmd_select_pipe(struct etnaviv_gpu *gpu,
	struct etnaviv_cmdbuf *buffer, u8 pipe)
{
@@ -101,6 +103,10 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
	/* initialize buffer */
	buffer->user_size = 0;

	/* Queue in PPU flop reset */
	if (etnaviv_flop_reset_ppu_require(&gpu->identity))
		etnaviv_flop_reset_ppu_run(gpu);

	CMD_WAIT(buffer, gpu->fe_waitcycles);
	CMD_LINK(buffer, 2,
		 etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
+7 −0
Original line number Diff line number Diff line
@@ -7,9 +7,16 @@
#define __ETNAVIV_BUFFER_H__

#include "etnaviv_cmdbuf.h"
#include "etnaviv_gpu.h"
#include "etnaviv_gem.h"
#include "etnaviv_mmu.h"

#include "common.xml.h"
#include "linux/printk.h"
#include "state.xml.h"
#include "state_blt.xml.h"
#include "state_hi.xml.h"
#include "state_3d.xml.h"
#include "cmdstream.xml.h"

static inline void OUT(struct etnaviv_cmdbuf *buffer, u32 data)
+3 −0
Original line number Diff line number Diff line
@@ -601,6 +601,9 @@ static void etnaviv_unbind(struct device *dev)

	component_unbind_all(dev, drm);

	etnaviv_cmdbuf_free(priv->flop_reset_data_ppu);
	kfree(priv->flop_reset_data_ppu);

	etnaviv_cmdbuf_suballoc_destroy(priv->cmdbuf_suballoc);

	xa_destroy(&priv->active_contexts);
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ struct etnaviv_drm_private {
	/* list of GEM objects: */
	struct mutex gem_lock;
	struct list_head gem_list;

	/* ppu flop reset data */
	struct etnaviv_cmdbuf *flop_reset_data_ppu;
};

int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
Loading