intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Badal Nilawar <badal.nilawar@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	anshuman.gupta@intel.com, rodrigo.vivi@intel.com,
	alexander.usyskin@intel.com, gregkh@linuxfoundation.org,
	daniele.ceraolospurio@intel.com
Subject: Re: [RFC 9/9] {fwctl,drm}/xe/pcode: Introduce xe_pcode_fwctl
Date: Tue, 6 May 2025 15:13:53 -0300	[thread overview]
Message-ID: <20250506181353.GA89958@nvidia.com> (raw)
In-Reply-To: <20250429160956.1014376-10-badal.nilawar@intel.com>

On Tue, Apr 29, 2025 at 09:39:56PM +0530, Badal Nilawar wrote:

> diff --git a/drivers/gpu/drm/xe/xe_pcode_fwctl.c b/drivers/gpu/drm/xe/xe_pcode_fwctl.c
> new file mode 100644

I really do prefer it if you can find a way to put the code in
drivers/fwctl instead of in DRM subsystem.
> +static int xe_pcode_fwctl_uctx_open(struct fwctl_uctx *uctx)
> +{
> +	struct xe_pcode_fwctl_dev *fwctl_dev =
> +		container_of(uctx->fwctl, struct xe_pcode_fwctl_dev, fwctl);
> +	struct xe_device *xe = fwctl_dev->xe;
> +
> +	xe_pm_runtime_get(xe);

Shouldn't this be in the RPC function? Why keep the device awake as
long as a the FD is open?

> +static void *xe_pcode_fwctl_rpc(struct fwctl_uctx *uctx,
> +				enum fwctl_rpc_scope scope,
> +				void *in, size_t in_len, size_t *out_len)
> +{
> +	struct xe_pcode_fwctl_dev *fwctl_dev =
> +		container_of(uctx->fwctl, struct xe_pcode_fwctl_dev, fwctl);
> +	struct xe_tile *root_tile = xe_device_get_root_tile(fwctl_dev->xe);
> +	struct fwctl_rpc_xe_pcode *rpc = in;
> +	int err;
> +
> +	if (in_len != sizeof(struct fwctl_rpc_xe_pcode) ||
> +	    *out_len != sizeof(struct fwctl_rpc_xe_pcode))
> +		return ERR_PTR(-EMSGSIZE);
> +
> +	if (!xe_pcode_fwctl_rpc_validate(rpc, scope))
> +		return ERR_PTR(-EBADMSG);

There should be an EPERM here if the scope is not good enough..
> +/**
> + * struct fwctl_rpc_xe_pcode - FWCTL Remote Procedure Calls for Xe PCODE
> + */
> +struct fwctl_rpc_xe_pcode {
> +	/** @command: The main Mailbox command */
> +	__u8 command;
> +	/** @param1: A subcommand or a parameter of the main command */
> +	__u16 param1;
> +	/** @param2: A parameter of a subcommand or a subsubcommand */
> +	__u16 param2;
> +	/** @data0: The first 32 bits of data. In general data-in as param */
> +	__u32 data0;
> +	/** @data1: The other 32 bits of data. In general data-out */
> +	__u32 data1;
> +	/** @pad: Padding the uAPI struct - Must be 0. Not sent to firmware */
> +	__u8 pad[3];
> +};

This has implicit padding? Make the padding explicit or use packed..
> +/**
> + * DOC: Late Binding Commands
> + *
> + * FWCTL info.uctx_caps: FWCTL_XE_PCODE_LATEBINDING
> + * FWCTL rpc.scope: FWCTL_RPC_CONFIGURATION
> + *
> + * Command	0x5C - LATE_BINDING
> + * Param1	0x0 - GET_CAPABILITY_STATUS
> + * Param2	0
> + * Data in	None
> + * Data out:
> + *
> + *  - Bit0: ate binding for V1 Fan Tables is supported.

"ate" is a typo?

This seems fine, though very simple in what it can do. Do you imagine
more commands down the road?

Jason

  parent reply	other threads:[~2025-05-06 18:14 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 16:09 [RFC 0/9] Introducing firmware late binding Badal Nilawar
2025-04-29 16:09 ` [RFC 1/9] mei: bus: add mei_cldev_mtu interface Badal Nilawar
2025-04-29 16:09 ` [RFC 2/9] mei: late_bind: add late binding component driver Badal Nilawar
2025-05-07 22:42   ` Daniele Ceraolo Spurio
2025-05-08  5:41     ` Usyskin, Alexander
2025-06-03 12:01       ` Nilawar, Badal
2025-04-29 16:09 ` [RFC 3/9] drm/xe/late_bind_fw: Introducing late_bind_fw Badal Nilawar
2025-05-07 21:38   ` Daniele Ceraolo Spurio
2025-06-03 13:52     ` Nilawar, Badal
2025-04-29 16:09 ` [RFC 4/9] drm/xe/xe_late_bind_fw: Initialize late binding firmware Badal Nilawar
2025-05-07 23:11   ` Daniele Ceraolo Spurio
2025-06-03 13:57     ` Nilawar, Badal
2025-04-29 16:09 ` [RFC 5/9] drm/xe/xe_late_bind_fw: Load " Badal Nilawar
2025-05-07 23:44   ` Daniele Ceraolo Spurio
2025-06-04  5:36     ` Nilawar, Badal
2025-04-29 16:09 ` [RFC 6/9] drm/xe/xe_late_bind_fw: Reload late binding fw in rpm resume Badal Nilawar
2025-04-29 16:09 ` [RFC 7/9] drm/xe/xe_late_bind_fw: Reload late binding fw in S2Idle/S3 resume Badal Nilawar
2025-04-29 16:09 ` [RFC 8/9] drm/xe/xe_late_bind_fw: Introduce debug fs node to disable late binding Badal Nilawar
2025-04-29 16:09 ` [RFC 9/9] {fwctl,drm}/xe/pcode: Introduce xe_pcode_fwctl Badal Nilawar
2025-05-01 15:44   ` Rodrigo Vivi
2025-05-06 18:13   ` Jason Gunthorpe [this message]
2025-05-07 19:49     ` Rodrigo Vivi
2025-05-07 22:04       ` Jason Gunthorpe
2025-08-22 19:33         ` Rodrigo Vivi
2025-08-28 12:48           ` Jason Gunthorpe
2025-06-06 13:47       ` Nilawar, Badal
2025-06-06 13:45     ` Nilawar, Badal
2025-06-30 22:01     ` Rodrigo Vivi
2025-06-30 22:45       ` Jason Gunthorpe
2025-04-29 16:13 ` ✓ CI.Patch_applied: success for Introducing firmware late binding (rev2) Patchwork
2025-04-29 16:14 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-29 16:15 ` ✓ CI.KUnit: success " Patchwork
2025-04-29 16:23 ` ✓ CI.Build: " Patchwork
2025-04-29 16:26 ` ✗ CI.Hooks: failure " Patchwork
2025-04-29 16:27 ` ✗ CI.checksparse: warning " Patchwork
2025-04-29 19:02 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-30 11:47 ` [RFC 0/9] Introducing firmware late binding Jani Nikula
2025-05-06  7:53 ` ✗ Xe.CI.BAT: failure for Introducing firmware late binding (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-04-29  7:37 [RFC 0/9] Introducing firmware late binding Badal Nilawar
2025-04-29  7:38 ` [RFC 9/9] {fwctl,drm}/xe/pcode: Introduce xe_pcode_fwctl Badal Nilawar

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=20250506181353.GA89958@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alexander.usyskin@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@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;
as well as URLs for NNTP newsgroup(s).