xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
       [not found] <1371472598-20330-1-git-send-email-paul.durrant@citrix.com>
@ 2013-06-17 12:36 ` Paul Durrant
  0 siblings, 0 replies; 9+ messages in thread
From: Paul Durrant @ 2013-06-17 12:36 UTC (permalink / raw)
  To: qemu-devel, xen-devel; +Cc: Paul Durrant

Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The
initialization code for this machine type can easily be pulled into the
generic pc initialization code and guarded with a test for whether the xen
accelerator options is specified, which is more consistent with the way
other accelerators are used.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
 hw/i386/pc_piix.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d618570..6d3f161 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -91,6 +91,10 @@ static void pc_init1(MemoryRegion *system_memory,
     DeviceState *icc_bridge;
     FWCfgState *fw_cfg = NULL;
 
+    if (xen_hvm_init() != 0) {
+        hw_error("xen hardware virtual machine initialisation failed");
+    }
+
     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
@@ -320,9 +324,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 {
-    if (xen_hvm_init() != 0) {
-        hw_error("xen hardware virtual machine initialisation failed");
-    }
     pc_init_pci(args);
 }
 #endif
-- 
1.7.10.4

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

* [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
       [not found] <1371549586-4672-1-git-send-email-paul.durrant@citrix.com>
@ 2013-06-18  9:59 ` Paul Durrant
  0 siblings, 0 replies; 9+ messages in thread
From: Paul Durrant @ 2013-06-18  9:59 UTC (permalink / raw)
  To: qemu-devel, xen-devel; +Cc: Paul Durrant

Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The
initialization code for this machine type can easily be pulled into the
generic pc initialization code and guarded with a test for whether the xen
accelerator options is specified, which is more consistent with the way
other accelerators are used.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
 hw/i386/pc_piix.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d618570..7bbb59a 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1,3 +1,4 @@
+
 /*
  * QEMU PC System Emulator
  *
@@ -91,6 +92,10 @@ static void pc_init1(MemoryRegion *system_memory,
     DeviceState *icc_bridge;
     FWCfgState *fw_cfg = NULL;
 
+    if (xen_enabled() && xen_hvm_init() != 0) {
+        hw_error("xen hardware virtual machine initialisation failed");
+    }
+
     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
@@ -320,9 +325,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 {
-    if (xen_hvm_init() != 0) {
-        hw_error("xen hardware virtual machine initialisation failed");
-    }
     pc_init_pci(args);
 }
 #endif
-- 
1.7.10.4

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

* [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
       [not found] <1371554221-5762-1-git-send-email-paul.durrant@citrix.com>
@ 2013-06-18 11:17 ` Paul Durrant
  2013-06-20 14:44   ` Stefano Stabellini
  2013-06-25 12:01   ` Stefano Stabellini
  2013-06-18 11:17 ` [PATCH 2/2] Move hardcoded initialization of xen-platform device Paul Durrant
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Paul Durrant @ 2013-06-18 11:17 UTC (permalink / raw)
  To: qemu-devel, xen-devel; +Cc: Paul Durrant

Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The
initialization code for this machine type can easily be pulled into the
generic pc initialization code and guarded with a test for whether the xen
accelerator options is specified, which is more consistent with the way
other accelerators are used.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
 hw/i386/pc_piix.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d618570..f96e0c2 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -91,6 +91,11 @@ static void pc_init1(MemoryRegion *system_memory,
     DeviceState *icc_bridge;
     FWCfgState *fw_cfg = NULL;
 
+    if (xen_enabled() && xen_hvm_init() != 0) {
+        fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
+        exit(1);
+    }
+
     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
@@ -320,9 +325,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 {
-    if (xen_hvm_init() != 0) {
-        hw_error("xen hardware virtual machine initialisation failed");
-    }
     pc_init_pci(args);
 }
 #endif
-- 
1.7.10.4

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

* [PATCH 2/2] Move hardcoded initialization of xen-platform device.
       [not found] <1371554221-5762-1-git-send-email-paul.durrant@citrix.com>
  2013-06-18 11:17 ` [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains Paul Durrant
@ 2013-06-18 11:17 ` Paul Durrant
  2013-06-18 12:23 ` [PATCH 0/2] Remove hardcoded xen-platform device initialization (v4) Paolo Bonzini
       [not found] ` <1371554221-5762-3-git-send-email-paul.durrant@citrix.com>
  3 siblings, 0 replies; 9+ messages in thread
From: Paul Durrant @ 2013-06-18 11:17 UTC (permalink / raw)
  To: qemu-devel, xen-devel; +Cc: Paul Durrant

Creation of the xen-platform device is currently hardcoded into machine
type pc's initialization code, guarded by a test for the whether the xen
accelerator is enabled. This patch moves the creation of xen-platform into
the initialization code of the xenfv machine type. This maintains backwards
compatibility for that machine type but allows more flexibility if another
machine type is used with Xen HVM domains.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
 hw/i386/pc_piix.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index f96e0c2..c294138 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -179,9 +179,6 @@ static void pc_init1(MemoryRegion *system_memory,
     pc_register_ferr_irq(gsi[13]);
 
     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
-    if (xen_enabled()) {
-        pci_create_simple(pci_bus, -1, "xen-platform");
-    }
 
     /* init basic PC hardware */
     pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
@@ -325,7 +322,14 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 {
+    PCIBus *bus;
+
     pc_init_pci(args);
+
+    bus = pci_find_root_bus(0);
+    if (bus != NULL) {
+        pci_create_simple(bus, -1, "xen-platform");
+    }
 }
 #endif
 
-- 
1.7.10.4

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

* Re: [PATCH 0/2] Remove hardcoded xen-platform device initialization (v4)
       [not found] <1371554221-5762-1-git-send-email-paul.durrant@citrix.com>
  2013-06-18 11:17 ` [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains Paul Durrant
  2013-06-18 11:17 ` [PATCH 2/2] Move hardcoded initialization of xen-platform device Paul Durrant
@ 2013-06-18 12:23 ` Paolo Bonzini
       [not found] ` <1371554221-5762-3-git-send-email-paul.durrant@citrix.com>
  3 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2013-06-18 12:23 UTC (permalink / raw)
  To: Paul Durrant; +Cc: qemu-devel, xen-devel

Il 18/06/2013 13:16, Paul Durrant ha scritto:
> Because of concerns over backwards compatibility and a suggestion that
> xenfv should be retired in favour of using the pc machine type I have re-
> worked my original patch into 2 patches:
> 
> [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM
> [PATCH 2/2] Move hardcoded initialization of xen-platform device.
> 
> Application of both these patches allows alternative pc machine types to be
> used with the accel=xen option, but preserves the hardcoded creation of
> the xen-platform device only for machine type xenfv.

Perfect!

Paolo

> v3:
> - Add test for xen_enabled() that went missing in v2
> 
> v4:
> - Remove erroneous whitespace hunk
> - Replace hw_error() with fprintf()+exit(1)
> - Add braces to single-line if
> 
> 

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

* Re: [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
  2013-06-18 11:17 ` [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains Paul Durrant
@ 2013-06-20 14:44   ` Stefano Stabellini
  2013-06-25 12:01   ` Stefano Stabellini
  1 sibling, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2013-06-20 14:44 UTC (permalink / raw)
  To: Paul Durrant; +Cc: qemu-devel, xen-devel

On Tue, 18 Jun 2013, Paul Durrant wrote:
> Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The
> initialization code for this machine type can easily be pulled into the
> generic pc initialization code and guarded with a test for whether the xen
> accelerator options is specified, which is more consistent with the way
> other accelerators are used.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  hw/i386/pc_piix.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index d618570..f96e0c2 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -91,6 +91,11 @@ static void pc_init1(MemoryRegion *system_memory,
>      DeviceState *icc_bridge;
>      FWCfgState *fw_cfg = NULL;
>  
> +    if (xen_enabled() && xen_hvm_init() != 0) {
> +        fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
> +        exit(1);
> +    }
> +
>      icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
>      object_property_add_child(qdev_get_machine(), "icc-bridge",
>                                OBJECT(icc_bridge), NULL);
> @@ -320,9 +325,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
>  #ifdef CONFIG_XEN
>  static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
>  {
> -    if (xen_hvm_init() != 0) {
> -        hw_error("xen hardware virtual machine initialisation failed");
> -    }
>      pc_init_pci(args);
>  }
>  #endif
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
> 

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

* Re: [PATCH 2/2] Move hardcoded initialization of xen-platform device.
       [not found] ` <1371554221-5762-3-git-send-email-paul.durrant@citrix.com>
@ 2013-06-20 14:44   ` Stefano Stabellini
  0 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2013-06-20 14:44 UTC (permalink / raw)
  To: Paul Durrant; +Cc: qemu-devel, xen-devel

On Tue, 18 Jun 2013, Paul Durrant wrote:
> Creation of the xen-platform device is currently hardcoded into machine
> type pc's initialization code, guarded by a test for the whether the xen
> accelerator is enabled. This patch moves the creation of xen-platform into
> the initialization code of the xenfv machine type. This maintains backwards
> compatibility for that machine type but allows more flexibility if another
> machine type is used with Xen HVM domains.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  hw/i386/pc_piix.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index f96e0c2..c294138 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -179,9 +179,6 @@ static void pc_init1(MemoryRegion *system_memory,
>      pc_register_ferr_irq(gsi[13]);
>  
>      pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
> -    if (xen_enabled()) {
> -        pci_create_simple(pci_bus, -1, "xen-platform");
> -    }
>  
>      /* init basic PC hardware */
>      pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
> @@ -325,7 +322,14 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
>  #ifdef CONFIG_XEN
>  static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
>  {
> +    PCIBus *bus;
> +
>      pc_init_pci(args);
> +
> +    bus = pci_find_root_bus(0);
> +    if (bus != NULL) {
> +        pci_create_simple(bus, -1, "xen-platform");
> +    }
>  }
>  #endif

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

* Re: [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
  2013-06-18 11:17 ` [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains Paul Durrant
  2013-06-20 14:44   ` Stefano Stabellini
@ 2013-06-25 12:01   ` Stefano Stabellini
  2013-06-25 12:58     ` Paul Durrant
  1 sibling, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2013-06-25 12:01 UTC (permalink / raw)
  To: Paul Durrant; +Cc: qemu-devel, xen-devel

On Tue, 18 Jun 2013, Paul Durrant wrote:
> Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The
> initialization code for this machine type can easily be pulled into the
> generic pc initialization code and guarded with a test for whether the xen
> accelerator options is specified, which is more consistent with the way
> other accelerators are used.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> ---
>  hw/i386/pc_piix.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index d618570..f96e0c2 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -91,6 +91,11 @@ static void pc_init1(MemoryRegion *system_memory,
>      DeviceState *icc_bridge;
>      FWCfgState *fw_cfg = NULL;
>  
> +    if (xen_enabled() && xen_hvm_init() != 0) {
> +        fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
> +        exit(1);
> +    }
> +
>      icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
>      object_property_add_child(qdev_get_machine(), "icc-bridge",
>                                OBJECT(icc_bridge), NULL);

I was about to submit a pull request with this patch, but unfortunately
it breaks non-xen compilations:

hw/i386/pc_piix.o: In function `pc_init1':
/local/scratch/sstabellini/qemu/hw/i386/pc_piix.c:94: undefined reference to `xen_hvm_init'

you need to add the function to xen-stub.c:

diff --git a/xen-stub.c b/xen-stub.c
index 6f0516a..47c8e73 100644
--- a/xen-stub.c
+++ b/xen-stub.c
@@ -63,3 +63,8 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 void xen_modified_memory(ram_addr_t start, ram_addr_t length)
 {
 }
+
+int xen_hvm_init(void)
+{
+    return 0;
+}

I'll include this change in the pull request

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

* Re: [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
  2013-06-25 12:01   ` Stefano Stabellini
@ 2013-06-25 12:58     ` Paul Durrant
  0 siblings, 0 replies; 9+ messages in thread
From: Paul Durrant @ 2013-06-25 12:58 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: qemu-devel@nongnu.org, xen-devel@lists.xen.org

> -----Original Message-----
> From: Stefano Stabellini [mailto:stefano.stabellini@eu.citrix.com]
> Sent: 25 June 2013 13:02
> To: Paul Durrant
> Cc: qemu-devel@nongnu.org; xen-devel@lists.xen.org
> Subject: Re: [Xen-devel] [PATCH 1/2] Allow use of pc machine type
> (accel=xen) for Xen HVM domains.
> 
> On Tue, 18 Jun 2013, Paul Durrant wrote:
> > Xen HVM domains normally spawn QEMU with a dedicated xenfv machine
> type. The
> > initialization code for this machine type can easily be pulled into the
> > generic pc initialization code and guarded with a test for whether the xen
> > accelerator options is specified, which is more consistent with the way
> > other accelerators are used.
> >
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > ---
> >  hw/i386/pc_piix.c |    8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > index d618570..f96e0c2 100644
> > --- a/hw/i386/pc_piix.c
> > +++ b/hw/i386/pc_piix.c
> > @@ -91,6 +91,11 @@ static void pc_init1(MemoryRegion
> *system_memory,
> >      DeviceState *icc_bridge;
> >      FWCfgState *fw_cfg = NULL;
> >
> > +    if (xen_enabled() && xen_hvm_init() != 0) {
> > +        fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
> > +        exit(1);
> > +    }
> > +
> >      icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
> >      object_property_add_child(qdev_get_machine(), "icc-bridge",
> >                                OBJECT(icc_bridge), NULL);
> 
> I was about to submit a pull request with this patch, but unfortunately
> it breaks non-xen compilations:
> 
> hw/i386/pc_piix.o: In function `pc_init1':
> /local/scratch/sstabellini/qemu/hw/i386/pc_piix.c:94: undefined reference
> to `xen_hvm_init'
> 
> you need to add the function to xen-stub.c:
> 
> diff --git a/xen-stub.c b/xen-stub.c
> index 6f0516a..47c8e73 100644
> --- a/xen-stub.c
> +++ b/xen-stub.c
> @@ -63,3 +63,8 @@ void qmp_xen_set_global_dirty_log(bool enable, Error
> **errp)
>  void xen_modified_memory(ram_addr_t start, ram_addr_t length)
>  {
>  }
> +
> +int xen_hvm_init(void)
> +{
> +    return 0;
> +}
> 
> I'll include this change in the pull request

Ok. Thanks for the fix-up.

  Paul

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

end of thread, other threads:[~2013-06-25 12:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1371554221-5762-1-git-send-email-paul.durrant@citrix.com>
2013-06-18 11:17 ` [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains Paul Durrant
2013-06-20 14:44   ` Stefano Stabellini
2013-06-25 12:01   ` Stefano Stabellini
2013-06-25 12:58     ` Paul Durrant
2013-06-18 11:17 ` [PATCH 2/2] Move hardcoded initialization of xen-platform device Paul Durrant
2013-06-18 12:23 ` [PATCH 0/2] Remove hardcoded xen-platform device initialization (v4) Paolo Bonzini
     [not found] ` <1371554221-5762-3-git-send-email-paul.durrant@citrix.com>
2013-06-20 14:44   ` [PATCH 2/2] Move hardcoded initialization of xen-platform device Stefano Stabellini
     [not found] <1371549586-4672-1-git-send-email-paul.durrant@citrix.com>
2013-06-18  9:59 ` [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains Paul Durrant
     [not found] <1371472598-20330-1-git-send-email-paul.durrant@citrix.com>
2013-06-17 12:36 ` Paul Durrant

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