linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jorge Ramirez <jorge.ramirez@oss.qualcomm.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Jorge Ramirez <jorge.ramirez@oss.qualcomm.com>,
	quic_vgarodia@quicinc.com, quic_dikshita@quicinc.com,
	krzk+dt@kernel.org, konradybcio@kernel.org, mchehab@kernel.org,
	andersson@kernel.org, conor+dt@kernel.org,
	amit.kucheria@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 v7 3/7] media: venus: Add support for AR50_LITE video core
Date: Thu, 17 Jul 2025 14:33:04 +0200	[thread overview]
Message-ID: <aHjtgHT2Nxmm5nEf@trex> (raw)
In-Reply-To: <8ac6f365-205a-4140-98b1-847f54ce08af@linaro.org>

On 17/07/25 10:29:44, Bryan O'Donoghue wrote:
> On 17/07/2025 08:19, Jorge Ramirez wrote:
> > > > --- a/drivers/media/platform/qcom/venus/helpers.c
> > > > +++ b/drivers/media/platform/qcom/venus/helpers.c
> > > > @@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
> > > >    }
> > > >    EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
> > > > +void venus_helper_prepare_eos_data(struct venus_inst *inst,
> > > > +				   struct hfi_frame_data *data)
> > > > +{
> > > > +	struct venus_core *core = inst->core;
> > > > +
> > > > +	data->buffer_type = HFI_BUFFER_INPUT;
> > > > +	data->flags = HFI_BUFFERFLAG_EOS;
> > > > +
> > > > +	if (IS_V6(core) && is_fw_rev_or_older(core, 1, 0, 87))
> > > > +		return;
> > > > +
> > > > +	if (IS_V4(core) && is_lite(core) && is_fw_rev_or_older(core, 6, 0, 53))
> > > > +		data->alloc_len = 1;
> > > > +
> > > > +	data->device_addr = 0xdeadb000;
> > > > +}
> > > > +EXPORT_SYMBOL_GPL(venus_helper_prepare_eos_data);
> > > This function doesn't appear to have alot to do with AR50_LITE as it
> > > pertains to IS_V6() and IS_V4().
> > > 
> > > This I think should be a separate patch with its own commit log to describe
> > > the quite complex logic of version numbers going on here.
> > Let me give it some background:
> > 
> > According to the HFI specification, EOS (End-of-Stream) buffers must
> > have 'valid' addresses. While the firmware currently appears to make no
> > use of the EOS buffer contents, allocating and mapping them would have
> > been a better driver choice IMO. Hoever this one has better performance
> > which is probably the reason why it has stayed.
> > 
> > The firmware then does perform operations involving the buffer's size
> > and length fields, and enforces boundary checks accordingly. On the
> > AR50_LITE platform, an earlier firmware version lacked a check on
> > alloc_len, leading to a division-by-zero scenario.
> > 
> > This has been addressed, and we plan to release firmware version 6.0.54,
> > which includes the necessary boundary check for alloc_len.
> > 
> > I should probaly replace IS_V4(core) && is_lite(core) with
> > IS_AR50_LITE() instead of trying to give it the appearence of a design
> > feature.
> > 
> > seems the sensible thing to do, right?
> 
> I'll stipulate to all of that.
> 
> I know I'm being pedantic but, the title and subject of this patch is
> "AR50_LITE" does stuff.
> 
> As traveler from a mirror-universe - I would read the commit log here, look
> at this function and be none the wiser what was going on.

right this is because I think you saw through my inconsistency.

The truth is I should have written the function as below; and I think
now there is a case for it being in this patch since it is addressing a
firmware issue on the firmware release supporting this core which the
patch is adding the functionality for.

void venus_helper_prepare_eos_data(struct venus_inst *inst,
				   struct hfi_frame_data *data)
{
	struct venus_core *core = inst->core;

	data->buffer_type = HFI_BUFFER_INPUT;
	data->flags = HFI_BUFFERFLAG_EOS;

	if (IS_V6(core) && is_fw_rev_or_older(core, 1, 0, 87))
		return;

	if (IS_AR50_LITE(core) && is_fw_rev_or_older(core, 6, 0, 53))
		data->alloc_len = 1;

	data->device_addr = 0xdeadb000;
}
EXPORT_SYMBOL_GPL(venus_helper_prepare_eos_data);

what do you think? this is really just adding a the AR50_LITE line to
the existing implementation.

> 
> The EOS check is a fundamental HFI capability which is why I again reiterate
> it deserves its own commit log with the above explanation - word-for-word
> would be fine from my POV, to explain what is going on.
>

umm not sure yet but if the above does not make you change your mind
I'll do it.

> Long live the Empire!

:)

> 
> ---
> bod

  reply	other threads:[~2025-07-17 12:33 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 20:47 [PATCH v7 0/7] media: venus: Add QCM2290 support with AR50_LITE core Jorge Ramirez-Ortiz
2025-07-15 20:47 ` [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema Jorge Ramirez-Ortiz
2025-07-16 23:22   ` Bryan O'Donoghue
2025-07-17  6:35     ` Jorge Ramirez
2025-07-17  6:45       ` Krzysztof Kozlowski
2025-07-17 11:16         ` Jorge Ramirez
2025-07-17 17:00           ` Jorge Ramirez
2025-07-17 17:08             ` Jorge Ramirez
2025-07-18  6:27             ` Krzysztof Kozlowski
2025-07-18 10:02               ` Konrad Dybcio
2025-07-18 10:04                 ` Krzysztof Kozlowski
2025-07-18 10:21                   ` Konrad Dybcio
2025-07-18 10:21                   ` Bryan O'Donoghue
2025-08-04 11:08                     ` Jorge Ramirez
2025-07-15 20:47 ` [PATCH v7 2/7] media: venus: Conditionally register codec nodes based on firmware version Jorge Ramirez-Ortiz
2025-07-16 23:37   ` Bryan O'Donoghue
2025-07-17  6:51     ` Jorge Ramirez
2025-07-17  8:55       ` Bryan O'Donoghue
2025-08-04 11:12         ` Jorge Ramirez
2025-07-15 20:47 ` [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core Jorge Ramirez-Ortiz
2025-07-16 23:50   ` Bryan O'Donoghue
2025-07-17  7:19     ` Jorge Ramirez
2025-07-17  9:29       ` Bryan O'Donoghue
2025-07-17 12:33         ` Jorge Ramirez [this message]
2025-08-04 11:15           ` Jorge Ramirez
2025-07-15 20:47 ` [PATCH v7 4/7] media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core Jorge Ramirez-Ortiz
2025-07-17  9:43   ` Bryan O'Donoghue
2025-08-04 10:40     ` Jorge Ramirez
2025-07-15 20:47 ` [PATCH v7 5/7] media: venus: core: Add qcm2290 DT compatible and resource data Jorge Ramirez-Ortiz
2025-07-28  6:16   ` Dikshita Agarwal
2025-07-28  9:39   ` Dmitry Baryshkov
2025-07-15 20:47 ` [PATCH v7 6/7] arm64: dts: qcom: qcm2290: Add Venus video node Jorge Ramirez-Ortiz
2025-07-15 20:47 ` [PATCH v7 7/7] arm64: dts: qcom: qrb2210-rb1: Enable Venus Jorge Ramirez-Ortiz
2025-07-17  9:45   ` Bryan O'Donoghue
2025-07-17 12:33     ` Jorge Ramirez

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=aHjtgHT2Nxmm5nEf@trex \
    --to=jorge.ramirez@oss.qualcomm.com \
    --cc=amit.kucheria@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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=quic_dikshita@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    /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;
as well as URLs for NNTP newsgroup(s).