devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maximilian Luz <luzmaximilian@gmail.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Steev Klimaszewski <steev@kali.org>,
	Shawn Guo <shawn.guo@linaro.org>,
	Cristian Marussi <cristian.marussi@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-arm-msm@vger.kernel.org, linux-efi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] dt-bindings: firmware: Add Qualcomm UEFI Secure Application client
Date: Thu, 28 Jul 2022 14:49:38 +0200	[thread overview]
Message-ID: <b703f678-b2c5-cdeb-ac40-9646e043d1c3@gmail.com> (raw)
In-Reply-To: <CAC_iWjLWBJLth26ifFfHvimProHZu_w5SjQNWSH_D2Fs_JXjbA@mail.gmail.com>

On 7/28/22 14:35, Ilias Apalodimas wrote:
> Hi Maximilian
> 
> On Thu, 28 Jul 2022 at 13:48, Maximilian Luz <luzmaximilian@gmail.com> wrote:
>>
>> On 7/28/22 08:03, Ilias Apalodimas wrote:
>>> Hi all,
>>>
>>> On Wed, 27 Jul 2022 at 16:24, Sudeep Holla <sudeep.holla@arm.com> wrote:
>>>>
>>>> On Wed, Jul 27, 2022 at 03:03:49PM +0200, Maximilian Luz wrote:
>>>>>
>>>>> Is there really a good way around it?
>>>>
>>>> Yes rely on the firmware preferably auto discover, if that is not an option,
>>>> how about query. It seem to be working in your case.
>>>
>>> That's a good point.  We have a similar situation with some Arm
>>> devices and U-Boot.  Let me try to explain a bit.
>>>
>>> There's code plugged in in OP-TEE and U-Boot atm which allows you to
>>> store EFI variables on an RPMB.  This is a nice alternative if your
>>> device doesn't have any other secure storage,  however it presents
>>> some challenges after ExitBootServices, similar to the ones you have
>>> here.
>>>
>>> The eMMC controller usually lives in the non-secure world.  OP-TEE
>>> can't access that, so it relies on a userspace supplicant to perform
>>> the RPMB accesses.  That supplicant is present in U-Boot and
>>> Get/SetVariable works fine before ExitBootServices.  Once Linux boots,
>>>    the 'U-Boot supplicant' goes away and we launch the linux equivalent
>>> one from userspace.  Since variable accessing is a runtime service and
>>> it still has to go through the firmware we can't use those anymore
>>> since U-Boot doesn't preserve the supplicant, the eMMC driver and the
>>> OP-TEE portions needed in the runtime section(and even if it did we
>>> would now have 2 drivers racing to access the same hardware).  Instead
>>> U-Boot copies the variables in runtime memory and
>>> GetVariable/GetNextVariable still works, but SetVariable returns
>>> EFI_UNSUPPORTED.
>>>
>>> I've spent enough time looking at available solutions and although
>>> this indeed breaks the EFI spec, something along the lines of
>>> replacing the runtime services with ones that give you direct access
>>> to the secure world, completely bypassing the firmware is imho our
>>> least bad option.
>>
>> This sounds very similar to what Qualcomm may be doing on some devices.
>> The TrEE interface allows for callbacks and there are indications that
>> one such callback-service is for RPMB. I believe that at least on some
>> platforms, Qualcomm also stores UEFI variables in RPMB and uses the same
>> uefisecapp interface in combination with RPMB listeners installed by the
>> kernel to access them.
>>
>>> I have an ancient branch somewhere that I can polish up and send an
>>> RFC [1],  but the way I enabled that was to install an empty config
>>> table from the firmware.  That empty table is basically an indication
>>> to the kernel saying "Hey I can't store variables, can you do that for
>>> me".
>>>
>>> Is there any chance we can do something similar on that device (or
>>> find a reasonable way of inferring that we need to replace some
>>> services).  That way we could at least have a common entry point to
>>> the kernel and leave out the DT changes.
>>>
>>> [1] https://git.linaro.org/people/ilias.apalodimas/net-next.git/log/?h=setvar_rt_optee_3
>>
>> I would very much like to avoid the need for special bootloaders. The
>> devices we're talking about are WoA devices, meaning they _should_
>> ideally boot just fine with EFI and ACPI.
> 
> I've already responded to following email, but I'll repeat it here for
> completeness. It's not a special bootloader.  It's the opposite, it's
> a generic UEFI compliant bootloader which takes advantage of the fact
> EFI is extensible. We are doing something very similar in how we load
> our initrd via the EFI_LOAD_FILE2 protocol.  Whether Qualcomm can add
> that to their bootloaders is a different topic though.  But at some
> point we need to draw a line than keep overloading the DT because a
> vendor decided to go down it's own path.

But still, you're asking users to install an extra thing in the boot
chain. That's what I mean by "special". So the situation would then be
this: User needs a) GRUB (or something similar) for booting the kernel
(or dual-booting, ...), b) DTBLoader for loading the device-tree because
we don't support the ACPI Qualcomm provided, and c) your thing for EFI
variables and potentially other firmware fix-ups. b) and c) are both
things that "normal" users don't expect. IMHO we should try to get rid
of those "non-standard" things, not add more.

>>   From an end-user perspective, it's annoying enough that we'll have to
>> stick with DTs for the time being due to the use of PEPs in ACPI. I
>> really don't want to add some special bootloader for fixups to that.
>> Also, this would just move the problem from kernel to bootloader.
> 
> But it *is* a bootloader problem.  The bootloader is aware of the fact
> that it can't provide runtime services for X reasons and that's
> exactly why we are trying to set EFI_RT_PROPERTIES_TABLE correctly
> from the firmware.  All we are doing is install a config table to tell
> the OS "I can't do that, can you find a way around it?".

Sure, but is making the Linux installation process more device
dependent and complicated really the best way to solve this?

Regards,
Max

  reply	other threads:[~2022-07-28 12:49 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-23 22:49 [PATCH 0/4] firmware: Add support for Qualcomm UEFI Secure Application Maximilian Luz
2022-07-23 22:49 ` [PATCH 1/4] firmware: qcom_scm: Export SCM call functions Maximilian Luz
2022-07-23 22:49 ` [PATCH 2/4] firmware: Add support for Qualcomm Trusted Execution Environment SCM calls Maximilian Luz
2022-07-23 22:49 ` [PATCH 3/4] firmware: Add support for Qualcomm UEFI Secure Application Maximilian Luz
2023-01-17  8:24   ` Johan Hovold
2023-01-17  8:42     ` Maximilian Luz
2023-01-18 20:45     ` Maximilian Luz
2023-01-19 16:47       ` Johan Hovold
2023-01-19 17:19         ` Maximilian Luz
2023-01-17 11:05   ` Johan Hovold
2023-01-17 12:07     ` Maximilian Luz
2022-07-23 22:49 ` [PATCH 4/4] dt-bindings: firmware: Add Qualcomm UEFI Secure Application client Maximilian Luz
2022-07-25  1:06   ` Rob Herring
2022-07-26 10:17   ` Krzysztof Kozlowski
2022-07-26 11:15     ` Maximilian Luz
2022-07-26 13:25       ` Krzysztof Kozlowski
2022-07-26 15:00         ` Maximilian Luz
2022-07-27 11:24           ` Krzysztof Kozlowski
2022-07-27 13:00             ` Maximilian Luz
2022-07-28  7:48               ` Krzysztof Kozlowski
2022-07-28 10:25                 ` Maximilian Luz
2022-07-28 10:38                   ` Krzysztof Kozlowski
2022-07-28 10:49                     ` Maximilian Luz
2022-07-26 14:30   ` Sudeep Holla
2022-07-26 15:15     ` Maximilian Luz
2022-07-26 15:41       ` Sudeep Holla
2022-07-26 17:01         ` Maximilian Luz
2022-07-27 11:38           ` Krzysztof Kozlowski
2022-07-27 13:03             ` Maximilian Luz
2022-07-27 13:24               ` Sudeep Holla
2022-07-27 14:49                 ` Maximilian Luz
2022-07-28  6:03                 ` Ilias Apalodimas
2022-07-28 10:48                   ` Maximilian Luz
2022-07-28 11:33                     ` Sudeep Holla
2022-07-28 12:13                       ` Maximilian Luz
2022-07-28 12:24                       ` Ilias Apalodimas
2022-07-28 15:05                       ` Ard Biesheuvel
2022-07-28 15:16                         ` Ilias Apalodimas
2022-07-28 16:16                         ` Sudeep Holla
2022-07-28 16:24                           ` Konrad Dybcio
2022-07-28 12:35                     ` Ilias Apalodimas
2022-07-28 12:49                       ` Maximilian Luz [this message]
2022-07-28 16:56                         ` Ilias Apalodimas
2022-07-28 17:27                           ` Maximilian Luz
2022-07-29  8:52                             ` Sudeep Holla
2022-07-29 15:11                               ` Maximilian Luz
2022-07-31  9:54                             ` Ilias Apalodimas
2022-07-31 22:48                               ` Maximilian Luz
2022-07-28  8:23           ` Sudeep Holla
2022-07-28 10:05             ` Maximilian Luz
2022-07-28 11:21               ` Sudeep Holla
2022-07-28 11:45                 ` Maximilian Luz
2022-07-28 13:42                   ` Sudeep Holla
2022-07-28 14:09                     ` Maximilian Luz
2022-07-25 19:27 ` [PATCH 0/4] firmware: Add support for Qualcomm UEFI Secure Application Rob Herring
2022-07-25 20:16   ` Maximilian Luz
2022-08-02 11:51 ` Srinivas Kandagatla
2022-08-02 13:22   ` Maximilian Luz
2022-08-02 14:02     ` Ard Biesheuvel
2022-08-02 19:11       ` Maximilian Luz
2022-09-02  7:26     ` Sumit Garg
2022-09-02 13:18       ` Maximilian Luz
2022-09-05  6:50         ` Sumit Garg
2022-11-23 11:22     ` Srinivas Kandagatla
2022-11-23 12:05       ` Maximilian Luz

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=b703f678-b2c5-cdeb-ac40-9646e043d1c3@gmail.com \
    --to=luzmaximilian@gmail.com \
    --cc=agross@kernel.org \
    --cc=ardb@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cristian.marussi@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=steev@kali.org \
    --cc=sudeep.holla@arm.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).