From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02ADFC433DB for ; Wed, 6 Jan 2021 10:37:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95CCF23102 for ; Wed, 6 Jan 2021 10:37:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95CCF23102 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=UBlw0Y3ocK7s996TlZu87xBw3nv8n1NgsB49qunQC6Y=; b=vceNtYaxZJRRkB3JRdWYys1gnO X7knVyDfqwp776dhAHCT3DexDCSmybHvAALQD5hHIyMHv9j2yUwFYY7/GcHG3JY9q4/vqZcAp2B18 SOeLkyVvATLW2obwTjJKAoIS7+iq+aKaDyWCwstKFiTCJn1MqgWVOIVXc31q8cM5P9wN/yKJphoAj 30mkhehDIz43p5VPXDcumkuof1uyoLx2ypy++ZTHnPoTsOrKXYYU/3mYzOqnjb38CtCuQUmXdu/7o pyY4mLmfWBi5xg11NKTEIBjY544lIoo/5ifCSa4YQVPar6D0iy7Q2ZOZnxShhSAYCXg2cPSx9xyZ2 gcmBt6Bg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kx69i-0000rQ-N5; Wed, 06 Jan 2021 10:35:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kx69f-0000q4-Qv for linux-arm-kernel@lists.infradead.org; Wed, 06 Jan 2021 10:35:05 +0000 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 D11061FB; Wed, 6 Jan 2021 02:35:01 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.195.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F0EC43F719; Wed, 6 Jan 2021 02:34:59 -0800 (PST) From: Andre Przywara To: Will Deacon , Catalin Marinas , Ard Biesheuvel , Russell King , Marc Zyngier Subject: [PATCH v6 0/5] ARM: arm64: Add SMCCC TRNG entropy service Date: Wed, 6 Jan 2021 10:34:48 +0000 Message-Id: <20210106103453.152275-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210106_053503_974183_F7C68804 X-CRM114-Status: GOOD ( 21.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Lorenzo Pieralisi , Theodore Ts'o , Linus Walleij , linux-kernel@vger.kernel.org, Mark Brown , Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, a fix to v5, now *really* fixing the wrong priority of SMCCC vs. RNDR in arch_get_random_seed_long_early(). Apologies for messing this up in v5 and thanks to broonie for being on the watch! Will, Catalin: it would be much appreciated if you could consider taking patch 1/5. This contains the common definitions, and is a prerequisite for every other patch, although they are somewhat independent and likely will need to go through different subsystems. Cheers, Andre ============================== The ARM architected TRNG firmware interface, described in ARM spec DEN0098[1], defines an ARM SMCCC based interface to a true random number generator, provided by firmware. This series collects all the patches implementing this in various places: as a user feeding into the ARCH_RANDOM pool, both for ARM and arm64, and as a service provider for KVM guests. Patch 1 introduces the interface definition used by all three entities. Patch 2 prepares the Arm SMCCC firmware driver to probe for the interface. This patch is needed to avoid a later dependency on *two* patches (there might be a better solution to this problem). Patch 3 implements the ARM part, patch 4 is the arm64 version. The final patch 5 adds support to provide random numbers to KVM guests. This was tested on: - QEMU -kernel (no SMCCC, regression test) - Juno w/ prototype of the h/w Trusted RNG support - mainline KVM (SMCCC, but no TRNG: regression test) - ARM and arm64 KVM guests, using the KVM service in patch 5/5 Based on v5.11-rc2, please let me know if I should rebase it on something else. A git repo is accessible at: https://gitlab.arm.com/linux-arm/linux-ap/-/commits/smccc-trng/v6/ Cheers, Andre [1] https://developer.arm.com/documentation/den0098/latest/ Changelog v5 ... v6: - *really* fixing order of SMCCC vs. RNDR call in the *_early() version Changelog v4 ... v5: - change order of SMCCC call vs. RNDR call in arch_get_random_seed_long_early - adding Sudeep's R-b: tags Changelog v3 ... v4: - include cache.h to always have __ro_after_init defined - change order of SMCCC call vs. RNDR call in arm64's archrandom.h - adding LinusW's R-b: tags Changelog v2 ... v3: - ARM: fix compilation with randconfig - arm64: use SMCCC call also in arch_get_random_seed_long_early() - KVM: comment on return value usage - KVM: use more interesting UUID (enjoy, Marc!) - KVM: use bitmaps instead of open coded long arrays - KVM: drop direct usage of arch_get_random() interface Changelog "v1" ... v2: - trigger ARCH_RANDOM initialisation from the SMCCC firmware driver - use a single bool in smccc.c to hold the initialisation state for arm64 - handle endianess correctly in the KVM provider Andre Przywara (2): firmware: smccc: Introduce SMCCC TRNG framework arm64: Add support for SMCCC TRNG entropy source Ard Biesheuvel (3): firmware: smccc: Add SMCCC TRNG function call IDs ARM: implement support for SMCCC TRNG entropy source KVM: arm64: implement the TRNG hypervisor call arch/arm/Kconfig | 4 ++ arch/arm/include/asm/archrandom.h | 74 +++++++++++++++++++++++++ arch/arm64/include/asm/archrandom.h | 82 ++++++++++++++++++++++++---- arch/arm64/include/asm/kvm_host.h | 2 + arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/hypercalls.c | 6 ++ arch/arm64/kvm/trng.c | 85 +++++++++++++++++++++++++++++ drivers/firmware/smccc/smccc.c | 6 ++ include/linux/arm-smccc.h | 31 +++++++++++ 9 files changed, 281 insertions(+), 11 deletions(-) create mode 100644 arch/arm/include/asm/archrandom.h create mode 100644 arch/arm64/kvm/trng.c -- 2.17.1 *** BLURB HERE *** Andre Przywara (2): firmware: smccc: Introduce SMCCC TRNG framework arm64: Add support for SMCCC TRNG entropy source Ard Biesheuvel (3): firmware: smccc: Add SMCCC TRNG function call IDs ARM: implement support for SMCCC TRNG entropy source KVM: arm64: implement the TRNG hypervisor call arch/arm/Kconfig | 4 ++ arch/arm/include/asm/archrandom.h | 74 +++++++++++++++++++++++++ arch/arm64/include/asm/archrandom.h | 82 ++++++++++++++++++++++++---- arch/arm64/include/asm/kvm_host.h | 2 + arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/hypercalls.c | 6 ++ arch/arm64/kvm/trng.c | 85 +++++++++++++++++++++++++++++ drivers/firmware/smccc/smccc.c | 6 ++ include/linux/arm-smccc.h | 31 +++++++++++ 9 files changed, 281 insertions(+), 11 deletions(-) create mode 100644 arch/arm/include/asm/archrandom.h create mode 100644 arch/arm64/kvm/trng.c -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel