Received: from eggs.gnu.org ([2001:4830:134:3::10]:56861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCtZH-0002Wm-KL for qemu-devel@nongnu.org; Fri, 02 Dec 2016 14:32:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCtZE-00053m-Aa for qemu-devel@nongnu.org; Fri, 02 Dec 2016 14:32:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52016) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cCtZE-00053X-2U for qemu-devel@nongnu.org; Fri, 02 Dec 2016 14:32:20 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1023ACA62C for ; Fri, 2 Dec 2016 19:32:19 +0000 (UTC) References: <20161201170624.26496-1-lersek@redhat.com> <20161201170624.26496-8-lersek@redhat.com> <20161201191312.GA13060@thinpad.lan.raisama.net> <20fba314-63c0-e003-415d-20b142d9a075@redhat.com> <20161202131815.17d07ef5@nial.brq.redhat.com> From: Laszlo Ersek Message-ID: Date: Fri, 2 Dec 2016 20:32:14 +0100 MIME-Version: 1.0 In-Reply-To: <20161202131815.17d07ef5@nial.brq.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 7/7] hw/i386/pc_q35: advertise broadcast SMI if VCPU hotplug is turned off List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Eduardo Habkost , qemu devel list , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini On 12/02/16 13:18, Igor Mammedov wrote: > On Thu, 1 Dec 2016 21:42:58 +0100 > Laszlo Ersek wrote: > >> On 12/01/16 20:13, Eduardo Habkost wrote: >>> On Thu, Dec 01, 2016 at 06:06:24PM +0100, Laszlo Ersek wrote: >>>> For the time being, we cannot handle SMIs in OVMF if VCPUs can show up >>>> after boot. Otherwise, advertise ICH9_LPC_SMI_F_BROADCAST. >>>> >>>> Implement this generally, by introducing a new PCMachineClass method, >>>> namely get_smi_host_features(), and implement the above logic for >>>> pc-q35-2.9 and later. The idea is that future machine types might want to >>>> calculate (the same or different) SMI host features from different >>>> information, and that shouldn't affect earlier machine types. >>>> >>>> In turn, validating guest feature requests (inter-feature dependencies) >>>> should be possible purely based on the available host feature set. For >>>> example, in the future we might enforce that the guest select >>>> ICH9_LPC_SMI_F_VCPU_PARKING as a prerequisite for >>>> ICH9_LPC_SMI_F_BROADCAST, but only if the machine type itself advertises >>>> ICH9_LPC_SMI_F_VCPU_PARKING. >>>> >>>> Cc: "Michael S. Tsirkin" >>>> Cc: Eduardo Habkost >>>> Cc: Gerd Hoffmann >>>> Cc: Igor Mammedov >>>> Cc: Paolo Bonzini >>>> Signed-off-by: Laszlo Ersek >>>> --- >>>> include/hw/i386/pc.h | 1 + >>>> hw/i386/pc_q35.c | 24 +++++++++++++++++++++++- >>>> 2 files changed, 24 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h >>>> index 430735e501dd..e164947116b6 100644 >>>> --- a/include/hw/i386/pc.h >>>> +++ b/include/hw/i386/pc.h >>>> @@ -116,10 +116,11 @@ struct PCMachineClass { >>>> /*< public >*/ >>>> >>>> /* Methods: */ >>>> HotplugHandler *(*get_hotplug_handler)(MachineState *machine, >>>> DeviceState *dev); >>>> + uint64_t (*get_smi_host_features)(void); >>> >>> I'd prefer to encode the differences between machine-types as >>> data, instead of code, to make introspection easier in the >>> future. Is it possible to encode this in a simple PCMachineClass >>> struct data field or (even bettter) a QOM property? >>> >> >> I don't know how else to capture the (smp_cpus == max_cpus) question, >> for saying that "this machine type supports SMI broadcast, as long as >> VCPU hotplug is disabled in the configuration". > (smp_cpus == max_cpus) doesn't mean that CPU hotplug is disabled > (it actually can't be disabled at all). > > In addition, it's possible to start machine with > -smp 1,sockets=2,max_cpus=2 -device mycputype,socket=2 > > where all cpus will be coldpugged > It would be better to use PCMachineState.boot_cpus which contains > present cpus count. > > I'd drop hotplug check (as usecase is broken in many places anyway) > and even won't touch PCMachineState, instead add a property like > ICH9_LPC.enable_smi_broadcast(on by default) and disable it for > old machine types using compat props. I'll look into that, thanks! Laszlo > > We can work on making CPU hotplug and OVMF work in follow up patches. > >> Technically we could give PCMC two new (data) fields, a host features >> bitmap for when VCPU hotplug is enabled, and another for when VCPU >> hotplug is disabled. Then board code would take the right field and pass >> it on to ich9_lpc_pm_init(). >> >> Thanks >> Laszlo >