* [Qemu-devel] [PATCH] switch balloon initialization to -device.
@ 2009-08-14 8:34 Gerd Hoffmann
2009-08-14 9:44 ` Markus Armbruster
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2009-08-14 8:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
With that patch applied "-balloon virtio,args" becomes a shortcut for
"-device virtio-balloon-pci,args".
Side effects:
- ballon device gains support for id=<tag>.
- ballon device is off by default now.
- initialization order changes, which may in different pci slot
assignment depending on the VM configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pc.c | 7 -------
sysemu.h | 2 --
vl.c | 34 ++++++++++++++++++----------------
3 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index cc6e7e8..ab26291 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1115,7 +1115,6 @@ static void pc_init1(ram_addr_t ram_size,
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
int bios_size, isa_bios_size, oprom_area_size;
PCIBus *pci_bus;
- PCIDevice *pci_dev;
ISADevice *isa_dev;
int piix3_devfn = -1;
CPUState *env;
@@ -1412,12 +1411,6 @@ static void pc_init1(ram_addr_t ram_size,
}
}
- /* Add virtio balloon device */
- if (pci_enabled && virtio_balloon) {
- pci_dev = pci_create("virtio-balloon-pci", virtio_balloon_devaddr);
- qdev_init(&pci_dev->qdev);
- }
-
/* Add virtio console devices */
if (pci_enabled) {
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
diff --git a/sysemu.h b/sysemu.h
index dffb2f1..4f7b689 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -112,8 +112,6 @@ extern int win2k_install_hack;
extern int rtc_td_hack;
extern int alt_grab;
extern int usb_enabled;
-extern int virtio_balloon;
-extern const char *virtio_balloon_devaddr;
extern int smp_cpus;
extern int max_cpus;
extern int cursor_hide;
diff --git a/vl.c b/vl.c
index 8b2b289..d55747d 100644
--- a/vl.c
+++ b/vl.c
@@ -223,8 +223,6 @@ int max_cpus = 0;
const char *vnc_display;
int acpi_enabled = 1;
int no_hpet = 0;
-int virtio_balloon = 1;
-const char *virtio_balloon_devaddr;
int fd_bootchk = 1;
int no_reboot = 0;
int no_shutdown = 0;
@@ -4523,23 +4521,27 @@ static void select_vgahw (const char *p)
#ifdef TARGET_I386
static int balloon_parse(const char *arg)
{
- char buf[128];
- const char *p;
+ QemuOpts *opts;
- if (!strcmp(arg, "none")) {
- virtio_balloon = 0;
- } else if (!strncmp(arg, "virtio", 6)) {
- virtio_balloon = 1;
- if (arg[6] == ',') {
- p = arg + 7;
- if (get_param_value(buf, sizeof(buf), "addr", p)) {
- virtio_balloon_devaddr = strdup(buf);
- }
+ if (strcmp(arg, "none") == 0) {
+ return 0;
+ }
+
+ if (!strncmp(arg, "virtio", 6)) {
+ if (arg[6] == ',') {
+ /* have params -> parse them */
+ opts = qemu_opts_parse(&qemu_device_opts, arg+7, NULL);
+ if (!opts)
+ return -1;
+ } else {
+ /* create empty opts */
+ opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
}
- } else {
- return -1;
+ qemu_opt_set(opts, "driver", "virtio-balloon-pci");
+ return 0;
}
- return 0;
+
+ return -1;
}
#endif
--
1.6.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] switch balloon initialization to -device.
2009-08-14 8:34 [Qemu-devel] [PATCH] switch balloon initialization to -device Gerd Hoffmann
@ 2009-08-14 9:44 ` Markus Armbruster
2009-08-14 10:10 ` Gerd Hoffmann
0 siblings, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2009-08-14 9:44 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Gerd Hoffmann <kraxel@redhat.com> writes:
> With that patch applied "-balloon virtio,args" becomes a shortcut for
> "-device virtio-balloon-pci,args".
>
> Side effects:
> - ballon device gains support for id=<tag>.
> - ballon device is off by default now.
> - initialization order changes, which may in different pci slot
> assignment depending on the VM configuration.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Looks good on quick inspection (gotta run), just one question: what
happens when I (stupidly) do -balloon virtio,driver=e1000 ? Question
might apply to plain -device before this patch as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] switch balloon initialization to -device.
2009-08-14 9:44 ` Markus Armbruster
@ 2009-08-14 10:10 ` Gerd Hoffmann
2009-08-21 15:59 ` Markus Armbruster
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2009-08-14 10:10 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
On 08/14/09 11:44, Markus Armbruster wrote:
> Gerd Hoffmann<kraxel@redhat.com> writes:
>
>> With that patch applied "-balloon virtio,args" becomes a shortcut for
>> "-device virtio-balloon-pci,args".
>>
>> Side effects:
>> - ballon device gains support for id=<tag>.
>> - ballon device is off by default now.
>> - initialization order changes, which may in different pci slot
>> assignment depending on the VM configuration.
>>
>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>
> Looks good on quick inspection (gotta run), just one question: what
> happens when I (stupidly) do -balloon virtio,driver=e1000 ? Question
> might apply to plain -device before this patch as well.
QemuOpts allows overwriting, so who is written last will win.
Write order is undefined, so don't try that at home ;)
Behavior of the current code:
-balloon virtio,driver=e1000 will give you a balloon device.
-device virtio-blk-pci,driver=e1000 will give you a e1000.
cheers,
Gerd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] switch balloon initialization to -device.
2009-08-14 10:10 ` Gerd Hoffmann
@ 2009-08-21 15:59 ` Markus Armbruster
0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2009-08-21 15:59 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Gerd Hoffmann <kraxel@redhat.com> writes:
> On 08/14/09 11:44, Markus Armbruster wrote:
>> Gerd Hoffmann<kraxel@redhat.com> writes:
>>
>>> With that patch applied "-balloon virtio,args" becomes a shortcut for
>>> "-device virtio-balloon-pci,args".
>>>
>>> Side effects:
>>> - ballon device gains support for id=<tag>.
>>> - ballon device is off by default now.
>>> - initialization order changes, which may in different pci slot
>>> assignment depending on the VM configuration.
>>>
>>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>>
>> Looks good on quick inspection (gotta run), just one question: what
>> happens when I (stupidly) do -balloon virtio,driver=e1000 ? Question
>> might apply to plain -device before this patch as well.
>
> QemuOpts allows overwriting, so who is written last will win.
> Write order is undefined, so don't try that at home ;)
>
> Behavior of the current code:
>
> -balloon virtio,driver=e1000 will give you a balloon device.
> -device virtio-blk-pci,driver=e1000 will give you a e1000.
Ugly. Not sure it's worth fixing.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-21 15:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-14 8:34 [Qemu-devel] [PATCH] switch balloon initialization to -device Gerd Hoffmann
2009-08-14 9:44 ` Markus Armbruster
2009-08-14 10:10 ` Gerd Hoffmann
2009-08-21 15:59 ` Markus Armbruster
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.