Skip to content

Commit 92ba203

Browse files
committed
drm/xe/pf: Move GGTT config KLVs encoding to helper
In upcoming patch we will want to encode GGTT config KLVs based on raw numbers, without relying on the allocated GGTT node. Signed-off-by: Michal Wajdeczko <[email protected]> Reviewed-by: Piotr Piórkowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1c38dd6 commit 92ba203

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,25 +238,34 @@ static struct xe_gt_sriov_config *pf_pick_vf_config(struct xe_gt *gt, unsigned i
238238
}
239239

240240
/* Return: number of configuration dwords written */
241-
static u32 encode_config_ggtt(u32 *cfg, const struct xe_gt_sriov_config *config, bool details)
241+
static u32 encode_ggtt(u32 *cfg, u64 start, u64 size, bool details)
242242
{
243243
u32 n = 0;
244244

245-
if (xe_ggtt_node_allocated(config->ggtt_region)) {
246-
if (details) {
247-
cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_START);
248-
cfg[n++] = lower_32_bits(config->ggtt_region->base.start);
249-
cfg[n++] = upper_32_bits(config->ggtt_region->base.start);
250-
}
251-
252-
cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_SIZE);
253-
cfg[n++] = lower_32_bits(config->ggtt_region->base.size);
254-
cfg[n++] = upper_32_bits(config->ggtt_region->base.size);
245+
if (details) {
246+
cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_START);
247+
cfg[n++] = lower_32_bits(start);
248+
cfg[n++] = upper_32_bits(start);
255249
}
256250

251+
cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_SIZE);
252+
cfg[n++] = lower_32_bits(size);
253+
cfg[n++] = upper_32_bits(size);
254+
257255
return n;
258256
}
259257

258+
/* Return: number of configuration dwords written */
259+
static u32 encode_config_ggtt(u32 *cfg, const struct xe_gt_sriov_config *config, bool details)
260+
{
261+
struct xe_ggtt_node *node = config->ggtt_region;
262+
263+
if (!xe_ggtt_node_allocated(node))
264+
return 0;
265+
266+
return encode_ggtt(cfg, node->base.start, node->base.size, details);
267+
}
268+
260269
/* Return: number of configuration dwords written */
261270
static u32 encode_config(u32 *cfg, const struct xe_gt_sriov_config *config, bool details)
262271
{

0 commit comments

Comments
 (0)