[RFC v2 5/5] drm/xe/RAS: send multicast event on occurrence of an error
Aravind Iddamsetty
aravind.iddamsetty at linux.intel.com
Fri Aug 25 11:55:31 UTC 2023
Whenever a correctable or an uncorrectable error happens an event is sent
to the corresponding listeners of these groups.
Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty at linux.intel.com>
---
drivers/gpu/drm/xe/xe_irq.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index 226be96e341a..5eb041d7e07c 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -1073,6 +1073,37 @@ xe_gsc_hw_error_handler(struct xe_gt *gt, const enum hardware_error hw_err)
xe_mmio_write32(gt, GSC_HEC_CORR_UNCORR_ERR_STATUS(base, hw_err).reg, err_status);
}
+static void generate_netlink_event(struct xe_gt *gt, const enum hardware_error hw_err)
+{
+ struct xe_device *xe = gt->xe;
+ struct sk_buff *msg;
+ void *hdr;
+
+ if (!xe->drm.drm_genl_family.module)
+ return;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
+ if (!msg) {
+ drm_dbg_driver(&xe->drm, "couldn't allocate memory for error multicast event\n");
+ return;
+ }
+
+ hdr = genlmsg_put(msg, 0, 0, &xe->drm.drm_genl_family, 0, DRM_RAS_CMD_ERROR_EVENT);
+ if (!hdr) {
+ drm_dbg_driver(&xe->drm, "mutlicast msg buffer is small\n");
+ nlmsg_free(msg);
+ return;
+ }
+
+ genlmsg_end(msg, hdr);
+
+ genlmsg_multicast(&xe->drm.drm_genl_family, msg, 0,
+ hw_err ?
+ DRM_GENL_MCAST_UNCORR_ERR
+ : DRM_GENL_MCAST_CORR_ERR,
+ GFP_ATOMIC);
+}
+
static void
xe_hw_error_source_handler(struct xe_gt *gt, const enum hardware_error hw_err)
{
@@ -1103,6 +1134,7 @@ xe_hw_error_source_handler(struct xe_gt *gt, const enum hardware_error hw_err)
xe_mmio_write32(gt, DEV_ERR_STAT_REG(hw_err).reg, errsrc);
+ generate_netlink_event(gt, hw_err);
out_unlock:
spin_unlock_irqrestore(>_to_xe(gt)->irq.lock, flags);
}
--
2.25.1
More information about the dri-devel
mailing list