Add support for KFD Thermal Throttling SMI event

Add handling for receiving thermal throttling SMI event from the
kernel.
Also, update the event notification test to work with the new event.

Change-Id: Ib89c12b244f90998ccbae0a38b37f25705d156e0


[ROCm/rocm_smi_lib commit: aff75c955f]
Цей коміт міститься в:
Mukul Joshi
2020-08-10 12:50:33 -04:00
зафіксовано Mukul Joshi
джерело 8082416569
коміт 4ad8b300d8
4 змінених файлів з 7 додано та 4 видалено
+1
Переглянути файл
@@ -544,6 +544,7 @@ struct kfd_ioctl_import_dmabuf_args {
enum kfd_smi_event {
KFD_SMI_EVENT_NONE = 0, /* not used */
KFD_SMI_EVENT_VMFAULT = 1, /* event start counting at 1 */
KFD_SMI_EVENT_THERMAL_THROTTLE = 2,
};
#define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
+4 -3
Переглянути файл
@@ -280,8 +280,9 @@ typedef struct {
typedef enum {
RSMI_EVT_NOTIF_VMFAULT = KFD_SMI_EVENT_VMFAULT, //!< VM page fault
RSMI_EVT_NOTIF_FIRST = RSMI_EVT_NOTIF_VMFAULT,
RSMI_EVT_NOTIF_THERMAL_THROTTLE = KFD_SMI_EVENT_THERMAL_THROTTLE,
RSMI_EVT_NOTIF_LAST = RSMI_EVT_NOTIF_VMFAULT
RSMI_EVT_NOTIF_LAST = RSMI_EVT_NOTIF_THERMAL_THROTTLE
} rsmi_evt_notification_type_t;
/*
@@ -3228,8 +3229,8 @@ rsmi_event_notification_init(uint32_t dv_ind);
* bit position starting from 1.
* For example, if the mask field is 0x0000000000000003, which means first bit,
* bit 1 (bit position start from 1) and bit 2 are set, which indicate interest
* in receiving RSMI_EVT_NOTIF_VMFAULT (which has a value of 1) and the next
* event in that list which has a value of 2.
* in receiving RSMI_EVT_NOTIF_VMFAULT (which has a value of 1) and
* RSMI_EVT_NOTIF_THERMAL_THROTTLE event (which has a value of 2).
*
* @retval ::RSMI_STATUS_INIT_ERROR is returned if
* ::rsmi_event_notification_init() has not been called before a call to this
+1 -1
Переглянути файл
@@ -102,7 +102,7 @@ void TestEvtNotifReadWrite::Run(void) {
rsmi_evt_notification_type_t evt_type = RSMI_EVT_NOTIF_FIRST;
uint64_t mask = RSMI_EVENT_MASK_FROM_INDEX(evt_type);
while (evt_type != RSMI_EVT_NOTIF_LAST) {
while (evt_type <= RSMI_EVT_NOTIF_LAST) {
mask |= RSMI_EVENT_MASK_FROM_INDEX(evt_type);
evt_type = static_cast<rsmi_evt_notification_type_t>(
static_cast<uint32_t>(evt_type)+1);
+1
Переглянути файл
@@ -80,6 +80,7 @@ NameFromFWEnum(rsmi_fw_block_t blk) {
static const std::map<rsmi_evt_notification_type_t, const char *>
kEvtNotifEvntNameMap = {
{RSMI_EVT_NOTIF_VMFAULT, "RSMI_EVT_NOTIF_VMFAULT"},
{RSMI_EVT_NOTIF_THERMAL_THROTTLE, "RSMI_EVT_NOTIF_THERMAL_THROTTLE"},
};
const char *
NameFromEvtNotifType(rsmi_evt_notification_type_t evt) {