From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1364F606A322 for ; Thu, 3 Dec 2026 11:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uKuTUGxf; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c9R0i1TT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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-Unsubscribe-Post: List-Owner; bh=zALp1PBMm5vqJesm71utBajXAW4CXE2cWkyHGba1ehU=; b=uKuTUGxfhwql1z zDg98Gt5jBhHJZ4QhcaKPACaDGicFWhqL8jAkUoYrtgd8lAyvLIwDC7UqQ9uA+ZDmcl2aM/XDXaHA iOIWir25fPtTGjTUZ/mfEGUlulhK+Rl3pJwmD9qQPN16E1bsvDbgx9PO0NRZmLgZhae5hM210QV/s eCh1IgBt5Au8cmpHSEvcm5mfGOHN/iXd2HZ5waeHS+Hxh7YJU4xdvnO5qk1OMateseNIUHxqALBlN piRSut61vDAxrjtjvz+V3cuHPOPfRIRww4rNsqax+BtbXbSYWPdxz088qP9dRjq1N1bC8C6VweuGM Xr2Cd0xj8/dkrSTCmtmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ4x4-0000000ENpL-0XVU; Thu, 03 Dec 2026 11:26:14 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ4x0-0000000ENoc-1ePa for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 11:26:12 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D323A621E1; Thu, 3 Dec 2026 11:26:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9628C1F000C1; Thu, 3 Dec 2026 11:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796297169; bh=zALp1PBMm5vqJesm71utBajXAW4CXE2cWkyHGba1ehU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=c9R0i1TThS63IuzE5L8DpokNPGZPMfvm49Y9Hmj39Q4KkmBFEDkQISpyQMsl5r44T V6Ct7u6ItSUo0uG5vBcksDAqDZvYz1Ny5VgR0/I9P09qKZ3yas1KrXpBVahuDN+LZ9 T+DfI0uZsMhxgCKHDS1ZHzy5nXG+OoFo6C6nREbD7UmQZZ/Pkdl1zGnZlfhGNRPEIG ed23lzupT/y0sG5PkuOf72UYXnmIBEvUTqv9nJEtXofP2F2v1DLUFZ0Lls+VwlZH+j ZnKfF9D+DgM/QrhkKJ9V+S7dCsFAEwxqSAmEu5NUHT8eWGBLDs+xZgLhKo6eLJrpM4 Ri34weT5Nhqjg== Message-ID: <1e93deeb-8633-4e16-8711-c67fd048fbdd@kernel.org> Date: Thu, 3 Dec 2026 12:26:05 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: stm32: dcmipp: pixelproc: Fix width limit for downsize block To: Alain Volmat Cc: Lin Huiyi , hugues.fruchet@foss.st.com, mchehab@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: From: Hans Verkuil Content-Language: en-US, nl In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 02/12/2026 09:40, Alain Volmat wrote: > Hi Hans, > > On Tue, Dec 01, 2026 at 01:42:42PM +0100, Hans Verkuil wrote: >> Alain, >> >> Can you review this? It sounds plausible, but someone with the datasheet should >> verify this. > > Indeed, 4096 is too big for this field. However 4095 is also too big > since the maximum value is 4094. As a matter of fact I have a downstream > kernel commit fixing that and have in my todo to push it but just haven't > done it yet since I am currently focusing on preparation of the ISP > statistics and control block upstreaming. OK, in that case I'll drop this patch and wait for your patch. Regards, Hans > > Regards, > Alain > >> >> Regards, >> >> Hans >> >> On 29/11/2026 18:42, Lin Huiyi wrote: >>> The pixelproc subdev advertises a maximum width of >>> DCMIPP_FRAME_MAX_WIDTH (4096), but the downsize block target size >>> register DCMIPP_PxDSSZR stores the width in a 12-bit field >>> (GENMASK(11,0)) which can hold at most 4095. Composing a full >>> 4096-pixel wide stream therefore writes 4096 into the register, >>> setting bit 12 outside of the HSIZE field and leaving the field >>> itself at 0. >>> >>> Clamp the pixelproc width to the largest value the field can >>> represent (4095). >>> >>> Fixes: 239cf9e5fda1 ("media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev") >>> Signed-off-by: Lin Huiyi >>> --- >>> .../platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c >>> index 7d8e5f0863..779c898793 100644 >>> --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c >>> +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c >>> @@ -455,8 +455,14 @@ dcmipp_pixelproc_adjust_fmt(struct dcmipp_pixelproc_device *pixelproc, >>> if (!vpix) >>> fmt->code = PIXELPROC_MEDIA_BUS_FMT_DEFAULT; >>> >>> + /* >>> + * The downsize target size register DCMIPP_PxDSSZR stores the >>> + * output width in a 12-bit field which can not hold >>> + * DCMIPP_FRAME_MAX_WIDTH, clamp the width to the largest value >>> + * the field can represent. >>> + */ >>> fmt->width = clamp_t(u32, fmt->width, DCMIPP_FRAME_MIN_WIDTH, >>> - DCMIPP_FRAME_MAX_WIDTH); >>> + DCMIPP_PxDSSZR_HSIZE_MASK); >>> fmt->height = clamp_t(u32, fmt->height, DCMIPP_FRAME_MIN_HEIGHT, >>> DCMIPP_FRAME_MAX_HEIGHT); >>> >> >