From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCRze-000538-N4 for qemu-devel@nongnu.org; Mon, 04 Mar 2013 04:47:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCRzb-0003R2-Fy for qemu-devel@nongnu.org; Mon, 04 Mar 2013 04:47:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCRzb-0003Qq-7A for qemu-devel@nongnu.org; Mon, 04 Mar 2013 04:47:35 -0500 Message-ID: <51346D9E.1090806@redhat.com> Date: Mon, 04 Mar 2013 10:47:10 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1af3c134891e119a21268ac6c48434447a8f6ab2.1362051582.git.hutao@cn.fujitsu.com> In-Reply-To: <1af3c134891e119a21268ac6c48434447a8f6ab2.1362051582.git.hutao@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v13 7/8] allower the user to disable pv event support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Peter Maydell , Gleb Natapov , "Michael S. Tsirkin" , Jan Kiszka , qemu-devel , Markus Armbruster , Blue Swirl , Orit Wasserman , kvm list , Juan Quintela , Alexander Graf , Andrew Jones , Alex Williamson , Sasha Levin , Stefan Hajnoczi , Luiz Capitulino , KAMEZAWA Hiroyuki , Kevin Wolf , Anthony Liguori , Marcelo Tosatti , "linux-kernel@vger.kernel.org" Il 28/02/2013 13:13, Hu Tao ha scritto: > Signed-off-by: Wen Congyang > Signed-off-by: Hu Tao > --- > hw/pc_piix.c | 9 ++++++++- > qemu-options.hx | 3 ++- > vl.c | 4 ++++ > 3 files changed, 14 insertions(+), 2 deletions(-) We cannot add -machine suboptions for everything we add to a random machine type. I think it's better to do one of the following: 1) not add it to the machine by default. Let libvirt add it with -device. 2) add a property to the piix3 ISA bridges (in hw/piix_pci.c) to enable/disable it. It can be set with -global PIIX3.pv_event=on/off. In the second case, if you set it to on by default, you will also need to add the property in hw/pc.h, to disable the device in older machine types for backwards-compatibility. Paolo > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 24a9bf3..82a421a 100644 > --- a/hw/pc_piix.c > +++ b/hw/pc_piix.c > @@ -44,6 +44,7 @@ > #include "exec/memory.h" > #include "exec/address-spaces.h" > #include "cpu.h" > +#include "qemu/config-file.h" > #ifdef CONFIG_XEN > # include > #endif > @@ -86,6 +87,8 @@ static void pc_init1(MemoryRegion *system_memory, > MemoryRegion *pci_memory; > MemoryRegion *rom_memory; > void *fw_cfg = NULL; > + QemuOptsList *list = qemu_find_opts("machine"); > + bool enable_pv_event = false; > > pc_cpus_init(cpu_model); > pc_acpi_init("acpi-dsdt.aml"); > @@ -218,7 +221,11 @@ static void pc_init1(MemoryRegion *system_memory, > pc_pci_device_init(pci_bus); > } > > - if (kvm_enabled()) { > + if (list && !QTAILQ_EMPTY(&list->head)) { > + enable_pv_event = qemu_opt_get_bool(QTAILQ_FIRST(&list->head), > + "enable_pv_event", false); > + } > + if (kvm_enabled() && enable_pv_event) { > kvm_pv_event_init(isa_bus); > } > } > diff --git a/qemu-options.hx b/qemu-options.hx > index 797d992..1ad4041 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -35,7 +35,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ > " kernel_irqchip=on|off controls accelerated irqchip support\n" > " kvm_shadow_mem=size of KVM shadow MMU\n" > " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" > - " mem-merge=on|off controls memory merge support (default: on)\n", > + " mem-merge=on|off controls memory merge support (default: on)\n" > + " enable_pv_event=on|off controls pv event support (default: off)\n", > QEMU_ARCH_ALL) > STEXI > @item -machine [type=]@var{name}[,prop=@var{value}[,...]] > diff --git a/vl.c b/vl.c > index 51d4922..5b3a279 100644 > --- a/vl.c > +++ b/vl.c > @@ -427,6 +427,10 @@ static QemuOptsList qemu_machine_opts = { > .name = "usb", > .type = QEMU_OPT_BOOL, > .help = "Set on/off to enable/disable usb", > + }, { > + .name = "enable_pv_event", > + .type = QEMU_OPT_BOOL, > + .help = "handle pv event" > }, > { /* End of list */ } > }, >