Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp712347ybl; Thu, 12 Dec 2019 03:46:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxohzUNNqyIUwYicT4RCzHmaHYyGuMZns9o8l/9xW8l4UMEGhEHZkXHkXNDYEti3d+lI5Vb X-Received: by 2002:a05:6830:1715:: with SMTP id 21mr7913895otk.67.1576151188256; Thu, 12 Dec 2019 03:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576151188; cv=none; d=google.com; s=arc-20160816; b=hmnDqWUFHErdm3EaMHdbmDuOIBp4tBDKXbX2P9+7Cx/QSLtoZLhW75l3b2CPdmXUWT Bu15vzykiAqH1uYwzRugHcjM9ZHlkKuIni8msw7QA8sCN9wuCCqX3PmzzslrGplYoFa2 HVUh0hAJpq2aM7GvprcJH1fOrWuDcOLjpJpsu9D8fX0kfDg+vQB0nGHzpKHQoIeu3MpC LrdCI8pJZzillzpAl3SGREInDjzgnR940lz1cg984P+/OBKc2WX6sYB9sB8d0tqKqsGL bO5YoEHaFbanrseGCxWx6hCq2HRBN1muWbWQmaS1H2rgAN3yHIFBTw0ayBI099HIK7lf VJ/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=f14rAzG7GQ558alS86M+uZErxFlYAYL4aaDQ3G0XNLI=; b=myaPhyOp2QVD6MBsRGYE08gtYupE8JEFLXjAKTYx1GRNOHw/yTcJd+OR7Bp+pJh//4 WkmXOrDuISv387C7frJJQbI77flSVqnUmAr6J4X7HzIec35vET/vCZp7WsMfTpcBp07b 87yz7zkbZZJCFl9j/TgTVYIqVNcLfkbUJHfbjKCKVE+ROeOZVG5cTjIJ6R09Ic1o12na TMoU+WXcdYTfIBrJ0GxkJG+XyH3IIY1FGxvZX3pNBOPB2bJVcZbKyuNDHWl6ReJYGtQG QBXHIbnDviAekpyDnPfT9IKC1YJGbF0z/vAqUrvuXIHB5J2uwywoL8lKL2vZAJLMMNyp MF0w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si3132597otp.124.2019.12.12.03.46.09; Thu, 12 Dec 2019 03:46:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729069AbfLLLqC (ORCPT + 99 others); Thu, 12 Dec 2019 06:46:02 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:45044 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbfLLLqC (ORCPT ); Thu, 12 Dec 2019 06:46:02 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ifMuq-0000Vg-Vq; Thu, 12 Dec 2019 12:45:57 +0100 To: Neal Liu Subject: Re: [PATCH v5 3/3] hwrng: add mtk-sec-rng driver X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 12 Dec 2019 11:45:56 +0000 From: Marc Zyngier Cc: Florian Fainelli , Ard Biesheuvel , , Mark Rutland , DTML , Herbert Xu , wsd_upstream , Catalin Marinas , Sean Wang , , Linux Kernel Mailing List , Rob Herring , , Matt Mackall , Matthias Brugger , =?UTF-8?Q?Crystal_Guo_=28=E9=83=AD?= =?UTF-8?Q?=E6=99=B6=29?= , Will Deacon , Lars Persson , In-Reply-To: <1576127609.27185.8.camel@mtkswgap22> 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> <20191202191146.79e6368c@why> <299029b0-0689-c2c4-4656-36ced31ed513@gmail.com> <1576127609.27185.8.camel@mtkswgap22> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: neal.liu@mediatek.com, f.fainelli@gmail.com, ard.biesheuvel@linaro.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, herbert@gondor.apana.org.au, wsd_upstream@mediatek.com, catalin.marinas@arm.com, sean.wang@kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-crypto@vger.kernel.org, mpm@selenic.com, matthias.bgg@gmail.com, crystal.guo@mediatek.com, will@kernel.org, lists@bofh.nu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2019-12-12 05:13, Neal Liu wrote: > On Tue, 2019-12-03 at 11:17 +0000, Marc Zyngier wrote: >> On 2019-12-03 04:16, Florian Fainelli wrote: >> > On 12/2/2019 11:11 AM, Marc Zyngier wrote: >> >> On Mon, 2 Dec 2019 16:12:09 +0000 >> >> Ard Biesheuvel wrote: >> >> >> >>> (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. >> >> >> >> Absolutely. I'd love to see a standard, ARM-specified, >> virtualizable >> >> RNG that is abstracted from the HW. >> > >> > Do you think we could use virtio-rng on top of a modified >> virtio-mmio >> > which instead of being backed by a hardware mailbox, could use >> > hvc/smc >> > calls to signal writes to shared memory and get notifications via >> an >> > interrupt? This would also open up the doors to other virtio uses >> > cases >> > beyond just RNG (e.g.: console, block devices?). If this is >> > completely >> > stupid, then please disregard this comment. >> >> The problem with a virtio device is that it is a ... device. What we >> want >> is to be able to have access to an entropy source extremely early in >> the >> kernel life, and devices tend to be available pretty late in the >> game. >> This means we cannot plug them in the architectural helpers that Ard >> mentions above. >> >> What you're suggesting looks more like a new kind of virtio >> transport, >> which is interesting, in a remarkably twisted way... ;-) >> >> Thanks, >> >> M. > > In conclusion, is it helpful that hw_random has a generic interface > to > add device randomness by talking to hwrng which is implemented in the > firmware or the hypervisor? > For most chip vendors, I think the answer is yes. We already prepared > a > new patchset and need you agree with this idea. As long as it is a *unified* interface, I'm all for that. Thanks, M. -- Jazz is not dead. It just smells funny...