Unverified Commit a3316314 authored by Matt Coster's avatar Matt Coster
Browse files

drm/imagination: Simplify module parameters



We had a whole load of bloaty infrastructure to deal with module parameters
in a way that's wholly unnecessary. Strip it all back to basics to make
adding new parameters less of a headache.

Reviewed-by: default avatarAlessio Belle <alessio.belle@imgtec.com>
Link: https://patch.msgid.link/20260113-device-support-info-v1-1-91e5db7f7294@imgtec.com


Signed-off-by: default avatarMatt Coster <matt.coster@imgtec.com>
parent 5a4e4e30
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ powervr-y := \
	pvr_hwrt.o \
	pvr_job.o \
	pvr_mmu.o \
	pvr_params.o \
	pvr_power.o \
	pvr_queue.o \
	pvr_stream.o \
+0 −2
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@

#include "pvr_device.h"
#include "pvr_fw_trace.h"
#include "pvr_params.h"

#include <linux/dcache.h>
#include <linux/debugfs.h>
@@ -18,7 +17,6 @@
#include <drm/drm_print.h>

static const struct pvr_debugfs_entry pvr_debugfs_entries[] = {
	{"pvr_params", pvr_params_debugfs_init},
	{"pvr_fw", pvr_fw_trace_debugfs_init},
};

+0 −9
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
#include "pvr_device_info.h"

#include "pvr_fw.h"
#include "pvr_params.h"
#include "pvr_power.h"
#include "pvr_queue.h"
#include "pvr_rogue_cr_defs.h"
@@ -607,14 +606,6 @@ pvr_device_init(struct pvr_device *pvr_dev)
	/* Get the platform-specific data based on the compatible string. */
	pvr_dev->device_data = of_device_get_match_data(dev);

	/*
	 * Setup device parameters. We do this first in case other steps
	 * depend on them.
	 */
	err = pvr_device_params_init(&pvr_dev->params);
	if (err)
		return err;

	/* Enable and initialize clocks required for the device to operate. */
	err = pvr_device_clk_init(pvr_dev);
	if (err)
+0 −10
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
#include "pvr_ccb.h"
#include "pvr_device_info.h"
#include "pvr_fw.h"
#include "pvr_params.h"
#include "pvr_rogue_fwif_stream.h"
#include "pvr_stream.h"

@@ -192,15 +191,6 @@ struct pvr_device {
	/** @fw_dev: Firmware related data. */
	struct pvr_fw_device fw_dev;

	/**
	 * @params: Device-specific parameters.
	 *
	 *          The values of these parameters are initialized from the
	 *          defaults specified as module parameters. They may be
	 *          modified at runtime via debugfs (if enabled).
	 */
	struct pvr_device_params params;

	/** @stream_musthave_quirks: Bit array of "must-have" quirks for stream commands. */
	u32 stream_musthave_quirks[PVR_STREAM_TYPE_MAX][PVR_STREAM_EXTHDR_TYPE_MAX];

+42 −4
Original line number Diff line number Diff line
@@ -14,9 +14,26 @@
#include <linux/build_bug.h>
#include <linux/dcache.h>
#include <linux/debugfs.h>
#include <linux/moduleparam.h>
#include <linux/sysfs.h>
#include <linux/types.h>

/*
 * Don't gate this behind CONFIG_DEBUG_FS so that it can be used as an initial
 * value without further conditional code...
 */
static u32 pvr_fw_trace_init_mask;

/*
 * ...but do only expose the module parameter if debugfs is enabled, since
 * there's no reason to turn on fw_trace without it.
 */
#if IS_ENABLED(CONFIG_DEBUG_FS)
module_param_named(init_fw_trace_mask, pvr_fw_trace_init_mask, hexint, 0600);
MODULE_PARM_DESC(init_fw_trace_mask,
		 "Enable FW trace for the specified groups at device init time");
#endif

static void
tracebuf_ctrl_init(void *cpu_ptr, void *priv)
{
@@ -126,6 +143,8 @@ void pvr_fw_trace_fini(struct pvr_device *pvr_dev)
 * @group_mask: New log group mask.
 *
 * Returns:
 *  * 0 if the provided @group_mask is the same as the current value (this is a
 *    short-circuit evaluation),
 *  * 0 on success,
 *  * Any error returned by pvr_kccb_send_cmd(), or
 *  * -%EIO if the device is lost.
@@ -138,6 +157,10 @@ update_logtype(struct pvr_device *pvr_dev, u32 group_mask)
	int idx;
	int err;

	/* No change in group_mask => nothing to update. */
	if (fw_trace->group_mask == group_mask)
		return 0;

	if (group_mask)
		fw_trace->tracebuf_ctrl->log_type = ROGUE_FWIF_LOG_TYPE_TRACE | group_mask;
	else
@@ -437,13 +460,25 @@ static const struct file_operations pvr_fw_trace_fops = {
	.release = fw_trace_release,
};

void
pvr_fw_trace_mask_update(struct pvr_device *pvr_dev, u32 old_mask, u32 new_mask)
static int pvr_fw_trace_mask_get(void *data, u64 *value)
{
	if (IS_ENABLED(CONFIG_DEBUG_FS) && old_mask != new_mask)
		update_logtype(pvr_dev, new_mask);
	struct pvr_device *pvr_dev = data;

	*value = pvr_dev->fw_dev.fw_trace.group_mask;

	return 0;
}

static int pvr_fw_trace_mask_set(void *data, u64 value)
{
	struct pvr_device *pvr_dev = data;

	return update_logtype(pvr_dev, (u32)value);
}

DEFINE_DEBUGFS_ATTRIBUTE(pvr_fw_trace_mask_fops, pvr_fw_trace_mask_get,
			 pvr_fw_trace_mask_set, "0x%08llx\n");

void
pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir)
{
@@ -463,4 +498,7 @@ pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir)
				    &fw_trace->buffers[thread_nr],
				    &pvr_fw_trace_fops);
	}

	debugfs_create_file("trace_mask", 0600, dir, fw_trace,
			    &pvr_fw_trace_mask_fops);
}
Loading