Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1420679iog; Sat, 25 Jun 2022 08:52:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tZ0odrzc+vvePwo6jMcOYisK+oDAJAC+gpBBBATI3+CXlhMW5E17gjWcn6VMpCYPz8DNcc X-Received: by 2002:a17:906:9c84:b0:6e0:7c75:6f01 with SMTP id fj4-20020a1709069c8400b006e07c756f01mr4594845ejc.103.1656172357963; Sat, 25 Jun 2022 08:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656172357; cv=none; d=google.com; s=arc-20160816; b=xyDU6rML7z3sTt9ef8hQ4/DXVJgzxYH3j6aDuTw6jwWASnh+DXOE+Q7XuasxrLqRZl ZOApX8yUSmaBQvv9+aMonX/fDvPBilk1fKW++iuOD+ADhZpQzf10lVBLiRw19CYyNIps pkTmDCZEPqaSCKXAiwXG5gs3TrqI8Omw43YLTTLbDyiWQK5lvSkGqa83PMOZXavQ6yit Y9JgE2uk7qfixUXNyFXbBZqxlH3PAnp9fi0ZySyf1u2bhBZpFZO2d16lmMA+eMM2jQ7J Dj4HDrC9NRR/+6ZXuCUX1O+9eKikDAPeiPVcNtYV933X0REc48ivAALyc2RqMKg43Kn4 /mKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=W2HeGFQgLk1e9Km3S9SfOn5rxYkH34TUlnLdSzu3vHk=; b=vQKtEwcqjwva9QB9X/s7fDVGjdT9I1++yXj0bTeMAmtpQ86n1MOxTUjghZMcBn1tgJ zMieF9Zo0823Zk2ybrt3WzsojD9u0zeid+OnNhZn9kMLWLaJTfGKPZONtDugD13vXZ22 v5qnuAKc6Q6ZhRnJVEusJ+xDbVVx6IfTt7dzKgg8H3+iofGqKgwz5GX/qbCUgVG0UWjc osNIKk5KNLu7/gsuG6jNCWWAv0DDg8TUnkQW1liIazyz/I5Ru4dv6JuG811nxlMqvSLc J42acCd+h1VRFoM9hm56GDvRl9fTW3ZzywiYv1C4Ds1tJIHkxCY7kJc+10y4YLm0X0re rWjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=HboEAv4t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw15-20020a170906fcaf00b006f3a874f673si6042583ejb.4.2022.06.25.08.52.04; Sat, 25 Jun 2022 08:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=HboEAv4t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233131AbiFYPiy (ORCPT + 99 others); Sat, 25 Jun 2022 11:38:54 -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: 8bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 #define VIRT_BOOTI_VERSION MK_BI_VERSION(2, 0) 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 @@ #include #include +#include #include #include @@ -92,6 +93,9 @@ int __init virt_parse_bootinfo(const struct bi_record *record) data += 4; virt_bi_data.virtio.irq = be32_to_cpup(data); break; + case BI_VIRT_RNG_SEED: + add_bootloader_randomness(data + 4, be32_to_cpup(data)); + break; default: unknown = 1; break; -- 2.35.1