Commit 9d85821a authored by Michal Wajdeczko's avatar Michal Wajdeczko

drm/xe/vf: Setup VRAM based on received config data

VF drivers will obtain VRAM configuration from the GuC as part of
the VF self config. Use that configuration instead of trying to
read inaccessible registers.
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240530133527.1328-6-michal.wajdeczko@intel.com
parent 638d1c79
...@@ -478,6 +478,23 @@ u16 xe_gt_sriov_vf_guc_ids(struct xe_gt *gt) ...@@ -478,6 +478,23 @@ u16 xe_gt_sriov_vf_guc_ids(struct xe_gt *gt)
return gt->sriov.vf.self_config.num_ctxs; return gt->sriov.vf.self_config.num_ctxs;
} }
/**
* xe_gt_sriov_vf_lmem - VF LMEM configuration.
* @gt: the &xe_gt
*
* This function is for VF use only.
*
* Return: size of the LMEM assigned to VF.
*/
u64 xe_gt_sriov_vf_lmem(struct xe_gt *gt)
{
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
xe_gt_assert(gt, gt->sriov.vf.guc_version.major);
xe_gt_assert(gt, gt->sriov.vf.self_config.lmem_size);
return gt->sriov.vf.self_config.lmem_size;
}
static int vf_balloon_ggtt(struct xe_gt *gt) static int vf_balloon_ggtt(struct xe_gt *gt)
{ {
struct xe_gt_sriov_vf_selfconfig *config = &gt->sriov.vf.self_config; struct xe_gt_sriov_vf_selfconfig *config = &gt->sriov.vf.self_config;
......
...@@ -20,6 +20,7 @@ int xe_gt_sriov_vf_prepare_ggtt(struct xe_gt *gt); ...@@ -20,6 +20,7 @@ int xe_gt_sriov_vf_prepare_ggtt(struct xe_gt *gt);
u32 xe_gt_sriov_vf_gmdid(struct xe_gt *gt); u32 xe_gt_sriov_vf_gmdid(struct xe_gt *gt);
u16 xe_gt_sriov_vf_guc_ids(struct xe_gt *gt); u16 xe_gt_sriov_vf_guc_ids(struct xe_gt *gt);
u64 xe_gt_sriov_vf_lmem(struct xe_gt *gt);
u32 xe_gt_sriov_vf_read32(struct xe_gt *gt, struct xe_reg reg); u32 xe_gt_sriov_vf_read32(struct xe_gt *gt, struct xe_reg reg);
void xe_gt_sriov_vf_print_config(struct xe_gt *gt, struct drm_printer *p); void xe_gt_sriov_vf_print_config(struct xe_gt *gt, struct drm_printer *p);
......
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
#include "xe_device.h" #include "xe_device.h"
#include "xe_force_wake.h" #include "xe_force_wake.h"
#include "xe_gt_mcr.h" #include "xe_gt_mcr.h"
#include "xe_gt_sriov_vf.h"
#include "xe_mmio.h" #include "xe_mmio.h"
#include "xe_module.h" #include "xe_module.h"
#include "xe_sriov.h"
#include "xe_vram.h" #include "xe_vram.h"
#define BAR_SIZE_SHIFT 20 #define BAR_SIZE_SHIFT 20
...@@ -220,6 +222,22 @@ static int tile_vram_size(struct xe_tile *tile, u64 *vram_size, ...@@ -220,6 +222,22 @@ static int tile_vram_size(struct xe_tile *tile, u64 *vram_size,
int err; int err;
u32 reg; u32 reg;
if (IS_SRIOV_VF(xe)) {
struct xe_tile *t;
int id;
offset = 0;
for_each_tile(t, xe, id)
for_each_if(t->id < tile->id)
offset += xe_gt_sriov_vf_lmem(t->primary_gt);
*tile_size = xe_gt_sriov_vf_lmem(gt);
*vram_size = *tile_size;
*tile_offset = offset;
return 0;
}
err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment