Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp106779ybl; Mon, 2 Dec 2019 08:13:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwnyTrBsDKvhvxvp/AfOXCpX/oJbK2OErVgWE9QoQXiGKRbpYaLfr0eIl8tsmO0vlVUq9Kn X-Received: by 2002:a17:906:3484:: with SMTP id g4mr79363449ejb.293.1575303197468; Mon, 02 Dec 2019 08:13:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303197; cv=none; d=google.com; s=arc-20160816; b=0/BMkBSzpRVMqCAYAYBRRo/Xc7VfpeQdvWCEXvWAcYHcKpf2QtOhMqwWyhGGQtHPq0 LLkUjg0tXj5ZVnnR3L4V+qOTTH1aJ5MrsrS6iuUySlIibuzN1Lwn/XspNCNSiaVpb3Ch 2kHUI6+E9E8AcMCAi2h5G8IBUa3L8J1ZsThR/Yq0+aGdJv4dgQDu05q+NA7t1k3NB5a6 Xa83fjoVS6P+ycUE8O1SMWlr/WtGJ9M0RWIN6/thFkHbIQONFiMRtrbbF8s4KKqLUCki nLdzl+d+fSTpR3IztQJD8mJhKXmog5gKt+aiXLUxLnwgj1QKai6Zy4V+9WNeBRYbYA1m S06w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7Xv8o+WsUdwWC7CiaXpsHd5QUxK044+HKFw9W9npptk=; b=JoXU9QvHNcXTuyaQ13BNOGx+FpSanJ7x/LV26FhqKc5MXP0YTjOiHbW6rZTFDxdXKt pkK5WeXsLMepVuL+6iZDS5bFMOzxNHILRMUK6Bhc20Ww0R7RewdpNOiBb2YSRd2KTtNe 74VTL6eRaPxSEowCmaQ0zX3H+CLeoxM3acDhyG1Fafmn34iAwTtNnEgKxqjZWZDlWFuW 1tZaCwmLZ3QbYUVPzQcUlZFWs5lymuX0l9d26F3wlakSHOYUwTCeqd+Q+5/LuwpCFU0C cMH5SYEz1fEQFzUXzXr75ST4YJRezfNJO5ZZyUVlN3sCxE0KAwAfD8rmUB+DG6wMYxqO B3Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ig1O7d6G; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si1986392edq.409.2019.12.02.08.12.19; Mon, 02 Dec 2019 08:13:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ig1O7d6G; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727477AbfLBQMR (ORCPT + 99 others); Mon, 2 Dec 2019 11:12:17 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46988 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfLBQMR (ORCPT ); Mon, 2 Dec 2019 11:12:17 -0500 Received: by mail-wr1-f66.google.com with SMTP id z7so41552443wrl.13 for ; Mon, 02 Dec 2019 08:12:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7Xv8o+WsUdwWC7CiaXpsHd5QUxK044+HKFw9W9npptk=; b=ig1O7d6GsDt4NBwP75X4Y5ujFXKgklak77SWNGcBuqnwXLGpk+P5XN90JKiEaf2DlT WrVdXQtvxPygQzaAZx5Wyn09al6SJ3AefSjaSRjKH65+vqyjjGV3AAI7blYUMk6bxxNU imZoAbvk8e7WIQaP2QJWb/dcdykPO0gubpktQ7rXHibDskvWbSc6e4RfKGeymd1SEHkQ rN4NCNH9RCYgSR8vJIq6oJKWcWEeRYOub/IGzL0nHFyW8U+kqcHiSk1Jtzj7DgCmQ2b1 6mAr45FJYKlH47wLqjdCfiLeG38To+D9j+tZ1HBGdU1DBkzyDaikMHe5JMWjDCUZBREU +AIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7Xv8o+WsUdwWC7CiaXpsHd5QUxK044+HKFw9W9npptk=; b=rdOtjMjXhDGBjzei5aG6QJlF1aRxcwZAne7UtJWlWicIINQY+NDknPxwrzUb0DgNzx ON08qdDp6WSiquBLQvsOvwybCRQPnM7MYP0SPP+lBruD6nPYeXgVYAQaqLKcypUoCoEl dH4MKZW7DEI3Rm5hV5snFd+5yXePhlqBhZ/d3WYS19EYGl6JGOJF5NwWUVle6KCl1Ihq RIPGbPWlR8JzZUmljQwzXPlhRz/xa4YTlIYNBijpLJZBU+iCYrnYkGxIwQkJ52fP4pVA jjSXRQb8Xd18hGGNXDzWiXg/lMM69YhBVq/OZSw6NmhkIiYPOQS7PWYoutvNg5PtEoGF iA1w== X-Gm-Message-State: APjAAAXOBsaRZgS+7W4V1gyNa/J4fLjU3uOTC42SeyaP3RvjgypM8dTp qE8kX/hXkktVYSantV765/JpCmWWl3EdWVjExpjlxA== X-Received: by 2002:a5d:5345:: with SMTP id t5mr34600649wrv.0.1575303135165; Mon, 02 Dec 2019 08:12:15 -0800 (PST) MIME-Version: 1.0 References: <1574864578-467-1-git-send-email-neal.liu@mediatek.com> <1574864578-467-4-git-send-email-neal.liu@mediatek.com> <1575027046.24848.4.camel@mtkswgap22> In-Reply-To: <1575027046.24848.4.camel@mtkswgap22> From: Ard Biesheuvel Date: Mon, 2 Dec 2019 16:12:09 +0000 Message-ID: Subject: Re: [PATCH v5 3/3] hwrng: add mtk-sec-rng driver To: Neal Liu , Catalin Marinas , Will Deacon , Marc Zyngier Cc: Lars Persson , Mark Rutland , DTML , Herbert Xu , wsd_upstream , Sean Wang , Linux Kernel Mailing List , Rob Herring , =?UTF-8?B?Q3J5c3RhbCBHdW8gKOmDreaZtik=?= , "linux-crypto@vger.kernel.org" , Matt Mackall , Matthias Brugger , "linux-mediatek@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org (adding some more arm64 folks) On Fri, 29 Nov 2019 at 11:30, Neal Liu wrote: > > On Fri, 2019-11-29 at 18:02 +0800, Lars Persson wrote: > > Hi Neal, > > > > On Wed, Nov 27, 2019 at 3:23 PM Neal Liu wrote: > > > > > > For MediaTek SoCs on ARMv8 with TrustZone enabled, peripherals like > > > entropy sources is not accessible from normal world (linux) and > > > rather accessible from secure world (ATF/TEE) only. This driver aims > > > to provide a generic interface to ATF rng service. > > > > > > > I am working on several SoCs that also will need this kind of driver > > to get entropy from Arm trusted firmware. > > If you intend to make this a generic interface, please clean up the > > references to MediaTek and give it a more generic name. For example > > "Arm Trusted Firmware random number driver". > > > > It will also be helpful if the SMC call number is configurable. > > > > - Lars > > Yes, I'm trying to make this to a generic interface. I'll try to make > HW/platform related dependency to be configurable and let it more > generic. > Thanks for your suggestion. > I don't think it makes sense for each arm64 platform to expose an entropy source via SMC calls in a slightly different way, and model it as a h/w driver. Instead, we should try to standardize this, and perhaps expose it via the architectural helpers that already exist (get_random_seed_long() and friends), so they get plugged into the kernel random pool driver directly. Note that in addition to drivers based on vendor SMC calls, we already have a RNG h/w driver based on OP-TEE as well, where the driver attaches to a standardized trusted OS interface identified by a UUID, and which also gets invoked via SMC calls into secure firmware.