[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 13/15] hw/nvram/fw_cfg: Store 'reboot-timeout' as littl
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-ppc] [PULL 13/15] hw/nvram/fw_cfg: Store 'reboot-timeout' as little endian |
Date: |
Thu, 23 May 2019 14:43:18 +0200 |
From: Li Qiang <address@hidden>
The current codebase is not specific about the endianess of the
fw_cfg 'file' entry 'reboot-timeout'.
Per docs/specs/fw_cfg.txt:
=== All Other Data Items ===
Please consult the QEMU source for the most up-to-date
and authoritative list of selector keys and their respective
items' purpose, format and writeability.
Checking the git history, this code was introduced in commit
ac05f3492421, very similar to commit 3d3b8303c6f8 for the
'boot-menu-wait' entry, which explicitely use little-endian.
OVMF consumes 'boot-menu-wait' as little-endian, however it does
not consume 'reboot-timeout'.
Regarding the git history and OVMF use, we choose to explicit
'reboot-timeout' endianess as little-endian.
Signed-off-by: Li Qiang <address@hidden>
Tested-by: Thomas Huth <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
[PMD: Reword commit description based on review comments]
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
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 b2dc0a80cb..9f7b7789bc 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -234,6 +234,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");
@@ -250,7 +251,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)
--
2.20.1
- [Qemu-ppc] [PULL 00/15] Fw cfg 20190523 patches, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 15/15] tests: fw_cfg: add 'splash-time' test case, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 10/15] tests/fw_cfg: Free QFWCFG object after qtest has run, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 14/15] tests: fw_cfg: add 'reboot-timeout' test case, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 13/15] hw/nvram/fw_cfg: Store 'reboot-timeout' as little endian,
Philippe Mathieu-Daudé <=
- [Qemu-ppc] [PULL 12/15] tests: fw_cfg: add a function to get the fw_cfg file, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 11/15] tests: refactor fw_cfg_test, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 07/15] hw/sparc64: Implement fw_cfg_arch_key_name(), Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 09/15] tests/libqos: Add pc_fw_cfg_uninit() and use it, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 08/15] tests/libqos: Add io_fw_cfg_uninit() and mm_fw_cfg_uninit(), Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 01/15] hw/nvram/fw_cfg: Add trace events, Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 02/15] hw/nvram/fw_cfg: Add fw_cfg_arch_key_name(), Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 06/15] hw/sparc: Implement fw_cfg_arch_key_name(), Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 04/15] hw/i386: Implement fw_cfg_arch_key_name(), Philippe Mathieu-Daudé, 2019/05/23
- [Qemu-ppc] [PULL 05/15] hw/ppc: Implement fw_cfg_arch_key_name(), Philippe Mathieu-Daudé, 2019/05/23