[PATCH 3/6] drm/xe/vf: Obtain value of GMDID register from GuC
Matt Roper
matthew.d.roper at intel.com
Thu May 23 20:52:06 UTC 2024
On Thu, May 23, 2024 at 09:22:37PM +0200, Michal Wajdeczko wrote:
> VFs don't have access to the GMDID register and must obtain it
> value using GuC VF ABI KLV query. Add function for doing that.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 29 +++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_gt_sriov_vf.h | 1 +
> 2 files changed, 30 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> index 237486a80fb5..5b8771f831f7 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> @@ -284,6 +284,35 @@ static int guc_action_query_single_klv64(struct xe_guc *guc, u32 key, u64 *value
> return 0;
> }
>
> +/**
> + * xe_gt_sriov_vf_gmdid - Query GMDID over MMIO.
> + * @gt: the &xe_gt
> + *
> + * This function is for VF use only.
> + *
> + * Return: value of GMDID KLV on success or 0 on failure.
> + */
> +u32 xe_gt_sriov_vf_gmdid(struct xe_gt *gt)
> +{
> + const char *type = xe_gt_is_media_type(gt) ? "media" : "graphics";
> + struct xe_guc *guc = >->uc.guc;
> + u32 value;
> + int err;
> +
> + xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
> + xe_gt_assert(gt, gt->sriov.vf.guc_version.major > 1 || gt->sriov.vf.guc_version.minor >= 2);
> +
> + err = guc_action_query_single_klv32(guc, GUC_KLV_GLOBAL_CFG_GMD_ID_KEY, &value);
> + if (unlikely(err)) {
> + xe_gt_sriov_err(gt, "Failed to obtain %s GMDID (%pe)\n",
> + type, ERR_PTR(err));
> + return 0;
> + }
> +
> + xe_gt_sriov_dbg(gt, "%s GMDID = %#x\n", type, value);
> + return value;
> +}
> +
> static int vf_get_ggtt_info(struct xe_gt *gt)
> {
> struct xe_gt_sriov_vf_selfconfig *config = >->sriov.vf.self_config;
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.h b/drivers/gpu/drm/xe/xe_gt_sriov_vf.h
> index be69c1025320..0391ed72a570 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.h
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.h
> @@ -17,6 +17,7 @@ int xe_gt_sriov_vf_query_config(struct xe_gt *gt);
> int xe_gt_sriov_vf_connect(struct xe_gt *gt);
> int xe_gt_sriov_vf_query_runtime(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);
> u32 xe_gt_sriov_vf_read32(struct xe_gt *gt, struct xe_reg reg);
>
> --
> 2.43.0
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list