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 <[email protected]> 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/[email protected]?part=2
