[SWDEV-536953] Fix sets/resets + Align Power Cap Behavior with ROCM_SMI (#456)

Changes:
  - Modified outputputs for amd-smi set/reset when in partitions
    to display error codes
  - Provided some general cleanup for the above ^
----------------------------------------------------
  - Updated  `amd-smi set -o <value>` /  `amd-smi set --power-cap <value>`  command to
    allow setting power cap to values other than 0, provided the current power cap is not 0.
  - Modified power_cap_read_write.cc:
    - Added a check to ensure that the power cap can only be set to non-zero values if the current
      power cap is not 0.
    - Reset the power cap to the original value after the test to maintain state consistency.
Change-Id: If489bb35812ba4fc4cc34723b0dc39c99926e5d7

---------

Signed-off-by: Poag, Charis <Charis.Poag@amd.com>
Esse commit está contido em:
Poag, Charis
2025-07-22 17:21:15 -05:00
commit de GitHub
commit ec055f2c2d
4 arquivos alterados com 362 adições e 140 exclusões
+9 -2
Ver Arquivo
@@ -38,8 +38,15 @@ class AmdSmiLibraryException(AmdSmiException):
err_code=self.err_code, err_info=self.err_info
)
def get_error_info(self):
return self.err_info
def get_error_info(self, detailed=True):
"""Get error info, if detailed is True, return full error message, otherwise return short version"""
# If detailed is True, return full error message
# If detailed is False, return only the error code and a short description
if detailed:
return self.err_info
else:
error_out = str(self.err_info).split(" - ")[0]
return f"{error_out}"
def get_error_code(self):
return self.err_code