linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	Sudeep Holla <sudeep.holla@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Mark Brown <broonie@kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v2 0/5] ARM: arm64: Add SMCCC TRNG entropy service
Date: Thu,  5 Nov 2020 12:56:51 +0000	[thread overview]
Message-ID: <20201105125656.25259-1-andre.przywara@arm.com> (raw)

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.

Compared to the initial posts, this version:
- triggers the ARCH_RANDOM initialisation from the SMCCC firmware driver
- uses a single bool in smccc.c to hold the initialisation state for arm64
- handles endianess correctly in the KVM provider

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)
- ARM and arm64 KVM guests, using the KVM service in patch 5/5

Based on v5.10-rc2, please let me know if I should rebased on something
else. A git repo is accessible at:
https://gitlab.arm.com/linux-arm/linux-ap/-/commits/smccc-trng/v2/

Cheers,
Andre

[1] https://developer.arm.com/documentation/den0098/latest/

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 | 63 +++++++++++++++++---
 arch/arm64/include/asm/kvm_host.h   |  2 +
 arch/arm64/kvm/Makefile             |  2 +-
 arch/arm64/kvm/hypercalls.c         |  6 ++
 arch/arm64/kvm/trng.c               | 91 +++++++++++++++++++++++++++++
 drivers/firmware/smccc/smccc.c      |  5 ++
 include/linux/arm-smccc.h           | 31 ++++++++++
 9 files changed, 270 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/include/asm/archrandom.h
 create mode 100644 arch/arm64/kvm/trng.c

-- 
2.17.1


             reply	other threads:[~2020-11-05 12:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 12:56 Andre Przywara [this message]
2020-11-05 12:56 ` [PATCH v2 1/5] firmware: smccc: Add SMCCC TRNG function call IDs Andre Przywara
2020-11-05 12:56 ` [PATCH v2 2/5] firmware: smccc: Introduce SMCCC TRNG framework Andre Przywara
2020-11-05 12:56 ` [PATCH v2 3/5] ARM: implement support for SMCCC TRNG entropy source Andre Przywara
2020-11-05 17:15   ` kernel test robot
2020-11-05 17:56     ` André Przywara
2020-11-05 17:15   ` kernel test robot
2020-11-06 15:29   ` Marc Zyngier
2020-11-06 15:30     ` Ard Biesheuvel
2020-11-06 15:35       ` Marc Zyngier
2020-11-05 12:56 ` [PATCH v2 4/5] arm64: Add " Andre Przywara
2020-11-05 13:41   ` Mark Brown
2020-11-05 14:03     ` Mark Rutland
2020-11-05 14:04       ` Ard Biesheuvel
2020-11-05 14:30         ` Mark Rutland
2020-11-05 14:34           ` Ard Biesheuvel
2020-11-05 14:45             ` Mark Rutland
2020-11-05 14:48             ` Marc Zyngier
2020-11-05 14:29       ` Mark Brown
2020-11-05 14:38         ` Mark Rutland
2020-11-12 16:03           ` André Przywara
2020-11-05 14:30       ` André Przywara
2020-11-05 12:56 ` [PATCH v2 5/5] KVM: arm64: implement the TRNG hypervisor call Andre Przywara
2020-11-05 14:13   ` Marc Zyngier
2020-11-05 16:19     ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201105125656.25259-1-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=ardb@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).