From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 347A5C5DF7D for ; Fri, 21 Aug 2026 15:30:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D77010F30C; Fri, 21 Aug 2026 15:30:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="ZFPXbrY7"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A7DC10F30F for ; Fri, 21 Aug 2026 15:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1787326232; bh=0SjnZoAiswH2T2RP04K1GTQXFm/D343GdExP27HzYZ0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZFPXbrY7cH7u2m2aO7U5qtI7tjfoSJzfJXiLX1T6K9gqmwpcOJEmCaGdsFOCY16Ak sDBsBeZpI+F3ZpqDzMJhxw8e2wIuf/hSXJ0jYkRD9tdHQYjt+jMdYm8BEfULVwOc+L sgCa80xWk8NrN1hPa7N2uCpJv2bPLEAdsvl9vzlfyQ0wN27U/tK6sc9HbpIlYRxJO1 X0WQO1rR261LhDk2Tl6mAd6KujTLr1D7GsS9eefaWcL46xkLxIaAKPb446rtEoMyYq b16KIE7u9moyfgcdN78WnKz0l5zSxi0HvA5hm9RtrchSN0Vm5j6ZXkaO2mEu2xs39L 36M4zE9JhNs9g== Received: from [100.64.0.241] (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id AC72F17E0829; Fri, 21 Aug 2026 17:30:31 +0200 (CEST) Message-ID: <4fc2a3b6-2771-438b-ae99-5574e9c6efc9@collabora.com> Date: Fri, 21 Aug 2026 18:30:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 67/69] drm/connector: Drop redundant hdmi vendor/product fields To: Maxime Ripard Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Andy Yan , Algea Cao , Daniel Stone , Liu Ying , Phong LE , kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rockchip@lists.infradead.org, Diederik de Haas References: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> <20260731-dw-hdmi-qp-scramb-v10-67-294364b2cf15@collabora.com> <20260820-strange-rich-tiger-78a5a4@houat> Content-Language: en-US From: Cristian Ciocaltea In-Reply-To: <20260820-strange-rich-tiger-78a5a4@houat> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 8/20/26 1:10 PM, Maxime Ripard wrote: > On Fri, Jul 31, 2026 at 07:20:14PM +0300, Cristian Ciocaltea wrote: >> Now that all users migrated to the new drmm_connector_hdmi_init() >> signature, vendor and product are provided through struct >> drm_connector_hdmi_funcs, a reference to which is already stored in >> drm_connector_hdmi. >> >> Drop the redundant fields from drm_connector_hdmi and point its users to >> hdmi.funcs->vendor and hdmi.funcs->product instead. >> >> This allows simplifying the related connector registration tests by >> getting rid of the now unnecessary KUNIT_EXPECT_MEMEQ() checks. >> >> Tested-by: Diederik de Haas # NanoPC-T6 LTS, Rock 5B >> Signed-off-by: Cristian Ciocaltea >> --- >> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 4 +-- >> drivers/gpu/drm/drm_connector.c | 4 --- >> drivers/gpu/drm/tests/drm_connector_test.c | 41 +++---------------------- >> include/drm/drm_connector.h | 14 ++------- >> 4 files changed, 8 insertions(+), 55 deletions(-) >> [...] >> /* >> * Test that the registration of a connector with a vendor name at the >> - * maximum length succeeds, and is stored padded without the trailing >> - * zero. >> + * maximum length succeeds. >> */ >> static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test) >> { >> struct drm_connector_init_priv *priv = test->priv; >> - const char expected_vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] = { >> - 'V', 'e', 'n', 'd', 'o', 'r', >> - 'V', 'e', >> - }; >> int ret; >> >> priv->hdmi_funcs = dummy_hdmi_funcs; >> @@ -911,10 +882,6 @@ static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test) >> DRM_MODE_CONNECTOR_HDMIA, >> &priv->ddc); >> KUNIT_EXPECT_EQ(test, ret, 0); >> - KUNIT_EXPECT_MEMEQ(test, >> - priv->connector.hdmi.vendor, >> - expected_vendor, >> - sizeof(priv->connector.hdmi.vendor)); >> } > > Unfortunately, these tests were useful, and are there to match what the > spec asks for. I've just added a new test to cover this, as well as a couple of prerequisites to consolidate SPD InfoFrame handling: * video/hdmi: Define SPD InfoFrame field lengths and use strtomem_pad() HDMI specification defines the SPD InfoFrame Vendor Name and Product Description as fixed-size fields, 8 and 16 bytes respectively, padded with zeros and left without any trailing NUL when a name spans the whole field. Give those lengths a name and mark the fields as non-strings, so that the copies can be handed over to strtomem_pad(), which implements precisely the required semantics. This also bounds the reads from the source strings, whereas the open-coded strlen() could run past the end of the buffer in the hdmi_spd_infoframe_unpack() path, where the names come straight from the wire and are not NUL-terminated. While at it, replace the related magic numbers in the pack and unpack helpers with the new defines. * drm/connector: Use the SPD InfoFrame field length defines DRM_CONNECTOR_HDMI_{VENDOR,PRODUCT}_LEN used to size the vendor and product arrays in struct drm_connector_hdmi. Those arrays are gone and both names are now only validated before being copied into the SPD InfoFrame, hence the limits they have to be checked against are the ones of the SPD InfoFrame fields themselves. Switch the remaining users over to HDMI_SPD_INFOFRAME_{VENDOR,PRODUCT}_LEN and drop the DRM specific defines, so that the two cannot drift apart. * drm/tests: hdmi: Add SPD InfoFrame vendor/product coverage The vendor and product strings provided through struct drm_connector_hdmi_funcs end up in the SPD InfoFrame, whose fields are defined by the HDMI specification as fixed-size: 8 bytes for the vendor name and 16 bytes for the product description, padded with zeros and left without any trailing NUL when a name spans the whole field. Nothing exercises that so far, since the SPD InfoFrame is only generated for connectors implementing the related hooks, which none of the existing test funcs provides. Add a connector variant supplying those hooks, along with parametrized tests covering both the padded and the exact length cases. Thanks, Cristian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 994BEC5DF94 for ; Fri, 21 Aug 2026 15:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xn0YO/qo20n3N+0eaFGp2myiAFSNuXERA9Yf0gAtyM8=; b=w3qSxHFOjtvvA7 vyUF7TUwcGHcTvDnwhqp2T4AZ6pvBKzIOT/dsuzkeWBba+hxze+R+PL3eaPDgb3+c+Slq6yHgEoSD HBA9rzL2GuR0ofsFxbgt5TfeCz1gzpYZMYyYqjQ2Qbs/v5KVr+TDYSQsxaCUwPVH9dtjLu4ifOY7N yF4c9h0kvgo8t/klOAwXVuZhHpYCVgQ06tiyQ0L4W+gwUD/Z06FvEh5bf0EWxHGgJVoh+25NBoPe5 OrQgU7vx7ByO+6pNqCCvnehyJF9hOR8C748tjC3Ql9zQLmKzRtQQlQOymK6HnwsCwSLRaf6Iw2Uth YsZLVSyDJDBI3kfiuH9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wxRCb-0000000DgiJ-06lR; Fri, 21 Aug 2026 15:30:41 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wxRCV-0000000Dgh1-2lKE; Fri, 21 Aug 2026 15:30:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1787326232; bh=0SjnZoAiswH2T2RP04K1GTQXFm/D343GdExP27HzYZ0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZFPXbrY7cH7u2m2aO7U5qtI7tjfoSJzfJXiLX1T6K9gqmwpcOJEmCaGdsFOCY16Ak sDBsBeZpI+F3ZpqDzMJhxw8e2wIuf/hSXJ0jYkRD9tdHQYjt+jMdYm8BEfULVwOc+L sgCa80xWk8NrN1hPa7N2uCpJv2bPLEAdsvl9vzlfyQ0wN27U/tK6sc9HbpIlYRxJO1 X0WQO1rR261LhDk2Tl6mAd6KujTLr1D7GsS9eefaWcL46xkLxIaAKPb446rtEoMyYq b16KIE7u9moyfgcdN78WnKz0l5zSxi0HvA5hm9RtrchSN0Vm5j6ZXkaO2mEu2xs39L 36M4zE9JhNs9g== Received: from [100.64.0.241] (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id AC72F17E0829; Fri, 21 Aug 2026 17:30:31 +0200 (CEST) Message-ID: <4fc2a3b6-2771-438b-ae99-5574e9c6efc9@collabora.com> Date: Fri, 21 Aug 2026 18:30:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 67/69] drm/connector: Drop redundant hdmi vendor/product fields To: Maxime Ripard Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Andy Yan , Algea Cao , Daniel Stone , Liu Ying , Phong LE , kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rockchip@lists.infradead.org, Diederik de Haas References: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> <20260731-dw-hdmi-qp-scramb-v10-67-294364b2cf15@collabora.com> <20260820-strange-rich-tiger-78a5a4@houat> Content-Language: en-US From: Cristian Ciocaltea In-Reply-To: <20260820-strange-rich-tiger-78a5a4@houat> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260821_083037_331690_5B297891 X-CRM114-Status: GOOD ( 20.95 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On 8/20/26 1:10 PM, Maxime Ripard wrote: > On Fri, Jul 31, 2026 at 07:20:14PM +0300, Cristian Ciocaltea wrote: >> Now that all users migrated to the new drmm_connector_hdmi_init() >> signature, vendor and product are provided through struct >> drm_connector_hdmi_funcs, a reference to which is already stored in >> drm_connector_hdmi. >> >> Drop the redundant fields from drm_connector_hdmi and point its users to >> hdmi.funcs->vendor and hdmi.funcs->product instead. >> >> This allows simplifying the related connector registration tests by >> getting rid of the now unnecessary KUNIT_EXPECT_MEMEQ() checks. >> >> Tested-by: Diederik de Haas # NanoPC-T6 LTS, Rock 5B >> Signed-off-by: Cristian Ciocaltea >> --- >> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 4 +-- >> drivers/gpu/drm/drm_connector.c | 4 --- >> drivers/gpu/drm/tests/drm_connector_test.c | 41 +++---------------------- >> include/drm/drm_connector.h | 14 ++------- >> 4 files changed, 8 insertions(+), 55 deletions(-) >> [...] >> /* >> * Test that the registration of a connector with a vendor name at the >> - * maximum length succeeds, and is stored padded without the trailing >> - * zero. >> + * maximum length succeeds. >> */ >> static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test) >> { >> struct drm_connector_init_priv *priv = test->priv; >> - const char expected_vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] = { >> - 'V', 'e', 'n', 'd', 'o', 'r', >> - 'V', 'e', >> - }; >> int ret; >> >> priv->hdmi_funcs = dummy_hdmi_funcs; >> @@ -911,10 +882,6 @@ static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test) >> DRM_MODE_CONNECTOR_HDMIA, >> &priv->ddc); >> KUNIT_EXPECT_EQ(test, ret, 0); >> - KUNIT_EXPECT_MEMEQ(test, >> - priv->connector.hdmi.vendor, >> - expected_vendor, >> - sizeof(priv->connector.hdmi.vendor)); >> } > > Unfortunately, these tests were useful, and are there to match what the > spec asks for. I've just added a new test to cover this, as well as a couple of prerequisites to consolidate SPD InfoFrame handling: * video/hdmi: Define SPD InfoFrame field lengths and use strtomem_pad() HDMI specification defines the SPD InfoFrame Vendor Name and Product Description as fixed-size fields, 8 and 16 bytes respectively, padded with zeros and left without any trailing NUL when a name spans the whole field. Give those lengths a name and mark the fields as non-strings, so that the copies can be handed over to strtomem_pad(), which implements precisely the required semantics. This also bounds the reads from the source strings, whereas the open-coded strlen() could run past the end of the buffer in the hdmi_spd_infoframe_unpack() path, where the names come straight from the wire and are not NUL-terminated. While at it, replace the related magic numbers in the pack and unpack helpers with the new defines. * drm/connector: Use the SPD InfoFrame field length defines DRM_CONNECTOR_HDMI_{VENDOR,PRODUCT}_LEN used to size the vendor and product arrays in struct drm_connector_hdmi. Those arrays are gone and both names are now only validated before being copied into the SPD InfoFrame, hence the limits they have to be checked against are the ones of the SPD InfoFrame fields themselves. Switch the remaining users over to HDMI_SPD_INFOFRAME_{VENDOR,PRODUCT}_LEN and drop the DRM specific defines, so that the two cannot drift apart. * drm/tests: hdmi: Add SPD InfoFrame vendor/product coverage The vendor and product strings provided through struct drm_connector_hdmi_funcs end up in the SPD InfoFrame, whose fields are defined by the HDMI specification as fixed-size: 8 bytes for the vendor name and 16 bytes for the product description, padded with zeros and left without any trailing NUL when a name spans the whole field. Nothing exercises that so far, since the SPD InfoFrame is only generated for connectors implementing the related hooks, which none of the existing test funcs provides. Add a connector variant supplying those hooks, along with parametrized tests covering both the padded and the exact length cases. Thanks, Cristian _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip