Among attributes of a PCIe bridge upstream port of a discrete graphics
card, there are three AER statistics attributes: aer_dev_correctable,
aer_dev_nonfatal and aer_dev_fatal.  Each consists of a number of key-
value pairs, while the library now expects only single value attributes.
That affects formatting of lsgpu -p output.  In order to print that data
correctly in a human readable form, extra formatting effort would be
needed.  However, users of lsgpu, the only call site of that printing
function of the igt_device_scan library, are not necessarily interested in
that data.  Just drop those attributes from the printout.

v2: Hand over detection of AER attributes to a helper.

Signed-off-by: Janusz Krzysztofik <[email protected]>
---
 lib/igt_device_scan.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index d5159f5d40..cdd735e994 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -612,6 +612,13 @@ static bool is_link_attr(const char *name)
               !strcmp(name, "current_link_width");
 }
 
+static bool is_aer_attr(const char *name)
+{
+       return !strcmp(name, "aer_dev_correctable") ||
+              !strcmp(name, "aer_dev_nonfatal") ||
+              !strcmp(name, "aer_dev_fatal");
+}
+
 static void dump_props_and_attrs(const struct igt_device *dev, bool omit_link)
 {
        struct igt_map_entry *entry;
@@ -627,6 +634,10 @@ static void dump_props_and_attrs(const struct igt_device 
*dev, bool omit_link)
                if (omit_link && is_link_attr(entry->key))
                        continue;
 
+               /* omit multi-line AER statistics data */
+               if (is_aer_attr(entry->key))
+                       continue;
+
                _print_key_value((char *)entry->key, (char *)entry->data);
        }
        printf("\n");
-- 
2.52.0

Reply via email to