Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jayant Shekhar" <jayant.shekhar@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v3 02/21] drm/msm/dcp: Add HFI packet helpers
Date: Thu, 26 Nov 2026 06:52:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-234911@kernel.org> (raw)
In-Reply-To: <20261126-jshekhar-v3-dcp-v3-2-f1e9d7505039@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [Low] drm/msm/dcp: Kconfig help text contradicts qcom,dcp.yaml DT
  binding
- [Low] drm/msm/dcp: DRM_MSM_DCP Kconfig forces built-in VIRTIO_MMIO and
  QCOM_IPCC
- [Low] drm/msm/dcp: 20-bit HFI_PACKET_SIZE_MAX mismatches 21-bit packet
  size mask
- [Low] drm/msm/dcp: duplicate HFI packing macros and KV property
  parsers
- [Low] drm/msm/dcp: malformed kernel-doc comments and __cplusplus
  guards in HFI
--

commit 1a12340ec280848da59198aa830dba2527674b79
Author: Jayant Shekhar <jayant.shekhar@oss.qualcomm.com>

drm/msm/dcp: Add HFI packet helpers

This commit adds the DRM_MSM_DCP Kconfig option and defines the HFI packet
formats, packing and unpacking helpers, and key/value property parsing
utilities for communicating with the DCP firmware.

> diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> index ed1c4775d1e92..df25373d7847f 100644
> --- a/drivers/gpu/drm/msm/Kconfig
> +++ b/drivers/gpu/drm/msm/Kconfig
> @@ -114,6 +114,32 @@ config DRM_MSM_DPU
>  	  the MSM DRM driver. It is the display controller found in devices
>  	  using e.g. SDM845 and newer platforms.
>  
> +config DRM_MSM_DCP
> +	bool "Enable DCP firmware-delegated display support in MSM DRM driver"
> +	depends on DRM_MSM
> +	depends on VIRTIO_MMIO=y && QCOM_IPCC=y
> +	select DRM_MSM_KMS
> +	select VIRTIO_QCOM_DCP
> +	select DRM_BRIDGE_CONNECTOR

[Severity: Low]
Does DRM_MSM_DCP need to depend on VIRTIO_MMIO=y && QCOM_IPCC=y?

Because DRM_MSM_DCP is a bool symbol that selects the tristate
VIRTIO_QCOM_DCP, it forces VIRTIO_QCOM_DCP=y and prevents enabling DCP in
modular kernel configurations where DRM_MSM, VIRTIO_MMIO, or QCOM_IPCC are
built as loadable modules.  Also, selecting DRM_BRIDGE_CONNECTOR here is
redundant because DRM_MSM_KMS already selects it.

> +	select DRM_MIPI_DSI
> +	select DRM_DISPLAY_DSC_HELPER
> +	default y
> +	help
> +	  Compile in support for the DCP (Display Coprocessor) firmware-delegated
> +	  display architecture in the MSM DRM driver.
> +
> +	  DCP is used on Hawi (qcom,hawi) SoC where all display hardware is
> +	  owned by a separate Display Coprocessor firmware. The host AP
> +	  communicates with DCP via two interfaces:
> +	    - IPCC SMP2P mailbox: power notifications and response wakeups
> +	    - HFI over VirtIO MMIO: display command/response exchange
> +
> +	  DPU and bridge nodes in the Device Tree are topology-only (no
> +	  compatible string, no reg). The driver detects them by node name
> +	  prefix using of_node_name_prefix().

[Severity: Low]
Does this help text match Documentation/devicetree/bindings/display/msm/qcom,dcp.yaml?

In the binding, the DCP node requires compatible = "virtio,device34", its
port@N, interface@N, and dsi@N child nodes all require reg properties, and
internal DPU resources are discovered at runtime from firmware rather than
represented as compatible-less DT nodes matched by arbitrary node name
prefixes.  In addition, the commit message only mentions HFI packet helpers
and does not mention adding the DRM_MSM_DCP Kconfig symbol.

> diff --git a/drivers/gpu/drm/msm/dcp/hfi/hfi_pack_unpack_common.h b/drivers/gpu/drm/msm/dcp/hfi/hfi_pack_unpack_common.h
> new file mode 100644
> index 0000000000000..b767e6ee8e405
> --- /dev/null
> +++ b/drivers/gpu/drm/msm/dcp/hfi/hfi_pack_unpack_common.h
> @@ -0,0 +1,79 @@

[ ... ]

> +/* Header size field width. */
> +#define HFI_HEADER_SIZE_MAX                                   0x00ffffff
> +/* Packet size field width. */
> +#define HFI_PACKET_SIZE_MAX                                   0x000fffff
> +
> +#define HFI_HEADER_CMD_BUFF_TYPE_START_BIT                                   24
> +#define HFI_PACKET_PAYLOAD_TYPE_START_BIT                                21
> +
> +#define GET_HEADER_SIZE(data)           \
> +	((data) & ((1 << HFI_HEADER_CMD_BUFF_TYPE_START_BIT) - 1))
> +#define GET_HEADER_CMD_BUFF_TYPE(data)         \
> +	((data) >> HFI_HEADER_CMD_BUFF_TYPE_START_BIT)
> +#define GET_PACKET_SIZE(data)           \
> +	((data) & ((1 << HFI_PACKET_PAYLOAD_TYPE_START_BIT) - 1))

[Severity: Low]
Should HFI_PACKET_SIZE_MAX be 0x001fffff instead of 0x000fffff?

struct hfi_packet in hfi_packet.h documents the packet size field as bits
[20:0] (21 bits) with payload type in bits [31:21], and GET_PACKET_SIZE()
masks 21 bits via HFI_PACKET_PAYLOAD_TYPE_START_BIT (21), whereas
hfi_create_packet() validates payload_size against the 20-bit
HFI_PACKET_SIZE_MAX (0x000fffff).

> diff --git a/drivers/gpu/drm/msm/dcp/hfi/hfi_packer.h b/drivers/gpu/drm/msm/dcp/hfi/hfi_packer.h
> new file mode 100644
> index 0000000000000..460c11c724162
> --- /dev/null
> +++ b/drivers/gpu/drm/msm/dcp/hfi/hfi_packer.h
> @@ -0,0 +1,65 @@

[ ... ]

> +/* Pack a version-zero property and return its serialized word count. */
> +#define HFI_PACK(payload, property_id, ...) \
> +({ \
> +	const u32 __hfi_values[] = { __VA_ARGS__ }; \
> +	u32 *__hfi_payload = (payload); \
> +	u32 __hfi_count = ARRAY_SIZE(__hfi_values); \
> +\
> +	*__hfi_payload++ = HFI_PACK_KEY(property_id, 0, __hfi_count); \
> +	memcpy(__hfi_payload, __hfi_values, sizeof(__hfi_values)); \
> +	__hfi_count + 1; \
> +})
> +
> +/* Pack a property with an explicitly selected protocol version. */
> +#define HFI_PACK_VERSION(payload, property_id, version, ...) \
> +({ \
> +	const u32 __hfi_values[] = { __VA_ARGS__ }; \
> +	u32 *__hfi_payload = (payload); \
> +	u32 __hfi_count = ARRAY_SIZE(__hfi_values); \
> +\
> +	*__hfi_payload++ = HFI_PACK_KEY(property_id, version, __hfi_count); \
> +	memcpy(__hfi_payload, __hfi_values, sizeof(__hfi_values)); \
> +	__hfi_count + 1; \
> +})

[Severity: Low]
This isn't a bug, but HFI_PACK() duplicates the body of HFI_PACK_VERSION()
instead of expanding to HFI_PACK_VERSION(payload, property_id, 0,
__VA_ARGS__).

Also, this patch introduces two separate key/value property unpackers and
key-extraction macro sets: hfi_unpacker_get_kv_pairs_count() and
hfi_unpacker_get_kv_pairs() (both taking an unused cmd_buf_hdl argument)
with HFI_UNPACK_KEY() in hfi_unpacker.{c,h}, which are never used anywhere
in the series, alongside hfi_util_kv_parser_init() and
hfi_util_kv_parser_get_next() with HFI_PROP_ID() and HFI_PROP_SZ() in
hfi_utils.{c,h}.  In hfi_utils.h, HFI_VAL_L32() and HFI_VAL_H32() are also
unused and duplicate lower_32_bits() and upper_32_bits() from
linux/wordpart.h.

> +
> +/** hfi_get_header_size() - Return the bytes used by an HFI header. */
> +u32 hfi_get_header_size(struct hfi_cmd_buff_hdl *cmd_buf_hdl);
> +
> +/** hfi_create_header() - Initialize an HFI command header. */
> +int hfi_create_header(struct hfi_cmd_buff_hdl *cmd_buf_hdl,
> +		      struct hfi_header_info *header_info);
> +
> +/** hfi_create_full_packet() - Append a packet and its payload. */
> +int hfi_create_full_packet(struct hfi_cmd_buff_hdl *cmd_buf_hdl,
> +			   struct hfi_packet_info *packet_info);
> +
> +/** hfi_create_packet_header() - Append a packet without a payload. */
> +int hfi_create_packet_header(struct hfi_cmd_buff_hdl *cmd_buf_hdl,
> +			     struct hfi_packet_info *packet_info);
> +
> +#ifdef __cplusplus
> +}
> +#endif /* __cplusplus */

[Severity: Low]
This isn't a bug, but single-line "/** ... */" comments without parameter
and return descriptions are malformed kernel-doc and trigger
scripts/kernel-doc warnings.  Also, the #ifdef __cplusplus guards in
hfi_packer.h and hfi_unpacker.h are not needed in internal kernel headers.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-jshekhar-v3-dcp-v3-0-f1e9d7505039@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-26  6:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  6:29 [PATCH v3 00/21] drm/msm/dcp: Add Qualcomm DCP display support Jayant Shekhar
2026-11-26  6:29 ` [PATCH v3 01/21] dt-bindings: display: msm: Add Qualcomm DCP Jayant Shekhar
2026-11-26  6:44   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 02/21] drm/msm/dcp: Add HFI packet helpers Jayant Shekhar
2026-11-26  6:52   ` sashiko-bot [this message]
2026-11-26  6:29 ` [PATCH v3 03/21] drm/msm/dcp: Add HFI device definitions Jayant Shekhar
2026-11-26  6:29 ` [PATCH v3 04/21] drm/msm/dcp: Add HFI display definitions Jayant Shekhar
2026-11-26  6:29 ` [PATCH v3 05/21] drm/msm/dcp: Add HFI panel definitions Jayant Shekhar
2026-11-26  6:40   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 06/21] drm/msm/dcp: Add HFI VirtIO transport Jayant Shekhar
2026-11-26  6:51   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 07/21] drm/msm/dcp: Handle asynchronous HFI responses Jayant Shekhar
2026-11-26  6:49   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 08/21] drm/msm/dcp: Add generic HFI display commands Jayant Shekhar
2026-11-26  6:45   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 09/21] drm/msm/dcp: Add HFI DSI and panel commands Jayant Shekhar
2026-11-26  6:54   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 10/21] drm/msm/dcp: Add DCP CRTCs Jayant Shekhar
2026-11-26  6:58   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 11/21] drm/msm/dcp: Add DCP planes Jayant Shekhar
2026-11-26  7:02   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 12/21] drm/msm/dcp: Route HFI display events Jayant Shekhar
2026-11-26  6:50   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 13/21] drm/msm/dcp: Add DCP encoder Jayant Shekhar
2026-11-26  6:42   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 14/21] drm/msm/dcp: Add DCP DSI host and panel support Jayant Shekhar
2026-11-26  7:06   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 15/21] drm/msm/dcp: Integrate the DSI bridge with KMS Jayant Shekhar
2026-11-26  6:53   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 16/21] drm/msm/dcp: Register DCP display pipeline Jayant Shekhar
2026-11-26  7:03   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 17/21] drm/msm: Export GPU component matching helper Jayant Shekhar
2026-11-26  6:29 ` [PATCH v3 18/21] drm/msm/dcp: Add DCP VirtIO driver Jayant Shekhar
2026-11-26  7:07   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 19/21] drm/msm: Support KMS backends without a display IRQ Jayant Shekhar
2026-11-26  6:29 ` [PATCH v3 20/21] drm/msm: Register the DCP backend Jayant Shekhar
2026-11-26  7:00   ` sashiko-bot
2026-11-26  6:29 ` [PATCH v3 21/21] arm64: dts: qcom: hawi: Add DCP support Jayant Shekhar
2026-11-26  7:10   ` sashiko-bot

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=sashiko-outbox-234911@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jayant.shekhar@oss.qualcomm.com \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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