Commit b12f3ea7 authored by Adrián Larumbe's avatar Adrián Larumbe Committed by Boris Brezillon
Browse files

drm/panfrost: Replace fdinfo's profiling debugfs knob with sysfs



Debugfs isn't always available in production builds that try to squeeze
every single byte out of the kernel image, but we still need a way to
toggle the timestamp and cycle counter registers so that jobs can be
profiled for fdinfo's drm engine and cycle calculations.

Drop the debugfs knob and replace it with a sysfs file that accomplishes
the same functionality, and document its ABI in a separate file.

Signed-off-by: default avatarAdrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240306015819.822128-2-adrian.larumbe@collabora.com
parent 57a4e3a9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
What:		/sys/bus/platform/drivers/panfrost/.../profiling
Date:		February 2024
KernelVersion:	6.8.0
Contact:	Adrian Larumbe <adrian.larumbe@collabora.com>
Description:
		Get/set drm fdinfo's engine and cycles profiling status.
		Valid values are:
		0: Don't enable fdinfo job profiling sources.
		1: Enable fdinfo job profiling sources, this enables both the GPU's
		   timestamp and cycle counter registers.
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -38,3 +38,12 @@ the currently possible format options:

Possible `drm-engine-` key names are: `fragment`, and  `vertex-tiler`.
`drm-curfreq-` values convey the current operating frequency for that engine.

Users must bear in mind that engine and cycle sampling are disabled by default,
because of power saving concerns. `fdinfo` users and benchmark applications which
query the fdinfo file must make sure to toggle the job profiling status of the
driver by writing into the appropriate sysfs node::

    echo <N> > /sys/bus/platform/drivers/panfrost/[a-f0-9]*.gpu/profiling

Where `N` is either `0` or `1`, depending on the desired enablement status.
+0 −2
Original line number Diff line number Diff line
@@ -12,6 +12,4 @@ panfrost-y := \
	panfrost_perfcnt.o \
	panfrost_dump.o

panfrost-$(CONFIG_DEBUG_FS) += panfrost_debugfs.o

obj-$(CONFIG_DRM_PANFROST) += panfrost.o
+0 −21
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/* Copyright 2023 Collabora ltd. */
/* Copyright 2023 Amazon.com, Inc. or its affiliates. */

#include <linux/debugfs.h>
#include <linux/platform_device.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_file.h>
#include <drm/panfrost_drm.h>

#include "panfrost_device.h"
#include "panfrost_gpu.h"
#include "panfrost_debugfs.h"

void panfrost_debugfs_init(struct drm_minor *minor)
{
	struct drm_device *dev = minor->dev;
	struct panfrost_device *pfdev = platform_get_drvdata(to_platform_device(dev->dev));

	debugfs_create_atomic_t("profile", 0600, minor->debugfs_root, &pfdev->profile_mode);
}
+0 −14
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright 2023 Collabora ltd.
 * Copyright 2023 Amazon.com, Inc. or its affiliates.
 */

#ifndef PANFROST_DEBUGFS_H
#define PANFROST_DEBUGFS_H

#ifdef CONFIG_DEBUG_FS
void panfrost_debugfs_init(struct drm_minor *minor);
#endif

#endif  /* PANFROST_DEBUGFS_H */
Loading