From 8373a0fd520884088aa13b5ee4601913d402762a Mon Sep 17 00:00:00 2001 From: Markus Armbruster <armbru@redhat.com> Date: Wed, 1 Jul 2009 00:59:03 +0200 Subject: [PATCH 3/3] New command line option -balloon Backported from upstream, with the addr= feature dropped. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <87y6r9wcp4.fsf@pike.pond.sub.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Bugzilla: 503790 RH-Upstream-status: backport-from-upstream Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: john cooper <john.cooper@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> --- qemu/hw/pc.c | 2 +- qemu/sysemu.h | 1 + qemu/vl.c | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletions(-) diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c index 313fe11..692ddea 100644 --- a/qemu/hw/pc.c +++ b/qemu/hw/pc.c @@ -1209,7 +1209,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, } /* Add virtio balloon device */ - if (pci_enabled) + if (pci_enabled && virtio_balloon) virtio_balloon_init(pci_bus); #ifdef USE_KVM_DEVICE_ASSIGNMENT diff --git a/qemu/sysemu.h b/qemu/sysemu.h index 939f19a..e522a33 100644 --- a/qemu/sysemu.h +++ b/qemu/sysemu.h @@ -101,6 +101,7 @@ extern int win2k_install_hack; extern int rtc_td_hack; extern int alt_grab; extern int usb_enabled; +extern int virtio_balloon; extern int smp_cpus; extern int cursor_hide; extern int graphic_rotate; diff --git a/qemu/vl.c b/qemu/vl.c index 38bd0f3..7dd48f0 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -235,6 +235,7 @@ int smp_cpus = 1; const char *vnc_display; int acpi_enabled = 1; int no_hpet = 0; +int virtio_balloon = 1; int fd_bootchk = 1; int no_reboot = 0; int no_shutdown = 0; @@ -4282,6 +4283,9 @@ static void help(int exitcode) #ifdef TARGET_I386 "-no-acpi disable ACPI\n" "-no-hpet disable HPET\n" + "-balloon none disable balloon device\n" + "-balloon virtio\n" + " enable virtio balloon device (default)\n" "-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,data=file1[:file2]...]\n" " ACPI table description\n" "-smbios file=binary\n" @@ -4417,6 +4421,7 @@ enum { QEMU_OPTION_vnc, QEMU_OPTION_no_acpi, QEMU_OPTION_no_hpet, + QEMU_OPTION_balloon, QEMU_OPTION_acpitable, QEMU_OPTION_smbios, QEMU_OPTION_curses, @@ -4570,6 +4575,7 @@ static const QEMUOption qemu_options[] = { { "usb", 0, QEMU_OPTION_usb }, { "no-acpi", 0, QEMU_OPTION_no_acpi }, { "no-hpet", 0, QEMU_OPTION_no_hpet }, + { "balloon", HAS_ARG, QEMU_OPTION_balloon }, { "acpitable", HAS_ARG, QEMU_OPTION_acpitable }, { "smbios", HAS_ARG, QEMU_OPTION_smbios }, { "no-reboot", 0, QEMU_OPTION_no_reboot }, @@ -4823,6 +4829,20 @@ static void select_vgahw (const char *p) } } +#ifdef TARGET_I386 +static int balloon_parse(const char *arg) +{ + if (!strcmp(arg, "none")) { + virtio_balloon = 0; + } else if (!strcmp(arg, "virtio")) { + virtio_balloon = 1; + } else { + return -1; + } + return 0; +} +#endif + #ifdef _WIN32 static BOOL WINAPI qemu_ctrl_handler(DWORD type) { @@ -5712,6 +5732,12 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_no_hpet: no_hpet = 1; break; + case QEMU_OPTION_balloon: + if (balloon_parse(optarg) < 0) { + fprintf(stderr, "Unknown -balloon argument %s\n", optarg); + exit(1); + } + break; case QEMU_OPTION_no_reboot: no_reboot = 1; break; -- 1.6.3.rc4.29.g8146