From nobody Sun Apr 19 21:57:35 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43D0FC433EF for ; Sat, 25 Jun 2022 15:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233141AbiFYPiz (ORCPT ); Sat, 25 Jun 2022 11:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233065AbiFYPix (ORCPT ); Sat, 25 Jun 2022 11:38:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7213515A2C for ; Sat, 25 Jun 2022 08:38:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F670614CE for ; Sat, 25 Jun 2022 15:38:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1C0FC341C0; Sat, 25 Jun 2022 15:38:50 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="HboEAv4t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1656171529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=W2HeGFQgLk1e9Km3S9SfOn5rxYkH34TUlnLdSzu3vHk=; b=HboEAv4t1+dldljw8zw4CRuDJan78kdT6RlYYm3yLsRG8wrC5hq+7eEhaV1vZyNckoqiLy 974QqWVyyC0fp/wtP3RfYuzSM01ITLpT62ECXLDnprxwsx8Oy4ZiWvZlgRokbzUsk65A6H 2zcmdShZGeBqmXeWMKwd3FAJAmzP8No= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id c2029b86 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sat, 25 Jun 2022 15:38:49 +0000 (UTC) From: "Jason A. Donenfeld" To: geert@linux-m68k.org, laurent@vivier.eu, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Cc: "Jason A. Donenfeld" Subject: [PATCH] m68k: virt: pass RNG seed via bootinfo block Date: Sat, 25 Jun 2022 17:38:41 +0200 Message-Id: <20220625153841.143928-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Other virt VMs can pass RNG seeds via the "rng-seed" device tree property or via UEFI, but m68k doesn't have either. Instead it has its own bootinfo protocol. So this commit adds support for receiving a RNG seed from it, which will be used at the earliest possible time in boot, just like device tree. Signed-off-by: Jason A. Donenfeld Reviewed-by: Laurent Vivier --- arch/m68k/include/uapi/asm/bootinfo-virt.h | 1 + arch/m68k/virt/config.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/arch/m68k/include/uapi/asm/bootinfo-virt.h b/arch/m68k/include= /uapi/asm/bootinfo-virt.h index e4db7e2213ab..7c3044acdf4a 100644 --- a/arch/m68k/include/uapi/asm/bootinfo-virt.h +++ b/arch/m68k/include/uapi/asm/bootinfo-virt.h @@ -12,6 +12,7 @@ #define BI_VIRT_GF_TTY_BASE 0x8003 #define BI_VIRT_VIRTIO_BASE 0x8004 #define BI_VIRT_CTRL_BASE 0x8005 +#define BI_VIRT_RNG_SEED 0x8006 =20 #define VIRT_BOOTI_VERSION MK_BI_VERSION(2, 0) =20 diff --git a/arch/m68k/virt/config.c b/arch/m68k/virt/config.c index 632ba200ad42..ad71af8273ec 100644 --- a/arch/m68k/virt/config.c +++ b/arch/m68k/virt/config.c @@ -2,6 +2,7 @@ =20 #include #include +#include #include =20 #include @@ -92,6 +93,9 @@ int __init virt_parse_bootinfo(const struct bi_record *re= cord) data +=3D 4; virt_bi_data.virtio.irq =3D be32_to_cpup(data); break; + case BI_VIRT_RNG_SEED: + add_bootloader_randomness(data + 4, be32_to_cpup(data)); + break; default: unknown =3D 1; break; --=20 2.35.1