summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_sriov.c
diff options
context:
space:
mode:
authorMichal Wajdeczko <michal.wajdeczko@intel.com>2024-03-27 19:27:40 +0100
committerMichal Wajdeczko <michal.wajdeczko@intel.com>2024-03-28 13:45:37 +0100
commit0613834f3dddb4bf3ff82861dad661b1ede97f7b (patch)
tree434913fa1e1d909ee40d03ea12d4f0a1bd8be5b7 /drivers/gpu/drm/xe/xe_sriov.c
parentd79c88c45dae1f1c5f80bd473811c6d053f55828 (diff)
drm/xe/vf: Add proper detection of the SR-IOV VF mode
SR-IOV VF mode detection is based on testing VF capability bit on the register that is accessible from both the PF and enabled VFs. Bspec: 49904, 53227 Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240327182740.407-4-michal.wajdeczko@intel.com
Diffstat (limited to 'drivers/gpu/drm/xe/xe_sriov.c')
-rw-r--r--drivers/gpu/drm/xe/xe_sriov.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
index 2bcef998c8a9..3e103edf7174 100644
--- a/drivers/gpu/drm/xe/xe_sriov.c
+++ b/drivers/gpu/drm/xe/xe_sriov.c
@@ -5,7 +5,11 @@
#include <drm/drm_managed.h>
+#include "regs/xe_sriov_regs.h"
+
#include "xe_assert.h"
+#include "xe_device.h"
+#include "xe_mmio.h"
#include "xe_sriov.h"
/**
@@ -28,6 +32,13 @@ const char *xe_sriov_mode_to_string(enum xe_sriov_mode mode)
}
}
+static bool test_is_vf(struct xe_device *xe)
+{
+ u32 value = xe_mmio_read32(xe_root_mmio_gt(xe), VF_CAP_REG);
+
+ return value & VF_CAP;
+}
+
/**
* xe_sriov_probe_early - Probe a SR-IOV mode.
* @xe: the &xe_device to probe mode on
@@ -44,8 +55,10 @@ void xe_sriov_probe_early(struct xe_device *xe)
enum xe_sriov_mode mode = XE_SRIOV_MODE_NONE;
bool has_sriov = xe->info.has_sriov;
- /* TODO: replace with proper mode detection */
- xe_assert(xe, !has_sriov);
+ if (has_sriov) {
+ if (test_is_vf(xe))
+ mode = XE_SRIOV_MODE_VF;
+ }
xe_assert(xe, !xe->sriov.__mode);
xe->sriov.__mode = mode;