[igt-dev] [PATCH i-g-t v2 1/3] lib/igt_power: Modify igt_power library for xe

Riana Tauro riana.tauro at intel.com
Fri Aug 25 05:46:57 UTC 2023


Modify igt_pm library for xe tests. To check if a
device is dgfx, igt_power open call needs to be modified for
xe.

v2: add newline and fix commit message (Kamil)

Signed-off-by: Riana Tauro <riana.tauro at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 lib/igt_power.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/igt_power.c b/lib/igt_power.c
index 3b34be406..810859b13 100644
--- a/lib/igt_power.c
+++ b/lib/igt_power.c
@@ -12,6 +12,8 @@
 #include "igt_power.h"
 #include "igt_sysfs.h"
 
+#include "xe/xe_query.h"
+
 static const char *rapl_domains[] = { "cpu", "gpu", "pkg", "ram" };
 
 static int rapl_parse(struct rapl *r, const char *str)
@@ -99,11 +101,13 @@ static inline void rapl_close(struct rapl *r)
 int igt_power_open(int fd, struct igt_power *p, const char *domain)
 {
 	int i;
+	bool is_dgfx;
 
 	p->hwmon_fd = -1;
 	p->rapl.fd = -1;
 
-	if (gem_has_lmem(fd)) {
+	is_dgfx = is_xe_device(fd) ? xe_has_vram(fd) : gem_has_lmem(fd);
+	if (is_dgfx) {
 		if (strncmp(domain, "gpu", strlen("gpu")) == 0) {
 			p->hwmon_fd = igt_hwmon_open(fd);
 			if (p->hwmon_fd >= 0)
-- 
2.40.0



More information about the igt-dev mailing list