From 268a508efa9c694f4cc80602f04f681b269b193e Mon Sep 17 00:00:00 2001 From: Christian Lachner Date: Fri, 27 Feb 2026 10:07:27 +0100 Subject: [PATCH] dcn_regdump.sh: improve dcn version detection The old code only detected patterns in the form of x.y.z . However, the reporting for some GPUs is just in the form of x.y (eg. 7800XT which is DCN 3.2 (without leading ".0"). This change adds detection support for both variants. --- dcn_regdump.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dcn_regdump.sh b/dcn_regdump.sh index 3eb0d31..98a84f6 100755 --- a/dcn_regdump.sh +++ b/dcn_regdump.sh @@ -105,10 +105,10 @@ detect_dcn_version() { local bdf="${gpu_bdf#*:}" # strip domain prefix (0000:03:00.0 → 03:00.0) local ver # Try BDF-scoped match first (e.g. "amdgpu 0000:03:00.0: ... DCN 3.2.1") - ver=$(dmesg 2>/dev/null | grep "$bdf" | grep -oE 'initialized on DCN [0-9]+\.[0-9]+\.[0-9]+' | tail -1 | awk '{print $NF}') + ver=$(dmesg 2>/dev/null | grep "$bdf" | grep -oE 'initialized on DCN [0-9]+\.[0-9]+(\.[0-9]+)?' | tail -1 | sed -e's/^.* \([0-9.]\+\)$/\1/' -e's/^\([0-9]\.[0-9.]\)$/\1.0/') # Fall back to any matching dmesg line if [ -z "$ver" ]; then - ver=$(dmesg 2>/dev/null | grep -oE 'initialized on DCN [0-9]+\.[0-9]+\.[0-9]+' | tail -1 | awk '{print $NF}') + ver=$(dmesg 2>/dev/null | grep -oE 'initialized on DCN [0-9]+\.[0-9]+(\.[0-9]+)?' | tail -1 | sed -e's/^.* \([0-9.]\+\)$/\1/' -e's/^\([0-9]\.[0-9.]\)$/\1.0/') fi echo "$ver" }