From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXXAr-0004AC-6I for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:11:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXXAi-0004N6-4b for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:11:09 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:44473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXXAh-0004Md-Lf for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:10:59 -0400 Received: by mail-wi0-f169.google.com with SMTP id hi2so1208369wib.0 for ; Fri, 26 Sep 2014 08:10:53 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <542581FA.2030807@redhat.com> Date: Fri, 26 Sep 2014 17:10:50 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409344310-5441-1-git-send-email-ehabkost@redhat.com> <1409344310-5441-16-git-send-email-ehabkost@redhat.com> In-Reply-To: <1409344310-5441-16-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 15/17] accel: Create accel object when initializing machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Michael Mueller , "Michael S. Tsirkin" , Marcel Apfelbaum , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , =?windows-1252?Q?Andreas_?= =?windows-1252?Q?F=E4rber?= Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > Create an actual TYPE_ACCEL object when initializing a machine. This > will allow accelerator classes to implement some initialization on > instance_init, and to save state on the TYPE_ACCEL object. > > Signed-off-by: Eduardo Habkost > --- > hw/core/accel.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/core/accel.c b/hw/core/accel.c > index 98fcf0d..66ee1fa 100644 > --- a/hw/core/accel.c > +++ b/hw/core/accel.c > @@ -60,11 +60,15 @@ static AccelClass *accel_find(const char *opt_name) > > static int accel_init_machine(AccelClass *acc, MachineState *ms) > { > + ObjectClass *oc = OBJECT_CLASS(acc); > + const char *cname = object_class_get_name(oc); > + AccelState *accel = ACCEL(object_new(cname)); > int ret; > *(acc->allowed) = true; > ret = acc->init_machine(ms); > if (ret < 0) { > *(acc->allowed) = false; > + object_unref(OBJECT(accel)); > } > return ret; > } > Reviewed-by: Paolo Bonzini