From a68cd9612a3a1d83ee3b984100dba4c68ba600c0 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Fri, 22 Aug 2025 15:02:16 -0500 Subject: [PATCH] [SWDEV-540665] Power cap on 1VF cli parsing fix Signed-off-by: Maisam Arif Change-Id: I5aac8f820fd8ae1c6c1dbae3b5b9e69018c69452 [ROCm/amdsmi commit: e030f71229c5753905264faca7af81e12f1e4c7c] --- projects/amdsmi/amdsmi_cli/amdsmi_commands.py | 2 +- projects/amdsmi/amdsmi_cli/amdsmi_parser.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index 107013e431..5624f7e87b 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -5059,7 +5059,7 @@ class AMDSMICommands(): command = " ".join(sys.argv[1:]) raise AmdSmiRequiredCommandException(command, self.logger.format) else: - if not any([args.process_isolation is not None, args.clk_limit is not None]): + if not any([args.process_isolation is not None, args.clk_limit is not None, args.power_cap is not None]): command = " ".join(sys.argv[1:]) raise AmdSmiRequiredCommandException(command, self.logger.format) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_parser.py b/projects/amdsmi/amdsmi_cli/amdsmi_parser.py index 766d92223d..5daf63f6d7 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_parser.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_parser.py @@ -1237,7 +1237,7 @@ class AMDSMIParser(argparse.ArgumentParser): power_cap_min = str(power_cap_min) + ' W' set_power_cap_help = f"Set power capacity limit:\n\tmin cap: {power_cap_min}, max cap: {power_cap_max}" set_clk_limit_help = "Sets the sclk (aka gfxclk) or mclk minimum and maximum frequencies. \n\tex: amd-smi set -L (sclk | mclk) (min | max) value" - set_process_isolation_help = "Enable or disable the GPU process isolation on a per partition basis: 0 for disable and 1 for enable.\n" + set_process_isolation_help = "Enable or disable the GPU process isolation on a per partition basis:\n 0 for disable and 1 for enable.\n" # Help text for CPU set options set_cpu_pwr_limit_help = "Set power limit for the given socket. Input parameter is power limit value." @@ -1274,7 +1274,7 @@ class AMDSMIParser(argparse.ArgumentParser): required=False, help=set_compute_partition_help, metavar=('TYPE/INDEX')) set_value_exclusive_group.add_argument('-M', '--memory-partition', action='store', choices=self.helpers.get_memory_partition_types(), type=str.upper, required=False, help=set_memory_partition_help, metavar='PARTITION') # Power cap is enabled on guest, maintain order - set_value_exclusive_group.add_argument('-o', '--power-cap', action='store', type=lambda value: self._positive_int(value, '--power-cap'), required=False, help=set_power_cap_help, metavar='WATTS') + set_value_exclusive_group.add_argument('-o', '--power-cap', action='store', type=lambda value: self._not_negative_int(value, '--power-cap'), required=False, help=set_power_cap_help, metavar='WATTS') if self.helpers.is_baremetal(): set_value_exclusive_group.add_argument('-p', '--soc-pstate', action='store', required=False, type=lambda value: self._not_negative_int(value, '--soc-pstate'), help=set_soc_pstate_help, metavar='POLICY_ID') set_value_exclusive_group.add_argument('-x', '--xgmi-plpd', action='store', required=False, type=lambda value: self._not_negative_int(value, '--xgmi-plpd'), help=set_xgmi_plpd_help, metavar='POLICY_ID')