Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1445601iog; Sat, 25 Jun 2022 09:29:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uqlSOMbUv2yK/ae4Y4jjJQOCo9c+pkQHwPmBvaDAsiWt1mwbAGdP5gjrDPXA4DWmwqn/Ha X-Received: by 2002:aa7:c857:0:b0:433:5c62:ddbc with SMTP id g23-20020aa7c857000000b004335c62ddbcmr6034038edt.218.1656174553365; Sat, 25 Jun 2022 09:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656174553; cv=none; d=google.com; s=arc-20160816; b=jo1G05aAuDn/Bf2WCJ0UP5AvKSkrKuHbzvySL4uWjBDHU+1A6Q2Y99dCwCugZ+fYeB SOnZ58SEVM5CAcRJ9hgIwoEQmkw96IVL3FgMncCcNH4t0poAyUmrkwqcKPog+zLmkhJj wKrBNZMXoSAn1E3kvTRP69ZUj6SBYl/QbXH8HW9xZDRd8mZolikRUNK2dtvHAVMRDTGt H/DI5iWvwKgHnPTArLVmadESToEe7E/j4XSdqSiKZJjflqc2X4uATu8Hj55u9uKdN0Ym ri2lHFEUfGhU/noDFxj1f6JKRuv8qF/71xx9dSUnGjaDXhyCaf3WRnl8a4gvvgnUEs33 cy6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZhFippxmz1dvC7jgL/gj9iy6JyEimwp5f4boGKlnkuU=; b=Y+Wo4dcBBQxUvXmVPSBrt8BZmYTCof0EfivDzlLpz7yg4+pUtsNkaAkj7d5JAy+6w6 /0GioGKaW2hR9GUzRIkgairlvkQxXQoPmNPu00Aa4q76VwD0dQPfJlDlJZEVGUVYoFYa AyKvWhF6NRtYV2J3DTgqJfNrGMhd8mH84HwLG6LDEx4SeymgN693ATmSNSqoZylh97WW MYMTQBDMly8ENfz+zf5aQ3REOkpK/xunQ+DAwpkZ/d/XHnhrEnx+SSnKGcPT46vCa9w4 VYmxzFryhoKZXbqrpe0ULeSlq+vmjlHOf6PHXBmZt7JMbkZ6Q8dnuJ+Z0uyNGKp15U3Z dWAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=bUX6Xlfi; 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 ne23-20020a1709077b9700b006feb04902a8si7852894ejc.824.2022.06.25.09.28.48; Sat, 25 Jun 2022 09:29:13 -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=bUX6Xlfi; 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 S233270AbiFYQUP (ORCPT + 99 others); Sat, 25 Jun 2022 12:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233251AbiFYQUN (ORCPT ); Sat, 25 Jun 2022 12:20:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A67C13E03 for ; Sat, 25 Jun 2022 09:20:13 -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 8F8AA6152F for ; Sat, 25 Jun 2022 16:20:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7339AC341C0 for ; Sat, 25 Jun 2022 16:20:11 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="bUX6Xlfi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1656174008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZhFippxmz1dvC7jgL/gj9iy6JyEimwp5f4boGKlnkuU=; b=bUX6XlfiQwXZmDt2pV373ltUZJoletKqMSAD+LxsdFMxyzT5D8I6IYMCVmjLUF5yQKuLeE fx1M1vl52PHqD9TJ1gP/KkMrDsnNEtdJu9bwtPW5AvWxuZ03A4k1brTctGc7cXHo8vpEdA fcujdzxJ0cF8iqWykpdJibhR0v8YM4A= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 60490be4 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Sat, 25 Jun 2022 16:20:08 +0000 (UTC) Received: by mail-io1-f53.google.com with SMTP id p69so5627053iod.10 for ; Sat, 25 Jun 2022 09:20:07 -0700 (PDT) X-Gm-Message-State: AJIora/TM0t5PKYiLjDMUmyT/6VE4uUZrK702He2Q/OJAhOnUonveqKl 6TZxaOLuEE4w2EzEnLi5CWUkLYQiQ1fLHDc8tnI= X-Received: by 2002:a05:6602:2d90:b0:63d:b41e:e4e4 with SMTP id k16-20020a0566022d9000b0063db41ee4e4mr2392482iow.172.1656174006947; Sat, 25 Jun 2022 09:20:06 -0700 (PDT) MIME-Version: 1.0 References: <20220625153841.143928-1-Jason@zx2c4.com> <512bdf97-5468-e2d2-75bd-24107aaf8a34@vivier.eu> In-Reply-To: <512bdf97-5468-e2d2-75bd-24107aaf8a34@vivier.eu> From: "Jason A. Donenfeld" Date: Sat, 25 Jun 2022 18:19:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] m68k: virt: pass RNG seed via bootinfo block To: Laurent Vivier Cc: Geert Uytterhoeven , linux-m68k , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Sat, Jun 25, 2022 at 6:08 PM Laurent Vivier wrote: > > Le 25/06/2022 =C3=A0 17:38, Jason A. Donenfeld a =C3=A9crit : > > 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/inc= lude/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 +=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)); > > In fact, why don't you use the record->size to get the size of the buffer= ? > > It seems useless to encode twice the length of the buffer, the second tim= e on a 32bit while the > length cannot exceed a 16bit value. Doesn't that make the length ambiguous because of required alignment? Would rather keep this general. As is, it's also much more like the others and more uniform to keep it that way. You were able to review it and see that it was right after glancing for a second. That seems superior to any imaginary gains we'd get by overloading the record size. Jason