Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp475769pxy; Sat, 31 Jul 2021 13:50:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaf4XqHYwCHdVVAz5St4JgNb6eZALdy2xnXD1TASO9QZ0OEpfEar9xsh5mlPgAQLSsakby X-Received: by 2002:a05:6602:3304:: with SMTP id b4mr7585384ioz.186.1627764601296; Sat, 31 Jul 2021 13:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627764601; cv=none; d=google.com; s=arc-20160816; b=Hbw2wwGnfwvZopWyiwPxV03Hd9sK4tCLa3i3S4sE00IvAPDqhUbLWInaGyDJ1xHTJ1 0QlCK9fizyopvsPOuy6CvVoSHWP9A42e4qwSX5EV3H4zyQ1Ii5KtYMZsaL5FZq1xyreb +/u2nkWNo6u3JLIOx4ycWTtm5ejq4ZfyiIhoX03dZx5bVVA/iCmLHggWAxwgq0VZCmd8 o7CgLQ3Ay3Hsk9Q5walfiVa3oZD90KAW5eXeo6Rc+0JjLexGoLSXsIHOguKHZpdYdF8t CTimI4Twjd8pFDYUL8WfPCZ/PRoKN1+XcJdQ/1GeBCWA4pmzg9ESfdYkCjRzhn2tx3da Wi3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=E1S+ivTraaDGijnFh+mg4KCJHPc5YEhmTE2R2fO7KbM=; b=Wcn1KGIHtpAtWWJ5/d0kofxW4r8LcrJi31Zpm+oLy+9D+ueXqtYKi0f3/mJm96YkiC tdlIWCTypEQzxa35Vm0SwT9F7ZiNW3/CXkwkMIgT56m8vbR3+MuxHhvcTw3RgkZ6Iq6m EawkyalTEpIjGGZLvw2AuNj6OrhQMU1sM7BU0W2f8ittqngO0MBRddoBOuOJeZQsbJaa Y/rHT1kAreJCpYitXb00co9wIPMZNsNfUS5DPZkgOPIvoh78HclUatgb4vjVuj2jfu6N Nm8CYvZuVbpno9JblZ41tOJqwkccaCgH+8jmNpiv/MtCYHnvA9avY1NF5RdmK2n9Bci8 MEHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 a16si6906909ilb.149.2021.07.31.13.49.33; Sat, 31 Jul 2021 13:50:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S230312AbhGaUtj (ORCPT + 99 others); Sat, 31 Jul 2021 16:49:39 -0400 Received: from foss.arm.com ([217.140.110.172]:52358 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbhGaUti (ORCPT ); Sat, 31 Jul 2021 16:49:38 -0400 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 C095ED6E; Sat, 31 Jul 2021 13:49:31 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 979383F70D; Sat, 31 Jul 2021 13:49:29 -0700 (PDT) From: Andre Przywara To: Matt Mackall , Herbert Xu , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Herrenschmidt , Ard Biesheuvel , Mark Brown , Will Deacon , Ali Saidi , Jon Nettleton Subject: [PATCH v4 0/2] hwrng: Add Arm SMCCC TRNG based driver Date: Sat, 31 Jul 2021 21:48:43 +0100 Message-Id: <20210731204845.21196-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.14.1 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The "Arm True Random Number Generator Firmware Interface"[1] provides an SMCCC based interface to a true hardware random number generator. So far we are using that in arch_get_random_seed(), but it might be useful to expose the entropy through the /dev/hwrng device as well. This allows to assess the quality of the implementation, by using "rngtest" from the rng-tools package, for example. Patch 1 creates a platform device, triggered by the previous discovery of the SMCCC TRNG service. Patch 2 implements a hw_random platform driver, which is instantiated through this said platform device. The driver can be loaded as module, or built into the kernel. [1] https://developer.arm.com/documentation/den0098/latest/ Changelog v3 ... v4: - drop pointless driver loading message - drop unneeded init() routine Changelog v2 ... v3: - split platform device and driver Changelog v1 ... v2: - fix building as a module - de-register device upon exit - mention module name in Kconfig Andre Przywara (2): firmware: smccc: Register smccc_trng platform device hwrng: Add Arm SMCCC TRNG based driver drivers/char/hw_random/Kconfig | 14 +++ drivers/char/hw_random/Makefile | 1 + drivers/char/hw_random/arm_smccc_trng.c | 123 ++++++++++++++++++++++++ drivers/firmware/smccc/smccc.c | 17 ++++ 4 files changed, 155 insertions(+) create mode 100644 drivers/char/hw_random/arm_smccc_trng.c -- 2.17.6