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/amdsmi commit: aff75c955f]
This commit is contained in:
Mukul Joshi
2020-08-10 12:50:33 -04:00
committed by Mukul Joshi
orang tua d7e3e0f579
melakukan e6f5d59edf
4 mengubah file dengan 7 tambahan dan 4 penghapusan
@@ -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))
@@ -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
@@ -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);
@@ -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) {