// SPDX-License-Identifier: MIT /* * Copyright © 2023-2024 Intel Corporation */ #include "abi/guc_actions_sriov_abi.h" #include "xe_bo.h" #include "xe_gt.h" #include "xe_gt_sriov_pf_helpers.h" #include "xe_gt_sriov_pf_policy.h" #include "xe_gt_sriov_printk.h" #include "xe_guc_ct.h" #include "xe_guc_klv_helpers.h" #include "xe_pm.h" /* * Return: number of KLVs that were successfully parsed and saved, * negative error code on failure. */ static int guc_action_update_vgt_policy(struct xe_guc *guc, u64 addr, u32 size) { … } /* * Return: number of KLVs that were successfully parsed and saved, * negative error code on failure. */ static int pf_send_policy_klvs(struct xe_gt *gt, const u32 *klvs, u32 num_dwords) { … } /* * Return: 0 on success, -ENOKEY if some KLVs were not updated, -EPROTO if reply was malformed, * negative error code on failure. */ static int pf_push_policy_klvs(struct xe_gt *gt, u32 num_klvs, const u32 *klvs, u32 num_dwords) { … } static int pf_push_policy_u32(struct xe_gt *gt, u16 key, u32 value) { … } static int pf_update_policy_bool(struct xe_gt *gt, u16 key, bool *policy, bool value) { … } static int pf_update_policy_u32(struct xe_gt *gt, u16 key, u32 *policy, u32 value) { … } static int pf_provision_sched_if_idle(struct xe_gt *gt, bool enable) { … } static int pf_reprovision_sched_if_idle(struct xe_gt *gt) { … } static void pf_sanitize_sched_if_idle(struct xe_gt *gt) { … } /** * xe_gt_sriov_pf_policy_set_sched_if_idle - Control the 'sched_if_idle' policy. * @gt: the &xe_gt where to apply the policy * @enable: the value of the 'sched_if_idle' policy * * This function can only be called on PF. * * Return: 0 on success or a negative error code on failure. */ int xe_gt_sriov_pf_policy_set_sched_if_idle(struct xe_gt *gt, bool enable) { … } /** * xe_gt_sriov_pf_policy_get_sched_if_idle - Retrieve value of 'sched_if_idle' policy. * @gt: the &xe_gt where to read the policy from * * This function can only be called on PF. * * Return: value of 'sched_if_idle' policy. */ bool xe_gt_sriov_pf_policy_get_sched_if_idle(struct xe_gt *gt) { … } static int pf_provision_reset_engine(struct xe_gt *gt, bool enable) { … } static int pf_reprovision_reset_engine(struct xe_gt *gt) { … } static void pf_sanitize_reset_engine(struct xe_gt *gt) { … } /** * xe_gt_sriov_pf_policy_set_reset_engine - Control the 'reset_engine' policy. * @gt: the &xe_gt where to apply the policy * @enable: the value of the 'reset_engine' policy * * This function can only be called on PF. * * Return: 0 on success or a negative error code on failure. */ int xe_gt_sriov_pf_policy_set_reset_engine(struct xe_gt *gt, bool enable) { … } /** * xe_gt_sriov_pf_policy_get_reset_engine - Retrieve value of 'reset_engine' policy. * @gt: the &xe_gt where to read the policy from * * This function can only be called on PF. * * Return: value of 'reset_engine' policy. */ bool xe_gt_sriov_pf_policy_get_reset_engine(struct xe_gt *gt) { … } static int pf_provision_sample_period(struct xe_gt *gt, u32 value) { … } static int pf_reprovision_sample_period(struct xe_gt *gt) { … } static void pf_sanitize_sample_period(struct xe_gt *gt) { … } /** * xe_gt_sriov_pf_policy_set_sample_period - Control the 'sample_period' policy. * @gt: the &xe_gt where to apply the policy * @value: the value of the 'sample_period' policy * * This function can only be called on PF. * * Return: 0 on success or a negative error code on failure. */ int xe_gt_sriov_pf_policy_set_sample_period(struct xe_gt *gt, u32 value) { … } /** * xe_gt_sriov_pf_policy_get_sample_period - Retrieve value of 'sample_period' policy. * @gt: the &xe_gt where to read the policy from * * This function can only be called on PF. * * Return: value of 'sample_period' policy. */ u32 xe_gt_sriov_pf_policy_get_sample_period(struct xe_gt *gt) { … } static void pf_sanitize_guc_policies(struct xe_gt *gt) { … } /** * xe_gt_sriov_pf_policy_sanitize - Reset policy settings. * @gt: the &xe_gt * * This function can only be called on PF. * * Return: 0 on success or a negative error code on failure. */ void xe_gt_sriov_pf_policy_sanitize(struct xe_gt *gt) { … } /** * xe_gt_sriov_pf_policy_reprovision - Reprovision (and optionally reset) policy settings. * @gt: the &xe_gt * @reset: if true will reprovision using default values instead of latest * * This function can only be called on PF. * * Return: 0 on success or a negative error code on failure. */ int xe_gt_sriov_pf_policy_reprovision(struct xe_gt *gt, bool reset) { … } static void print_guc_policies(struct drm_printer *p, struct xe_gt_sriov_guc_policies *policy) { … } /** * xe_gt_sriov_pf_policy_print - Dump actual policy values. * @gt: the &xe_gt where to read the policy from * @p: the &drm_printer * * This function can only be called on PF. * * Return: 0 on success or a negative error code on failure. */ int xe_gt_sriov_pf_policy_print(struct xe_gt *gt, struct drm_printer *p) { … }