Re: [PATCH v4 2/4] drm/xe/vf: Split submission config query helpers
Michal Wajdeczko <[email protected]> Wed, 5 Aug 2026 13:13:24 +0200
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
On 7/28/2026 11:50 AM, 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 <[email protected]> > Cc: Michal Wajdeczko <[email protected]> > --- > 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..e96515766081 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; > +} > + > +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) { hmm, this might be pre-existing issue, as any later change post probe time from 0 dbs to !0 is an unexpected config change > 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 config->num_dbs ? 0 : -ENODATA; the config with zero doorbells is still valid, so IMO we shouldn't abort here (doorbells are not required by VF to submit WLs, note that even xe is not using them today) > +} > + > +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)