Merge amd-staging into amd-master 20231005

Change-Id: Ie217f139f63aa10ec5e9ce48797b7cb94864736d
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
This commit is contained in:
Galantsev, Dmitrii
2023-10-05 16:22:31 -05:00
7 changed files with 154 additions and 100 deletions
+38 -5
View File
@@ -30,8 +30,8 @@ from rsmiBindings import *
# Minor version - Increment when adding a new feature, set to 0 when major is incremented
# Patch version - Increment when adding a fix, set to 0 when minor is incremented
SMI_MAJ = 1
SMI_MIN = 4
SMI_PAT = 1
SMI_MIN = 5
SMI_PAT = 0
__version__ = '%s.%s.%s' % (SMI_MAJ, SMI_MIN, SMI_PAT)
# Set to 1 if an error occurs
@@ -1694,6 +1694,32 @@ def setNPSMode(deviceList, npsMode):
printErrLog(device, 'Failed to retrieve NPS mode, even though device supports it.')
printLogSpacer()
def showVersion(isCSV=False):
values = { 'ROCM-SMI version': __version__ }
version = rsmi_version_t()
status = rocmsmi.rsmi_version_get(byref(version))
if status == 0:
version_string = "%u.%u.%u" % (version.major, version.minor, version.patch)
values['ROCM-SMI-LIB version'] = version_string
if isCSV:
print('name, value')
for k in values.keys():
print('%s, %s' % (k, values[k]))
return
if PRINT_JSON:
temp_str = '{\n'
for k in values.keys():
temp_str += ' "%s": "%s",\n' % (k, values[k])
if len(values.keys()) > 1:
# replace ',\n' with '\n}'
temp_str = temp_str[:-2]
temp_str += '\n}'
print(temp_str)
return
for k in values.keys():
print('%s: %s' % (k, values[k]))
def showAllConcise(deviceList):
""" Display critical info for all devices in a concise format
@@ -2071,7 +2097,7 @@ def showFwInfo(deviceList, fwType):
ret = rocmsmi.rsmi_dev_firmware_version_get(device, fw_block_names_l.index(fw_name), byref(fw_ver))
if rsmi_ret_ok(ret, device, 'get_firmware_version_' + str(fw_name)):
# The VCN, VCE, UVD, SOS and ASD firmware's value needs to be in hexadecimal
if fw_name in ['VCN', 'VCE', 'UVD', 'SOS', 'ASD']:
if fw_name in ['VCN', 'VCE', 'UVD', 'SOS', 'ASD', 'MES', 'MES KIQ']:
printLog(device, '%s firmware version' % (fw_name),
'\t0x%s' % (str(hex(fw_ver.value))[2:].zfill(8)))
# The TA XGMI, TA RAS, and SMC firmware's hex value looks like 0x12345678
@@ -2974,7 +3000,7 @@ def showTempGraph(deviceList):
printLogSpacer()
def showVersion(deviceList, component):
def showDriverVersion(deviceList, component):
""" Display the software version for the specified component
@param deviceList: List of DRM devices (can be a single-item list)
@@ -3633,6 +3659,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='AMD ROCm System Management Interface | ROCM-SMI version: %s' % __version__,
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=90, width=120))
groupVersion = parser.add_argument_group()
groupDev = parser.add_argument_group()
groupDisplayOpt = parser.add_argument_group('Display Options')
groupDisplayTop = parser.add_argument_group('Topology')
@@ -3646,6 +3673,7 @@ if __name__ == '__main__':
groupResponse = parser.add_argument_group('Auto-response options')
groupActionOutput = parser.add_argument_group('Output options')
groupVersion.add_argument('-V', '--version', help='Show version information', action='store_true')
groupDev.add_argument('-d', '--device', help='Execute command on specified device', type=int, nargs='+')
groupDisplayOpt.add_argument('--alldevices', action='store_true') # ------------- function deprecated, no help menu
groupDisplayOpt.add_argument('--showhw', help='Show Hardware details', action='store_true')
@@ -3794,11 +3822,16 @@ if __name__ == '__main__':
# Must set PRINT_JSON early so the prints can be silenced
if args.json or args.csv:
PRINT_JSON = True
# Initialize rsmiBindings
rocmsmi = initRsmiBindings(silent=PRINT_JSON)
# Initialize the rocm SMI library
initializeRsmi()
if args.version:
showVersion(isCSV=args.csv)
sys.exit()
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.WARNING)
if args.loglevel is not None:
numericLogLevel = getattr(logging, args.loglevel.upper(), logging.WARNING)
@@ -3897,7 +3930,7 @@ if __name__ == '__main__':
if args.showhw:
showAllConciseHw(deviceList)
if args.showdriverversion:
showVersion(deviceList, rsmi_sw_component_t.RSMI_SW_COMP_DRIVER)
showDriverVersion(deviceList, rsmi_sw_component_t.RSMI_SW_COMP_DRIVER)
if args.showtempgraph:
showTempGraph(deviceList)
if args.showid:
+17 -17
View File
@@ -37,8 +37,6 @@ def initRsmiBindings(silent=False):
print_silent('Using lib from %s' % path_librocm)
else:
print('Unable to find librocm_smi64.so.@VERSION_MAJOR@')
else:
print_silent('Library loaded from: %s ' % path_librocm)
# ----------> TODO: Support static libs as well as SO
try:
@@ -419,25 +417,27 @@ class rsmi_fw_block_t(c_int):
RSMI_FW_BLOCK_ME = 4
RSMI_FW_BLOCK_MEC = 5
RSMI_FW_BLOCK_MEC2 = 6
RSMI_FW_BLOCK_PFP = 7
RSMI_FW_BLOCK_RLC = 8
RSMI_FW_BLOCK_RLC_SRLC = 9
RSMI_FW_BLOCK_RLC_SRLG = 10
RSMI_FW_BLOCK_RLC_SRLS = 11
RSMI_FW_BLOCK_SDMA = 12
RSMI_FW_BLOCK_SDMA2 = 13
RSMI_FW_BLOCK_SMC = 14
RSMI_FW_BLOCK_SOS = 15
RSMI_FW_BLOCK_TA_RAS = 16
RSMI_FW_BLOCK_TA_XGMI = 17
RSMI_FW_BLOCK_UVD = 18
RSMI_FW_BLOCK_VCE = 19
RSMI_FW_BLOCK_VCN = 20
RSMI_FW_BLOCK_MES = 7
RSMI_FW_BLOCK_MES_KIQ = 8
RSMI_FW_BLOCK_PFP = 9
RSMI_FW_BLOCK_RLC = 10
RSMI_FW_BLOCK_RLC_SRLC = 11
RSMI_FW_BLOCK_RLC_SRLG = 12
RSMI_FW_BLOCK_RLC_SRLS = 13
RSMI_FW_BLOCK_SDMA = 14
RSMI_FW_BLOCK_SDMA2 = 15
RSMI_FW_BLOCK_SMC = 16
RSMI_FW_BLOCK_SOS = 17
RSMI_FW_BLOCK_TA_RAS = 18
RSMI_FW_BLOCK_TA_XGMI = 19
RSMI_FW_BLOCK_UVD = 20
RSMI_FW_BLOCK_VCE = 21
RSMI_FW_BLOCK_VCN = 22
RSMI_FW_BLOCK_LAST = RSMI_FW_BLOCK_VCN
# The following list correlated to the rsmi_fw_block_t
fw_block_names_l = ['ASD', 'CE', 'DMCU', 'MC', 'ME', 'MEC', 'MEC2', 'PFP',\
fw_block_names_l = ['ASD', 'CE', 'DMCU', 'MC', 'ME', 'MEC', 'MEC2', 'MES', 'MES KIQ', 'PFP',\
'RLC', 'RLC SRLC', 'RLC SRLG', 'RLC SRLS', 'SDMA', 'SDMA2',\
'SMC', 'SOS', 'TA RAS', 'TA XGMI', 'UVD', 'VCE', 'VCN']