From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [Qemu-devel] [PATCH v5 06/16] apic: Introduce backend/frontend infrastructure for KVM reuse Date: Tue, 20 Dec 2011 00:32:00 +0100 Message-ID: <4EEFC970.9030205@web.de> References: <4EEFB72E.7030508@codemonkey.ws> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigAE88911C9482DEF9F55D3B09" Cc: Avi Kivity , Marcelo Tosatti , Blue Swirl , Anthony Liguori , qemu-devel , kvm@vger.kernel.org, "Michael S. Tsirkin" To: Anthony Liguori Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:51497 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126Ab1LSXcJ (ORCPT ); Mon, 19 Dec 2011 18:32:09 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate01.web.de (Postfix) with ESMTP id C7FC61A5C7F45 for ; Tue, 20 Dec 2011 00:32:07 +0100 (CET) In-Reply-To: <4EEFB72E.7030508@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: 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--