Update KFD SMI event notification handling

Event bitmask in KFD SMI event is now replaced with event index in
the SMI event message. Sending a event bitmask, which was a 64-bit
field with only 1 bit set, was quite wasteful of memory and also
potentially limiting to 64 events. Instead the kernel would send
event index in the SMI event message. As a result, update the
KFD SMI event handling to expect the event index in the message.

Change-Id: I3e74620788d3c1f7c0bdaa69e9d9ab3d1aba2c92
This commit is contained in:
Mukul Joshi
2020-08-07 13:13:37 -04:00
committed by Mukul Joshi
parent 8f9f9433d8
commit 406859ca8a
4 changed files with 24 additions and 9 deletions
+6 -2
View File
@@ -541,8 +541,12 @@ struct kfd_ioctl_import_dmabuf_args {
/*
* KFD SMI(System Management Interface) events
*/
/* Event type (defined by bitmask) */
#define KFD_SMI_EVENT_VMFAULT 0x0000000000000001
enum kfd_smi_event {
KFD_SMI_EVENT_NONE = 0, /* not used */
KFD_SMI_EVENT_VMFAULT = 1, /* event start counting at 1 */
};
#define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
struct kfd_ioctl_smi_events_args {
__u32 gpuid; /* to KFD */
+13 -2
View File
@@ -284,6 +284,11 @@ typedef enum {
RSMI_EVT_NOTIF_LAST = RSMI_EVT_NOTIF_VMFAULT
} rsmi_evt_notification_type_t;
/*
* Macro to generate event bitmask from event id
*/
#define RSMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
//! Maximum number of characters an event notification message will be
#define MAX_EVENT_NOTIFICATION_MSG_SIZE 64
@@ -3217,8 +3222,14 @@ rsmi_event_notification_init(uint32_t dv_ind);
* @param dv_ind a device index corresponding to the device on which to
* listen for events
*
* @param mask 0 or more elements of ::rsmi_evt_notification_type_t OR'd
* together that indicate which event types to listen for.
* @param mask Bitmask generated by OR'ing 1 or more elements of
* ::rsmi_evt_notification_type_t indicating which event types to listen for,
* where the rsmi_evt_notification_type_t value indicates the bit field, with
* 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.
*
* @retval ::RSMI_STATUS_INIT_ERROR is returned if
* ::rsmi_event_notification_init() has not been called before a call to this