drivers/gpu/drm/xe/xe_sriov_pf_provision.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_sriov_pf_provision.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/xe_sriov_pf_provision.c
Extension
.c
Size
14560 bytes
Lines
573
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (xe_sriov_pf_num_vfs(xe)) {
			xe_sriov_dbg(xe, "can't restore %s: VFs must be disabled!\n",
				     mode_to_string(mode));
			return -EBUSY;
		}
		pf_unprovision_all_vfs(xe);
	}

	xe_sriov_dbg(xe, "mode %s changed to %s by %ps\n",
		     mode_to_string(xe->sriov.pf.provision.mode),
		     mode_to_string(mode), __builtin_return_address(0));
	xe->sriov.pf.provision.mode = mode;
	return 0;
}

/**
 * xe_sriov_pf_provision_bulk_apply_eq() - Change execution quantum for all VFs and PF.
 * @xe: the PF &xe_device
 * @eq: execution quantum in [ms] to set
 *
 * Change execution quantum (EQ) provisioning on all tiles/GTs.
 *
 * This function can only be called on PF.
 *
 * Return: 0 on success or a negative error code on failure.
 */
int xe_sriov_pf_provision_bulk_apply_eq(struct xe_device *xe, u32 eq)
{
	struct xe_gt *gt;
	unsigned int id;
	int result = 0;
	int err;

	guard(mutex)(xe_sriov_pf_master_mutex(xe));

	for_each_gt(gt, xe, id) {
		err = xe_gt_sriov_pf_config_bulk_set_exec_quantum_locked(gt, eq);
		result = result ?: err;
	}

	return result;
}

/**
 * xe_sriov_pf_provision_apply_vf_eq() - Change VF's execution quantum.
 * @xe: the PF &xe_device
 * @vfid: the VF identifier
 * @eq: execution quantum in [ms] to set
 *
 * Change VF's execution quantum (EQ) provisioning on all tiles/GTs.
 *
 * This function can only be called on PF.
 *
 * Return: 0 on success or a negative error code on failure.
 */
int xe_sriov_pf_provision_apply_vf_eq(struct xe_device *xe, unsigned int vfid, u32 eq)
{
	struct xe_gt *gt;
	unsigned int id;
	int result = 0;
	int err;

	guard(mutex)(xe_sriov_pf_master_mutex(xe));

	for_each_gt(gt, xe, id) {
		err = xe_gt_sriov_pf_config_set_exec_quantum_locked(gt, vfid, eq);
		result = result ?: err;
	}

	return result;
}

static int pf_report_unclean(struct xe_gt *gt, unsigned int vfid,
			     const char *what, u32 found, u32 expected)
{
	char name[8];

	xe_sriov_dbg(gt_to_xe(gt), "%s on GT%u has %s=%u (expected %u)\n",
		     xe_sriov_function_name(vfid, name, sizeof(name)),
		     gt->info.id, what, found, expected);
	return -EUCLEAN;
}

/**
 * xe_sriov_pf_provision_query_vf_eq() - Query VF's execution quantum.
 * @xe: the PF &xe_device
 * @vfid: the VF identifier
 * @eq: placeholder for the returned execution quantum in [ms]
 *
 * Query VF's execution quantum (EQ) provisioning from all tiles/GTs.

Annotation

Implementation Notes