Thread (15 messages) 15 messages, 7 authors, 2021-07-30

Re: [PATCH 1/3] regmap: add regmap using ARM SMCCC

From: Mark Brown <broonie@kernel.org>
Date: 2021-07-23 16:38:12
Also in: lkml

On Fri, Jul 23, 2021 at 05:53:15PM +0200, Clément Léger wrote:
Mark Brown [off-list ref] a écrit :
quoted
I can't see any SMC specification for this interface?  Frankly I have
some very substantial concerns about the use case for this over
exposing the functionality of whatever device the SMC is gating
access to through SMC interfaces specific to that functionality.
This would require to modify drivers to check if the access should be
done using SMCs, parse the device tree to find appropriate SMC ids for
each functionality, add dependencies in KConfig on
HAVE_ARM_SMCCC_DISCOVERY, and do SMC calls instead of regmap access.
I'm not saying this is not the way to go but this is clearly more
intrusive than keeping the existing syscon support.
You're not doing this at the syscon level, you're doing this at the
regmap level.  Any user of this code is going to have to be modified to
use the SMCCC regmap and discover the relevant SMCCC interfaces no
matter what, but by having it we're saying that that's a sensible and
reasonable thing to do and encouraging implementations as a result.

Device specific regmap interfaces do not require adding anything to the
core, there's the reg_read() and reg_write() callbacks for this, if
there is a sensible use case for this at the syscon level and only the
syscon level (but I really do strongly question if it's a good idea at
all) then you can use those without adding a generic interface for
defining SMCCC conduits as regmaps.  TBH what's being added to the
regmap core is so trival that I don't see what we'd be gaining anyway
even if this was widely used, it's not helping with the SMCCC
enumeration side at all.
quoted
Exposing raw access to a (presumed?) subset of whatever device
functionality feels like the wrong abstraction level to be working at
and like an invitation to system integrators to do things that are
going to get them into trouble down the line.
Indeed, access is reduced to a subset of registers offset which are
checked by the TEE.
I really think it would be clearer and safer to have the TEE expose
specific operations that encode the intent of whatever it is trying to
accomplish rather than just expose the register map and then audit the
operations that are going on in the register map after the fact.  It
seems like it's going to be more error prone to do things this way,
especially as this starts getting used as a generic pipe for exposing
things and things get built up - as well as auditing concerns if any
problems are identified it's going to be harder to track the intent of
what the non-secure world is doing.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help