From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 04/10] drm/xe/guc: Add helpers for HXG messages
Date: Fri, 29 Dec 2023 22:08:33 +0100 [thread overview]
Message-ID: <20231229210833.cphh32yxvqrckyfp@intel.com> (raw)
In-Reply-To: <20231227235838.212-5-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on czw [2023-gru-28 00:58:32 +0100]:
> In addition to MMIO and CTB communication between the host driver
> and the GUC firmware, we will start using GuC HXG message protocol
> in communication between SR-IOV VFs and PF. Define helpers related
> to HXG message protocol to minimize code duplication.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_hxg_helpers.h | 107 ++++++++++++++++++++++++
> 1 file changed, 107 insertions(+)
> create mode 100644 drivers/gpu/drm/xe/xe_guc_hxg_helpers.h
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_hxg_helpers.h b/drivers/gpu/drm/xe/xe_guc_hxg_helpers.h
> new file mode 100644
> index 000000000000..4dc080484e7a
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_guc_hxg_helpers.h
> @@ -0,0 +1,107 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +#ifndef _XE_GUC_HXG_HELPERS_H_
> +#define _XE_GUC_HXG_HELPERS_H_
> +
> +#include <linux/bitfield.h>
> +#include <linux/types.h>
> +
> +#include "abi/guc_messages_abi.h"
> +
> +/**
> + * hxg_sizeof - Queries size of the object or type (in HXG units).
> + *
> + * Asserts when actual size is not aligned to HXG unit (u32).
> + *
> + * Return: size in dwords (u32).
> + */
> +#define hxg_sizeof(T) (sizeof(T) / sizeof(u32) + BUILD_BUG_ON_ZERO(sizeof(T) % sizeof(u32)))
> +
> +static inline const char *guc_hxg_type_to_string(unsigned int type)
> +{
> + switch (type) {
> + case GUC_HXG_TYPE_REQUEST:
> + return "request";
> + case GUC_HXG_TYPE_FAST_REQUEST:
> + return "fast-request";
> + case GUC_HXG_TYPE_EVENT:
> + return "event";
> + case GUC_HXG_TYPE_NO_RESPONSE_BUSY:
> + return "busy";
> + case GUC_HXG_TYPE_NO_RESPONSE_RETRY:
> + return "retry";
> + case GUC_HXG_TYPE_RESPONSE_FAILURE:
> + return "failure";
> + case GUC_HXG_TYPE_RESPONSE_SUCCESS:
> + return "response";
> + default:
> + return "<invalid>";
> + }
> +}
> +
> +static inline bool guc_hxg_type_is_action(unsigned int type)
> +{
> + switch (type) {
> + case GUC_HXG_TYPE_REQUEST:
> + case GUC_HXG_TYPE_FAST_REQUEST:
> + case GUC_HXG_TYPE_EVENT:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> +static inline bool guc_hxg_type_is_reply(unsigned int type)
> +{
> + switch (type) {
> + case GUC_HXG_TYPE_NO_RESPONSE_BUSY:
> + case GUC_HXG_TYPE_NO_RESPONSE_RETRY:
> + case GUC_HXG_TYPE_RESPONSE_FAILURE:
> + case GUC_HXG_TYPE_RESPONSE_SUCCESS:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> +static inline u32 guc_hxg_msg_encode_success(u32 *msg, u32 data0)
> +{
> + msg[0] = FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
> + FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_RESPONSE_SUCCESS) |
> + FIELD_PREP(GUC_HXG_RESPONSE_MSG_0_DATA0, data0);
> +
> + return GUC_HXG_RESPONSE_MSG_MIN_LEN;
> +}
> +
> +static inline u32 guc_hxg_msg_encode_failure(u32 *msg, u32 error, u32 hint)
> +{
> + msg[0] = FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
> + FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_RESPONSE_FAILURE) |
> + FIELD_PREP(GUC_HXG_FAILURE_MSG_0_HINT, hint) |
> + FIELD_PREP(GUC_HXG_FAILURE_MSG_0_ERROR, error);
> +
> + return GUC_HXG_FAILURE_MSG_LEN;
> +}
> +
> +static inline u32 guc_hxg_msg_encode_busy(u32 *msg, u32 counter)
> +{
> + msg[0] = FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
> + FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_NO_RESPONSE_BUSY) |
> + FIELD_PREP(GUC_HXG_BUSY_MSG_0_COUNTER, counter);
> +
> + return GUC_HXG_BUSY_MSG_LEN;
> +}
> +
> +static inline u32 guc_hxg_msg_encode_retry(u32 *msg, u32 reason)
> +{
> + msg[0] = FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
> + FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_NO_RESPONSE_RETRY) |
> + FIELD_PREP(GUC_HXG_RETRY_MSG_0_REASON, reason);
> +
> + return GUC_HXG_RETRY_MSG_LEN;
> +}
Note to the 4 functions above ^^^^^:
I know that naming convention says to use in this case guc_hxg_*
However, these functions, by their content directly indicate that they
are only h2g.
I have a subjective feeling, which you can ignore, that they should be
labeled in some way as h2g.
But still:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> +
> +#endif
> --
> 2.25.1
>
--
next prev parent reply other threads:[~2023-12-29 21:08 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-27 23:58 [PATCH 00/10] Introduce Relay Communication for SR-IOV Michal Wajdeczko
2023-12-27 23:58 ` [PATCH 01/10] drm/xe: Allocate dedicated workqueue for SR-IOV workers Michal Wajdeczko
2023-12-29 21:06 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 02/10] drm/xe: Define Virtual Function Identifier Michal Wajdeczko
2023-12-29 21:07 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 03/10] drm/xe: Introduce GT-oriented SR-IOV logging macros Michal Wajdeczko
2023-12-29 21:07 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 04/10] drm/xe/guc: Add helpers for HXG messages Michal Wajdeczko
2023-12-29 21:08 ` Piotr Piórkowski [this message]
2023-12-29 22:10 ` Michal Wajdeczko
2023-12-27 23:58 ` [PATCH 05/10] drm/xe/guc: Update few GuC CTB ABI definitions Michal Wajdeczko
2023-12-29 21:09 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 06/10] drm/xe/guc: Add Relay Communication " Michal Wajdeczko
2023-12-29 21:09 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 07/10] drm/xe/guc: Introduce Relay Communication for SR-IOV Michal Wajdeczko
2023-12-29 21:14 ` Piotr Piórkowski
2023-12-29 22:55 ` Michal Wajdeczko
2023-12-27 23:58 ` [PATCH 08/10] drm/xe/kunit: Allow to replace xe_guc_ct_send_recv() with stub Michal Wajdeczko
2023-12-29 21:15 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 09/10] drm/xe/kunit: Add GuC Relay kunit tests Michal Wajdeczko
2023-12-29 21:15 ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 10/10] drm/xe/guc: Start handling GuC Relay event messages Michal Wajdeczko
2023-12-29 21:16 ` Piotr Piórkowski
2024-01-04 5:43 ` ✓ CI.Patch_applied: success for Introduce Relay Communication for SR-IOV Patchwork
2024-01-04 5:43 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-04 5:44 ` ✓ CI.KUnit: success " Patchwork
2024-01-04 5:52 ` ✓ CI.Build: " Patchwork
2024-01-04 5:52 ` ✗ CI.Hooks: failure " Patchwork
2024-01-04 5:53 ` ✓ CI.checksparse: success " Patchwork
2024-01-04 6:30 ` ✗ CI.BAT: 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=20231229210833.cphh32yxvqrckyfp@intel.com \
--to=piotr.piorkowski@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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