From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>,
<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v5 2/6] drm/xe/vf: Split submission config query helpers
Date: Tue, 11 Aug 2026 11:02:51 +0200 [thread overview]
Message-ID: <2a2b00af-e895-40d8-9345-47904a9bc34a@intel.com> (raw)
In-Reply-To: <20260810101428.1009573-10-satyanarayana.k.v.p@intel.com>
On 8/10/2026 12:14 PM, Satyanarayana K V P wrote:
> Refactor vf_get_submission_cfg() into separate vf_get_ctxs_cfg()
> and vf_get_dbs_cfg() functions which allows independent error
> handling and validation for each resource, and improves testability.
>
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
with small nit below
> ---
> V4 -> V5:
> - Allow zero DBs are valid configuration (Michal W).
>
> V3 -> V4:
> - Removed coverage for more error scenarios. (Michal W).
> - Updated fucntion names. (Michal W)
> - Added error scenarios in new commit.
> - Updated commit message.
>
> V2 -> V3:
> - Added coverage for more error scenarios.
> ---
> drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 49 +++++++++++++++++++++++------
> 1 file changed, 40 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> index 37899fcf5b22..339ea0d3344c 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> @@ -568,11 +568,11 @@ static int vf_get_lmem_info(struct xe_gt *gt)
> return size ? 0 : -ENODATA;
> }
>
> -static int vf_get_submission_cfg(struct xe_gt *gt)
> +static int vf_get_ctxs_cfg(struct xe_gt *gt)
> {
> struct xe_gt_sriov_vf_selfconfig *config = >->sriov.vf.self_config;
> struct xe_guc *guc = >->uc.guc;
> - u32 num_ctxs, num_dbs;
> + u32 num_ctxs;
> int err;
>
> xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
> @@ -581,27 +581,58 @@ static int vf_get_submission_cfg(struct xe_gt *gt)
> if (unlikely(err))
> return err;
>
> - err = guc_action_query_single_klv32(guc, GUC_KLV_VF_CFG_NUM_DOORBELLS_KEY, &num_dbs);
> - if (unlikely(err))
> - return err;
> -
> if (config->num_ctxs && config->num_ctxs != num_ctxs) {
> xe_gt_sriov_err(gt, "Unexpected CTXs reassignment: %u != %u\n",
> num_ctxs, config->num_ctxs);
> return -EREMCHG;
> }
> +
> + xe_gt_sriov_dbg_verbose(gt, "CTXs %u\n", num_ctxs);
> +
> + config->num_ctxs = num_ctxs;
> +
> + return config->num_ctxs ? 0 : -ENODATA;
nit: we can now code all this as:
if (!num_ctxs) {
xe_gt_sriov_err(gt, "No CTXs assigned!\n");
return -ENODATA;
}
xe_gt_sriov_dbg_verbose(gt, "CTXs %u\n", num_ctxs);
config->num_ctxs = num_ctxs;
return 0;
but we can postpone that until we will be forced to switch to SIGID
> +}
> +
> +static int vf_get_dbs_cfg(struct xe_gt *gt)
> +{
> + struct xe_gt_sriov_vf_selfconfig *config = >->sriov.vf.self_config;
> + struct xe_guc *guc = >->uc.guc;
> + u32 num_dbs;
> + int err;
> +
> + xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
> +
> + err = guc_action_query_single_klv32(guc, GUC_KLV_VF_CFG_NUM_DOORBELLS_KEY, &num_dbs);
> + if (unlikely(err))
> + return err;
> +
> if (config->num_dbs && config->num_dbs != num_dbs) {
> xe_gt_sriov_err(gt, "Unexpected DBs reassignment: %u != %u\n",
> num_dbs, config->num_dbs);
> return -EREMCHG;
> }
>
> - xe_gt_sriov_dbg_verbose(gt, "CTXs %u DBs %u\n", num_ctxs, num_dbs);
> + xe_gt_sriov_dbg_verbose(gt, "DBs %u\n", num_dbs);
>
> - config->num_ctxs = num_ctxs;
> config->num_dbs = num_dbs;
>
> - return config->num_ctxs ? 0 : -ENODATA;
> + return 0;
> +}
> +
> +static int vf_get_submission_cfg(struct xe_gt *gt)
> +{
> + int err;
> +
> + err = vf_get_ctxs_cfg(gt);
> + if (unlikely(err))
> + return err;
> +
> + err = vf_get_dbs_cfg(gt);
> + if (unlikely(err))
> + return err;
> +
> + return 0;
> }
>
> static void vf_cache_gmdid(struct xe_gt *gt)
next prev parent reply other threads:[~2026-08-11 9:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 10:14 [PATCH v5 0/6] KUnit test for VF provisioning error handling Satyanarayana K V P
2026-08-10 10:14 ` [PATCH v5 1/6] drm/xe/guc: Allow to replace xe_guc_mmio_send_recv() with KUNIT stub Satyanarayana K V P
2026-08-11 8:54 ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 2/6] drm/xe/vf: Split submission config query helpers Satyanarayana K V P
2026-08-11 9:02 ` Michal Wajdeczko [this message]
2026-08-10 10:14 ` [PATCH v5 3/6] drm/xe/vf: Add bounds checking for queried context and doorbell counts Satyanarayana K V P
2026-08-11 9:04 ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 4/6] drm/xe/vf: Add bounds checking for queried GGTT base and size Satyanarayana K V P
2026-08-11 9:43 ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 5/6] drm/xe/vf: Add bounds checking for queried VRAM size Satyanarayana K V P
2026-08-11 9:48 ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 6/6] drm/xe/tests: Add KUnit tests for VF provisioning error handling Satyanarayana K V P
2026-08-11 10:12 ` Michal Wajdeczko
2026-08-10 10:18 ` ✗ CI.checkpatch: warning for KUnit test for VF provisioning error handling (rev5) Patchwork
2026-08-10 10:19 ` ✓ CI.KUnit: success " Patchwork
2026-08-10 11:01 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-10 13:16 ` ✗ Xe.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=2a2b00af-e895-40d8-9345-47904a9bc34a@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=satyanarayana.k.v.p@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.