From: Raag Jadav <raag.jadav@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-xe@lists.freedesktop.org,
Stuart Summers <stuart.summers@intel.com>,
Matt Roper <matthew.d.roper@intel.com>,
Riana Tauro <riana.tauro@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>
Subject: Re: [PATCH v3 4/6] drm/xe/configfs: Allow to select by class only
Date: Tue, 9 Sep 2025 12:27:01 +0200 [thread overview]
Message-ID: <aMAA9V14iZqHK8fz@black.igk.intel.com> (raw)
In-Reply-To: <20250905-wa-bb-cmds-v3-4-3da2b7bdc73e@intel.com>
On Fri, Sep 05, 2025 at 10:50:32PM -0700, Lucas De Marchi wrote:
> For a future configfs attribute, it's desirable to select by engine mask
> only as the instance doesn't make sense.
>
> Rename the function lookup_engine_mask() to lookup_engine_info() and
> make it return the entry. This allows parse_engine() to still return an
> item if the caller wants to allow parsing a class-only string like
> "rcs", "bcs", "ccs", etc.
...
> -static bool lookup_engine_mask(const char *pattern, u64 *mask)
> +/*
> + * Lookup engine_info. If @mask is not NULL, reduce the mask according to the
> + * instance in @pattern.
> + *
> + * Examples of inputs:
> + * - lookup_engine_info("rcs0", &mask): return "rcs" entry from @engine_info and
> + * mask == BIT_ULL(XE_HW_ENGINE_RCS0)
> + * - lookup_engine_info("rcs*", &mask): return "rcs" entry from @engine_info and
> + * mask == XE_HW_ENGINE_RCS_MASK
> + * - lookup_engine_info("rcs", NULL): return "rcs" entry from @engine_info
> + */
> +static const struct engine_info *lookup_engine_info(const char *pattern, u64 *mask)
Now that we're returning engine_info, I'm wondering if we have any use for
mask parameter?
Raag
> {
> for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) {
> u8 instance;
> @@ -263,29 +275,33 @@ static bool lookup_engine_mask(const char *pattern, u64 *mask)
> continue;
>
> pattern += strlen(engine_info[i].cls);
> + if (!mask && !*pattern)
> + return &engine_info[i];
>
> if (!strcmp(pattern, "*")) {
> *mask = engine_info[i].mask;
> - return true;
> + return &engine_info[i];
> }
>
> if (kstrtou8(pattern, 10, &instance))
> - return false;
> + return NULL;
>
> bit = __ffs64(engine_info[i].mask) + instance;
> if (bit >= fls64(engine_info[i].mask))
> - return false;
> + return NULL;
>
> *mask = BIT_ULL(bit);
> - return true;
> + return &engine_info[i];
> }
>
> - return false;
> + return NULL;
> }
next prev parent reply other threads:[~2025-09-09 10:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-06 5:50 [PATCH v3 0/6] drm/xe: Add user commands to WA BB via configfs Lucas De Marchi
2025-09-06 5:50 ` [PATCH v3 1/6] drm/xe: Update workaround documentation Lucas De Marchi
2025-09-06 5:50 ` [PATCH v3 2/6] drm/xe/configfs: Fix documentation warning Lucas De Marchi
2025-09-06 5:50 ` [PATCH v3 3/6] drm/xe/configfs: Extract function to parse engine Lucas De Marchi
2025-09-06 5:50 ` [PATCH v3 4/6] drm/xe/configfs: Allow to select by class only Lucas De Marchi
2025-09-09 10:27 ` Raag Jadav [this message]
2025-09-09 12:42 ` Lucas De Marchi
2025-09-09 17:22 ` Raag Jadav
2025-09-06 5:50 ` [PATCH v3 5/6] drm/xe/lrc: Allow to add user commands on context switch Lucas De Marchi
2025-09-06 5:50 ` [PATCH v3 6/6] drm/xe/configfs: Add post context restore bb Lucas De Marchi
2025-09-08 22:39 ` Matt Roper
2025-09-09 12:56 ` Lucas De Marchi
2025-09-08 19:46 ` ✗ CI.checkpatch: warning for drm/xe: Add user commands to WA BB via configfs Patchwork
2025-09-08 19:47 ` ✓ CI.KUnit: success " Patchwork
2025-09-08 20:27 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-08 23:55 ` ✗ 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=aMAA9V14iZqHK8fz@black.igk.intel.com \
--to=raag.jadav@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=stuart.summers@intel.com \
--cc=tursulin@ursulin.net \
--cc=umesh.nerlige.ramappa@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox