Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1496285pxv; Fri, 23 Jul 2021 09:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyze6u5ROKjbCO+qgrYYmitGtwjgv4pctaUmG/0yxqNvCkfmbCx6a6QUg/FqNs1p/BFX83O X-Received: by 2002:a50:8d4e:: with SMTP id t14mr6838583edt.138.1627058404438; Fri, 23 Jul 2021 09:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627058404; cv=none; d=google.com; s=arc-20160816; b=Wy4JTFXFVVDyevto7J9tIytAENZzQTPDRRWQ6Ml1z5CltxeUFVJlsIOc4KrJQpRxjU PWsq+j86cBWqMqj0btbDImbI5JNJn+4wadjmpnqoroLL4VUsQlfh2+MEOn60KPfHYSx5 QYNeXbn00A2NNo+aQmb5F08YhPxYPtgOcLnmB81Gjv1pZo14JlDtjFZZD/enK5MitfI5 5jcrIwXL4jRlgH8uPE3C0fB5OiXAyQaKz6qF0HiVb7PeS/KzObB/dOvH1/qBpFT7b5TK eB/OEie/P2cSGsLt1QFXY6/H0ntT+NYXGQrzbXhD1uWpKxwn8rW1MQWyLSiiQYqgRWkS XHcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=785hAFYzEvvXgDNOlps/uilJuY90jwkPcJk85MScSdc=; b=0be/2+5hZBn3lhhLd/9bINZ5C1OKcWCbXmvbLebIvUJuV6+2/dHlIv6fdFVs9NiiL8 1XGh+qJ6XdUOAkpJbOaVIIWncuJh0Y2HncFt9geFW5CPzvgR4nXekk9DItuv5m37WrGa 4JLIsGuzemwfW4nMgPvdstRPd4aAROFiTx9C8cQ5CYfdLiF+hdhT+1AubpcizypToIh4 qu90fDXQ+YwbYQAnvLtY/CvgrPkJ/hkn1QWkT0DiOapdSU4CSqtMRJ5v52d52wjKfaxc dFrH0QpXuWHwok1oxLlF7QBoMtcN5QhpPh6d94DGvgIG/LQl5alzpCivRx5kOdxIrFg/ R5AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qI86xF2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw8si33661794ejb.409.2021.07.23.09.39.40; Fri, 23 Jul 2021 09:40:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qI86xF2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbhGWP5g (ORCPT + 99 others); Fri, 23 Jul 2021 11:57:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbhGWP5d (ORCPT ); Fri, 23 Jul 2021 11:57:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA24F60200; Fri, 23 Jul 2021 16:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627058286; bh=pd1ix9gd0V9QAYHQpMWrkQIf6jQWsci2L6UchtBY9t4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qI86xF2+XwpGobd+AVtrk9Vt3Xg0RhWBA3tocM463ffJOJYeaWWBW2Y9DsC2bDnvz owj4l9QwiliBJA2eG5gU87ZpumHw/fLqTc3cl7AbWRx3MNrxJ6JKQM6FdNXWnLHlJq T/YNgAUIBzy8BXYKyVTo+lkKuvESNJ4OSnXB/bX2cBuT+yBXgUwXWLuiYX2AbWdJs+ f1fybymRgSsSLJO9/08MtdJesr9lazeDZF10pv0BQWzhNN9Na69lpQpujxg/HAgv4X I46TcWgBIpkYYM7PNKO0SwlsbOJlUW7Z7gX1XOFM0oJmfL0xUAW9pecYsBZVSttmQN Tj9hfsiu8gW5Q== Date: Fri, 23 Jul 2021 17:37:59 +0100 From: Mark Brown To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= Cc: Lee Jones , Rob Herring , Greg Kroah-Hartman , "Rafael J. Wysocki" , Arnd Bergmann , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan , Sudeep Holla , Alexandre Belloni Subject: Re: [PATCH 1/3] regmap: add regmap using ARM SMCCC Message-ID: <20210723163759.GI5221@sirena.org.uk> References: <20210723135239.388325-1-clement.leger@bootlin.com> <20210723135239.388325-2-clement.leger@bootlin.com> <20210723144317.GF5221@sirena.org.uk> <20210723175315.3eb149c7@fixe.home> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0NB0lE7sNnW8+0qW" Content-Disposition: inline In-Reply-To: <20210723175315.3eb149c7@fixe.home> X-Cookie: Integrity has no need for rules. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0NB0lE7sNnW8+0qW Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 23, 2021 at 05:53:15PM +0200, Cl=E9ment L=E9ger wrote: > Mark Brown a =E9crit : > > 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. > > 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. --0NB0lE7sNnW8+0qW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmD68GcACgkQJNaLcl1U h9AOoQf/XcPYNux2gSP2MFrnxE4ztiYuGYt2dJkgiDZ37OOoWt/eiXqZWhYPe+GC Mw1O6d/fIJbEVU5aXXE6omUMRNf/gR/SeYzUl2x9Uh8o4IkkVKQ3zNGaLu7O2jys 93zlueWjwPP58aw5/G0JGSQvO6eYa6/jx4Zr8jbewaPzHI24kKYHtgNAcBoBHUAX ELuNj+8mbq/eh8C8yIRT55HAeT7umgJ2WxKCLFAEweh5pLTMZKlDl6V6+2bN4zZc 58OQhAfe7s5BHZt0wravJkSUPmogBBn9B4GsJd/2KYs5JVclJoZ6Tqb1akhWdBDV 5QO+gPCQxEFZ39kKZLHcwRUxmb/bCA== =Rmsv -----END PGP SIGNATURE----- --0NB0lE7sNnW8+0qW--