From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcmgl-0001a0-DU for qemu-devel@nongnu.org; Mon, 19 Dec 2011 18:32:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rcmgk-0001XW-Bg for qemu-devel@nongnu.org; Mon, 19 Dec 2011 18:32:11 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:51493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcmgj-0001XQ-W2 for qemu-devel@nongnu.org; Mon, 19 Dec 2011 18:32:10 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate01.web.de (Postfix) with ESMTP id AF2FB1A5C7F04 for ; Tue, 20 Dec 2011 00:32:07 +0100 (CET) Message-ID: <4EEFC970.9030205@web.de> Date: Tue, 20 Dec 2011 00:32:00 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <4EEFB72E.7030508@codemonkey.ws> In-Reply-To: <4EEFB72E.7030508@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigAE88911C9482DEF9F55D3B09" Subject: Re: [Qemu-devel] [PATCH v5 06/16] apic: Introduce backend/frontend infrastructure for KVM reuse List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Anthony Liguori , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , qemu-devel , Blue Swirl , Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigAE88911C9482DEF9F55D3B09 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable [ Please strip your replies a bit. I always worry to miss a comment when scrolling down dozens of pages. ] On 2011-12-19 23:14, Anthony Liguori wrote: >> + >> +struct APICBackend { >> + const char *name; >> + void (*init)(APICState *s); >> + void (*set_base)(APICState *s, uint64_t val); >> + void (*set_tpr)(APICState *s, uint8_t val); >> + void (*external_nmi)(APICState *s); >> + >> + QSIMPLEQ_ENTRY(APICBackend) entry; >> +}; >=20 >=20 > Wouldn't this be more naturally modeled by making APICBackend be a base= > class? >=20 > In qdev today, this would look like: >=20 > struct APICCommon { > SysBusDevice qdev; > ... > }; >=20 > struct APICCommonInfo { > DeviceInfo qdev; > void (*init)(APICState *s); > void (*set_base)(APICState *s, uint64_t val); > void (*set_tpr)(APICState *s, uint8_t val); > void (*external_nmi)(APICState *s); > }; >=20 > Take a look at SCSIDevice for an example of this in practice. This is > nicer because as we move save/load into devices methods, it becomes > natural to define the state and save/load function in the base class.=20 > Provided it only uses base class state, it lets save/load be compatible= > between both in-kernel and in-qemu device model. The difference is (unless I completely miss your point) that a common SCSI base class is used by different derived classes. Here we have a common frontend class but different base classes, so to say. And we have a mechanism to chose where to inherit from on instantiation. Precisely this allows to keep the compatibility between in-kernel and user space model in this series. Jan --------------enigAE88911C9482DEF9F55D3B09 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7vyXQACgkQitSsb3rl5xRHHQCg15ius8LfpBUqqiJIpDv9ohzG gwEAn1rbMzNllleQk9Ho40fqnGxMvKca =3qMA -----END PGP SIGNATURE----- --------------enigAE88911C9482DEF9F55D3B09--