Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/pkg/amdgpu/amdgpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ func ParseTopologyProperties(path string, re *regexp.Regexp) (int64, error) {
return 0, errors.New("Topology property not found. Regex: " + re.String())
}

var fwVersionRe = regexp.MustCompile(`(\w+) feature version: (\d+), firmware version: (0x[0-9a-fA-F]+)`)
// Newer kernels print an extra "program: N," field on the SMC line.
var fwVersionRe = regexp.MustCompile(`(\w+) feature version: (\d+),(?: program: \d+,)? firmware version: (0x[0-9a-fA-F]+)`)

func parseDebugFSFirmwareInfo(path string) (map[string]uint32, map[string]uint32) {
feat := make(map[string]uint32)
Expand Down
15 changes: 15 additions & 0 deletions internal/pkg/amdgpu/amdgpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,21 @@ func TestParseDebugFSFirmwareInfo(t *testing.T) {
}
}

// Kernel 7.0 on an MI325X prints "program: N," between the SMC feature and
// firmware versions; the SMC entry must still parse.
func TestParseDebugFSFirmwareInfoSMCProgram(t *testing.T) {
feat, fw := parseDebugFSFirmwareInfo("../../../testdata/debugfs-parsing/amdgpu_firmware_info_mi325x")
if v, ok := fw["SMC"]; !ok || v != 0x07551300 {
t.Errorf("SMC firmware = %#x (present %v), want 0x07551300", v, ok)
}
if v, ok := feat["SMC"]; !ok || v != 0 {
t.Errorf("SMC feature = %d (present %v), want 0", v, ok)
}
if v := fw["MEC"]; v != 0x000080c2 {
t.Errorf("MEC firmware = %#x, want 0x80c2 (a line without program must still parse)", v)
}
}

func TestRenderDevIdsFromTopology(t *testing.T) {
renderDevIds := GetDevIdsFromTopology("../../../testdata/topology-parsing-mi308")

Expand Down
5 changes: 5 additions & 0 deletions testdata/debugfs-parsing/amdgpu_firmware_info_mi325x
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RLC feature version: 1, firmware version: 0x00000046
MEC feature version: 50, firmware version: 0x000080c2
SMC feature version: 0, program: 7, firmware version: 0x07551300 (85.19.0)
SDMA0 feature version: 44, firmware version: 0x0000001b
VCN feature version: 0, firmware version: 0x09118022
Loading