Add support for get and set APIs for CPUISOFreqPolicy and DFCState Co… (#1901)
* Add support for get and set APIs for CPUISOFreqPolicy and DFCState Control
- Add support for get and set APIs for CPUISOFreqPolicy and DFCState Control
in AMD SMI and also in the CLI tool
* CHANGELOG.md file updated
* SWDEV-562837: Update amdsmi-py-api.md as per the new APIs
Updated amdsmi-py-api.md as per the new APIs added.
---------
Signed-off-by: Soumya <sranjanr@amd.com>
Signed-off-by: gabrpham <Gabriel.Pham@amd.com>
Co-authored-by: Saka Sitharammurthy <SitharamMurthy.Saka@amd.com>
This commit is contained in:
committed by
GitHub
parent
6c98c49362
commit
c6b7448227
@@ -6754,3 +6754,177 @@ try:
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_set_cpu_rail_isofreq_policy
|
||||
|
||||
Description: Set the CPU Rail Isofrequency Policy. This function configures the frequency policy for CPU power rails.
|
||||
|
||||
Input parameters:
|
||||
- `processor_handle` (amdsmi_processor_handle): CPU socket handle to query
|
||||
- `value` (int): Input policy value indicating the isofrequency setting:
|
||||
- 0: Independent control enabled (each rail has an independent frequency limit)
|
||||
- 1: Independent control disabled (all cores on both rails or each rail - have the same frequency limit)
|
||||
|
||||
Output: `None`
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_rail_isofreq_policy` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
#### Possible Library Exceptions
|
||||
|
||||
- `AMDSMI_STATUS_NOT_SUPPORTED` - Feature not supported
|
||||
- `AMDSMI_STATUS_NOT_YET_IMPLEMENTED` - Feature not yet implemented
|
||||
- `AMDSMI_STATUS_NO_HSMP_MSG_SUP` - HSMP message/feature not supported
|
||||
- `AMDSMI_STATUS_INVAL` - Invalid parameters
|
||||
- `AMDSMI_STATUS_TIMEOUT` - Timeout in API call
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
from amdsmi import *
|
||||
try:
|
||||
ret = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
|
||||
processor_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPUs on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
# Set independent control mode (0)
|
||||
amdsmi_set_cpu_rail_isofreq_policy(processor, 0)
|
||||
print("CPU rail isofrequency policy: set to each rail has independent frequency limit")
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpu_rail_isofreq_policy
|
||||
|
||||
Description: Get the CPU Rail Isofrequency Policy. This function retrieves the current frequency policy configuration for CPU power rails.
|
||||
|
||||
Input parameters:
|
||||
- `processor_handle` (amdsmi_processor_handle): CPU socket handle to query
|
||||
|
||||
Output: Integer representing the CPU rail isofrequency policy:
|
||||
- 0: Independent control enabled (each rail has an independent frequency limit)
|
||||
- 1: Independent control disabled (all cores on both rails or each rail - have the same frequency limit)
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpu_rail_isofreq_policy` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
#### Possible Library Exceptions
|
||||
|
||||
- `AMDSMI_STATUS_NOT_SUPPORTED` - Feature not supported
|
||||
- `AMDSMI_STATUS_NOT_YET_IMPLEMENTED` - Feature not yet implemented
|
||||
- `AMDSMI_STATUS_NO_HSMP_MSG_SUP` - HSMP message/feature not supported
|
||||
- `AMDSMI_STATUS_INVAL` - Invalid parameters
|
||||
- `AMDSMI_STATUS_TIMEOUT` - Timeout in API call
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
from amdsmi import *
|
||||
try:
|
||||
ret = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
|
||||
processor_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPUs on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
policy = amdsmi_get_cpu_rail_isofreq_policy(processor)
|
||||
if policy == 0:
|
||||
print("CPU rail isofrequency policy: Each rail has independent frequency limit")
|
||||
elif policy == 1:
|
||||
print("CPU rail isofrequency policy: Both rail have same frequency limit")
|
||||
else:
|
||||
print("CPU rail isofrequency policy: Unknown value {policy}")
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_set_dfc_ctrl
|
||||
|
||||
Description: Set the DFCState enabling control. DFCState is a low power state used for I/O Die (IOD).
|
||||
|
||||
Input parameters:
|
||||
- `processor_handle` (amdsmi_processor_handle): CPU socket handle to query
|
||||
- `value` (int): DFCState control value:
|
||||
- 0: Disable DFCState control
|
||||
- 1: Enable DFCState control
|
||||
|
||||
Output: `None`
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_dfc_ctrl` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
#### Possible Library Exceptions
|
||||
|
||||
- `AMDSMI_STATUS_NOT_SUPPORTED` - Feature not supported
|
||||
- `AMDSMI_STATUS_NOT_YET_IMPLEMENTED` - Feature not yet implemented
|
||||
- `AMDSMI_STATUS_NO_HSMP_MSG_SUP` - HSMP message/feature not supported
|
||||
- `AMDSMI_STATUS_INVAL` - Invalid parameters
|
||||
- `AMDSMI_STATUS_TIMEOUT` - Timeout in API call
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
from amdsmi import *
|
||||
try:
|
||||
ret = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
|
||||
processor_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPUs on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
# Enable DFCState control
|
||||
amdsmi_set_dfc_ctrl(processor, 1)
|
||||
print("DFCState control enabled")
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_dfc_ctrl
|
||||
|
||||
Description: Get the current DFCState enabling control status. DFCState is a low power state used for I/O Die (IOD).
|
||||
|
||||
Input parameters:
|
||||
- `processor_handle` (amdsmi_processor_handle): CPU socket handle to query
|
||||
|
||||
Output: Integer representing the DFCState control status:
|
||||
- 0: DFCState control is disabled
|
||||
- 1: DFCState control is enabled
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_dfc_ctrl` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
#### Possible Library Exceptions
|
||||
|
||||
- `AMDSMI_STATUS_NOT_SUPPORTED` - Feature not supported
|
||||
- `AMDSMI_STATUS_NOT_YET_IMPLEMENTED` - Feature not yet implemented
|
||||
- `AMDSMI_STATUS_NO_HSMP_MSG_SUP` - HSMP message/feature not supported
|
||||
- `AMDSMI_STATUS_INVAL` - Invalid parameters
|
||||
- `AMDSMI_STATUS_TIMEOUT` - Timeout in API call
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
from amdsmi import *
|
||||
try:
|
||||
ret = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
|
||||
processor_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPUs on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
dfc_status = amdsmi_get_dfc_ctrl(processor)
|
||||
if dfc_status == 0:
|
||||
print("DFCState control is disabled")
|
||||
elif dfc_status == 1:
|
||||
print("DFCState control is enabled")
|
||||
else:
|
||||
print(f"DFCState control: Unknown status {dfc_status}")
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user