From: "Michael S. Tsirkin" <mst@redhat.com>
To: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org,
philip.li@intel.com, zhijianx.li@intel.com, philmd@redhat.com,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: Re: [Qemu-devel] [PATCH for-4.0 v4 4/4] i386: allow to load initrd below 4G for recent linux
Date: Fri, 21 Dec 2018 11:10:30 -0500 [thread overview]
Message-ID: <20181221110913-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1544063533-10139-5-git-send-email-lizhijian@cn.fujitsu.com>
On Thu, Dec 06, 2018 at 10:32:13AM +0800, Li Zhijian wrote:
> a new field xloadflags was added to recent x86 linux, and BIT 1:
> XLF_CAN_BE_LOADED_ABOVE_4G is used to tell bootload that where initrd can be
> loaded safely.
>
> Current QEMU/BIOS always loads initrd below below_4g_mem_size which is always
> less than 4G, so here limiting initrd_max to 4G - 1 simply is enough if
> this bit is set.
>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Richard Henderson <rth@twiddle.net>
> CC: Eduardo Habkost <ehabkost@redhat.com>
> CC: "Michael S. Tsirkin" <mst@redhat.com>
> CC: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>
> ---
> V3: correct grammar and check XLF_CAN_BE_LOADED_ABOVE_4G first (Michael S. Tsirkin)
>
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
> ---
> hw/i386/pc.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 3b10726..baa99c0 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -904,7 +904,15 @@ static void load_linux(PCMachineState *pcms,
> #endif
>
> /* highest address for loading the initrd */
> - if (protocol >= 0x203) {
> + if (protocol >= 0x20c &&
> + lduw_p(header+0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) {
> + /*
> + * Although kernel allows initrd loading to above 4G,
> + * it just makes it as large as possible while still staying below 4G
> + * since current BIOS always loads initrd below pcms->below_4g_mem_size
> + */
> + initrd_max = UINT32_MAX;
> + } else if (protocol >= 0x203) {
> initrd_max = ldl_p(header+0x22c);
> } else {
> initrd_max = 0x37ffffff;
I still have trouble understanding the above.
Anyone else wants to comment / help rephrase the comment
and commit log so it's readable?
> --
> 2.7.4
next prev parent reply other threads:[~2018-12-21 16:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 2:32 [Qemu-devel] [PATCH for-4.0 v4 0/4] allow to load initrd below 4G for recent kernel Li Zhijian
2018-12-06 2:32 ` [Qemu-devel] [PATCH for-4.0 v4 1/4] unify len and addr type for memory/address APIs Li Zhijian
2019-01-07 10:04 ` Stefano Garzarella
2019-01-08 1:06 ` Li Zhijian
2018-12-06 2:32 ` [Qemu-devel] [PATCH for-4.0 v4 2/4] refactor load_image_size Li Zhijian
2018-12-21 16:12 ` Michael S. Tsirkin
2018-12-24 2:14 ` Li Zhijian
2019-01-07 10:33 ` Stefano Garzarella
2019-01-08 1:09 ` Li Zhijian
2018-12-06 2:32 ` [Qemu-devel] [PATCH for-4.0 v4 3/4] i386: import & use bootparam.h Li Zhijian
2018-12-21 16:04 ` Michael S. Tsirkin
2019-01-04 16:41 ` Stefano Garzarella
2019-01-08 1:11 ` Li Zhijian
2018-12-06 2:32 ` [Qemu-devel] [PATCH for-4.0 v4 4/4] i386: allow to load initrd below 4G for recent linux Li Zhijian
2018-12-21 16:10 ` Michael S. Tsirkin [this message]
2018-12-27 20:31 ` Eduardo Habkost
2018-12-28 7:20 ` Li Zhijian
2019-01-07 12:11 ` Stefano Garzarella
2019-01-09 6:22 ` Li Zhijian
2019-01-07 23:35 ` Paolo Bonzini
2018-12-21 1:37 ` [Qemu-devel] [PATCH for-4.0 v4 0/4] allow to load initrd below 4G for recent kernel Li Zhijian
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=20181221110913-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ehabkost@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philip.li@intel.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=zhijianx.li@intel.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).