[PATCH v4 3/6] drm/xe/pf: Move GGTT config KLVs encoding to helper
Piotr Piórkowski
piotr.piorkowski at intel.com
Tue Jul 15 07:06:03 UTC 2025
Michal Wajdeczko <michal.wajdeczko at intel.com> wrote on pią [2025-lip-11 21:33:13 +0200]:
> 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 <michal.wajdeczko at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 35 ++++++++++++++--------
> 1 file changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index e84fd44c6598..55afc5b06371 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -237,24 +237,33 @@ static struct xe_gt_sriov_config *pf_pick_vf_config(struct xe_gt *gt, unsigned i
> return >->sriov.pf.vfs[vfid].config;
> }
>
> +/* Return: number of configuration dwords written */
> +static u32 encode_ggtt(u32 *cfg, u64 start, u64 size, bool details)
> +{
> + u32 n = 0;
> +
> + if (details) {
> + cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_START);
> + cfg[n++] = lower_32_bits(start);
> + cfg[n++] = upper_32_bits(start);
> + }
> +
> + cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_SIZE);
> + cfg[n++] = lower_32_bits(size);
> + cfg[n++] = upper_32_bits(size);
> +
> + return n;
> +}
> +
> /* Return: number of configuration dwords written */
> static u32 encode_config_ggtt(u32 *cfg, const struct xe_gt_sriov_config *config, bool details)
> {
> - u32 n = 0;
> + struct xe_ggtt_node *node = config->ggtt_region;
>
> - if (xe_ggtt_node_allocated(config->ggtt_region)) {
> - if (details) {
> - cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_START);
> - cfg[n++] = lower_32_bits(config->ggtt_region->base.start);
> - cfg[n++] = upper_32_bits(config->ggtt_region->base.start);
> - }
> + if (!xe_ggtt_node_allocated(node))
> + return 0;
>
> - cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_SIZE);
> - cfg[n++] = lower_32_bits(config->ggtt_region->base.size);
> - cfg[n++] = upper_32_bits(config->ggtt_region->base.size);
> - }
> -
> - return n;
> + return encode_ggtt(cfg, node->base.start, node->base.size, details);
> }
LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
>
> /* Return: number of configuration dwords written */
> --
> 2.47.1
>
--
More information about the Intel-xe
mailing list