[SWDEV-532131] Update String Lengths (#383)

Signed-off-by: Narlo, Joseph <Joseph.Narlo@amd.com>

[ROCm/amdsmi commit: 7c29b4eab8]
This commit is contained in:
Narlo, Joseph
2025-05-28 18:31:30 -05:00
committed by GitHub
vanhempi d2bf77401e
commit 41522f665f
6 muutettua tiedostoa jossa 24 lisäystä ja 24 poistoa
+5
Näytä tiedosto
@@ -98,6 +98,11 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
### Changed
- **The char arrays in the following structures have been changed**.
- `amdsmi_vbios_info_t` member `build_date` changed from AMDSMI_MAX_DATE_LENGTH to AMDSMI_MAX_STRING_LENGTH.
- `amdsmi_dpm_policy_entry_t` member `policy_description` changed from AMDSMI_MAX_NAME to AMDSMI_MAX_STRING_LENGTH.
- `amdsmi_name_value_t` member `name` changed from AMDSMI_MAX_NAME to AMDSMI_MAX_STRING_LENGTH.
- **The `amd-smi topology` command has been enabled for Guest environments**.
- `amd-smi topology` is now available in Guest environments. This includes full functionality so users can use the command just as they would in Bare Metal environments.
@@ -753,7 +753,7 @@ typedef struct {
*/
typedef struct {
char name[AMDSMI_MAX_STRING_LENGTH];
char build_date[AMDSMI_MAX_DATE_LENGTH];
char build_date[AMDSMI_MAX_STRING_LENGTH];
char part_number[AMDSMI_MAX_STRING_LENGTH];
char version[AMDSMI_MAX_STRING_LENGTH];
uint64_t reserved[32];
@@ -1252,21 +1252,15 @@ typedef enum {
*/
#define AMDSMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
/**
* @brief Maximum number of characters an event notification message will be
* matches kfd message max size
*/
#define MAX_EVENT_NOTIFICATION_MSG_SIZE 256
/**
* @brief Event notification data returned from event notification API
*
* @cond @tag{gpu_bm_linux} @endcond
*/
typedef struct {
amdsmi_processor_handle processor_handle; //!< Handler of device that corresponds to the event
amdsmi_evt_notification_type_t event; //!< Event type
char message[MAX_EVENT_NOTIFICATION_MSG_SIZE]; //!< Event message
amdsmi_processor_handle processor_handle; //!< Handler of device that corresponds to the event
amdsmi_evt_notification_type_t event; //!< Event type
char message[AMDSMI_MAX_STRING_LENGTH]; //!< Event message
} amdsmi_evt_notification_data_t;
/**
@@ -1614,7 +1608,7 @@ typedef struct {
*/
typedef struct {
uint32_t policy_id;
char policy_description[AMDSMI_MAX_NAME];
char policy_description[AMDSMI_MAX_STRING_LENGTH];
} amdsmi_dpm_policy_entry_t;
#define AMDSMI_MAX_NUM_PM_POLICIES 32
@@ -1982,7 +1976,7 @@ typedef struct {
* @cond @tag{gpu_bm_linux} @endcond
*/
typedef struct {
char name[MAX_AMDSMI_NAME_LENGTH]; //!< Name
char name[AMDSMI_MAX_STRING_LENGTH]; //!< Name
uint64_t value; //!< Use uint64_t to make it universal
} amdsmi_name_value_t;
@@ -78,7 +78,7 @@ AMDSMI_NUM_VOLTAGE_CURVE_POINTS = 3
# Max size definitions
AMDSMI_MAX_MM_IP_COUNT = 8
AMDSMI_MAX_DATE_LENGTH = 32
AMDSMI_MAX_STRING_LENGTH = 64
AMDSMI_MAX_STRING_LENGTH = 256
AMDSMI_MAX_DEVICES = 32
AMDSMI_MAX_NAME = 32
AMDSMI_MAX_DRIVER_VERSION_LENGTH = 80
@@ -88,7 +88,6 @@ AMDSMI_MAX_CACHE_TYPES = 10
AMDSMI_MAX_NUM_XGMI_PHYSICAL_LINK = 64
AMDSMI_GPU_UUID_SIZE = 38
MAX_AMDSMI_NAME_LENGTH = 64
MAX_EVENT_NOTIFICATION_MSG_SIZE = 256
_AMDSMI_STRING_LENGTH = 80
@@ -908,7 +908,7 @@ class struct_amdsmi_vbios_info_t(Structure):
struct_amdsmi_vbios_info_t._pack_ = 1 # source:False
struct_amdsmi_vbios_info_t._fields_ = [
('name', ctypes.c_char * 256),
('build_date', ctypes.c_char * 32),
('build_date', ctypes.c_char * 256),
('part_number', ctypes.c_char * 256),
('version', ctypes.c_char * 256),
('reserved', ctypes.c_uint64 * 32),
@@ -1804,7 +1804,7 @@ class struct_amdsmi_dpm_policy_entry_t(Structure):
struct_amdsmi_dpm_policy_entry_t._pack_ = 1 # source:False
struct_amdsmi_dpm_policy_entry_t._fields_ = [
('policy_id', ctypes.c_uint32),
('policy_description', ctypes.c_char * 32),
('policy_description', ctypes.c_char * 256),
]
amdsmi_dpm_policy_entry_t = struct_amdsmi_dpm_policy_entry_t
@@ -2022,7 +2022,7 @@ class struct_amdsmi_name_value_t(Structure):
struct_amdsmi_name_value_t._pack_ = 1 # source:False
struct_amdsmi_name_value_t._fields_ = [
('name', ctypes.c_char * 64),
('name', ctypes.c_char * 256),
('value', ctypes.c_uint64),
]
@@ -793,7 +793,7 @@ const _: () = {
#[derive(Debug, Copy, Clone)]
pub struct AmdsmiVbiosInfoT {
pub name: [::std::os::raw::c_char; 256usize],
pub build_date: [::std::os::raw::c_char; 32usize],
pub build_date: [::std::os::raw::c_char; 256usize],
pub part_number: [::std::os::raw::c_char; 256usize],
pub version: [::std::os::raw::c_char; 256usize],
pub reserved: [u64; 32usize],
@@ -807,11 +807,11 @@ const _: () = {
["Offset of field: AmdsmiVbiosInfoT::build_date"]
[::std::mem::offset_of!(AmdsmiVbiosInfoT, build_date) - 256usize];
["Offset of field: AmdsmiVbiosInfoT::part_number"]
[::std::mem::offset_of!(AmdsmiVbiosInfoT, part_number) - 288usize];
[::std::mem::offset_of!(AmdsmiVbiosInfoT, part_number) - 512usize];
["Offset of field: AmdsmiVbiosInfoT::version"]
[::std::mem::offset_of!(AmdsmiVbiosInfoT, version) - 544usize];
[::std::mem::offset_of!(AmdsmiVbiosInfoT, version) - 768usize];
["Offset of field: AmdsmiVbiosInfoT::reserved"]
[::std::mem::offset_of!(AmdsmiVbiosInfoT, reserved) - 800usize];
[::std::mem::offset_of!(AmdsmiVbiosInfoT, reserved) - 1024usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -1833,7 +1833,7 @@ const _: () = {
#[derive(Debug, Copy, Clone)]
pub struct AmdsmiDpmPolicyEntryT {
pub policy_id: u32,
pub policy_description: [::std::os::raw::c_char; 32usize],
pub policy_description: [::std::os::raw::c_char; 256usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
@@ -1914,8 +1914,9 @@ amdsmi_get_gpu_event_notification(int timeout_ms,
rsmi_evt_notification_data_t rsmi_data = r_data[i];
data[i].event = static_cast<amdsmi_evt_notification_type_t>(
rsmi_data.event);
// Size is tied max event notification size
snprintf(data[i].message,
MAX_EVENT_NOTIFICATION_MSG_SIZE,
AMDSMI_MAX_STRING_LENGTH,
"%s",
rsmi_data.message);
amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
@@ -3637,7 +3638,8 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios
if (drm_write == 0) {
strncpy(info->name, reinterpret_cast<char *>(vbios.name), AMDSMI_MAX_STRING_LENGTH);
strncpy(info->build_date, reinterpret_cast<char *>(vbios.date), AMDSMI_MAX_DATE_LENGTH);
strncpy(info->build_date, reinterpret_cast<char *>(vbios.date), AMDSMI_MAX_STRING_LENGTH - 1);
info->build_date[AMDSMI_MAX_STRING_LENGTH - 1] = '\0';
strncpy(info->part_number, reinterpret_cast<char *>(vbios.vbios_pn),
AMDSMI_MAX_STRING_LENGTH);
strncpy(info->version, reinterpret_cast<char *>(vbios.vbios_ver_str),