diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2018-02-26 12:54:31 +0000 |
---|---|---|
committer | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2018-03-07 23:11:53 +0000 |
commit | 289202e876688338f439ded7613804ee67034e91 (patch) | |
tree | 1fd42288d6f05f41b3c0e08b289a36e0994cb173 /tests | |
parent | 4ead0251f2ba52783f2e790e532c660e95121c7b (diff) |
tests/pm_sseu: adapt debugfs parsing for newer kernels
We introduced a subslice mask storage per slice in newer kernels
(because of the possibility of asymmetry). As a result the debugfs
output has changed a bit.
v2: Add a comment on why we have a special case on subslice per slice
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pm_sseu.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/pm_sseu.c b/tests/pm_sseu.c index 41e1c9fa..9a7daa56 100644 --- a/tests/pm_sseu.c +++ b/tests/pm_sseu.c @@ -104,6 +104,14 @@ dbg_get_status_section(const char *title, char **first, char **last) *last = pos - 1; } +static bool +dbg_has_line(const char *first, const char *last, const char *name) +{ + char *pos = strstr(first, name); + + return pos != NULL && pos < last; +} + static int dbg_get_int(const char *first, const char *last, const char *name) { @@ -161,8 +169,14 @@ dbg_get_status(struct status *stat) dbg_get_int(first, last, "Available Slice Total:"); stat->info.subslice_total = dbg_get_int(first, last, "Available Subslice Total:"); - stat->info.subslice_per = - dbg_get_int(first, last, "Available Subslice Per Slice:"); + /* Dealing with a change in 4.17. */ + if (dbg_has_line(first, last, "Available Subslice Per Slice:")) { + stat->info.subslice_per = + dbg_get_int(first, last, "Available Subslice Per Slice:"); + } else { + stat->info.subslice_per = + dbg_get_int(first, last, "Available Slice0 subslices:"); + } stat->info.eu_total = dbg_get_int(first, last, "Available EU Total:"); stat->info.eu_per = @@ -182,8 +196,14 @@ dbg_get_status(struct status *stat) dbg_get_int(first, last, "Enabled Slice Total:"); stat->hw.subslice_total = dbg_get_int(first, last, "Enabled Subslice Total:"); - stat->hw.subslice_per = - dbg_get_int(first, last, "Enabled Subslice Per Slice:"); + /* Dealing with a change in 4.17. */ + if (dbg_has_line(first, last, "Enabled Subslice Per Slice:")) { + stat->hw.subslice_per = + dbg_get_int(first, last, "Enabled Subslice Per Slice:"); + } else { + stat->hw.subslice_per = + dbg_get_int(first, last, "Enabled Slice0 subslices:"); + } stat->hw.eu_total = dbg_get_int(first, last, "Enabled EU Total:"); stat->hw.eu_per = |