qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@163.com>
To: philmd@redhat.com, lersek@redhat.com, kraxel@redhat.com,
	thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com
Cc: qemu-devel@nongnu.org, liq3ea@gmail.com, Li Qiang <liq3ea@163.com>
Subject: [Qemu-devel] [PATCH v2 3/5] fw_cfg: reboot: store reboot-timeout as little endian
Date: Wed, 24 Apr 2019 07:06:41 -0700	[thread overview]
Message-ID: <20190424140643.62457-4-liq3ea@163.com> (raw)
In-Reply-To: <20190424140643.62457-1-liq3ea@163.com>

So that if the guest and host endianess does not match it
can still work as expection.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 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)
-- 
2.17.1

WARNING: multiple messages have this Message-ID (diff)
From: Li Qiang <liq3ea@163.com>
To: philmd@redhat.com, lersek@redhat.com, kraxel@redhat.com,
	thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com
Cc: Li Qiang <liq3ea@163.com>, liq3ea@gmail.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 3/5] fw_cfg: reboot: store reboot-timeout as little endian
Date: Wed, 24 Apr 2019 07:06:41 -0700	[thread overview]
Message-ID: <20190424140643.62457-4-liq3ea@163.com> (raw)
Message-ID: <20190424140641.QY80v4LCpLQ6Y6P8Ku4ik1d_AczmZz8AplFHfa0RXfM@z> (raw)
In-Reply-To: <20190424140643.62457-1-liq3ea@163.com>

So that if the guest and host endianess does not match it
can still work as expection.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 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)
-- 
2.17.1




  parent reply	other threads:[~2019-04-24 14:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 14:06 [Qemu-devel] [PATCH v2 0/5] fw_cfg_test refactor and add two test cases Li Qiang
2019-04-24 14:06 ` Li Qiang
2019-04-24 14:06 ` [Qemu-devel] [PATCH v2 1/5] tests: refactor fw_cfg_test Li Qiang
2019-04-24 14:06   ` Li Qiang
2019-04-24 14:06 ` [Qemu-devel] [PATCH v2 2/5] tests: fw_cfg: add a function to get the fw_cfg file Li Qiang
2019-04-24 14:06   ` Li Qiang
2019-04-24 14:06 ` Li Qiang [this message]
2019-04-24 14:06   ` [Qemu-devel] [PATCH v2 3/5] fw_cfg: reboot: store reboot-timeout as little endian Li Qiang
2019-04-24 14:06 ` [Qemu-devel] [PATCH v2 4/5] tests: fw_cfg: add reboot_timeout test case Li Qiang
2019-04-24 14:06   ` Li Qiang
2019-04-24 14:06 ` [Qemu-devel] [PATCH v2 5/5] tests: fw_cfg: add splash time " Li Qiang
2019-04-24 14:06   ` Li Qiang
2019-04-25  9:57 ` [Qemu-devel] [PATCH v2 0/5] fw_cfg_test refactor and add two test cases Thomas Huth
2019-04-25  9:57   ` Thomas Huth
2019-04-25 14:29   ` Li Qiang
2019-04-25 14:29     ` Li Qiang
2019-04-29  5:09     ` Li Qiang
2019-04-29  5:09       ` Li Qiang
2019-04-29 13:18       ` Thomas Huth
2019-04-29 13:18         ` Thomas Huth
2019-04-29 13:46         ` Li Qiang
2019-04-29 13:46           ` Li Qiang
2019-05-09  9:57 ` Li Qiang
2019-05-17  2:28   ` Li Qiang
2019-05-20 21:29     ` Philippe Mathieu-Daudé
2019-05-21  2:17       ` Li Qiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190424140643.62457-4-liq3ea@163.com \
    --to=liq3ea@163.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).