Commit f3009272 authored by Satyanarayana K V P's avatar Satyanarayana K V P Committed by Matthew Brost
Browse files

drm/xe/vf: Create contexts for CCS read write



Create two LRCs to handle CCS meta data read / write from CCS pool in the
VM. Read context is used to hold GPU instructions to be executed at save
time and write context is used to hold GPU instructions to be executed at
the restore time.

Allocate batch buffer pool using suballocator for both read and write
contexts.

Migration framework is reused to create LRCAs for read and write.

Signed-off-by: default avatarSatyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250722120506.6483-2-satyanarayana.k.v.p@intel.com
parent 9a220e06
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ xe-y += \
	xe_memirq.o \
	xe_sriov.o \
	xe_sriov_vf.o \
	xe_sriov_vf_ccs.o \
	xe_tile_sriov_vf.o

xe-$(CONFIG_PCI_IOV) += \
+4 −0
Original line number Diff line number Diff line
@@ -940,6 +940,10 @@ int xe_device_probe(struct xe_device *xe)

	xe_vsec_init(xe);

	err = xe_sriov_late_init(xe);
	if (err)
		goto err_unregister_display;

	return devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe);

err_unregister_display:
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "xe_sriov_pf_types.h"
#include "xe_sriov_types.h"
#include "xe_sriov_vf_types.h"
#include "xe_sriov_vf_ccs_types.h"
#include "xe_step_types.h"
#include "xe_survivability_mode_types.h"

@@ -182,6 +183,9 @@ struct xe_tile {
		struct {
			/** @sriov.vf.ggtt_balloon: GGTT regions excluded from use. */
			struct xe_ggtt_node *ggtt_balloon[2];

			/** @sriov.vf.ccs: CCS read and write contexts for VF. */
			struct xe_tile_vf_ccs ccs[XE_SRIOV_VF_CCS_CTX_COUNT];
		} vf;
	} sriov;

+39 −0
Original line number Diff line number Diff line
@@ -134,6 +134,33 @@ static int sa_info(struct xe_gt *gt, struct drm_printer *p)
	return 0;
}

static int sa_info_vf_ccs(struct xe_gt *gt, struct drm_printer *p)
{
	struct xe_tile *tile = gt_to_tile(gt);
	struct xe_sa_manager *bb_pool;
	enum xe_sriov_vf_ccs_rw_ctxs ctx_id;

	if (!IS_VF_CCS_READY(gt_to_xe(gt)))
		return 0;

	xe_pm_runtime_get(gt_to_xe(gt));

	for_each_ccs_rw_ctx(ctx_id) {
		bb_pool = tile->sriov.vf.ccs[ctx_id].mem.ccs_bb_pool;
		if (!bb_pool)
			break;

		drm_printf(p, "ccs %s bb suballoc info\n", ctx_id ? "write" : "read");
		drm_printf(p, "-------------------------\n");
		drm_suballoc_dump_debug_info(&bb_pool->base, p, bb_pool->gpu_addr);
		drm_puts(p, "\n");
	}

	xe_pm_runtime_put(gt_to_xe(gt));

	return 0;
}

static int topology(struct xe_gt *gt, struct drm_printer *p)
{
	xe_pm_runtime_get(gt_to_xe(gt));
@@ -303,6 +330,13 @@ static const struct drm_info_list vf_safe_debugfs_list[] = {
	{"hwconfig", .show = xe_gt_debugfs_simple_show, .data = hwconfig},
};

/*
 * only for GT debugfs files which are valid on VF. Not valid on PF.
 */
static const struct drm_info_list vf_only_debugfs_list[] = {
	{"sa_info_vf_ccs", .show = xe_gt_debugfs_simple_show, .data = sa_info_vf_ccs},
};

/* everything else should be added here */
static const struct drm_info_list pf_only_debugfs_list[] = {
	{"hw_engines", .show = xe_gt_debugfs_simple_show, .data = hw_engines},
@@ -424,6 +458,11 @@ void xe_gt_debugfs_register(struct xe_gt *gt)
		drm_debugfs_create_files(pf_only_debugfs_list,
					 ARRAY_SIZE(pf_only_debugfs_list),
					 root, minor);
	else
		drm_debugfs_create_files(vf_only_debugfs_list,
					 ARRAY_SIZE(vf_only_debugfs_list),
					 root, minor);


	xe_uc_debugfs_register(&gt->uc, root);

+19 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include "xe_sriov.h"
#include "xe_sriov_pf.h"
#include "xe_sriov_vf.h"
#include "xe_sriov_vf_ccs.h"

/**
 * xe_sriov_mode_to_string - Convert enum value to string.
@@ -157,3 +158,21 @@ const char *xe_sriov_function_name(unsigned int n, char *buf, size_t size)
		strscpy(buf, "PF", size);
	return buf;
}

/**
 * xe_sriov_late_init() - SR-IOV late initialization functions.
 * @xe: the &xe_device to initialize
 *
 * On VF this function will initialize code for CCS migration.
 *
 * Return: 0 on success or a negative error code on failure.
 */
int xe_sriov_late_init(struct xe_device *xe)
{
	int err = 0;

	if (IS_VF_CCS_INIT_NEEDED(xe))
		err = xe_sriov_vf_ccs_init(xe);

	return err;
}
Loading