Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp536310pxb; Thu, 5 Nov 2020 06:43:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOmGG8x76O6eQVhSE3/f5zv7W2/W4JejKUNytcwWmkAGVGkDFF75GJf3TahEj2wRHdot3d X-Received: by 2002:a17:906:3c13:: with SMTP id h19mr2655380ejg.117.1604587398943; Thu, 05 Nov 2020 06:43:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604587398; cv=none; d=google.com; s=arc-20160816; b=bO9OEtoJTubB+GasbyUehvZJW+B3cfgxJzIfcDzmU+8P2eSCYjqie4kcarSiVPqB0t /Wo+SBJ2eyghc1tBljeHME63M5EE03vC/R9n0UCiDfMFtYI+5EMjueylJfNktaiZXKEa CBxN+bu6rx9BtdDNGgEh0dlSJk9Na96iKb2ChcMw6Yci8+PwrYSDBLD9qVHMDw6QrCov 8fadF+iChW6jIIQ4Rsp2oZESP6NldTgSjG7pw9m1wd6almX7nay+NLQRw1FyB8K/96fo JDAlQkufaJ0bHhHW6glFMD9B8adSlpnUgmEh19lBCjBhUwVA/41AWhqzVHSKTpegzdD/ skIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=oTSZ9WjlDxRS6jUbhmrwl+JGwo+XJ07yz7XWAtHYrKM=; b=jE/aI5OczyeiulQXGmN1z/EYFlzqzo52su+lT1D8CMJh0khN2TnnXAh/dUqyJRMC3V fu2ufj7XNNEzOmeQ5cYKPa8OmrrbJkrDO9BNnjgggIRFgwfTkEkKyyYYoPK0qcvh6snS CmjQUjTTTSY5Ot/hJVT2Ysg+UA2wV69hvxzPFq5kUl9ZMDFBZ2WhFjZYntVqV9ZWGrss IFE1SDBZM80NT7CghM1Q+0M5mRUQvlzcHyjR+G1Ivio5X7TCXXry1Sd9B4IIynIrzJkW qyvXnZxPT/EB7MNb9J3FvReBCq4ES7wQQG4dQIDFOluZl7D5gS/NJIowNk7Ul/t6Qfgf Mh+Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si1308317eje.481.2020.11.05.06.42.55; Thu, 05 Nov 2020 06:43:18 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730822AbgKEOi6 (ORCPT + 99 others); Thu, 5 Nov 2020 09:38:58 -0500 Received: from foss.arm.com ([217.140.110.172]:34420 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727275AbgKEOi6 (ORCPT ); Thu, 5 Nov 2020 09:38:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB61414BF; Thu, 5 Nov 2020 06:38:57 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.58.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3B68D3F719; Thu, 5 Nov 2020 06:38:55 -0800 (PST) Date: Thu, 5 Nov 2020 14:38:52 +0000 From: Mark Rutland To: Mark Brown Cc: Andre Przywara , Will Deacon , Catalin Marinas , Ard Biesheuvel , Russell King , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Sudeep Holla , Lorenzo Pieralisi , Linus Walleij Subject: Re: [PATCH v2 4/5] arm64: Add support for SMCCC TRNG entropy source Message-ID: <20201105143852.GJ82102@C02TD0UTHF1T.local> References: <20201105125656.25259-1-andre.przywara@arm.com> <20201105125656.25259-5-andre.przywara@arm.com> <20201105134142.GA4856@sirena.org.uk> <20201105140322.GH82102@C02TD0UTHF1T.local> <20201105142949.GB4856@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105142949.GB4856@sirena.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 05, 2020 at 02:29:49PM +0000, Mark Brown wrote: > On Thu, Nov 05, 2020 at 02:03:22PM +0000, Mark Rutland wrote: > > On Thu, Nov 05, 2020 at 01:41:42PM +0000, Mark Brown wrote: > > > > It isn't obvious to me why we don't fall through to trying the SMCCC > > > TRNG here if for some reason the v8.5-RNG didn't give us something. > > > Definitely an obscure possibility but still... > > > I think it's better to assume that if we have a HW RNG and it's not > > giving us entropy, it's not worthwhile trapping to the host, which might > > encounter the exact same issue. > > There's definitely a good argument for that, but OTOH it's possible the > SMCCC implementation is doing something else (it'd be an interesting > implementation decision but...). That said I don't really mind, I think > my comment was more that if we're doing this the code should be explicit > about what the intent is since right now it isn't obvious. Either a > comment or having an explicit "what method are we choosing" thing. > > > That said, I'm not sure it's great to plumb this under the > > arch_get_random*() interfaces, e.g. given this measn that > > add_interrupt_randomness() will end up trapping to the host all the time > > when it calls arch_get_random_seed_long(). > > > Is there an existing interface for "slow" runtime entropy that we can > > plumb this into instead? > > Yeah, I was wondering about this myself - it seems like a better fit for > hwrng rather than the arch interfaces but that's not used until > userspace comes up, the arch stuff is all expected to be quick. I > suppose we could implement the SMCCC stuff for the early variants of the > API you added so it gets used for bootstrapping purposes and then we > rely on userspace keeping things topped up by fetching entropy through > hwrng or otherwise but that feels confused so I have a hard time getting > enthusiastic about it. I'm perfectly happy for the early functions to call this, or for us to add something new firmwware_get_random_*() functions that we can call early (and potentially at runtime, but less often than arch_get_random_*()). I suspect the easy thing to do for now is plumb this into the existing early arch functions and hwrng. Thanks, Mark.