Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Teres Alexis, Alan Previn" <alan.previn.teres.alexis@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>
Subject: Re: [PATCH v2 1/2] drm/xe/gsc: Initialize GSC proxy
Date: Thu, 11 Jan 2024 20:02:16 +0000	[thread overview]
Message-ID: <b0319900c4578281f980b054c3e817df9e943f41.camel@intel.com> (raw)
In-Reply-To: <20240110004416.1127942-2-daniele.ceraolospurio@intel.com>

On Tue, 2024-01-09 at 16:44 -0800, Daniele Ceraolo Spurio wrote:
> The GSC uC needs to communicate with the CSME to perform certain
> operations. Since the GSC can't perform this communication directly on

alan:snip


> +static int proxy_query(struct xe_gsc *gsc)
> +{
> +	struct xe_gt *gt = gsc_to_gt(gsc);
> +	struct xe_device *xe = gt_to_xe(gt);
> +	struct xe_gsc_proxy_header *to_csme_hdr = gsc->proxy.to_csme;
> +	void *to_csme_payload = gsc->proxy.to_csme + PROXY_HDR_SIZE;
> +	u32 wr_offset;
> +	u32 reply_offset;
> +	u32 size;
> +	int ret;
> +
> +	wr_offset = xe_gsc_emit_header(xe, &gsc->proxy.to_gsc, 0,
> +				       HECI_MEADDRESS_PROXY, 0, PROXY_HDR_SIZE);
> +	wr_offset = emit_proxy_header(xe, &gsc->proxy.to_gsc, wr_offset);
> +
> +	size = wr_offset;
> +
> +	while (1) {
> +		/*
> +		 * Poison the GSC response header space to make sure we don't
> +		 * read a stale reply.
> +		 */
> +		xe_gsc_poison_header(xe, &gsc->proxy.from_gsc, 0);
> +
> +		/* send proxy message to GSC */
> +		ret = proxy_send_to_gsc(gsc, size);
> +		if (ret)
> +			goto proxy_error;
> +
> +		/* check the reply from GSC */
> +		ret = xe_gsc_read_out_header(xe, &gsc->proxy.from_gsc, 0,
> +					     PROXY_HDR_SIZE, &reply_offset);
> +		if (ret) {
> +			xe_gt_err(gt, "Invalid gsc header in proxy reply (%pe)\n",
> +				  ERR_PTR(ret));
> +			goto proxy_error;
> +		}
> +
> +		/* copy the proxy header reply from GSC */
> +		xe_map_memcpy_from(xe, to_csme_hdr, &gsc->proxy.from_gsc,
> +				   reply_offset, PROXY_HDR_SIZE);
> +
> +		/* stop if this was the last message */
> +		if (FIELD_GET(GSC_PROXY_TYPE, to_csme_hdr->hdr) == GSC_PROXY_MSG_TYPE_PROXY_END)
> +			break;
alan:snip

> proxy_error:
> +	return ret < 0 ? ret : 0;
> +}

alan: nit: with the fixing of the ret for the case where ret < expected header size,
i dont see anymore cases where ret can be >0 and not an error within the loops points
of "goto proxy_error" or the break. In which case, we can simply remove "proxy_error:"
and return ret at the end and in all prior cases, where there is a "goto proxy_error"
replace with a direct "return ret". 

But this is trivial, so no point holding off:
Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com>

  reply	other threads:[~2024-01-11 20:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10  0:44 [PATCH v2 0/2] drm/xe: GSC proxy support Daniele Ceraolo Spurio
2024-01-10  0:44 ` [PATCH v2 1/2] drm/xe/gsc: Initialize GSC proxy Daniele Ceraolo Spurio
2024-01-11 20:02   ` Teres Alexis, Alan Previn [this message]
2024-01-16  6:13   ` Kandpal, Suraj
2024-01-16 16:53     ` Daniele Ceraolo Spurio
2024-01-10  0:44 ` [PATCH v2 2/2] drm/xe/gsc: add support for GSC proxy interrupt Daniele Ceraolo Spurio
2024-01-11 20:02   ` Teres Alexis, Alan Previn
2024-01-10  2:38 ` ✓ CI.Patch_applied: success for drm/xe: GSC proxy support (rev2) Patchwork
2024-01-10  2:38 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-10  2:39 ` ✓ CI.KUnit: success " Patchwork
2024-01-10  2:47 ` ✓ CI.Build: " Patchwork
2024-01-10  2:47 ` ✗ CI.Hooks: failure " Patchwork
2024-01-10  2:48 ` ✓ CI.checksparse: success " Patchwork
2024-01-10  3:26 ` ✗ CI.BAT: failure " Patchwork
2024-01-17  0:40 ` ✓ CI.Patch_applied: success for drm/xe: GSC proxy support (rev3) Patchwork
2024-01-17  0:41 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-17  0:42 ` ✓ CI.KUnit: success " Patchwork
2024-01-17  0:49 ` ✓ CI.Build: " Patchwork
2024-01-17  0:49 ` ✗ CI.Hooks: failure " Patchwork
2024-01-17  0:51 ` ✓ CI.checksparse: success " Patchwork
2024-01-17 16:39 ` ✓ CI.Patch_applied: " Patchwork
2024-01-17 16:39 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-17 16:40 ` ✓ CI.KUnit: success " Patchwork
2024-01-17 16:47 ` ✓ CI.Build: " Patchwork
2024-01-17 16:48 ` ✗ CI.Hooks: failure " Patchwork
2024-01-17 16:49 ` ✓ CI.checksparse: success " Patchwork
2024-01-17 17:12 ` ✓ CI.BAT: " 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=b0319900c4578281f980b054c3e817df9e943f41.camel@intel.com \
    --to=alan.previn.teres.alexis@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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