]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/xe/pf: Re-initialize SR-IOV specific HW settings
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 25 Apr 2024 14:39:26 +0000 (16:39 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 26 Apr 2024 09:44:00 +0000 (11:44 +0200)
On older platforms (12.00) the PF driver must explicitly unblock
VF's modifications to the GGTT. On newer platforms this capability
is enabled by default.

Bspec: 49908, 53204
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240425143927.2265-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/regs/xe_sriov_regs.h
drivers/gpu/drm/xe/xe_gt.c
drivers/gpu/drm/xe/xe_gt_sriov_pf.c
drivers/gpu/drm/xe/xe_gt_sriov_pf.h

index 617ddb84b7faf30b08ffbae9de50f071b91f94c8..017b4ddd1ecf4fb4f778f49774a789d87f5801fe 100644 (file)
@@ -14,6 +14,9 @@
 #define   LMEM_EN                      REG_BIT(31)
 #define   LMTT_DIR_PTR                 REG_GENMASK(30, 0) /* in multiples of 64KB */
 
+#define VIRTUAL_CTRL_REG               XE_REG(0x10108c)
+#define   GUEST_GTT_UPDATE_EN          REG_BIT(8)
+
 #define VF_CAP_REG                     XE_REG(0x1901f8, XE_REG_OPTION_VF)
 #define   VF_CAP                       REG_BIT(0)
 
index a49e456b968de43170503f5fb83711b407712af7..0528d599c3fe281248befb373deba0989046bcca 100644 (file)
@@ -477,6 +477,9 @@ static int all_fw_domain_init(struct xe_gt *gt)
        if (IS_SRIOV_PF(gt_to_xe(gt)) && !xe_gt_is_media_type(gt))
                xe_lmtt_init_hw(&gt_to_tile(gt)->sriov.pf.lmtt);
 
+       if (IS_SRIOV_PF(gt_to_xe(gt)))
+               xe_gt_sriov_pf_init_hw(gt);
+
        err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
        XE_WARN_ON(err);
 
@@ -613,6 +616,9 @@ static int do_gt_restart(struct xe_gt *gt)
        if (IS_SRIOV_PF(gt_to_xe(gt)) && !xe_gt_is_media_type(gt))
                xe_lmtt_init_hw(&gt_to_tile(gt)->sriov.pf.lmtt);
 
+       if (IS_SRIOV_PF(gt_to_xe(gt)))
+               xe_gt_sriov_pf_init_hw(gt);
+
        xe_mocs_init(gt);
        err = xe_uc_start(&gt->uc);
        if (err)
index 791dcdd767e223a4857dcfe255c6c7cb52aa6f3d..687ea81931d1e5ba355d5d2ded96c7ef664cb3ff 100644 (file)
@@ -5,8 +5,11 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_sriov_regs.h"
+
 #include "xe_gt_sriov_pf.h"
 #include "xe_gt_sriov_pf_helpers.h"
+#include "xe_mmio.h"
 
 /*
  * VF's metadata is maintained in the flexible array where:
@@ -50,3 +53,25 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt)
 
        return 0;
 }
+
+static bool pf_needs_enable_ggtt_guest_update(struct xe_device *xe)
+{
+       return GRAPHICS_VERx100(xe) == 1200;
+}
+
+static void pf_enable_ggtt_guest_update(struct xe_gt *gt)
+{
+       xe_mmio_write32(gt, VIRTUAL_CTRL_REG, GUEST_GTT_UPDATE_EN);
+}
+
+/**
+ * xe_gt_sriov_pf_init_hw - Initialize SR-IOV hardware support.
+ * @gt: the &xe_gt to initialize
+ *
+ * On some platforms the PF must explicitly enable VF's access to the GGTT.
+ */
+void xe_gt_sriov_pf_init_hw(struct xe_gt *gt)
+{
+       if (pf_needs_enable_ggtt_guest_update(gt_to_xe(gt)))
+               pf_enable_ggtt_guest_update(gt);
+}
index 05142ffc431914255038cde285410db3d60bd822..37d7d6c3df036e5d46dc400e019892b1879a65e1 100644 (file)
@@ -10,11 +10,16 @@ struct xe_gt;
 
 #ifdef CONFIG_PCI_IOV
 int xe_gt_sriov_pf_init_early(struct xe_gt *gt);
+void xe_gt_sriov_pf_init_hw(struct xe_gt *gt);
 #else
 static inline int xe_gt_sriov_pf_init_early(struct xe_gt *gt)
 {
        return 0;
 }
+
+static inline void xe_gt_sriov_pf_init_hw(struct xe_gt *gt)
+{
+}
 #endif
 
 #endif