All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan.gerhold@linaro.org>
To: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Dikshita Agarwal <quic_dikshita@quicinc.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-media@vger.kernel.org, linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH v2 11/11] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Date: Sat, 23 Aug 2025 22:43:52 +0200	[thread overview]
Message-ID: <aKooCFoV3ZYwOMRx@linaro.org> (raw)
In-Reply-To: <20250822164030.6gubbs24raeg6kbx@hu-mojha-hyd.qualcomm.com>

On Fri, Aug 22, 2025 at 10:10:30PM +0530, Mukesh Ojha wrote:
> On Fri, Aug 22, 2025 at 06:26:19PM +0200, Stephan Gerhold wrote:
> > On Fri, Aug 22, 2025 at 08:36:11PM +0530, Mukesh Ojha wrote:
> > > On Fri, Aug 22, 2025 at 10:46:20AM +0200, Stephan Gerhold wrote:
> > > > On Fri, Aug 22, 2025 at 09:56:49AM +0530, Vikash Garodia wrote:
> > > > > On 8/20/2025 7:09 PM, Stephan Gerhold wrote:
> > > > > >>>> +int iris_fw_init(struct iris_core *core)
> > > > > >>>> +{
> > > > > >>>> +	struct platform_device_info info;
> > > > > >>>> +	struct iommu_domain *iommu_dom;
> > > > > >>>> +	struct platform_device *pdev;
> > > > > >>>> +	struct device_node *np;
> > > > > >>>> +	int ret;
> > > > > >>>> +
> > > > > >>>> +	np = of_get_child_by_name(core->dev->of_node, "video-firmware");
> > > > > >>>> +	if (!np)
> > > > > >>>> +		return 0;
> > > > > >>> You need a dt-bindings change for this as well. This is documented only
> > > > > >>> for Venus.
> > > > > >> You are right, wanted to send device tree and binding support separately.
> > > > > >> But if required, will add with the series in the next version.
> > > > > >>
> > > > > > You can send device tree changes separately, but dt-binding changes
> > > > > > always need to come before the driver changes.
> > > > > 
> > > > > Do you mean to update the examples section[1] with the firmware subnode,
> > > > > something similar to venus schema[2] ?
> > > > > 
> > > > 
> > > > Sorry, I missed the fact that the "video-firmware" subnode is already
> > > > documented for iris as well through qcom,venus-common.yaml (which is
> > > > included for qcom,sm8550-iris). I don't think it's strictly required to
> > > > add every possibility to the examples of the schema, since we'll also
> > > > have the actual DTBs later to test this part of the schema.
> > > > 
> > > > I would recommend to extend the description of the "video-firmware" node
> > > > in qcom,venus-common.yaml a bit. You do use the reset functionality of
> > > > TrustZone, so the description there doesn't fit for your use case.
> > > > 
> > > > I think we will also have to figure out how to handle the old
> > > > "ChromeOS"/"non_tz" use case (that resets Iris directly with the
> > > > registers) vs the EL2 PAS use case (that resets Iris in TZ but still
> > > > handles IOMMU from Linux). Simply checking for the presence of the
> > > > "video-firmware" node is not enough, because that doesn't tell us if the
> > > > PAS support is present in TZ.
> > > > 
> > > > I have been experimenting with a similar patch that copies the "non_tz"
> > > > code paths from Venus into Iris. We need this to upstream the Iris DT
> > > > patch for X1E without regressing the community-contributed x1-el2.dtso,
> > > > which doesn't have functional PAS when running in EL2.
> > > > 
> > > > Perhaps we could check for __qcom_scm_is_call_available() with the new
> > > > QCOM_SCM_PIL_PAS_GET_RSCTABLE to choose between invoking reset via PAS
> > > > or directly with the registers. I don't have a device with the new
> > > > firmware to verify if that works.
> > > 
> > > You can check QCOM_SCM_PIL_PAS_GET_RSCTABLE with __qcom_scm_is_call_available() 
> > > but there is a possibility that QCOM_SCM_PIL_PAS_GET_RSCTABLE SMC call will be
> > > used even for Gunyah. So, I believe, __qcom_scm_is_call_available() and
> > > video-firmware's iommu property is also important.
> > > 
> > 
> > Yeah, this sounds good.
> > 
> > > > 
> > > > I'll try to send out my patch soon, so you can better see the context.
> > > 
> > > Are you saying that you are going to send patch to support IRIS on
> > > x1-el2.dtso in non-secure way i.e., non-PAS way.
> > > 
> > 
> > The background is the following: I have a pending patch to add iris to
> > x1e80100.dtsi, but that currently breaks x1-el2.dtso. My original plan
> > was to disable &iris in x1-el2.dtso (because the PAS way seems to be
> > just broken), but then I saw that e.g. sc7180-el2.dtso does have working
> > Venus with the "video-firmware" node. Copy-pasting the "no_tz"(/non-PAS)
> > code as-is from venus into iris works just fine for x1-el2.dtso, so
> > disabling &iris in x1-el2.dtso just because the "no_tz" code is
> > currently missing in iris doesn't sound right.
> > 
> > As far as I understand the approach you use in this series does not work
> > without the TZ changes for older platforms like X1E(?), so adding that
> > code in iris seems to be the best way to move forward.
> 
> Yes, this series has dependency on firmware and will not work for older
> platforms.
> 
> > 
> > I started working on a patch for this a while ago, it just needs a bit
> > more cleanup. I'll try to finish it up and post it so we can discuss it
> > further. I think the IOMMU management in my patch would even work as-is
> > for you, you would just need to toggle a boolean to use the PAS instead
> > of accessing the registers directly.
> 
> Sounds like a plan.
> Thanks, please cc me when you send the patches; So, I could test along
> with my changes and make dependency on it.
> 

Krzysztof raised the concern that we shouldn't model the IOMMU specifier
for the firmware using a "video-firmware" subnode [1], similar to the
discussion for the "non-pixel" subnode recently [2].

I mostly finished up the cleanup of my patch, but I don't see any point
in posting it without an alternative proposal for the dt-bindings. For
this case, I think a simple property like

	firmware-iommus = <&apps_smmu ...>;

instead of

	video-firmware {
		iommus = <&apps_smmu ...>;
	};

could perhaps work. (XYZ-iommus isn't standardized at the moment, but I
think something like XYZ-gpios would make sense in this case. There are
many other possible approaches as well though.)

Unfortunately, I won't have enough time in the next weeks to fully
implement and propose an alternative. I'm assuming you still have
ongoing work for supporting the "non-pixel" IOMMU, perhaps your new
approach can be adapted for video-firmware as well?

I've pushed my current patch to a branch in case it helps. It's similar
to yours, but it has no external dependencies except for a fix in iris
I sent recently ("media: iris: Fix firmware reference leak and unmap
memory after load" [3]). You could use the non-PAS use case as a basis
to add the initial implementation in iris independent of this larger
patch series.

https://git.codelinaro.org/stephan.gerhold/linux/-/commit/1e068f5864d958ab9e807e6e3772b778cd0edea8.patch

For the PAS+IOMMU use case, it should be enough to set core->use_tz to
true, plus any changes needed for the SHM bridge (and maybe resource
table). The IOMMU management is independent from core->use_tz.

I'm also happy to add the non-PAS approach later on top of your changes,
whatever works best for you. :)

Thanks,
Stephan

[1]: https://lore.kernel.org/r/20250823155349.22344-2-krzysztof.kozlowski@linaro.org/
[2]: https://lore.kernel.org/r/20250627-video_cb-v3-0-51e18c0ffbce@quicinc.com/T/
[3]: https://lore.kernel.org/r/20250818-iris-firmware-leak-v1-1-1e3f9b8d31ce@linaro.org/

  reply	other threads:[~2025-08-23 20:43 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 16:54 [PATCH v2 00/11] Peripheral Image Loader support for Qualcomm SoCs running Linux host at EL2 Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 01/11] firmware: qcom_scm: Introduce PAS context initialization helper Mukesh Ojha
2025-08-19 17:17   ` Pavan Kondeti
2025-08-20  6:19     ` Mukesh Ojha
2025-08-20 11:40   ` Bryan O'Donoghue
2025-08-20 12:28     ` Mukesh Ojha
2025-09-13 14:54   ` Bryan O'Donoghue
2025-08-19 16:54 ` [PATCH v2 02/11] soc: qcom: mdtloader: Add context aware qcom_mdt_pas_load() helper Mukesh Ojha
2025-08-20 11:48   ` Bryan O'Donoghue
2025-08-20 12:25     ` Mukesh Ojha
2025-09-03 15:03   ` Bryan O'Donoghue
2025-09-04  9:52     ` Mukesh Ojha
2025-09-04 10:15       ` Bryan O'Donoghue
2025-09-04 11:43         ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 03/11] firmware: qcom_scm: Add a prep version of auth_and_reset function Mukesh Ojha
2025-08-20 12:03   ` Bryan O'Donoghue
2025-08-20 12:24     ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 04/11] firmware: qcom_scm: Simplify qcom_scm_pas_init_image() Mukesh Ojha
2025-08-21 14:36   ` Bryan O'Donoghue
2025-08-21 16:29     ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 05/11] firmware: qcom_scm: Add shmbridge support to pas_init/release function Mukesh Ojha
2025-08-21 15:23   ` Bryan O'Donoghue
2025-08-21 17:03     ` Mukesh Ojha
2025-08-22 16:52       ` Mukesh Ojha
2025-08-22 23:13       ` Bryan O'Donoghue
2025-08-19 16:54 ` [PATCH v2 06/11] remoteproc: Move resource table data structure to its own header Mukesh Ojha
2025-08-20  8:12   ` Stephan Gerhold
2025-08-20 15:18     ` Mukesh Ojha
2025-08-20 15:31       ` Stephan Gerhold
2025-08-22  7:56         ` Mukesh Ojha
2025-08-20 16:32       ` Mukesh Ojha
2025-08-20 16:53         ` Stephan Gerhold
2025-08-22  9:21           ` Mukesh Ojha
2025-08-22  8:35         ` Krzysztof Kozlowski
2025-08-22  9:30           ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 07/11] firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table Mukesh Ojha
2025-08-21 15:05   ` Krzysztof Kozlowski
2025-08-21 17:20     ` Mukesh Ojha
2025-08-22  6:22       ` Krzysztof Kozlowski
2025-08-22  7:21         ` Mukesh Ojha
2025-08-22  8:30         ` Krzysztof Kozlowski
2025-08-19 16:54 ` [PATCH v2 08/11] soc: qcom: mdt_loader: Add helper functions to map and unmap resources Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 09/11] remoteproc: pas: Extend parse_fw callback to parse resource table Mukesh Ojha
2025-08-20  8:36   ` Stephan Gerhold
2025-08-20 11:14     ` Mukesh Ojha
2025-08-20 13:07       ` Stephan Gerhold
2025-08-21 14:49     ` Krzysztof Kozlowski
2025-08-21 17:41       ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 10/11] remoteproc: qcom: pas: Enable Secure PAS support with IOMMU managed by Linux Mukesh Ojha
2025-08-20  8:40   ` Stephan Gerhold
2025-08-20 12:03     ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 11/11] media: iris: " Mukesh Ojha
2025-08-20  8:46   ` Stephan Gerhold
2025-08-20 11:56     ` Mukesh Ojha
2025-08-20 13:39       ` Stephan Gerhold
2025-08-22  4:26         ` Vikash Garodia
2025-08-22  8:46           ` Stephan Gerhold
2025-08-22 15:06             ` Mukesh Ojha
2025-08-22 16:26               ` Stephan Gerhold
2025-08-22 16:40                 ` Mukesh Ojha
2025-08-23 20:43                   ` Stephan Gerhold [this message]
2025-08-25 11:19                     ` Mukesh Ojha
2025-09-08  8:23                       ` Stephan Gerhold
2025-09-09 12:19                         ` Mukesh Ojha
2025-09-09 14:03                           ` Bryan O'Donoghue
2025-08-20 11:33   ` Bryan O'Donoghue
2025-08-20 12:00     ` Mukesh Ojha
2025-08-22  8:45   ` Krzysztof Kozlowski
2025-08-22 15:13     ` Mukesh Ojha
2025-08-23 15:41       ` Krzysztof Kozlowski
2025-08-23 15:46         ` Krzysztof Kozlowski
2025-08-23 15:52           ` Krzysztof Kozlowski
2025-08-20 11:03 ` [PATCH v2 00/11] Peripheral Image Loader support for Qualcomm SoCs running Linux host at EL2 Bryan O'Donoghue
2025-08-20 11:22   ` Mukesh Ojha
2025-09-03 11:56     ` Konrad Dybcio
2025-09-03 13:31       ` Bryan O'Donoghue
2025-09-03 14:02         ` Dmitry Baryshkov
2025-09-03 14:05           ` Bryan O'Donoghue
2025-09-03 14:13           ` Bryan O'Donoghue
2025-09-03 14:21             ` Bryan O'Donoghue
2025-09-03 14:28             ` Dmitry Baryshkov

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=aKooCFoV3ZYwOMRx@linaro.org \
    --to=stephan.gerhold@linaro.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mchehab@kernel.org \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.