From nobody Thu Nov 13 03:18:54 2025 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=1576515455; cv=none; d=zohomail.com; s=zohoarc; b=afNHiNUH+qOjhhAMvtK5l0RPPH1KcXBjZL4xgL6VJwvO3skesNMzqpRNHT7j0rXYypwjZAtdnfo5r+VcuNQvE2hRRI60u22hxHVlOa6TVKgXaIY1rqRm6ERApW2sAx7UwCaUZGly1xfKzlyVxavv0KmEBL0otMbTgdWuUnJWxl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576515455; h=Content-Type:Content-Transfer-Encoding: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=E/1LFy6wDBBmXAA/JB6bEc3nrfnmKGczXUnvs9Wqjvo=; b=AraypB36VbwD854RIMIYc/4zwctYXikEGMcTdl24ye+oqzUF36jY16BylJzOCpJt7MWWBXQg8GyNryBHlecXIkEQ8pC63Frv5t18vbqOv6dUjhVOo7VXRmPCVqkX2hVPge+fyJ7lOZ6qdw9yPRG/knRzh+uIqTDyAQObpLNjSSI= 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 1576515455389572.3418309728709; Mon, 16 Dec 2019 08:57:35 -0800 (PST) Received: from localhost ([::1]:56926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igtgb-0006N7-Or for importer@patchew.org; Mon, 16 Dec 2019 11:57:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56779) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igtFB-000560-EI for qemu-devel@nongnu.org; Mon, 16 Dec 2019 11:29:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igtFA-0007VH-91 for qemu-devel@nongnu.org; Mon, 16 Dec 2019 11:29:13 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:41945) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igtFA-0007TJ-22 for qemu-devel@nongnu.org; Mon, 16 Dec 2019 11:29:12 -0500 Received: by mail-wr1-x433.google.com with SMTP id c9so8037595wrw.8 for ; Mon, 16 Dec 2019 08:29:11 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id q68sm19962334wme.14.2019.12.16.08.29.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Dec 2019 08:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E/1LFy6wDBBmXAA/JB6bEc3nrfnmKGczXUnvs9Wqjvo=; b=Sl5Yi/S/arVByrSgAAyiJc7DBwNpLYpoK+646OGHYRnSUIZwRDryf584Ubn3gZCzKl zlP8FTGFurRvgfmCvC3GCuiFJuCLTCNES3rtpU2ruNsW7KD1IdfZqojp86ULLYhlTwM7 aCh/WVYg349ft5RdUbhRTyxejgtt6Fhgxm4N2XLSrbwQyMFV0c2A9CMB8TRiZ/AXluV0 8vgs8MXrIjSbrcF/2epq44Ez/iWcQlVqPjnnZGJARvHx//lIFOsfv8Ft9kZR1Mp8yB5K 3MqlLw98wR+fzT04LKbZ73+jY68mr9v94suRhM9f/kDg5DT5IlI40/mx/EV4Y5gYdXyH 88/A== 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:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=E/1LFy6wDBBmXAA/JB6bEc3nrfnmKGczXUnvs9Wqjvo=; b=erC19hdtx/WQjikFIHzpY6zZkmUgVdB6NVRaPnSGyB1aoTTmDWzSdLVjC+j9zgv81j EwDFp6h7SXgpQHBhdHWYHb1uYoEIs0vyxaoOAQAOW9GnSPITatqSCB+tvECTKMOW6FtK 8tk2QHilEQFpWjASSxmmkgaa9pj7BZkJac0SSzJ05B33eWLcdwutx7I1L1FdS4jQp4cM +ceSPTDE/lVGeKf2AihvaiIRPqYMi5Xc6IEFM/r7IGZfY8SonC2fQyvyDzCPQkJUGH3f ldmhwPV+4gvwiJscV7w7YS/tw6Bn2m4t0h/Tm1x97BOfKxWs41uRxcv5zy4MdDg45E4m lXQQ== X-Gm-Message-State: APjAAAXHHx6E/DXtOqEhjYSLXhRDSf6h7DON8pHzAnhkgC3Fy4PRFrJx lIzcFshjAQyDJzlMbcCSfOPd82Mn X-Google-Smtp-Source: APXvYqxWXAJRzppdYxpHkehM90HuzpIHn2yxPAAHF3WVnIIavosVsKoGE1gjjqq5Mp5u/XdeXdflwQ== X-Received: by 2002:a5d:4044:: with SMTP id w4mr31116335wrp.322.1576513750735; Mon, 16 Dec 2019 08:29:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 23/62] accel: pass object to accel_init_machine Date: Mon, 16 Dec 2019 17:28:07 +0100 Message-Id: <1576513726-53700-24-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576513726-53700-1-git-send-email-pbonzini@redhat.com> References: <1576513726-53700-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::433 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: , 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 dab6001..0378b90 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