From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3199C4332F for ; Mon, 17 Oct 2022 13:53:26 +0000 (UTC) Received: from localhost ([::1]:33220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okQYX-0004A5-JJ for qemu-devel@archiver.kernel.org; Mon, 17 Oct 2022 09:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okQVk-0001lX-24 for qemu-devel@nongnu.org; Mon, 17 Oct 2022 09:50:33 -0400 Received: from hsmtpd-def.xspmail.jp ([202.238.198.238]:50500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okQVi-0007Df-3q for qemu-devel@nongnu.org; Mon, 17 Oct 2022 09:50:31 -0400 X-Country-Code: JP Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) by hsmtpd-out-0.asahinet.cluster.xspmail.jp (Halon) with ESMTPA id 1d401af2-165f-4244-a75b-cd4b4c121455; Mon, 17 Oct 2022 22:50:23 +0900 (JST) Received: from SIOS1075.ysato.ml (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by sakura.ysato.name (Postfix) with ESMTPSA id DF8B81C023A; Mon, 17 Oct 2022 22:50:20 +0900 (JST) Date: Mon, 17 Oct 2022 22:50:18 +0900 Message-ID: <87k04ylftx.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: "Jason A. Donenfeld" Cc: peter.maydell@linaro.org, pbonzini@redhat.com, qemu-devel@nongnu.org Subject: Re: [PATCH v2 5/8] rx: re-randomize rng-seed on reboot In-Reply-To: <20221011204645.1160916-6-Jason@zx2c4.com> References: <20221011204645.1160916-1-Jason@zx2c4.com> <20221011204645.1160916-6-Jason@zx2c4.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Received-SPF: softfail client-ip=202.238.198.238; envelope-from=ysato@users.sourceforge.jp; helo=hsmtpd-def.xspmail.jp X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Wed, 12 Oct 2022 05:46:42 +0900, Jason A. Donenfeld wrote: > > When the system reboots, the rng-seed that the FDT has should be > re-randomized, so that the new boot gets a new seed. Since the FDT is in > the ROM region at this point, we add a hook right after the ROM has been > added, so that we have a pointer to that copy of the FDT. > > Cc: Yoshinori Sato > Signed-off-by: Jason A. Donenfeld > --- > hw/rx/rx-gdbsim.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c > index 8ffe1b8035..198d048964 100644 > --- a/hw/rx/rx-gdbsim.c > +++ b/hw/rx/rx-gdbsim.c > @@ -25,6 +25,7 @@ > #include "hw/rx/rx62n.h" > #include "sysemu/qtest.h" > #include "sysemu/device_tree.h" > +#include "sysemu/reset.h" > #include "hw/boards.h" > #include "qom/object.h" > > @@ -148,6 +149,8 @@ static void rx_gdbsim_init(MachineState *machine) > dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16); > rom_add_blob_fixed("dtb", dtb, dtb_size, > SDRAM_BASE + dtb_offset); > + qemu_register_reset(qemu_fdt_randomize_seeds, > + rom_ptr(SDRAM_BASE + dtb_offset, dtb_size)); > /* Set dtb address to R1 */ > RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset; > } > -- > 2.37.3 > Reviewed-by: Yoshinori Sato -- Yosinori Sato