From patchwork Wed Apr 24 14:06:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10914901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7342D1515 for ; Wed, 24 Apr 2019 14:23:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62D6D289D8 for ; Wed, 24 Apr 2019 14:23:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5713928A6D; Wed, 24 Apr 2019 14:23:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3FBF289D8 for ; Wed, 24 Apr 2019 14:23:18 +0000 (UTC) Received: from localhost ([127.0.0.1]:42491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJInu-0000j4-5G for patchwork-qemu-devel@patchwork.kernel.org; Wed, 24 Apr 2019 10:23:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJIfe-0002aF-9o for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:14:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJIY2-0006hS-OE for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:06:56 -0400 Received: from m12-14.163.com ([220.181.12.14]:54537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJIY1-0006fH-8q for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:06:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=BBctNjDbfh7h2nNE/V nZPLT9nVBtuY81kv5/qyNenhU=; b=E9B7PVevEE46QOVsoSuKAu2BWPUWTKmFIL KCs1c+wGZyuVOcecxS8LW/UjeuUIzzreCsRxcMIpGgVTa30lPO2z/unRoMK0XEHl rDzJCFqdZcj2LqLwBOJ7hUfuDYwb/8t0xPeb54vByUS/1rzR59DElpDGSy4ya0x+ Ioa3xRn0w= Received: from localhost.localdomain (unknown [115.200.201.0]) by smtp10 (Coremail) with SMTP id DsCowAC3Ayl0bcBcrks9CA--.5531S5; Wed, 24 Apr 2019 22:06:51 +0800 (CST) From: Li Qiang To: philmd@redhat.com, lersek@redhat.com, kraxel@redhat.com, thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com Date: Wed, 24 Apr 2019 07:06:41 -0700 Message-Id: <20190424140643.62457-4-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190424140643.62457-1-liq3ea@163.com> References: <20190424140643.62457-1-liq3ea@163.com> X-CM-TRANSID: DsCowAC3Ayl0bcBcrks9CA--.5531S5 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr45Wr1DZF17CFyxJr45Awb_yoWfCFc_uF W3Aw1rW3y7AwnFkF9YyF15Aw15Ka4UXF9Ikrn7KFyqy34UX39Fkw4Iqa9F9w1rWFWUCr9x Ca95Xr1DCa1v9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8IzuJUUUUU== X-Originating-IP: [115.200.201.0] X-CM-SenderInfo: 5oltjvrd6rljoofrz/xtbBLxWgbVUMI+dgjQAAsH X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.14 Subject: [Qemu-devel] [PATCH v2 3/5] fw_cfg: reboot: store reboot-timeout as little endian X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , liq3ea@gmail.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP So that if the guest and host endianess does not match it can still work as expection. Signed-off-by: Li Qiang --- hw/nvram/fw_cfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 5c3a46ce6f..df4242fc9c 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -178,6 +178,7 @@ static void fw_cfg_reboot(FWCfgState *s) { const char *reboot_timeout = NULL; int64_t rt_val = -1; + uint32_t rt_le32; /* get user configuration */ QemuOptsList *plist = qemu_find_opts("boot-opts"); @@ -194,7 +195,8 @@ static void fw_cfg_reboot(FWCfgState *s) } } - fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&rt_val, 4), 4); + rt_le32 = cpu_to_le32(rt_val); + fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&rt_le32, 4), 4); } static void fw_cfg_write(FWCfgState *s, uint8_t value)