Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp570035pxu; Tue, 6 Oct 2020 13:20:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJzkBBtjxFPwTgR3Oct3j1v68dBG68Db21XLw1rOnMILTCjkwgWV1uI+CPrAnpEaeuTppa X-Received: by 2002:a17:906:1411:: with SMTP id p17mr137345ejc.102.1602015625353; Tue, 06 Oct 2020 13:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602015625; cv=none; d=google.com; s=arc-20160816; b=RHkutpueF93eS259O5I/dUOUqaj0w5qWxb36I5+fIU17YlarEa3e3d2Xsz7EGEwt6o mvShfjxwnXtnamnyEJH/ICBAbnmMosrpQmG4OPQ3HI7sWvMHUtbaUqHsOPwHr0RbqnC/ vSuMS40lw7g0iXZCquqQ+DZ8F3dODU+kbFJK5HnJJsbpEaH20GnolNhjUBT8Y5h1Ji8P 04A7sP0dgZ4dE1CmOGuTGuup4lcECSyB0IW3xQvPJHy8iaDoRVeS12nq+ioqG1hX7mVT l685V6PRDxjQLoGmMMRVBDv6qbu356Al+h2tYjwNJJgOMJHpgzhIWfYZbQ78ZUAnb31+ 4uWw== 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=Z/fdcLEud6kb7T3AlzGyURZNe8JnfYlXYJDRgMxO5KA=; b=Me09obV8w1FDwQkKFK6FW/CS76uLOHadFX04rXpsMBUjOze9ScomRmJ87h5ydxyQm2 7kwbqcmXzd2gotSyl/T86JB1ToZf6C6nvx/TZ5uwGjgkVgoY/E5pHdOK+SqNbqEED7Hr ZhkNCK0iVN5BCeIhQ1v4AHkilnydEEK24jFKoCXYZ88+pAWPmRkX0kyYanBIr1Gd8l9j QlXKSJV4ctAuyBRqVRJSztQfub1LQ7FH1P5ZcXg4bvDkx9BmiSDpLkQ7F+E43Weo3Jq3 L7ppsFd1E6tOEilQziEaWAZ5fjyq3kziqcgOSmHPaFOQWLKXXosd8vi+jVUvXzCk7l3B FTlw== 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 k16si2899563ejd.538.2020.10.06.13.20.00; Tue, 06 Oct 2020 13:20:25 -0700 (PDT) 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 S1727202AbgJFUSs (ORCPT + 99 others); Tue, 6 Oct 2020 16:18:48 -0400 Received: from foss.arm.com ([217.140.110.172]:56210 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbgJFUSs (ORCPT ); Tue, 6 Oct 2020 16:18:48 -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 E7A0F113E; Tue, 6 Oct 2020 13:18:47 -0700 (PDT) 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 7B93D3F71F; Tue, 6 Oct 2020 13:18:46 -0700 (PDT) From: Andre Przywara To: Catalin Marinas , Will Deacon Cc: Mark Rutland , Mark Brown , Ard Biesheuvel , Richard Henderson , Lorenzo Pieralisi , Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] arm64: Add support for SMCCC TRNG interface Date: Tue, 6 Oct 2020 21:18:06 +0100 Message-Id: <20201006201808.37665-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 is the arm64 implementation of that interface, implemented in the arch_get_random_*() code. Patch 1/2 introduces the SMCCC function identifiers, this is extracted from Ard's patch, to avoid dependencies between the several patches floating around (ARM, KVM, arm64). Patch 2/2 detects the interface and calls into the firmware upon a call to arch_get_random_seed_long(). Support for the "early" variant is under investigation. This was tested on: - QEMU -kernel (no SMCCC, regression test) - Juno w/ standard firmware (SMCCC, but no TRNG: regression test) - Juno w/ "fake TRNG" firmware (to verify "random" numbers) - Juno w/ prototype of the h/w Trusted RNG support - mainline KVM (SMCCC, but no TRNG: regression test) - Ard's KVM patch (plus hack to inject fake numbers for verification purposes) Cheers, Andre [1] https://developer.arm.com/documentation/den0098/latest/ Andre Przywara (1): arm64: Add support for SMCCC TRNG firmware interface Ard Biesheuvel (1): firmware: smccc: Add SMCCC TRNG function call IDs arch/arm64/include/asm/archrandom.h | 83 +++++++++++++++++++++++++---- include/linux/arm-smccc.h | 31 +++++++++++ 2 files changed, 104 insertions(+), 10 deletions(-) -- 2.17.1