qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Li Qiang <liq3ea@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>, Li Qiang <liq3ea@163.com>,
	lvivier@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	Qemu Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/4] tests: fw_cfg: add reboot_timeout test case
Date: Thu, 25 Apr 2019 12:23:03 +0200	[thread overview]
Message-ID: <d773a58b-e33c-fa66-5afc-05bdc85efa53@redhat.com> (raw)
In-Reply-To: <CAKXe6SKvkJxauOPmBMS+CDPq9NS0qKpydkyOAuS7mHVrA8JVbQ@mail.gmail.com>

On 4/25/19 10:29 AM, Li Qiang wrote:
> 
> 
> Gerd Hoffmann <kraxel@redhat.com <mailto:kraxel@redhat.com>> 于2019年4月
> 25日周四 下午4:15写道:
> 
>     On Wed, Apr 24, 2019 at 09:16:56AM +0800, Li Qiang wrote:
>     > Thomas Huth <thuth@redhat.com <mailto:thuth@redhat.com>> 于2019年4
>     月24日周三 上午12:29写道:
>     >
>     > > Is this endianess-safe? Or do you need to byteswap
>     reboot_timeout if the
>     > > host and guest endianess does not match?
>     >
>     > Good question!
>     >
>     > IIUC, the qemu fw_cfg store the 'file' entry data just in byte stream.
> 
>     No.  Integers are defined to be little endian.  See fw_cfg_add_i64() for
>     example, there is an explicit cpu_to_le64() call for that.
> 
> 
> 
> Yes, for the fw_cfg 'integer' entry it is stored as little endian.
> But for the fw_cfg 'file' entry interpred as an integer, there is no
> specify the endianess.

I agree with Li, the endianess of 'reboot-timeout' is not clear.

>From 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.

So 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, so I think
it is safe to consider it little-endian and add a comment about its
endianess (referring the previous commits in the patch description).

Thanks,

Phil.

> 
> Thanks,
> Li Qiang
> 
>  
> 
>     cheers,
>       Gerd
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Li Qiang <liq3ea@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>
Cc: lvivier@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <thuth@redhat.com>, Li Qiang <liq3ea@163.com>,
	Qemu Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/4] tests: fw_cfg: add reboot_timeout test case
Date: Thu, 25 Apr 2019 12:23:03 +0200	[thread overview]
Message-ID: <d773a58b-e33c-fa66-5afc-05bdc85efa53@redhat.com> (raw)
Message-ID: <20190425102303.QSwGOjR1ziTa6jNJN5uSmocb_p6bDzAeSL2b8Todswk@z> (raw)
In-Reply-To: <CAKXe6SKvkJxauOPmBMS+CDPq9NS0qKpydkyOAuS7mHVrA8JVbQ@mail.gmail.com>

On 4/25/19 10:29 AM, Li Qiang wrote:
> 
> 
> Gerd Hoffmann <kraxel@redhat.com <mailto:kraxel@redhat.com>> 于2019年4月
> 25日周四 下午4:15写道:
> 
>     On Wed, Apr 24, 2019 at 09:16:56AM +0800, Li Qiang wrote:
>     > Thomas Huth <thuth@redhat.com <mailto:thuth@redhat.com>> 于2019年4
>     月24日周三 上午12:29写道:
>     >
>     > > Is this endianess-safe? Or do you need to byteswap
>     reboot_timeout if the
>     > > host and guest endianess does not match?
>     >
>     > Good question!
>     >
>     > IIUC, the qemu fw_cfg store the 'file' entry data just in byte stream.
> 
>     No.  Integers are defined to be little endian.  See fw_cfg_add_i64() for
>     example, there is an explicit cpu_to_le64() call for that.
> 
> 
> 
> Yes, for the fw_cfg 'integer' entry it is stored as little endian.
> But for the fw_cfg 'file' entry interpred as an integer, there is no
> specify the endianess.

I agree with Li, the endianess of 'reboot-timeout' is not clear.

From 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.

So 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, so I think
it is safe to consider it little-endian and add a comment about its
endianess (referring the previous commits in the patch description).

Thanks,

Phil.

> 
> Thanks,
> Li Qiang
> 
>  
> 
>     cheers,
>       Gerd
> 


  parent reply	other threads:[~2019-04-25 10:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20 10:00 [Qemu-devel] [PATCH 0/4] fw_cfg_test refactor and add two test cases Li Qiang
2019-04-20 10:00 ` Li Qiang
2019-04-20 10:00 ` [Qemu-devel] [PATCH 1/4] tests: refactor fw_cfg_test Li Qiang
2019-04-20 10:00   ` Li Qiang
2019-04-23 16:25   ` Thomas Huth
2019-04-23 16:25     ` Thomas Huth
2019-04-20 10:00 ` [Qemu-devel] [PATCH 2/4] tests: fw_cfg: add a function to get the fw_cfg file Li Qiang
2019-04-20 10:00   ` Li Qiang
2019-04-23 16:26   ` Thomas Huth
2019-04-23 16:26     ` Thomas Huth
2019-04-20 10:00 ` [Qemu-devel] [PATCH 3/4] tests: fw_cfg: add reboot_timeout test case Li Qiang
2019-04-20 10:00   ` Li Qiang
2019-04-23 16:29   ` Thomas Huth
2019-04-23 16:29     ` Thomas Huth
2019-04-24  1:16     ` Li Qiang
2019-04-24  1:16       ` Li Qiang
2019-04-24  7:30       ` Thomas Huth
2019-04-24  7:30         ` Thomas Huth
2019-04-24  7:41         ` Li Qiang
2019-04-24  7:41           ` Li Qiang
2019-04-24 14:08         ` Li Qiang
2019-04-24 14:08           ` Li Qiang
2019-04-25  8:15       ` Gerd Hoffmann
2019-04-25  8:15         ` Gerd Hoffmann
2019-04-25  8:29         ` Li Qiang
2019-04-25  8:29           ` Li Qiang
2019-04-25 10:23           ` Philippe Mathieu-Daudé [this message]
2019-04-25 10:23             ` Philippe Mathieu-Daudé
2019-04-26 16:57             ` Laszlo Ersek
2019-04-26 16:57               ` Laszlo Ersek
2019-04-26 16:53         ` Laszlo Ersek
2019-04-26 16:53           ` Laszlo Ersek
2019-04-20 10:00 ` [Qemu-devel] [PATCH 4/4] tests: fw_cfg: add splash time " Li Qiang
2019-04-20 10:00   ` 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=d773a58b-e33c-fa66-5afc-05bdc85efa53@redhat.com \
    --to=philmd@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=liq3ea@163.com \
    --cc=liq3ea@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@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).