All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/5] drm/xe/pf: Introduce helper functions for use by PF
Date: Wed, 10 Apr 2024 17:58:24 +0200	[thread overview]
Message-ID: <20240410155824.vgtz5a5bsbs2gbdf@intel.com> (raw)
In-Reply-To: <20240410123125.1155-3-michal.wajdeczko@intel.com>

Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on śro [2024-kwi-10 14:31:22 +0200]:
> PF driver will maintain VF's configuration data mostly on the
> GT level, but some internal data is located at the device level.
> 
> To allow easy access to that data from the GT level functions, and
> to minimize code duplications, introduce set of helper functions
> and macros for explicit use by the PF driver.
> 
> We will use these helpers in upcoming patches.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_helpers.h | 35 ++++++++++++++++
>  drivers/gpu/drm/xe/xe_sriov_pf_helpers.h    | 46 +++++++++++++++++++++
>  2 files changed, 81 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/xe_gt_sriov_pf_helpers.h
>  create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_helpers.h
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_helpers.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_helpers.h
> new file mode 100644
> index 000000000000..99472a48ec35
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_helpers.h
> @@ -0,0 +1,35 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023-2024 Intel Corporation
> + */
> +
> +#ifndef _XE_GT_SRIOV_PF_HELPERS_H_
> +#define _XE_GT_SRIOV_PF_HELPERS_H_
> +
> +#include "xe_gt_types.h"
> +#include "xe_sriov_pf_helpers.h"
> +
> +/**
> + * xe_sriov_pf_assert_vfid() - warn if &id is not a supported VF number when debugging.
> + * @gt: the PF &xe_gt to assert on
> + * @vfid: the VF number to assert
> + *
> + * Assert that &gt belongs to the Physical Function (PF) device and provided &vfid
> + * is within a range of supported VF numbers (up to maximum number of VFs that
> + * driver can support, including VF0 that represents the PF itself).
> + *
> + * Note: Effective only on debug builds. See `Xe ASSERTs`_ for more information.
> + */
> +#define xe_gt_sriov_pf_assert_vfid(gt, vfid)	xe_sriov_pf_assert_vfid(gt_to_xe(gt), (vfid))
> +
> +static inline int xe_gt_sriov_pf_get_totalvfs(struct xe_gt *gt)
> +{
> +	return xe_sriov_pf_get_totalvfs(gt_to_xe(gt));
> +}
> +
> +static inline struct mutex *xe_gt_sriov_pf_master_mutex(struct xe_gt *gt)
> +{
> +	return xe_sriov_pf_master_mutex(gt_to_xe(gt));
> +}
> +
> +#endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h b/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h
> new file mode 100644
> index 000000000000..7d156ba82479
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_helpers.h
> @@ -0,0 +1,46 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023-2024 Intel Corporation
> + */
> +
> +#ifndef _XE_SRIOV_PF_HELPERS_H_
> +#define _XE_SRIOV_PF_HELPERS_H_
> +
> +#include "xe_assert.h"
> +#include "xe_device_types.h"
> +#include "xe_sriov.h"
> +#include "xe_sriov_types.h"
> +
> +/**
> + * xe_sriov_pf_assert_vfid() - warn if &id is not a supported VF number when debugging.
> + * @xe: the PF &xe_device to assert on
> + * @vfid: the VF number to assert
> + *
> + * Assert that &xe represents the Physical Function (PF) device and provided &vfid
> + * is within a range of supported VF numbers (up to maximum number of VFs that
> + * driver can support, including VF0 that represents the PF itself).
> + *
> + * Note: Effective only on debug builds. See `Xe ASSERTs`_ for more information.
> + */
> +#define xe_sriov_pf_assert_vfid(xe, vfid) \
> +	xe_assert((xe), (vfid) <= xe_sriov_pf_get_totalvfs(xe))
> +
> +/**
> + * xe_sriov_pf_get_totalvfs() - Get maximum number of VFs that driver can support.
> + * @xe: the &xe_device to query (shall be PF)
> + *
> + * Return: Maximum number of VFs that this PF driver supports.
> + */
> +static inline int xe_sriov_pf_get_totalvfs(struct xe_device *xe)
> +{
> +	xe_assert(xe, IS_SRIOV_PF(xe));
> +	return xe->sriov.pf.driver_max_vfs;
> +}
> +
> +static inline struct mutex *xe_sriov_pf_master_mutex(struct xe_device *xe)
> +{
> +	xe_assert(xe, IS_SRIOV_PF(xe));
> +	return &xe->sriov.pf.master_lock;
> +}
> +
> +#endif

LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>

> -- 
> 2.43.0
> 

-- 

  reply	other threads:[~2024-04-10 15:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 12:31 [PATCH 0/5] PF: Add support to configure GuC SR-IOV policies Michal Wajdeczko
2024-04-10 12:31 ` [PATCH 1/5] drm/xe/pf: Introduce mutex to protect VFs configurations Michal Wajdeczko
2024-04-10 15:54   ` Piotr Piórkowski
2024-04-10 12:31 ` [PATCH 2/5] drm/xe/pf: Introduce helper functions for use by PF Michal Wajdeczko
2024-04-10 15:58   ` Piotr Piórkowski [this message]
2024-04-10 12:31 ` [PATCH 3/5] drm/xe/guc: Add PF2GUC_UPDATE_VGT_POLICY to ABI Michal Wajdeczko
2024-04-10 16:02   ` Piotr Piórkowski
2024-04-10 12:31 ` [PATCH 4/5] drm/xe/guc: Add helpers for GuC KLVs Michal Wajdeczko
2024-04-10 13:26   ` Ghimiray, Himal Prasad
2024-04-10 15:30   ` Piotr Piórkowski
2024-04-10 15:47     ` Michal Wajdeczko
2024-04-10 12:31 ` [PATCH 5/5] drm/xe/pf: Add support to configure GuC SR-IOV policies Michal Wajdeczko
2024-04-10 15:46   ` Piotr Piórkowski
2024-04-10 16:00     ` Michal Wajdeczko
2024-04-10 12:44 ` ✓ CI.Patch_applied: success for PF: " Patchwork
2024-04-10 12:45 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-10 12:45 ` ✓ CI.KUnit: success " Patchwork
2024-04-10 12:57 ` ✓ CI.Build: " Patchwork
2024-04-10 12:59 ` ✗ CI.Hooks: failure " Patchwork
2024-04-10 13:01 ` ✓ CI.checksparse: success " Patchwork
2024-04-10 13:27 ` ✓ CI.BAT: " Patchwork
2024-04-10 16:55 ` ✗ CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240410155824.vgtz5a5bsbs2gbdf@intel.com \
    --to=piotr.piorkowski@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.