From nobody Mon Feb 9 16:34:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575904359; cv=none; d=zohomail.com; s=zohoarc; b=ILA0Im5rLpAskDAkWx77c3osI7ckbdqbI5gakifHZ6k0HYxA7gLP88VPO4SsSI+Wy4RR7Ou/SF7gWfTmJG0Gs82vVM/xNHB0EE4KEj/YZ35O31ydGJuaCx7ICeGEkK1prhIHBzvk8fNMNFjWN7O7kySJbcQZFB3F9VkUTVK9WHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575904359; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=53drGG/4V0NylixgL3iQIcLKYE+QBnEUf/GWyCKPtTs=; b=lN3oq0bNMI9EZCPMctwnIdBRlBsrNv7rbMWltApVmCuxBFhFruRWNXIurntWU3XbQKQNwMowOKYf2ME3rbyTUFXwepR28six11JfsgHYBz4kb3KbLMAIyihek5SpFVE8bvRLFVnMt661x0Is+5fYpvfYLzS7P/p2HfslcpyIwfk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1575904359011390.2182219257363; Mon, 9 Dec 2019 07:12:39 -0800 (PST) Received: from localhost ([::1]:41298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieKiD-0006bO-FT for importer@patchew.org; Mon, 09 Dec 2019 10:12:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47220) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieKY0-0003WQ-1c for qemu-devel@nongnu.org; Mon, 09 Dec 2019 10:02:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieKXy-0001Sd-R1 for qemu-devel@nongnu.org; Mon, 09 Dec 2019 10:02:03 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:35403) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieKXy-0001Pe-IR for qemu-devel@nongnu.org; Mon, 09 Dec 2019 10:02:02 -0500 Received: by mail-wm1-x342.google.com with SMTP id c20so13811675wmb.0 for ; Mon, 09 Dec 2019 07:02:02 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id g9sm27219371wro.67.2019.12.09.07.02.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Dec 2019 07:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=53drGG/4V0NylixgL3iQIcLKYE+QBnEUf/GWyCKPtTs=; b=jr5dUEfWqZWGuVQP0ushn49uADQ6CKq9GI2D2Ot3F9/RlzXrS33s2rucjwq2CAW0oe Y54HSOc1rJ3vM5FHErklLh7EOHQ+JUuk0RUZYOyH60tHB2jX8kDOeZso7scia3d3lh77 YDfyiP2Q3VIt2oYjt+tGHZ3GgHh+fg9h7wIDqmVaQ14MR+FA2imjtu/tHbJCm+rFnWJD zEQ909duDpSoMFF8xm3pzM338N+kmrxtF0JMsfzRkCjJwmwmbQ9zXAE+B3utm5+/nQFJ JMw7y4hfSCw4mF/O+hSL7BbBB6UWKgF6zexfbhy1kmwTSD38Kr9eKF1bg11AbkqOnjyR AYrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=53drGG/4V0NylixgL3iQIcLKYE+QBnEUf/GWyCKPtTs=; b=lswx4Kifke909SVaKapjzPcU5KjrA6JAYU/znOSL8Tp+13wx2oEVXpxXpzFEGs9R2V BuEV4SPzOu0CPOi0hWf8sDJhGKfq85KEQemUgEWkpAcdKMcQWDIfZj4fy/3o2HvimWaq 7+SU00k55iQFgjMh11W1tzrnV/Z7zygFbsDxbM2FhRVRYEHKvfOB3RaZRPBLZPEzM5iW gu5kVFj3i8uGAEfABj99POWxQpbJ9ur4InDLwr5fmsbuqb1G63PqCLgPrwqhuSqQwF5x e6r9rkHcO5hMYeVGIjXHGm14fgaH8I0asibFN7v3cwQMXDMwlnG+M7/R8JHUfH7uafeG L37g== X-Gm-Message-State: APjAAAUicWZy2/KTbuxQTC7/Fmr0QwxUP0D3ss5rgQV1qLn9MI7wpN4h IVybm6pIHqnOpE36gf/qaruct2U8 X-Google-Smtp-Source: APXvYqxwQZEegqIDm4mke6EArHQ0ixXjxMtLERoY9pm7vA8ziCkRL8Kp+FEiWwI7iEGUarGcJTbyjQ== X-Received: by 2002:a1c:2705:: with SMTP id n5mr26671754wmn.68.1575903720906; Mon, 09 Dec 2019 07:02:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 12/18] accel: pass object to accel_init_machine Date: Mon, 9 Dec 2019 16:01:39 +0100 Message-Id: <1575903705-12925-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1575903705-12925-1-git-send-email-pbonzini@redhat.com> References: <1575903705-12925-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, elmarco@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We will have to set QOM properties before accel_init_machine, based on the options provided to -accel. Construct the object outside it so that it will be possible to iterate on properties between object_new_with_class and accel_init_machine. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- accel/accel.c | 4 ++-- include/sysemu/accel.h | 2 +- vl.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index dd38a46..1c5c3a6 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -46,9 +46,9 @@ AccelClass *accel_find(const char *opt_name) return ac; } =20 -int accel_init_machine(AccelClass *acc, MachineState *ms) +int accel_init_machine(AccelState *accel, MachineState *ms) { - AccelState *accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(acc))); + AccelClass *acc =3D ACCEL_GET_CLASS(accel); int ret; ms->accelerator =3D accel; *(acc->allowed) =3D true; diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 90b6213..22cac0f 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -67,7 +67,7 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; =20 AccelClass *accel_find(const char *opt_name); -int accel_init_machine(AccelClass *acc, MachineState *ms); +int accel_init_machine(AccelState *accel, MachineState *ms); =20 /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); diff --git a/vl.c b/vl.c index f18b26b..078ab7a 100644 --- a/vl.c +++ b/vl.c @@ -2841,6 +2841,7 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) bool *p_init_failed =3D opaque; const char *acc =3D qemu_opt_get(opts, "accel"); AccelClass *ac =3D accel_find(acc); + AccelState *accel; int ret; =20 if (!ac) { @@ -2848,7 +2849,8 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) error_report("invalid accelerator %s", acc); return 0; } - ret =3D accel_init_machine(ac, current_machine); + accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(ac))); + ret =3D accel_init_machine(accel, current_machine); if (ret < 0) { *p_init_failed =3D true; error_report("failed to initialize %s: %s", --=20 1.8.3.1