some small cleanups for xen_machine_pv.c
cover some small cleanups for xen_machine_pv.c
Hi,
Here are a few cleanup patches for qemu-xen's xen_machine_pv.c, in preparation for merging into upstream qemu.
please apply,
Gerd
PATCH 1/5 xen_machine_pv.c: switch to C99 initializers.
--- hw/xen_machine_pv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
hw/xen_machine_pv.c +4 -4
@@ -72,10 +72,10 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, }QEMUMachine xenpv_machine = { -"xenpv" , -"Xen Para-virtualized PC" , - xen_init_pv, -BIOS_SIZE |RAMSIZE_FIXED , + .name ="xenpv" , + .desc ="Xen Para-virtualized PC" , + .init = xen_init_pv, + .ram_require =BIOS_SIZE |RAMSIZE_FIXED , .max_cpus =1 , .nodisk_ok =1 , };
Signature · 1 line
1.6.1.3
PATCH 2/5 xen_machine_pv.c: delete pointless coomment.
In reply to Gerd Hoffmann--- hw/xen_machine_pv.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
hw/xen_machine_pv.c +0 -5
@@ -33,11 +33,6 @@ enum xen_mode xen_mode = XEN_EMULATE;extern void init_blktap (void ); - -/* The Xen PV machine currently provides -* - a virtual framebuffer -* - .... -*/ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename,
Signature · 1 line
1.6.1.3
PATCH 3/5 Fixup dummy cpu setup.
In reply to Gerd HoffmannPassing NULL to cpu_init() doesn't work in upstream qemu. Also make sure the dummy cpu is in halted mode.
--- hw/xen_machine_pv.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
hw/xen_machine_pv.c +9 -1
@@ -51,7 +51,15 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,#endif /* Initialize a dummy CPU */ - env =cpu_init (NULL ); +if (cpu_model ==NULL ) { +#ifdef TARGET_X86_64 + cpu_model ="qemu64" ; +#else + cpu_model ="qemu32" ; +#endif + } + env =cpu_init (cpu_model); + env->halted =1 ;/* Initialize backend core & drivers */ if (-1 ==xen_be_init ()) {
Signature · 1 line
1.6.1.3
Re: [PATCH 3/5] Fixup dummy cpu setup.
Quoted 19 lines · Gerd Hoffmann
Passing NULL to
cpu_init()doesn't work in upstream qemu. Also make sure the dummy cpu is in halted mode.Signed-off-by Gerd Hoffmann <[email protected]>--- hw/xen_machine_pv.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)hw/xen_machine_pv.c +2
-1@@ -51,7 +51,15 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,#endif /* Initialize a dummy CPU */ - env =cpu_init (NULL ); +if (cpu_model ==NULL ) { +#ifdef TARGET_X86_64
hw/xen_machine_pv.c static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, · line 65
Quoted 10 lines
hw/xen_machine_pv.c +7
-0+ cpu_model ="qemu64" ; +#else + cpu_model ="qemu32" ; +#endif + } + env =cpu_init (cpu_model); + env->halted =1 ;/* Initialize backend core & drivers */ if (-1 ==xen_be_init ()) {
Is there a way to achieve this without ifdef nastiness?
Signature · 3 lines
Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en
Re: [PATCH 3/5] Fixup dummy cpu setup.
Quoted 11 lines · Simon Horman
hw/xen_machine_pv.c static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, · line 61
Quoted 9 lines
hw/xen_machine_pv.c +8
-1- env =cpu_init (NULL ); +if (cpu_model ==NULL ) { +#ifdef TARGET_X86_64 + cpu_model ="qemu64" ; +#else + cpu_model ="qemu32" ; +#endif + } + env =cpu_init (cpu_model);Is there a way to achieve this without ifdef nastiness?
Well, one could try to make cpu_init(NULL) pick a sane default. But in the end that most likely would just be moving the ifdef to another place.
cheers,
Gerd
Re: [PATCH 3/5] Fixup dummy cpu setup.
Quoted 13 lines · Gerd Hoffmann
Quoted 11 lines · Simon Horman
hw/xen_machine_pv.c static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, · line 61
Quoted 9 lines
hw/xen_machine_pv.c +8
-1- env =cpu_init (NULL ); +if (cpu_model ==NULL ) { +#ifdef TARGET_X86_64 + cpu_model ="qemu64" ; +#else + cpu_model ="qemu32" ; +#endif + } + env =cpu_init (cpu_model);Is there a way to achieve this without ifdef nastiness?
Quoted 2 lines
Well, one could try to make
cpu_init(NULL)pick a sane default. But in the end that most likely would just be moving the ifdef to another place.
Understood.
Signature · 3 lines
Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en
PATCH 4/5 use uint32_t for xen_domid
In reply to Gerd Hoffmann--- hw/xen.h | 2 +- hw/xen_machine_pv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/xen.h +1 -1
@@ -14,7 +14,7 @@ enum xen_mode {XEN_ATTACH // attach to xen domain created by xend }; -extern int xen_domid; +extern uint32_t xen_domid;extern enum xen_mode xen_mode;#endif /* QEMU_HW_XEN_H */
hw/xen_machine_pv.c +1 -1
@@ -28,7 +28,7 @@#include "boards.h" #include "xen_backend.h" -int xen_domid; +uint32_t xen_domid;enum xen_mode xen_mode =XEN_EMULATE ;extern void init_blktap (void );
Signature · 1 line
1.6.1.3
RE: [PATCH 4/5] use uint32_t for xen_domid
May not matter but isn't a domid limited to 16-bits in the hypervisor? Probably should be consistent lest sign-extension or something cause a problem.
Quoted 51 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, March 20, 2009 10:03 AM
To: [email protected]
Cc: [email protected]; Gerd Hoffmann; [email protected]
Subject: [Xen-devel] [PATCH 4/5] useuint32_tforxen_domidSigned-off-by Gerd Hoffmann <[email protected]>--- hw/xen.h | 2 +- hw/xen_machine_pv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)hw/xen.h +1
-1@@ -14,7 +14,7 @@ enum xen_mode {XEN_ATTACH // attach to xen domain created by xend }; -extern int xen_domid; +extern uint32_t xen_domid;extern enum xen_mode xen_mode;#endif /* QEMU_HW_XEN_H */ hw/xen_machine_pv.c +1
-1@@ -28,7 +28,7 @@#include "boards.h" #include "xen_backend.h" -int xen_domid; +uint32_t xen_domid;enum xen_mode xen_mode =XEN_EMULATE ;extern void init_blktap (void );Signature · 7 lines
1.6.1.3 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xensource.com/xen-devel
Re: [PATCH 4/5] use uint32_t for xen_domid
Quoted 3 lines · Dan Magenheimer
May not matter but isn't a domid limited to 16-bits in the hypervisor? Probably should be consistent lest sign-extension or something cause a problem.
In /usr/include/xenctrl.h it is uint32_t everythere.
cheers,
Gerd
PATCH 5/5 kill unused variables
In reply to Gerd Hoffmann--- hw/xen_machine_pv.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
hw/xen_machine_pv.c +0 -2
@@ -41,8 +41,6 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,const char *cpu_model, const char *direct_pci) { - struct xenfb *xenfb; -extern int domid; CPUState *env;#ifndef CONFIG_STUBDOM
Signature · 1 line
1.6.1.3