mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bod@kernel.org>
To: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>,
	'Bryan O'Donoghue' <bryan.odonoghue@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/9] media: camss: video: check that a buffer is DMA contiguous and add a prepare hook
Date: Wed, 28 Oct 2026 12:32:15 +0000	[thread overview]
Message-ID: <0f436944-fa9a-49f9-ac1d-8779a36ab13d@kernel.org> (raw)
In-Reply-To: <20261028093003.722745-7-xiaqinghuan@mail.ustc.edu.cn>

On 28/10/2026 09:30, Qianhui Xu wrote:
> The write master of the newer VFE generations can only be programmed with
> a buffer whose payload is physically contiguous, because the frame
> increment registers describe one linear address range.  Check that the DMA
> mapping of every plane is contiguous for at least sizeimage bytes and
> reject the buffer otherwise, instead of silently writing past the end of
> the first scatterlist entry.
> 
> Also let the SoC code add its own alignment requirements to a queued
> buffer through a new prepare_buffer() video operation, which runs after
> the generic checks.
> 
> Signed-off-by: Qianhui Xu<xiaqinghuan@mail.ustc.edu.cn>
> ---
>   .../media/platform/qcom/camss/camss-video.c    | 18 +++++++++++++++++-
>   .../media/platform/qcom/camss/camss-video.h    |  1 +
>   2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
> index 0852eb6f1..027cf024f 100644
> --- a/drivers/media/platform/qcom/camss/camss-video.c
> +++ b/drivers/media/platform/qcom/camss/camss-video.c
> @@ -155,7 +155,10 @@ static int video_buf_init(struct vb2_buffer *vb)
>   	const struct v4l2_pix_format_mplane *format =
>   						&video->active_fmt.fmt.pix_mp;
>   	struct sg_table *sgt;
> -	unsigned int i;
> +	struct scatterlist *sg;
> +	dma_addr_t end;
> +	unsigned int i, j;
> +	size_t contiguous;
> 
>   	for (i = 0; i < format->num_planes; i++) {
>   		sgt = vb2_dma_sg_plane_desc(vb, i);
> @@ -163,6 +166,16 @@ static int video_buf_init(struct vb2_buffer *vb)
>   			return -EFAULT;
> 
>   		buffer->addr[i] = sg_dma_address(sgt->sgl);
> +		end = buffer->addr[i];
> +		contiguous = 0;
> +		for_each_sgtable_dma_sg(sgt, sg, j) {
> +			if (sg_dma_address(sg) != end)
> +				break;
> +			contiguous += sg_dma_len(sg);
> +			end += sg_dma_len(sg);
> +		}
> +		if (contiguous < format->plane_fmt[i].sizeimage)
> +			return -EINVAL;
>   	}

Is it really the case we can only do physically contiguous on sm8750 ?

Hrmm, first I've heard of this, it would be a gigantic step backwards too.

Can you cite some sources to prove this out ?

---
bod

  reply	other threads:[~2026-10-28 12:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  9:29 [PATCH v2 0/9] media: camss: add SM8750 support Qianhui Xu
2026-10-28  9:29 ` [PATCH v2 1/9] dt-bindings: media: add the Qualcomm SM8750 camera subsystem Qianhui Xu
2026-10-28 12:53   ` Krzysztof Kozlowski
2026-10-28  9:29 ` [PATCH v2 2/9] media: camss: csiphy: add CSIPHY 2.4.0 lane settings for SM8750 Qianhui Xu
2026-10-28  9:29 ` [PATCH v2 3/9] media: camss: csid: unwind the power-on path through a single error label Qianhui Xu
2026-10-28  9:29 ` [PATCH v2 4/9] media: camss: csid: add the 980 generation Qianhui Xu
2026-10-28  9:29 ` [PATCH v2 5/9] media: camss: csid: report frame starts from CSID Qianhui Xu
2026-10-28 12:30   ` Bryan O'Donoghue
2026-10-28  9:30 ` [PATCH v2 6/9] media: camss: video: check that a buffer is DMA contiguous and add a prepare hook Qianhui Xu
2026-10-28 12:32   ` Bryan O'Donoghue [this message]
2026-10-28  9:30 ` [PATCH v2 7/9] media: camss: video: stop the subdevices already started when a start fails Qianhui Xu
2026-10-28  9:30 ` [PATCH v2 8/9] media: camss: vfe: add the gen4 block and SM8750 camera subsystem Qianhui Xu
2026-10-28  9:30 ` [PATCH v2 9/9] arm64: dts: qcom: sm8750: add the " Qianhui Xu
2026-10-28 10:10 ` [PATCH v2 0/9] media: camss: add SM8750 support Vladimir Zapolskiy
2026-10-28 12:09   ` Qianhui Xu
2026-10-28 10:42 ` Hangxiang Ma
2026-10-28 12:09   ` Qianhui Xu
2026-10-28 12:17 ` Bryan O'Donoghue

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=0f436944-fa9a-49f9-ac1d-8779a36ab13d@kernel.org \
    --to=bod@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hangxiang.ma@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=xiaqinghuan@mail.ustc.edu.cn \
    /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

all inboxes | Powered by JetHome®