[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6328fe8d-c4ea-4945-b6ba-d994403121b5@broadcom.com>
Date: Wed, 12 Mar 2025 10:51:27 -0700
From: Florian Fainelli <florian.fainelli@...adcom.com>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Avri Altman <Avri.Altman@...disk.com>,
Kamal Dasu <kamal.dasu@...adcom.com>,
Jens Wiklander <jens.wiklander@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"robh@...nel.org" <robh@...nel.org>, "krzk+dt@...nel.org"
<krzk+dt@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
"wsa+renesas@...g-engineering.com" <wsa+renesas@...g-engineering.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"bcm-kernel-feedback-list@...adcom.com"
<bcm-kernel-feedback-list@...adcom.com>
Subject: Re: [PATCH RFC 0/3] mmc: sdhci-brcmstb: Add rpmb sharing support
On 3/12/25 06:17, Ulf Hansson wrote:
> On Tue, 11 Feb 2025 at 18:01, Florian Fainelli
> <florian.fainelli@...adcom.com> wrote:
>>
>> On 2/11/25 00:13, Avri Altman wrote:
>>>>>> This patch set adds support for Broadcom TZOS to read and write to
>>>>>> RPMB partition using synchronized access to the controller hardware.
>>> Practically it establishes a communication channel between the trust zone and the host controller regardless of the rpmb protocol.
>>> Or did I get it wrong?
>>
>> Rather than communication channel, I would describe it as an arbitration
>> scheme between N participants, with guaranteed forward progress and
>> fairness between all participants.
>
> A scheduler in the MMC controller HW?
There is no scheduler in the eMMC controller HW, all of the scheduling
and coordination is left to the OS and TZOS, and other participants.
>
> Nevertheless, it means bypassing the I/O scheduler in Linux and the
> mmc block layer, kind of breaking "fairness" from Linux point of view.
Yes that is a given, our approach favors the TZOS that has the ability
to preempt for short periods of time the eMMC controller issue a RPMB
access and then return control of the eMMC controller back to Linux. The
very reason we came up with that scheme is that we are not comfortable
with having a Linux task responsible for issuing RPMB accesses to the
eMMC device on behalf of the TEE. That task is subject to the same Linux
scheduling rules as any other task (yes we can play with priorities and
classes) and our TEE team was not comfortable with that, they prefer
hard guarantees that their RPMB accesses can complete within a certain
time, which this scheme provides.
>
>>
>> The interest here is for one of those participants to own the eMMC
>> controller for a certain amount of time and indicate when it is done
>> with it. This is not specific to eMMC as this could scale to virtually
>> any piece of HW that is driven by transactions from a CPU, but the main
>> application is for allowing the Trusted OS to own the eMMC controller
>> for a short period of time in order to do its RPMB access, and then give
>> it back in the same state it found it to the next participant.
>
> Honestly, I think this is a really terrible idea, sorry.
> > Data and communication with an eMMC needs to be synchronized and
> managed by a single owner. Having multiple clients with their own
> channel to the eMMC sounds prone to problems. Is each client going to
> have its own mmc protocol stack, dealing with eMMC initialization,
> data-synchronization and power-management, etc?
The synchronization is done around the start/end of transactions and yes
each participant does have a minimal amount of eMMC driver knowledge,
but is confined to doing RPMB accesses only. The contract is to put the
eMMC controller back into the state where you found it for the next
participant to make use of it.
When we operate with a single participant such as Linux, which is a
degraded mode there is no loss of performance nor any observable difference.
>
> As I said, we now have the RPMB subsystem for in-kernel access. Please
> use it instead.
That scheme works when all of the participants run on the same CPU, that
is not our case, as we have another participant that is a separate CPU
which you cannot factor into Linux's RPMB subsystem.
We considered doing a mediated/proxied eMMC access through a firmware
interface running on a CPU that would exclusively own the hardware, but
we really did not like losing access to mmc-utils and other things.
--
Florian
Powered by blists - more mailing lists