From: "Purkait, Soham" <soham.purkait@intel.com>
To: Karthik Poosa <karthik.poosa@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: <rodrigo.vivi@intel.com>, <anshuman.gupta@intel.com>,
<badal.nilawar@intel.com>, <raag.jadav@intel.com>,
<riana.tauro@intel.com>, <sk.anirban@intel.com>,
<mallesh.koujalagi@intel.com>,
<ravi.kishore.koppuravuri@intel.com>
Subject: Re: [PATCH v5 03/10] drm/xe/pcode: Add ordered write batch helper
Date: Mon, 30 Nov 2026 16:03:35 +0530 [thread overview]
Message-ID: <e09f3582-2502-4459-a37c-dd5a465f7978@intel.com> (raw)
In-Reply-To: <20261128055923.3316956-4-karthik.poosa@intel.com>
Hi Karthik,
On 28-11-2026 11:29, Karthik Poosa wrote:
> Add a pcode helper that issues an ordered sequence of mailbox writes
> while holding the pcode lock, so no other mailbox command can be
> interleaved.
But why pcode needs that here ? kindly do mention the same here.
>
> This will be used to write fan tables atomically with respect to other
> pcode users.
>
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pcode.c | 39 +++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_pcode.h | 12 +++++++++++
> 2 files changed, 51 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
> index fa9f45d565cb..409b9ff372e9 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.c
> +++ b/drivers/gpu/drm/xe/xe_pcode.c
> @@ -124,6 +124,45 @@ int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 data, int timeout
> return err;
> }
>
> +/**
> + * xe_pcode_write_batch - issue pcode writes in order under the mailbox lock
> + * @tile: tile
> + * @writes: mailbox/data pairs to write
> + * @count: number of entries in @writes
> + *
> + * Holds the pcode lock across all writes so no other mailbox command can be
> + * interleaved; the lock may be held for up to @count * PCODE_DEFAULT_TIMEOUT_MS.
Ditto.
> + * Stops at the first failure; earlier writes are not reverted.
> + *
> + * Return: 0 on success, negative error code otherwise.
> + */
> +int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
> + unsigned int count)
> +{
> + unsigned int i;
> + int err = 0;
> +
> + if (!count)
> + return -EINVAL;
Any log required to mention the specific reason ?
Regards,
Soham
> +
> + mutex_lock(&tile->pcode.lock);
> + for (i = 0; i < count; i++) {
> + u32 data = writes[i].data;
> +
> + err = pcode_mailbox_rw(tile, writes[i].mbox, &data, NULL, PCODE_DEFAULT_TIMEOUT_MS,
> + false, false);
> + if (err) {
> + xe_err(tile_to_xe(tile),
> + "pcode batch write %u/%u failed: mbox 0x%08x data 0x%08x, ret %pe\n",
> + i + 1, count, writes[i].mbox, writes[i].data, ERR_PTR(err));
> + break;
> + }
> + }
> + mutex_unlock(&tile->pcode.lock);
> +
> + return err;
> +}
> +
> int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0, u32 data1, int timeout)
> {
> int err;
> diff --git a/drivers/gpu/drm/xe/xe_pcode.h b/drivers/gpu/drm/xe/xe_pcode.h
> index 7e43792b0037..c601a12baba6 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.h
> +++ b/drivers/gpu/drm/xe/xe_pcode.h
> @@ -18,6 +18,16 @@ struct xe_pcode_version {
> u32 engg;
> };
>
> +/**
> + * struct xe_pcode_write - single pcode mailbox write
> + * @mbox: mailbox command
> + * @data: value written to PCODE_DATA0
> + */
> +struct xe_pcode_write {
> + u32 mbox;
> + u32 data;
> +};
> +
> #define PCODE_DEFAULT_TIMEOUT_MS 10
>
> int xe_pcode_init_early(struct xe_tile *tile);
> @@ -28,6 +38,8 @@ int xe_pcode_init_min_freq_table(struct xe_tile *tile, u32 min_gt_freq,
> int xe_pcode_read(struct xe_tile *tile, u32 mbox, u32 *val0, u32 *val1);
> int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 val,
> int timeout_ms);
> +int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
> + unsigned int count);
> int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0,
> u32 data1, int timeout);
> int xe_get_pcode_version(struct xe_device *xe, struct xe_pcode_version *version);
next prev parent reply other threads:[~2026-11-30 10:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 5:59 [PATCH v5 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
2026-11-28 5:59 ` [PATCH v5 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
2026-11-30 9:49 ` Purkait, Soham
2026-11-30 11:41 ` Poosa, Karthik
2026-11-28 5:59 ` [PATCH v5 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-11-28 5:59 ` [PATCH v5 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
2026-11-28 6:04 ` sashiko-bot
2026-11-30 10:33 ` Purkait, Soham [this message]
2026-11-28 5:59 ` [PATCH v5 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
2026-11-30 11:51 ` Purkait, Soham
2026-11-30 12:47 ` Poosa, Karthik
2026-11-28 5:59 ` [PATCH v5 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
2026-11-28 6:13 ` sashiko-bot
2026-11-30 11:27 ` Poosa, Karthik
2026-11-30 14:27 ` Poosa, Karthik
2026-11-30 14:29 ` Purkait, Soham
2026-11-28 5:59 ` [PATCH v5 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
2026-11-28 6:10 ` sashiko-bot
2026-11-30 16:11 ` Poosa, Karthik
2026-11-28 5:59 ` [PATCH v5 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
2026-11-28 6:15 ` sashiko-bot
2026-11-28 5:59 ` [PATCH v5 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
2026-11-28 6:27 ` sashiko-bot
2026-11-30 15:55 ` Purkait, Soham
2026-11-28 5:59 ` [PATCH v5 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
2026-11-28 6:12 ` sashiko-bot
2026-11-30 16:31 ` Purkait, Soham
2026-11-28 5:59 ` [PATCH v5 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
2026-11-30 16:44 ` Purkait, Soham
2026-11-28 6:14 ` ✗ CI.KUnit: failure for drm/xe/hwmon: Add fan control support (rev2) 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=e09f3582-2502-4459-a37c-dd5a465f7978@intel.com \
--to=soham.purkait@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=karthik.poosa@intel.com \
--cc=mallesh.koujalagi@intel.com \
--cc=raag.jadav@intel.com \
--cc=ravi.kishore.koppuravuri@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=sk.anirban@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.