diff mbox

[v2] PCMachineState: introduce acpi_build_enabled field

Message ID 1478022256-7089-1-git-send-email-wei.liu2@citrix.com
State New
Headers show

Commit Message

Wei Liu Nov. 1, 2016, 5:44 p.m. UTC
Introduce this field to control whether ACPI build is enabled by a
particular machine or accelerator.

It defaults to true if the machine itself supports ACPI build. Xen
accelerator will disable it because Xen is in charge of building ACPI
tables for the guest.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Sander Eikelenboom <linux@eikelenboom.it>

v2:
1. drop acpi-build property
2. set acpi_build_enabled to acpi_has_build
3. replace acpi_has_build check in acpi_build()
---
 hw/i386/acpi-build.c | 2 +-
 hw/i386/pc.c         | 2 ++
 include/hw/i386/pc.h | 2 ++
 xen-common.c         | 6 ++++++
 4 files changed, 11 insertions(+), 1 deletion(-)

Comments

Sander Eikelenboom Nov. 1, 2016, 6:35 p.m. UTC | #1
On 2016-11-01 18:44, Wei Liu wrote:
> Introduce this field to control whether ACPI build is enabled by a
> particular machine or accelerator.
> 
> It defaults to true if the machine itself supports ACPI build. Xen
> accelerator will disable it because Xen is in charge of building ACPI
> tables for the guest.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Hi Wei,

Just gave it a spin (backporting for xen-unstable wasn't too hard),
and this also works for me !

--
Sander

> ---
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Sander Eikelenboom <linux@eikelenboom.it>
> 
> v2:
> 1. drop acpi-build property
> 2. set acpi_build_enabled to acpi_has_build
> 3. replace acpi_has_build check in acpi_build()
> ---
>  hw/i386/acpi-build.c | 2 +-
>  hw/i386/pc.c         | 2 ++
>  include/hw/i386/pc.h | 2 ++
>  xen-common.c         | 6 ++++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 5cd1da9..13cbbde 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2953,7 +2953,7 @@ void acpi_setup(void)
>          return;
>      }
> 
> -    if (!pcmc->has_acpi_build) {
> +    if (!pcms->acpi_build_enabled) {
>          ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
>          return;
>      }
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f56ea0f..fbd9aed 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -2159,6 +2159,8 @@ static void pc_machine_initfn(Object *obj)
>      pcms->vmport = ON_OFF_AUTO_AUTO;
>      /* nvdimm is disabled on default. */
>      pcms->acpi_nvdimm_state.is_enabled = false;
> +    /* acpi build is enabled by default if machine supports it */
> +    pcms->acpi_build_enabled = 
> PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
>  }
> 
>  static void pc_machine_reset(void)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 98dc772..8eb517f 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -62,6 +62,8 @@ struct PCMachineState {
> 
>      AcpiNVDIMMState acpi_nvdimm_state;
> 
> +    bool acpi_build_enabled;
> +
>      /* RAM information (sizes, addresses, configuration): */
>      ram_addr_t below_4g_mem_size, above_4g_mem_size;
> 
> diff --git a/xen-common.c b/xen-common.c
> index 9099760..bacf962 100644
> --- a/xen-common.c
> +++ b/xen-common.c
> @@ -9,6 +9,7 @@
>   */
> 
>  #include "qemu/osdep.h"
> +#include "hw/i386/pc.h"
>  #include "hw/xen/xen_backend.h"
>  #include "qmp-commands.h"
>  #include "sysemu/char.h"
> @@ -114,6 +115,11 @@ static void xen_change_state_handler(void
> *opaque, int running,
> 
>  static int xen_init(MachineState *ms)
>  {
> +    PCMachineState *pcms = PC_MACHINE(ms);
> +
> +    /* Disable ACPI build because Xen handles it */
> +    pcms->acpi_build_enabled = false;
> +
>      xen_xc = xc_interface_open(0, 0, 0);
>      if (xen_xc == NULL) {
>          xen_pv_printf(NULL, 0, "can't open xen interface\n");
Stefano Stabellini Nov. 1, 2016, 7:29 p.m. UTC | #2
On Tue, 1 Nov 2016, Wei Liu wrote:
> Introduce this field to control whether ACPI build is enabled by a
> particular machine or accelerator.
> 
> It defaults to true if the machine itself supports ACPI build. Xen
> accelerator will disable it because Xen is in charge of building ACPI
> tables for the guest.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Sander Eikelenboom <linux@eikelenboom.it>
> 
> v2:
> 1. drop acpi-build property
> 2. set acpi_build_enabled to acpi_has_build
> 3. replace acpi_has_build check in acpi_build()
> ---
>  hw/i386/acpi-build.c | 2 +-
>  hw/i386/pc.c         | 2 ++
>  include/hw/i386/pc.h | 2 ++
>  xen-common.c         | 6 ++++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 5cd1da9..13cbbde 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2953,7 +2953,7 @@ void acpi_setup(void)
>          return;
>      }
>  
> -    if (!pcmc->has_acpi_build) {
> +    if (!pcms->acpi_build_enabled) {
>          ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
>          return;
>      }
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f56ea0f..fbd9aed 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -2159,6 +2159,8 @@ static void pc_machine_initfn(Object *obj)
>      pcms->vmport = ON_OFF_AUTO_AUTO;
>      /* nvdimm is disabled on default. */
>      pcms->acpi_nvdimm_state.is_enabled = false;
> +    /* acpi build is enabled by default if machine supports it */
> +    pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
>  }
>  
>  static void pc_machine_reset(void)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 98dc772..8eb517f 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -62,6 +62,8 @@ struct PCMachineState {
>  
>      AcpiNVDIMMState acpi_nvdimm_state;
>  
> +    bool acpi_build_enabled;
> +
>      /* RAM information (sizes, addresses, configuration): */
>      ram_addr_t below_4g_mem_size, above_4g_mem_size;
>  
> diff --git a/xen-common.c b/xen-common.c
> index 9099760..bacf962 100644
> --- a/xen-common.c
> +++ b/xen-common.c
> @@ -9,6 +9,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "hw/i386/pc.h"
>  #include "hw/xen/xen_backend.h"
>  #include "qmp-commands.h"
>  #include "sysemu/char.h"
> @@ -114,6 +115,11 @@ static void xen_change_state_handler(void *opaque, int running,
>  
>  static int xen_init(MachineState *ms)
>  {
> +    PCMachineState *pcms = PC_MACHINE(ms);
> +
> +    /* Disable ACPI build because Xen handles it */
> +    pcms->acpi_build_enabled = false;
> +
>      xen_xc = xc_interface_open(0, 0, 0);
>      if (xen_xc == NULL) {
>          xen_pv_printf(NULL, 0, "can't open xen interface\n");
> -- 
> 2.1.4
>
Eduardo Habkost Nov. 1, 2016, 10:05 p.m. UTC | #3
On Tue, Nov 01, 2016 at 05:44:16PM +0000, Wei Liu wrote:
> Introduce this field to control whether ACPI build is enabled by a
> particular machine or accelerator.
> 
> It defaults to true if the machine itself supports ACPI build. Xen
> accelerator will disable it because Xen is in charge of building ACPI
> tables for the guest.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Stefano Stabellini Nov. 1, 2016, 10:30 p.m. UTC | #4
On Tue, 1 Nov 2016, Eduardo Habkost wrote:
> On Tue, Nov 01, 2016 at 05:44:16PM +0000, Wei Liu wrote:
> > Introduce this field to control whether ACPI build is enabled by a
> > particular machine or accelerator.
> > 
> > It defaults to true if the machine itself supports ACPI build. Xen
> > accelerator will disable it because Xen is in charge of building ACPI
> > tables for the guest.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

Thank you Eduardo. I can queue it up unless you have other stuff in
progress.
Wei Liu Nov. 2, 2016, 3:49 p.m. UTC | #5
On Tue, Nov 01, 2016 at 03:30:59PM -0700, Stefano Stabellini wrote:
> On Tue, 1 Nov 2016, Eduardo Habkost wrote:
> > On Tue, Nov 01, 2016 at 05:44:16PM +0000, Wei Liu wrote:
> > > Introduce this field to control whether ACPI build is enabled by a
> > > particular machine or accelerator.
> > > 
> > > It defaults to true if the machine itself supports ACPI build. Xen
> > > accelerator will disable it because Xen is in charge of building ACPI
> > > tables for the guest.
> > > 
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > 
> > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> Thank you Eduardo. I can queue it up unless you have other stuff in
> progress.

I would like to backport this to qemu-xen tree, so it would be great if
this patch can be merged in the next two weeks. Thanks!

Wei.
Eduardo Habkost Nov. 3, 2016, 1:14 p.m. UTC | #6
On Tue, Nov 01, 2016 at 03:30:59PM -0700, Stefano Stabellini wrote:
> On Tue, 1 Nov 2016, Eduardo Habkost wrote:
> > On Tue, Nov 01, 2016 at 05:44:16PM +0000, Wei Liu wrote:
> > > Introduce this field to control whether ACPI build is enabled by a
> > > particular machine or accelerator.
> > > 
> > > It defaults to true if the machine itself supports ACPI build. Xen
> > > accelerator will disable it because Xen is in charge of building ACPI
> > > tables for the guest.
> > > 
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > 
> > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> Thank you Eduardo. I can queue it up unless you have other stuff in
> progress.

In case you didn't queue it yet, please go ahead.

Acked-by: Eduardo Habkost <ehabkost@redhat.com>
diff mbox

Patch

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 5cd1da9..13cbbde 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2953,7 +2953,7 @@  void acpi_setup(void)
         return;
     }
 
-    if (!pcmc->has_acpi_build) {
+    if (!pcms->acpi_build_enabled) {
         ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
         return;
     }
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f56ea0f..fbd9aed 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -2159,6 +2159,8 @@  static void pc_machine_initfn(Object *obj)
     pcms->vmport = ON_OFF_AUTO_AUTO;
     /* nvdimm is disabled on default. */
     pcms->acpi_nvdimm_state.is_enabled = false;
+    /* acpi build is enabled by default if machine supports it */
+    pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
 }
 
 static void pc_machine_reset(void)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 98dc772..8eb517f 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -62,6 +62,8 @@  struct PCMachineState {
 
     AcpiNVDIMMState acpi_nvdimm_state;
 
+    bool acpi_build_enabled;
+
     /* RAM information (sizes, addresses, configuration): */
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
 
diff --git a/xen-common.c b/xen-common.c
index 9099760..bacf962 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -9,6 +9,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "hw/i386/pc.h"
 #include "hw/xen/xen_backend.h"
 #include "qmp-commands.h"
 #include "sysemu/char.h"
@@ -114,6 +115,11 @@  static void xen_change_state_handler(void *opaque, int running,
 
 static int xen_init(MachineState *ms)
 {
+    PCMachineState *pcms = PC_MACHINE(ms);
+
+    /* Disable ACPI build because Xen handles it */
+    pcms->acpi_build_enabled = false;
+
     xen_xc = xc_interface_open(0, 0, 0);
     if (xen_xc == NULL) {
         xen_pv_printf(NULL, 0, "can't open xen interface\n");