aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Wajdeczko <[email protected]>2024-08-28 23:08:08 +0200
committerMichal Wajdeczko <[email protected]>2024-08-30 10:51:08 +0200
commitd69300abc2dec930fd280a013984150ae7c6a386 (patch)
treeead293950df52d93cd03767aab39a958a930b322
parent65fe9617a1256f0a36696d48f7c63a8d3ec290bc (diff)
drm/xe/pf: Drop GuC notifications for non-existing VF
It is unlikely that GuC will ever send a G2H notification with an invalid VFID and it is currently harmless if that actually happen. But in upcoming patches we will start using that VFID as an index and we must be sure it is a valid to avoid a crash due to a buggy firmware or a currupted G2H message. Signed-off-by: Michal Wajdeczko <[email protected]> Reviewed-by: Piotr Piórkowski <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
index d11839d9e7d4..ad447d867e51 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
@@ -8,6 +8,7 @@
#include "xe_device.h"
#include "xe_gt.h"
#include "xe_gt_sriov_pf_control.h"
+#include "xe_gt_sriov_pf_helpers.h"
#include "xe_gt_sriov_printk.h"
#include "xe_guc_ct.h"
#include "xe_sriov.h"
@@ -212,6 +213,11 @@ static void pf_handle_vf_flr_done(struct xe_gt *gt, u32 vfid)
static int pf_handle_vf_event(struct xe_gt *gt, u32 vfid, u32 eventid)
{
+ xe_gt_sriov_dbg_verbose(gt, "received VF%u event %#x\n", vfid, eventid);
+
+ if (vfid > xe_gt_sriov_pf_get_totalvfs(gt))
+ return -EPROTO;
+
switch (eventid) {
case GUC_PF_NOTIFY_VF_FLR:
pf_handle_vf_flr(gt, vfid);