Paul Durrant
2013-Jun-17 12:36 UTC
[PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
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
Paul Durrant
2013-Jun-18 09:59 UTC
[PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
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
Paul Durrant
2013-Jun-18 11:17 UTC
[PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
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
Stefano Stabellini
2013-Jun-20 14:44 UTC
Re: [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>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 >
Stefano Stabellini
2013-Jun-25 12:01 UTC
Re: [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
Paul Durrant
2013-Jun-25 12:58 UTC
Re: [PATCH 1/2] Allow use of pc machine type (accel=xen) for Xen HVM domains.
> -----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 requestOk. Thanks for the fix-up. Paul