All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Chunyan Liu <cyliu@suse.com>, xen-devel@lists.xensource.com
Cc: qemu-devel@nongnu.org, pasik@iki.fi, Ian.Campbell@citrix.com
Subject: Re: [RFC PATCH 2/2] qemu: support xen hvm direct kernel boot
Date: Thu, 29 May 2014 10:23:30 +0200	[thread overview]
Message-ID: <5386EE82.8040208@redhat.com> (raw)
In-Reply-To: <1401333804-15456-3-git-send-email-cyliu@suse.com>

Il 29/05/2014 05:23, Chunyan Liu ha scritto:
> [support xen HVM direct kernel boot]
> qemu side patch: if -kernel exists, calls xen_load_linux(), which
> will read kernel/initrd and add a linuxboot.bin or multiboot.bin
> option rom. The linuxboot.bin/multiboot.bin will load kernel/initrd
> and jump to execute kernel directly. It's working when xen uses
> seabios.
> 
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> ---
>  hw/i386/pc.c         | 29 +++++++++++++++++++++++++++++
>  hw/i386/pc_piix.c    |  7 +++++++
>  include/hw/i386/pc.h |  5 +++++
>  3 files changed, 41 insertions(+)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index e6369d5..dcd5d48 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1187,6 +1187,35 @@ void pc_acpi_init(const char *default_dsdt)
>      }
>  }
>  
> +FWCfgState *xen_load_linux(const char *kernel_filename,
> +                           const char *kernel_cmdline,
> +                           const char *initrd_filename,
> +                           ram_addr_t below_4g_mem_size,
> +                           PcGuestInfo *guest_info)
> +{
> +    int i;
> +    FWCfgState *fw_cfg;
> +
> +    assert(kernel_filename != NULL);
> +
> +    fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
> +    rom_set_fw(fw_cfg);
> +
> +    load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
> +    for (i = 0; i < nb_option_roms; i++) {
> +        /* For xen, we only want to add the linuxboot.bin/multiboot.bin option rom.
> +         * But in option_rom, there is still kvmvapic.bin. We don't want to add it.
> +         */
> +        if (strcmp(option_rom[i].name, "linuxboot.bin") &&
> +            strcmp(option_rom[i].name, "multiboot.bin")) {
> +            continue;
> +        }
> +        rom_add_option(option_rom[i].name, option_rom[i].bootindex);
> +    }

Instead of this hack, you can use:

diff --git a/hw/i386/xen/xen_apic.c b/hw/i386/xen/xen_apic.c
index 63bb7f7..f5acd6a 100644
--- a/hw/i386/xen/xen_apic.c
+++ b/hw/i386/xen/xen_apic.c
@@ -40,6 +40,7 @@ static void xen_apic_realize(DeviceState *dev, Error **errp)
 {
     APICCommonState *s = APIC_COMMON(dev);
 
+    s->vapic_control = 0;
     memory_region_init_io(&s->io_memory, OBJECT(s), &xen_apic_io_ops, s,
                           "xen-apic-msi", APIC_SPACE_SIZE);
 

> +    guest_info->fw_cfg = fw_cfg;
> +    return fw_cfg;
> +}
> +
>  FWCfgState *pc_memory_init(MemoryRegion *system_memory,
>                             const char *kernel_filename,
>                             const char *kernel_cmdline,
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index eaf3e61..14d4164 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -157,6 +157,13 @@ static void pc_init1(QEMUMachineInitArgs *args,
>                         args->initrd_filename,
>                         below_4g_mem_size, above_4g_mem_size,
>                         rom_memory, &ram_memory, guest_info);
> +    } else if (args->kernel_filename != NULL) {
> +        /* For xen HVM direct kernel boot, load linux here */
> +        fw_cfg = xen_load_linux(args->kernel_filename,
> +                                args->kernel_cmdline,
> +                                args->initrd_filename,
> +                                below_4g_mem_size,
> +                                guest_info);
>      }
>  
>      gsi_state = g_malloc0(sizeof(*gsi_state));
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 32a7687..e472184 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -134,6 +134,11 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
>  void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
>                              MemoryRegion *pci_address_space);
>  
> +FWCfgState *xen_load_linux(const char *kernel_filename,
> +                           const char *kernel_cmdline,
> +                           const char *initrd_filename,
> +                           ram_addr_t below_4g_mem_size,
> +                           PcGuestInfo *guest_info);
>  FWCfgState *pc_memory_init(MemoryRegion *system_memory,
>                             const char *kernel_filename,
>                             const char *kernel_cmdline,
> 

  reply	other threads:[~2014-05-29  8:23 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  3:23 [RFC PATCH 0/2] support xen HVM direct kernel boot Chunyan Liu
2014-05-29  3:23 ` [RFC PATCH 1/2] xen: pass kernel initrd to qemu Chunyan Liu
2014-06-02 15:24   ` [Qemu-devel] " Ian Campbell
2014-06-02 15:24     ` Ian Campbell
2014-06-03  4:49     ` [Qemu-devel] [Xen-devel] " Chun Yan Liu
2014-06-03  4:49       ` Chun Yan Liu
2014-06-03  9:06       ` [Qemu-devel] " Ian Campbell
2014-06-03  9:06         ` Ian Campbell
2014-06-03  9:18         ` [Qemu-devel] " Chun Yan Liu
2014-06-03  9:18           ` Chun Yan Liu
2014-05-29  3:23 ` [RFC PATCH 2/2] qemu: support xen hvm direct kernel boot Chunyan Liu
2014-05-29  8:23   ` Paolo Bonzini [this message]
2014-06-03  4:59     ` [Qemu-devel] [Xen-devel] " Chun Yan Liu
2014-06-03  4:59       ` Chun Yan Liu
2014-05-30 16:04 ` [Xen-devel] [RFC PATCH 0/2] support xen HVM " Konrad Rzeszutek Wilk
2014-06-02 15:14   ` [Qemu-devel] " Stefano Stabellini
2014-06-02 15:14     ` Stefano Stabellini
2014-06-03  9:16     ` [Qemu-devel] " Chun Yan Liu
2014-06-03  9:16       ` Chun Yan Liu
2014-06-03  9:31       ` [Qemu-devel] " Ian Campbell
2014-06-03  9:31         ` [Qemu-devel] " Ian Campbell
2014-06-03 10:20         ` [Qemu-devel] [Xen-devel] " Chun Yan Liu
2014-06-03 10:20           ` Chun Yan Liu
2014-06-03 11:32         ` [Qemu-devel] " Stefano Stabellini
2014-06-03 11:32           ` Stefano Stabellini
2014-06-02 15:19   ` [Qemu-devel] " Ian Campbell
2014-06-02 15:19     ` Ian Campbell
2014-06-02 16:58     ` [Qemu-devel] " Konrad Rzeszutek Wilk
2014-06-02 16:58       ` Konrad Rzeszutek Wilk
2014-06-03  3:35       ` [Qemu-devel] " Chun Yan Liu
2014-06-03  3:35         ` Chun Yan Liu
2014-06-03  9:04         ` [Qemu-devel] " Ian Campbell
2014-06-03  9:04           ` Ian Campbell
2014-06-03  9:24           ` [Qemu-devel] " Chun Yan Liu
2014-06-03  9:24             ` Chun Yan Liu
2014-06-03  8:59       ` [Qemu-devel] [Xen-devel] " Ian Campbell
2014-06-03  8:59         ` Ian Campbell

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=5386EE82.8040208@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=cyliu@suse.com \
    --cc=pasik@iki.fi \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.