Received: from eggs.gnu.org ([2001:4830:134:3::10]:35790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwbZh-0004Ke-7k for qemu-devel@nongnu.org; Tue, 18 Oct 2016 17:05:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwbZg-0000bs-9E for qemu-devel@nongnu.org; Tue, 18 Oct 2016 17:05:29 -0400 Date: Tue, 18 Oct 2016 18:49:37 -0200 From: Eduardo Habkost Message-ID: <20161018204937.GB5057@thinpad.lan.raisama.net> References: <20161018130007.k7hhxovkxiqiumfj@kamzik.brq.redhat.com> <20161018131829.GQ3275@thinpad.lan.raisama.net> <20161018142247.55d4aymduofvhy3r@kamzik.brq.redhat.com> <20161018152207.GZ3275@thinpad.lan.raisama.net> <20161018162202.pmui5rv3va7ubcrv@kamzik.brq.redhat.com> <20161018175737.3biqteztu3esvaaq@kamzik.brq.redhat.com> <20161018184532.GC3275@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] QOM properties vs C functions/fields (was Re: [PATCH v3 2/3] exec: rename cpu_exec_init() as cpu_exec_realizefn()) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Andrew Jones , Anthony Green , QEMU Developers , Alexander Graf , Max Filippov , Greg Ungerer , "Edgar E . Iglesias" , Guan Xuetao , Chen Gang , Jia Liu , Markus Armbruster , Bharata B Rao , David Gibson , Artyom Tarasenko , Laurent Vivier , Greg Kurz , qemu-arm , Igor Mammedov , Richard Henderson , Matthew Rosato , Bastian Koppelmann , Michael Walle , "qemu-ppc@nongnu.org" , Paolo Bonzini , Aurelien Jarno On Tue, Oct 18, 2016 at 09:30:01PM +0100, Peter Maydell wrote: > On 18 October 2016 at 19:45, Eduardo Habkost wrote: > > On Tue, Oct 18, 2016 at 07:12:51PM +0100, Peter Maydell wrote: > >> We actually have a concrete instance in the tree at the moment: > >> the raspberry pi 2. Specifically hw/arm/bcm2836.c sets the > >> mp_affinity for each cpu to 0xF00 | n (where n is the CPUID). > >> Currently it's doing that by reaching in and messing with > >> the mp_affinity field directly, but really it ought to be > >> doing it by setting a property on the CPU, and what it > >> wants isn't somethnig that can be expressed with a simple > >> nr_sockets/nr_cores/etc scheme. > > > > I am confused now. I thought QOM properties were meant for > > user-visible and/or user-configurable data. I assumed that if > > it's only meant to be used by C code inside QEMU, C functions > > and/or C struct fields were the way to go. > > Lots of stuff in a device's C struct is strictly internal > and not to be messed with. I thought that QOM properties > were essentially how a device defined its public (and > typically settable-only-once) config knobs. QOM properties > shouldn't be user-facing (read: stable, required to be > backwards-compatible) interface in general because > we don't really want to tie ourselves down that much. > In fact almost all our QOM objects are not usefully > user-facing at all. This interpretation surprises me, because it is the opposite of what I have seen us doing. Most of our QOM objects and properties are user-visible and user-configurable using -global, -device, -object, or qom-set (and probably other QMP commands). Some QOM properties are internal and we have been using the "x-" prefix to indicate that, but most of them do _not_ have the "x-" prefix. -- Eduardo