@@ -356,7 +356,7 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
selftests/igt_mmap.o \
selftests/igt_reset.o \
selftests/igt_spinner.o \
- selftests/librapl.o
+ selftests/libpower.o
# virtual gpu code
i915-y += i915_vgpu.o
@@ -11,7 +11,7 @@
#include "selftest_rc6.h"
#include "selftests/i915_random.h"
-#include "selftests/librapl.h"
+#include "selftests/libpower.h"
static u64 rc6_residency(struct intel_rc6 *rc6)
{
@@ -51,7 +51,7 @@ int live_rc6_manual(void *arg)
if (IS_VALLEYVIEW(gt->i915) || IS_CHERRYVIEW(gt->i915))
return 0;
- has_power = librapl_supported(gt->i915);
+ has_power = libpower_supported(gt->i915);
wakeref = intel_runtime_pm_get(gt->uncore->rpm);
/* Force RC6 off for starters */
@@ -61,9 +61,9 @@ int live_rc6_manual(void *arg)
res[0] = rc6_residency(rc6);
dt = ktime_get();
- rc0_power = librapl_energy_uJ();
+ rc0_power = libpower_get_energy_uJ();
msleep(250);
- rc0_power = librapl_energy_uJ() - rc0_power;
+ rc0_power = libpower_get_energy_uJ() - rc0_power;
dt = ktime_sub(ktime_get(), dt);
res[1] = rc6_residency(rc6);
if ((res[1] - res[0]) >> 10) {
@@ -89,9 +89,9 @@ int live_rc6_manual(void *arg)
res[0] = rc6_residency(rc6);
intel_uncore_forcewake_flush(rc6_to_uncore(rc6), FORCEWAKE_ALL);
dt = ktime_get();
- rc6_power = librapl_energy_uJ();
+ rc6_power = libpower_get_energy_uJ();
msleep(100);
- rc6_power = librapl_energy_uJ() - rc6_power;
+ rc6_power = libpower_get_energy_uJ() - rc6_power;
dt = ktime_sub(ktime_get(), dt);
res[1] = rc6_residency(rc6);
if (res[1] == res[0]) {
@@ -19,7 +19,7 @@
#include "selftest_rps.h"
#include "selftests/igt_flush_test.h"
#include "selftests/igt_spinner.h"
-#include "selftests/librapl.h"
+#include "selftests/libpower.h"
/* Try to isolate the impact of cstates from determing frequency response */
#define CPU_LATENCY 0 /* -1 to disable pm_qos, 0 to disable cstates */
@@ -1094,10 +1094,10 @@ static u64 __measure_power(int duration_ms)
{
u64 dE, dt;
- dE = librapl_energy_uJ();
+ dE = libpower_get_energy_uJ();
dt = ktime_get();
usleep_range(1000 * duration_ms, 2000 * duration_ms);
- dE = librapl_energy_uJ() - dE;
+ dE = libpower_get_energy_uJ() - dE;
dt = ktime_get() - dt;
return div64_u64(1000 * 1000 * dE, dt);
@@ -1143,7 +1143,7 @@ int live_rps_power(void *arg)
if (!intel_rps_is_enabled(rps) || GRAPHICS_VER(gt->i915) < 6)
return 0;
- if (!librapl_supported(gt->i915))
+ if (!libpower_supported(gt->i915))
return 0;
if (igt_spinner_init(&spin, gt))
@@ -169,7 +169,7 @@ static int slpc_power(struct intel_gt *gt, struct intel_engine_cs *engine)
* actually saves power. Let's see if our RAPL measurement supports
* that theory.
*/
- if (!librapl_supported(gt->i915))
+ if (!libpower_supported(gt->i915))
return 0;
min.freq = slpc->min_freq;
similarity index 69%
rename from drivers/gpu/drm/i915/selftests/librapl.c
rename to drivers/gpu/drm/i915/selftests/libpower.c
@@ -1,23 +1,23 @@
// SPDX-License-Identifier: MIT
/*
- * Copyright © 2020 Intel Corporation
+ * Copyright © 2023 Intel Corporation
*/
#include <asm/msr.h>
#include "i915_drv.h"
-#include "librapl.h"
+#include "libpower.h"
-bool librapl_supported(const struct drm_i915_private *i915)
+bool libpower_supported(const struct drm_i915_private *i915)
{
/* Discrete cards require hwmon integration */
if (IS_DGFX(i915))
return false;
- return librapl_energy_uJ();
+ return libpower_get_energy_uJ();
}
-u64 librapl_energy_uJ(void)
+u64 libpower_get_energy_uJ(void)
{
unsigned long long power;
u32 units;
new file mode 100644
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef SELFTEST_LIBPOWER_H
+#define SELFTEST_LIBPOWER_H
+
+#include <linux/types.h>
+
+struct drm_i915_private;
+
+bool libpower_supported(const struct drm_i915_private *i915);
+
+u64 libpower_get_energy_uJ(void);
+
+#endif /* SELFTEST_LIBPOWER_H */
deleted file mode 100644
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright © 2020 Intel Corporation
- */
-
-#ifndef SELFTEST_LIBRAPL_H
-#define SELFTEST_LIBRAPL_H
-
-#include <linux/types.h>
-
-struct drm_i915_private;
-
-bool librapl_supported(const struct drm_i915_private *i915);
-
-u64 librapl_energy_uJ(void);
-
-#endif /* SELFTEST_LIBRAPL_H */