提交 7d4c3d53 编写于 作者: M Markus Armbruster 提交者: Anthony Liguori

Replace -no-virtio-balloon by -balloon

We want to do (at least) two things to the virtio-balloon device:
suppress it, and control its PCI address.  Option -no-virtio-balloon
lets us do only the former.  To get the latter, replace
-no-virtio-balloon with

    -balloon none   disable balloon device
    -balloon virtio[,addr=str]
                    enable virtio balloon device (default)

Syntax suggested by Anthony Liguori.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 74efd61a
...@@ -1408,8 +1408,9 @@ static void pc_init1(ram_addr_t ram_size, ...@@ -1408,8 +1408,9 @@ static void pc_init1(ram_addr_t ram_size,
} }
/* Add virtio balloon device */ /* Add virtio balloon device */
if (pci_enabled && !no_virtio_balloon) { if (pci_enabled && virtio_balloon) {
pci_create_simple(pci_bus, -1, "virtio-balloon-pci"); pci_dev = pci_create("virtio-balloon-pci", virtio_balloon_devaddr);
qdev_init(&pci_dev->qdev);
} }
/* Add virtio console devices */ /* Add virtio console devices */
......
...@@ -684,12 +684,17 @@ Disable HPET support. ...@@ -684,12 +684,17 @@ Disable HPET support.
ETEXI ETEXI
#ifdef TARGET_I386 #ifdef TARGET_I386
DEF("no-virtio-balloon", 0, QEMU_OPTION_no_virtio_balloon, DEF("balloon", HAS_ARG, QEMU_OPTION_balloon,
"-no-virtio-balloon disable virtio balloon device\n") "-balloon none disable balloon device\n"
"-balloon virtio[,addr=str]\n"
" enable virtio balloon device (default)\n")
#endif #endif
STEXI STEXI
@item -no-virtio-balloon @item -balloon none
Disable virtio-balloon device. Disable balloon device.
@item -balloon virtio[,addr=@var{addr}]
Enable virtio balloon device (default), optionally with PCI address
@var{addr}.
ETEXI ETEXI
#ifdef TARGET_I386 #ifdef TARGET_I386
......
...@@ -116,7 +116,8 @@ extern int win2k_install_hack; ...@@ -116,7 +116,8 @@ extern int win2k_install_hack;
extern int rtc_td_hack; extern int rtc_td_hack;
extern int alt_grab; extern int alt_grab;
extern int usb_enabled; extern int usb_enabled;
extern int no_virtio_balloon; extern int virtio_balloon;
extern const char *virtio_balloon_devaddr;
extern int smp_cpus; extern int smp_cpus;
extern int cursor_hide; extern int cursor_hide;
extern int graphic_rotate; extern int graphic_rotate;
......
...@@ -242,7 +242,8 @@ int smp_cpus = 1; ...@@ -242,7 +242,8 @@ int smp_cpus = 1;
const char *vnc_display; const char *vnc_display;
int acpi_enabled = 1; int acpi_enabled = 1;
int no_hpet = 0; int no_hpet = 0;
int no_virtio_balloon = 0; int virtio_balloon = 1;
const char *virtio_balloon_devaddr;
int fd_bootchk = 1; int fd_bootchk = 1;
int no_reboot = 0; int no_reboot = 0;
int no_shutdown = 0; int no_shutdown = 0;
...@@ -4762,6 +4763,29 @@ static void select_vgahw (const char *p) ...@@ -4762,6 +4763,29 @@ static void select_vgahw (const char *p)
} }
} }
#ifdef TARGET_I386
static int balloon_parse(const char *arg)
{
char buf[128];
const char *p;
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);
}
}
} else {
return -1;
}
return 0;
}
#endif
#ifdef _WIN32 #ifdef _WIN32
static BOOL WINAPI qemu_ctrl_handler(DWORD type) static BOOL WINAPI qemu_ctrl_handler(DWORD type)
{ {
...@@ -5578,8 +5602,11 @@ int main(int argc, char **argv, char **envp) ...@@ -5578,8 +5602,11 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_no_hpet: case QEMU_OPTION_no_hpet:
no_hpet = 1; no_hpet = 1;
break; break;
case QEMU_OPTION_no_virtio_balloon: case QEMU_OPTION_balloon:
no_virtio_balloon = 1; if (balloon_parse(optarg) < 0) {
fprintf(stderr, "Unknown -balloon argument %s\n", optarg);
exit(1);
}
break; break;
#endif #endif
case QEMU_OPTION_no_reboot: case QEMU_OPTION_no_reboot:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册