All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types
@ 2014-08-20 20:55 Michael S. Tsirkin
  2014-08-21  4:35 ` Luiz Capitulino
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-08-20 20:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Stefan Hajnoczi, Anthony Liguori

commit 868270f23d8db2cce83e4f082fe75e8625a5fbf9
    acpi-build: tweak acpi migration limits
broke kernel loading with -kernel/-initrd: it doubled
the size of ACPI tables but did not reserve
enough memory.

As a result, issues on boot and halt are observed.

Fix this up by doubling reserved memory for new machine types.

Cc: qemu-stable@nongnu.org
Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/i386/pc.h |  2 ++
 hw/i386/pc.c         | 12 +++++++++---
 hw/i386/pc_piix.c    |  1 +
 hw/i386/pc_q35.c     |  1 +
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index aedc312..84caed8 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -176,6 +176,8 @@ void pc_acpi_init(const char *default_dsdt);
 PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
                                 ram_addr_t above_4g_mem_size);
 
+void pc_set_legacy_acpi_data_size(void);
+
 #define PCI_HOST_PROP_PCI_HOLE_START   "pci-hole-start"
 #define PCI_HOST_PROP_PCI_HOLE_END     "pci-hole-end"
 #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 8fa8d2f..0ca4deb 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -73,7 +73,12 @@
 #endif
 
 /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
-#define ACPI_DATA_SIZE       0x10000
+unsigned acpi_data_size = 0x20000;
+void pc_set_legacy_acpi_data_size(void)
+{
+    acpi_data_size = 0x10000;
+}
+
 #define BIOS_CFG_IOPORT 0x510
 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
 #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
@@ -811,8 +816,9 @@ static void load_linux(FWCfgState *fw_cfg,
         initrd_max = 0x37ffffff;
     }
 
-    if (initrd_max >= max_ram_size-ACPI_DATA_SIZE)
-    	initrd_max = max_ram_size-ACPI_DATA_SIZE-1;
+    if (initrd_max >= max_ram_size - acpi_data_size) {
+        initrd_max = max_ram_size - acpi_data_size - 1;
+    }
 
     fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr);
     fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline)+1);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7710724..744b331 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -337,6 +337,7 @@ static void pc_compat_2_0(MachineState *machine)
     legacy_acpi_table_size = 6652;
     smbios_legacy_mode = true;
     has_reserved_memory = false;
+    pc_set_legacy_acpi_data_size();
 }
 
 static void pc_compat_1_7(MachineState *machine)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 4b5a274..d4a907c 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -280,6 +280,7 @@ static void pc_compat_2_0(MachineState *machine)
 {
     smbios_legacy_mode = true;
     has_reserved_memory = false;
+    pc_set_legacy_acpi_data_size();
 }
 
 static void pc_compat_1_7(MachineState *machine)
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types
  2014-08-20 20:55 [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types Michael S. Tsirkin
@ 2014-08-21  4:35 ` Luiz Capitulino
  2014-08-22 19:37 ` Serge E. Hallyn
  2014-08-26 12:30 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Capitulino @ 2014-08-21  4:35 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Anthony Liguori, qemu-devel, Stefan Hajnoczi, qemu-stable

On Wed, 20 Aug 2014 22:55:38 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> commit 868270f23d8db2cce83e4f082fe75e8625a5fbf9
>     acpi-build: tweak acpi migration limits
> broke kernel loading with -kernel/-initrd: it doubled
> the size of ACPI tables but did not reserve
> enough memory.
> 
> As a result, issues on boot and halt are observed.
> 
> Fix this up by doubling reserved memory for new machine types.
> 
> Cc: qemu-stable@nongnu.org
> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>

Tested-by: Luiz Capitulino <lcapitulino@redhat.com>

> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/hw/i386/pc.h |  2 ++
>  hw/i386/pc.c         | 12 +++++++++---
>  hw/i386/pc_piix.c    |  1 +
>  hw/i386/pc_q35.c     |  1 +
>  4 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index aedc312..84caed8 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -176,6 +176,8 @@ void pc_acpi_init(const char *default_dsdt);
>  PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
>                                  ram_addr_t above_4g_mem_size);
>  
> +void pc_set_legacy_acpi_data_size(void);
> +
>  #define PCI_HOST_PROP_PCI_HOLE_START   "pci-hole-start"
>  #define PCI_HOST_PROP_PCI_HOLE_END     "pci-hole-end"
>  #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 8fa8d2f..0ca4deb 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -73,7 +73,12 @@
>  #endif
>  
>  /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
> -#define ACPI_DATA_SIZE       0x10000
> +unsigned acpi_data_size = 0x20000;
> +void pc_set_legacy_acpi_data_size(void)
> +{
> +    acpi_data_size = 0x10000;
> +}
> +
>  #define BIOS_CFG_IOPORT 0x510
>  #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
>  #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
> @@ -811,8 +816,9 @@ static void load_linux(FWCfgState *fw_cfg,
>          initrd_max = 0x37ffffff;
>      }
>  
> -    if (initrd_max >= max_ram_size-ACPI_DATA_SIZE)
> -    	initrd_max = max_ram_size-ACPI_DATA_SIZE-1;
> +    if (initrd_max >= max_ram_size - acpi_data_size) {
> +        initrd_max = max_ram_size - acpi_data_size - 1;
> +    }
>  
>      fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline)+1);
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7710724..744b331 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -337,6 +337,7 @@ static void pc_compat_2_0(MachineState *machine)
>      legacy_acpi_table_size = 6652;
>      smbios_legacy_mode = true;
>      has_reserved_memory = false;
> +    pc_set_legacy_acpi_data_size();
>  }
>  
>  static void pc_compat_1_7(MachineState *machine)
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 4b5a274..d4a907c 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -280,6 +280,7 @@ static void pc_compat_2_0(MachineState *machine)
>  {
>      smbios_legacy_mode = true;
>      has_reserved_memory = false;
> +    pc_set_legacy_acpi_data_size();
>  }
>  
>  static void pc_compat_1_7(MachineState *machine)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types
  2014-08-20 20:55 [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types Michael S. Tsirkin
  2014-08-21  4:35 ` Luiz Capitulino
@ 2014-08-22 19:37 ` Serge E. Hallyn
  2014-08-26 12:30 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Serge E. Hallyn @ 2014-08-22 19:37 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Anthony Liguori, qemu-devel, Stefan Hajnoczi, qemu-stable

Quoting Michael S. Tsirkin (mst@redhat.com):
> commit 868270f23d8db2cce83e4f082fe75e8625a5fbf9
>     acpi-build: tweak acpi migration limits
> broke kernel loading with -kernel/-initrd: it doubled
> the size of ACPI tables but did not reserve
> enough memory.
> 
> As a result, issues on boot and halt are observed.
> 
> Fix this up by doubling reserved memory for new machine types.
> 
> Cc: qemu-stable@nongnu.org
> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>

Thanks, this fixes it for me.

Tested-by: Serge Hallyn <serge.hallyn@canonical.com>

> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/hw/i386/pc.h |  2 ++
>  hw/i386/pc.c         | 12 +++++++++---
>  hw/i386/pc_piix.c    |  1 +
>  hw/i386/pc_q35.c     |  1 +
>  4 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index aedc312..84caed8 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -176,6 +176,8 @@ void pc_acpi_init(const char *default_dsdt);
>  PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
>                                  ram_addr_t above_4g_mem_size);
>  
> +void pc_set_legacy_acpi_data_size(void);
> +
>  #define PCI_HOST_PROP_PCI_HOLE_START   "pci-hole-start"
>  #define PCI_HOST_PROP_PCI_HOLE_END     "pci-hole-end"
>  #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 8fa8d2f..0ca4deb 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -73,7 +73,12 @@
>  #endif
>  
>  /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
> -#define ACPI_DATA_SIZE       0x10000
> +unsigned acpi_data_size = 0x20000;
> +void pc_set_legacy_acpi_data_size(void)
> +{
> +    acpi_data_size = 0x10000;
> +}
> +
>  #define BIOS_CFG_IOPORT 0x510
>  #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
>  #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
> @@ -811,8 +816,9 @@ static void load_linux(FWCfgState *fw_cfg,
>          initrd_max = 0x37ffffff;
>      }
>  
> -    if (initrd_max >= max_ram_size-ACPI_DATA_SIZE)
> -    	initrd_max = max_ram_size-ACPI_DATA_SIZE-1;
> +    if (initrd_max >= max_ram_size - acpi_data_size) {
> +        initrd_max = max_ram_size - acpi_data_size - 1;
> +    }
>  
>      fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline)+1);
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7710724..744b331 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -337,6 +337,7 @@ static void pc_compat_2_0(MachineState *machine)
>      legacy_acpi_table_size = 6652;
>      smbios_legacy_mode = true;
>      has_reserved_memory = false;
> +    pc_set_legacy_acpi_data_size();
>  }
>  
>  static void pc_compat_1_7(MachineState *machine)
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 4b5a274..d4a907c 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -280,6 +280,7 @@ static void pc_compat_2_0(MachineState *machine)
>  {
>      smbios_legacy_mode = true;
>      has_reserved_memory = false;
> +    pc_set_legacy_acpi_data_size();
>  }
>  
>  static void pc_compat_1_7(MachineState *machine)
> -- 
> MST

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types
  2014-08-20 20:55 [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types Michael S. Tsirkin
  2014-08-21  4:35 ` Luiz Capitulino
  2014-08-22 19:37 ` Serge E. Hallyn
@ 2014-08-26 12:30 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-08-26 12:30 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: jsnow, Anthony Liguori, qemu-devel, Stefan Hajnoczi, qemu-stable

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

On Wed, Aug 20, 2014 at 10:55:38PM +0200, Michael S. Tsirkin wrote:
> commit 868270f23d8db2cce83e4f082fe75e8625a5fbf9
>     acpi-build: tweak acpi migration limits
> broke kernel loading with -kernel/-initrd: it doubled
> the size of ACPI tables but did not reserve
> enough memory.
> 
> As a result, issues on boot and halt are observed.
> 
> Fix this up by doubling reserved memory for new machine types.
> 
> Cc: qemu-stable@nongnu.org
> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/hw/i386/pc.h |  2 ++
>  hw/i386/pc.c         | 12 +++++++++---
>  hw/i386/pc_piix.c    |  1 +
>  hw/i386/pc_q35.c     |  1 +
>  4 files changed, 13 insertions(+), 3 deletions(-)

Already merged but for the record:
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-26 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 20:55 [Qemu-devel] [PATCH] pc: reserve more memory for ACPI for new machine types Michael S. Tsirkin
2014-08-21  4:35 ` Luiz Capitulino
2014-08-22 19:37 ` Serge E. Hallyn
2014-08-26 12:30 ` Stefan Hajnoczi

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.