From nobody Fri May 17 12:14:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1694804439; cv=none; d=zohomail.com; s=zohoarc; b=H38SNOXmPrUMktmF/mPeZmW5osdruYHRZrtBV8KWmIdIXVKhW/bV8pHGqwRIHb0NRgxa9DMGFW4Z9jbTy1wLzgkLxUO3HN07oOkzTA/22v661THEZ9qACD9js4aHXoylXpYuEZ00FMRkMVADHHBSESWjNq0Vb5vMKMUPgoR4VUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694804439; 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=Z/oPseRALW5l8mhzSg1GPJ0x0BU257Ov4LZVxdjT9FU=; b=ehM4LA/EOfzYZaBnzDYxf++U2keTyKFjpso6N+K6b5XvYEp9MgSi7Aowh5IUqpHvW4pwUvbq/eew290qISwsb1ziK7HMwTgjsIrYu6QEGp1NLF2nDoVXbN/n6owI6jr1mHrbzNsU5/N464/dFCNGsg5YNJz+zVrqdWfG+aVWscM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694804439404828.7419799674053; Fri, 15 Sep 2023 12:00:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3L-0005md-PT; Fri, 15 Sep 2023 15:00:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3C-0005lO-7F for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:30 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3A-0007U3-Ja for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:21 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-530a6cbbb47so664905a12.0 for ; Fri, 15 Sep 2023 12:00:20 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id i8-20020a0564020f0800b005309eb7544fsm890148eda.45.2023.09.15.12.00.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804418; x=1695409218; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z/oPseRALW5l8mhzSg1GPJ0x0BU257Ov4LZVxdjT9FU=; b=PslIBvQoGzp4w8abC8mUdbENUG26RaBahvMc7ig3/DG9Ju2riqB/5NZe413CVd6605 qYG3j55vdrxL+DDFBTACoIxqDnSDOe/QSmp+QfE77DIridIyZ/+ZWT6Wkot71Z+bIfCJ USAZWM2X06x4/4ID1uCrLvEk/B/lNiUi3hnGkkLOqJdOXDp3faDeZGIm7XyWz73JH7jx QR4n8/biRD+cdGw6a9TK8OBaOmEIUDqD1WpANLHT+95mCDRT7VsMj0ZqPcI8tgJdgEJ8 kreggnZWbg+w7vsDSQusfOd4hMiVl9UXSEL1JPXTqx6xZTBoHTrrCYVjfOKxlutzr3GT k9iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804418; x=1695409218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z/oPseRALW5l8mhzSg1GPJ0x0BU257Ov4LZVxdjT9FU=; b=iaHsTvpCa91G+vppLmG1K2A4kmEmFSOQTr3Xqqpv+BnW7XVFEnU0/vVtHg9oIQCNoE tJkGN2CLhaOPZE47Qy4HwR6ImyL3TXFtfJavZiRHj3SY9U8SkrjdjjKcZeBHPywT2Iqw T36DpliNcG4oLcZxna1vB0rHm1E35n0K4F7sko3IiSY8p4U1bhWEC+WGEOsHgl96r0I1 440RrT2XN7VisZ8HlRBNAj6k4mZzXVvWTCHvrEJvkq+oa3GDba3bg1U9YLujKVdp60hJ +jQKugC3vZKE+Y2qnav77E/U7/SILHhq2WAghCBxcdOSK4Pz4WDhLMOGrYb4SxssGTao OMdA== X-Gm-Message-State: AOJu0YwRLV/HnviB9LdAq5Ss274dSsNCJbA1h+QMS0Bd9Y8uQb08qh7q lhcZu7nPOoGFDwaomOrCgY9cpmDgWYRbyu8hzHI= X-Google-Smtp-Source: AGHT+IEbQAuDRA4Cf7TJdz/ag9Jfi6f6vhHvUllHoGBImu9i64hdmiTexC51Mb0Aga2sWMgRs5JN6w== X-Received: by 2002:aa7:caca:0:b0:523:387d:f5f1 with SMTP id l10-20020aa7caca000000b00523387df5f1mr2283637edt.24.1694804418561; Fri, 15 Sep 2023 12:00:18 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 1/5] accel: Rename accel_cpu_realizefn() -> accel_cpu_realize() Date: Fri, 15 Sep 2023 21:00:04 +0200 Message-ID: <20230915190009.68404-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1694804441332100003 We use the '*fn' suffix for handlers, this is a public method. Drop the suffix. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Claudio Fontana --- include/qemu/accel.h | 4 ++-- accel/accel-common.c | 2 +- cpu.c | 2 +- target/i386/kvm/kvm-cpu.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index e84db2e3e5..cb64a07b84 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -90,11 +90,11 @@ void accel_setup_post(MachineState *ms); void accel_cpu_instance_init(CPUState *cpu); =20 /** - * accel_cpu_realizefn: + * accel_cpu_realize: * @cpu: The CPU that needs to call accel-specific cpu realization. * @errp: currently unused. */ -bool accel_cpu_realizefn(CPUState *cpu, Error **errp); +bool accel_cpu_realize(CPUState *cpu, Error **errp); =20 /** * accel_supported_gdbstub_sstep_flags: diff --git a/accel/accel-common.c b/accel/accel-common.c index df72cc989a..b953855e8b 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -119,7 +119,7 @@ void accel_cpu_instance_init(CPUState *cpu) } } =20 -bool accel_cpu_realizefn(CPUState *cpu, Error **errp) +bool accel_cpu_realize(CPUState *cpu, Error **errp) { CPUClass *cc =3D CPU_GET_CLASS(cpu); =20 diff --git a/cpu.c b/cpu.c index 0769b0b153..61c9760e62 100644 --- a/cpu.c +++ b/cpu.c @@ -136,7 +136,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) /* cache the cpu class for the hotpath */ cpu->cc =3D CPU_GET_CLASS(cpu); =20 - if (!accel_cpu_realizefn(cpu, errp)) { + if (!accel_cpu_realize(cpu, errp)) { return; } =20 diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 7237378a7d..4474689f81 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -35,7 +35,7 @@ static bool kvm_cpu_realizefn(CPUState *cs, Error **errp) * x86_cpu_realize(): * -> x86_cpu_expand_features() * -> cpu_exec_realizefn(): - * -> accel_cpu_realizefn() + * -> accel_cpu_realize() * kvm_cpu_realizefn() -> host_cpu_realizefn() * -> check/update ucode_rev, phys_bits, mwait */ --=20 2.41.0 From nobody Fri May 17 12:14:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1694804465; cv=none; d=zohomail.com; s=zohoarc; b=UQZYnTmbhf6iFkFOt02COWpQr391S7K3+vrZmdUZjeUKSLozvcJ0gwSv6P3Ap2VVR74dA0p1gpMdC0Ba9O68P9kV79h3jICx86WI78aMorBn2hxc9Dp7bV27Dw9yJpS6BrtN/fNk45GX6ttI6Vdm+YFbKaund4rqbBjLCW6KUUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694804465; 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=yj/VmI3CWTgvZ6wzrxeZ+28cs5rrw6eKGcMTnrAf39k=; b=ZO2eOj3CKZg6wkjIDT1pmblUfDA9HdQ0PVo2NmGD4hPNcZsHwGXm2rqe13cbkuZzYkCLvdUyoW1lBozMqBbjLsqJpt+9PFBfY42YQGOVD+wzci56x5rKGNgcH3VM2rJ+aRAFd8WGqD3KYj6jf4erUB9dUPRWIIbpyqDAFwvAOvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694804465735726.0859097429366; Fri, 15 Sep 2023 12:01:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3P-0005n1-Sc; Fri, 15 Sep 2023 15:00:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3N-0005ml-Sa for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:33 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3H-0007YG-2O for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:33 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bfbbd55158so39985661fa.1 for ; Fri, 15 Sep 2023 12:00:26 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id lc25-20020a170906dff900b0099bd86f9248sm2776714ejc.63.2023.09.15.12.00.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804425; x=1695409225; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yj/VmI3CWTgvZ6wzrxeZ+28cs5rrw6eKGcMTnrAf39k=; b=xUHo19+vptao8kqSuuUWv/Q39lEv+7Htw0FWGKlTZGLOuXPgNKFgtFmJ5VhU89TVDD UgSBqWuFWP1vpwH2Ew0HcQ9jY/7o7FgP2p1F4ZOiA4U+N9RT3olu50mAmAT3gmHFsXVg Wa9OxnS9upj/4r+qNkS6Bw0yEKwweBRkH1hfsr0/22H54na1maPE3pO6SkdsiYiDqeB9 9ZrBrNZg6PsLUrKf2Bq96Bji1erzBmAbwXhrSPqF57ok13WKdVutV+Gkw3HYZKjWN1Bv IKa2nMPKz1xWS04Qo4DJ/txBgBa3AjEBC70y5+zyhBS3RZ0eXz7C1mmDs/4TPSYi5g3M PSog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804425; x=1695409225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yj/VmI3CWTgvZ6wzrxeZ+28cs5rrw6eKGcMTnrAf39k=; b=Q9bFmnSO6+YwlqxM5zP1qanSXm1dqGGmAoucw4t/u8zwFeP8jiNVeR6Zqkiog779Fd WAGW37OX5u3WCGJT9EMkwdHFqIRhH2iP7kiHLSjyksH4gfhZXlxgEhC6D7e+udYhxYQW dvouDytbFxaYyvATXVtVF1fXDvRAPookvMSJIUVv5hvIRLni5+RZ7aOExDRayXcXfiFB EBZpnLNqpw4Zr24WFi/j9bhIbUtmlOc2OyustNW90mJ94BtlemC5b4KJM6c7Vw3r8tdW ysDsty2UDBuToaj1/rMFLPC3LyXppY0TEe5z77U7GzdQqWhKZoDY8C+AI8ctSTRBgp+u fDgQ== X-Gm-Message-State: AOJu0Yzy4wsNP6qFJNo99Np73alNdsWaonJMlbRS+wLUhQLVCu9ExXSt 4j+DlJoTCVX2cggl7xZZ7202qMdEfOvAn2ta+Gs= X-Google-Smtp-Source: AGHT+IFqQLY3Tj7eqeOV4Qk/KF83QEwxNZjoYa3bqymzIJPp2j/TFg6tNe+VoWlEZLh1FUBo2pLong== X-Received: by 2002:a2e:3e0e:0:b0:2b6:bc30:7254 with SMTP id l14-20020a2e3e0e000000b002b6bc307254mr2206820lja.13.1694804424824; Fri, 15 Sep 2023 12:00:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 2/5] accel: Introduce accel_cpu_unrealize() stub Date: Fri, 15 Sep 2023 21:00:05 +0200 Message-ID: <20230915190009.68404-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1694804467414100007 Prepare the stub for parity with accel_cpu_realize(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/accel.h | 6 ++++++ accel/accel-common.c | 4 ++++ cpu.c | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index cb64a07b84..23254c6c9c 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -96,6 +96,12 @@ void accel_cpu_instance_init(CPUState *cpu); */ bool accel_cpu_realize(CPUState *cpu, Error **errp); =20 +/** + * accel_cpu_unrealizefn: + * @cpu: The CPU that needs to call accel-specific cpu unrealization. + */ +void accel_cpu_unrealize(CPUState *cpu); + /** * accel_supported_gdbstub_sstep_flags: * diff --git a/accel/accel-common.c b/accel/accel-common.c index b953855e8b..cc3a45e663 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -129,6 +129,10 @@ bool accel_cpu_realize(CPUState *cpu, Error **errp) return true; } =20 +void accel_cpu_unrealize(CPUState *cpu) +{ +} + int accel_supported_gdbstub_sstep_flags(void) { AccelState *accel =3D current_accel(); diff --git a/cpu.c b/cpu.c index 61c9760e62..b928bbed50 100644 --- a/cpu.c +++ b/cpu.c @@ -187,8 +187,9 @@ void cpu_exec_unrealizefn(CPUState *cpu) cpu_list_remove(cpu); /* * Now that the vCPU has been removed from the RCU list, we can call - * tcg_exec_unrealizefn, which may free fields using call_rcu. + * accel_cpu_unrealize, which may free fields using call_rcu. */ + accel_cpu_unrealize(cpu); if (tcg_enabled()) { tcg_exec_unrealizefn(cpu); } --=20 2.41.0 From nobody Fri May 17 12:14:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1694804466; cv=none; d=zohomail.com; s=zohoarc; b=XmPddcxctSwk1ITTWg2jlzh1uAb1Duot8pAPwXEELUI8237f/DG7RY2DWExaV19PKR065RjKh07KRTvMpro626NlWplgrThXEt2xA2kopSBAETWzBOVsclsmeSBCpDy0gZRIOLz+BlGxSCd1rzreurdALC/5LNkQLOOalGkbJ5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694804466; 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=WDSY0XDObgkxUL7brWiUxnx3rvK0ibvXtjHunMwb0Ko=; b=jO14DkfJavvkIyIxcL751Csdcjxz5QaybNjuJr5MHvy+XUM8t8PvflkMrES3bxir3vz4XGnSkS5O44aIxggwcBvj63L4i4P6or/tqwRgTrhfoZdvy0boQyBP4Z9jGjlaaUu9SvDEC4TBsoyjLCY/BzRYeCpbDlU5AjE3l1aQ86I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694804466372403.46816670559735; Fri, 15 Sep 2023 12:01:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3X-0005rO-51; Fri, 15 Sep 2023 15:00:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3R-0005nC-Kk for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:37 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3N-0007a6-To for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:36 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9a645e54806so302825666b.0 for ; Fri, 15 Sep 2023 12:00:33 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id lg13-20020a170906f88d00b009828e26e519sm2750934ejb.122.2023.09.15.12.00.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804432; x=1695409232; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDSY0XDObgkxUL7brWiUxnx3rvK0ibvXtjHunMwb0Ko=; b=TB8etVMhsM+4J4V2UVXxXPjrrXg4yXqt2v28ZznHuJ4DfAxUknz09wn7xBVbSn9Lv8 WtgdM3ggP1CYorgtkH+uhqACmZjf4oAYg6U+25ZA62gEmUOdyHdQJd5Qoi061m3Bw09C 3Ce9ISdU5sPdgjhiTpi6ZDAH1pLbmdQv6aEiKTOOkCWxyJx+a74sSh1Yw2b5a+nwl1wU sDSnUOlEulL9TavjUGZgETffQXPLxfxOr+drl1yGjQmz3PoUrD8AjybkOCmEF5U5NLsb m7QyFwNqEELCc/+skgLfQ/hrEdzWSuYOhLDfh4KBamA5RgC/1aXCqeCNWNIXYPUtSBPF c4ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804432; x=1695409232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WDSY0XDObgkxUL7brWiUxnx3rvK0ibvXtjHunMwb0Ko=; b=OMJlpA9dAfaMAhh5X+kzd7H/ZnGUX+k2S1OwZuUZ/clAWVF0TIXe+A2iM2UhQxPpHw 3M3SPOqwGTz26Itynd/3XYPbl19jL/0pEDhX0Vf409AiLuzsMgw1VAxEegIRcsohHDRC XnzIB1qVnLmnKFCwhPCv0PcM6kGUCxAlb5/DZ69ETA88ulcKXZq/IAxm6qJ7vyjaNO8R 9mL3Kwthx4ytjqzmEUY6ocmJma9DbojPyxANnBV7Z59HPhFepehdA3RhK13cfDJQC8sG 4u3AEmUQpuE1ElgZRXO6k5/KfC2kuJ1G86Mm5Zb6J8twYJtAjJje9FeDbfg6a7bJZFyF P/2Q== X-Gm-Message-State: AOJu0Yy4u7QdV8LpMBnM64reggdUmxlSURxp8kY5TpomejQpNf88DY7v X4od96BxPQS3nzPC8AZpNmq3e1y2QOtpNU2NrA8= X-Google-Smtp-Source: AGHT+IGEP/lvi8q3j5fpuCxcqNS187PK1L6ySZKuoqbnVy4D7JQSt+RyvvPIVtxvhOTk4XTqtPcS7g== X-Received: by 2002:a17:906:76cc:b0:9a1:ddb9:654f with SMTP id q12-20020a17090676cc00b009a1ddb9654fmr1957052ejn.55.1694804432309; Fri, 15 Sep 2023 12:00:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 3/5] accel: Declare AccelClass::[un]realize_cpu() handlers Date: Fri, 15 Sep 2023 21:00:06 +0200 Message-ID: <20230915190009.68404-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1694804467316100005 Currently accel_cpu_realize() only performs target-specific realization. Introduce the [un]realize_cpu fields in the base AccelClass to be able to perform target-agnostic [un]realization of vCPUs. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/accel.h | 2 ++ accel/accel-common.c | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 23254c6c9c..7bd9907d2a 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -43,6 +43,8 @@ typedef struct AccelClass { bool (*has_memory)(MachineState *ms, AddressSpace *as, hwaddr start_addr, hwaddr size); #endif + bool (*realize_cpu)(CPUState *cpu, Error **errp); + void (*unrealize_cpu)(CPUState *cpu); =20 /* gdbstub related hooks */ int (*gdbstub_supported_sstep_flags)(void); diff --git a/accel/accel-common.c b/accel/accel-common.c index cc3a45e663..6d427f2b9d 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -122,15 +122,32 @@ void accel_cpu_instance_init(CPUState *cpu) bool accel_cpu_realize(CPUState *cpu, Error **errp) { CPUClass *cc =3D CPU_GET_CLASS(cpu); + AccelState *accel =3D current_accel(); + AccelClass *acc =3D ACCEL_GET_CLASS(accel); =20 - if (cc->accel_cpu && cc->accel_cpu->cpu_realizefn) { - return cc->accel_cpu->cpu_realizefn(cpu, errp); + /* target specific realization */ + if (cc->accel_cpu && cc->accel_cpu->cpu_realizefn + && !cc->accel_cpu->cpu_realizefn(cpu, errp)) { + return false; } + + /* generic realization */ + if (acc->realize_cpu && !acc->realize_cpu(cpu, errp)) { + return false; + } + return true; } =20 void accel_cpu_unrealize(CPUState *cpu) { + AccelState *accel =3D current_accel(); + AccelClass *acc =3D ACCEL_GET_CLASS(accel); + + /* generic unrealization */ + if (acc->unrealize_cpu) { + acc->unrealize_cpu(cpu); + } } =20 int accel_supported_gdbstub_sstep_flags(void) --=20 2.41.0 From nobody Fri May 17 12:14:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1694804491; cv=none; d=zohomail.com; s=zohoarc; b=SO5fVF48tmMOfMFJkdd+0dPLwXZJHnWRl9dU0JJvSksU0l4nrWqILWz3Fh6pG/WHRPjYUxlS7RGPwfK6LYYFhSBv4rr+eT4OpaWEw0X+cvM98Z5bxcQ7hxrLIqV5zQYvWWA4choY5vgsyjyjCh4lP+m6W5nl2Gzbz4+mzAABGPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694804491; 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=YgOXTjMw7CegRZgzm9gZgaFqpfOBfIJY+75/jhEK298=; b=KVwi69eURSeW3nhw8fRSlXnjNKgFymdABPwngfiWAdpd4rUnobsF9PbIqgyJc6X/1KJ7QLGUNQJLIfKaucFIWZ1MFprULf8Xx2EMksybdglANP/8Ix737YZMHtWyfeN6f99696qeNPbvgvlaFzYJMqPHr6nwGRgh7wfVdGVDSJI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694804491470743.3245977810817; Fri, 15 Sep 2023 12:01:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3b-0006BB-OF; Fri, 15 Sep 2023 15:00:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3Z-0005vO-9e for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:45 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3V-0007aa-6r for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:44 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bce552508fso38491171fa.1 for ; Fri, 15 Sep 2023 12:00:40 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id l21-20020a1709061c5500b009ad89697c86sm2771684ejg.144.2023.09.15.12.00.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804439; x=1695409239; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YgOXTjMw7CegRZgzm9gZgaFqpfOBfIJY+75/jhEK298=; b=JWx2AxDeZ3UH9Iq0gpA8RIRY8gMaBrdwU6/Xx8/b8xL1/dwSfJ9eLvsMucVCx54fiA RJLSgkRWl3qODJ7vDHw/C+8dcZiGw836fwSXeJbHRk5pfu89OlrZ9HWW2n6kYlp7IEYd 3oNxN8Y2ygWTmZeJ2vU1TbjwR82gqZWwksmWwl+kFgIGhQLNQdBoq2c7k8nPKmakJXvo MXxE1zsgiS1PL1A/4RGVXbfGPOiUlHFMeBHlmOwxCwENh8BPEHYS90cnO6pvOpgrijf4 IqOJaalDnfM7BUGy1IAZ+hZH++eM+HcfDc+R5L3a9BLaMMywtuH4zscU98jlvZrLSOLV 5r+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804439; x=1695409239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YgOXTjMw7CegRZgzm9gZgaFqpfOBfIJY+75/jhEK298=; b=Ii/w0Ddlv3pWmz6m2Odb8KVF/+sVYJiWX/T9RCpVUE/wdohQGgS7/SZXAqgLByNkHy VUu7VPRYUzAqGW56kGjOqRpkqKKrNoMudFNMzVp6j+RAFP/1h13iAY+NVgdYo+EpqQjJ 0jLuZABsvUzBuAKyTXo1u/9Tdp6BnkjZWl36qqcuv7O155cLFyqBLy2DzctlBTVai+TG 437J3rDnfy9QmWZbO0P9QxgeKn6s4l8pUFOUiHbJTki3gLlvQK06kGPbIpqs8RijBobR DLZTgId945VSqwwA/4iQE6PhiB/SRU9BdKHwhJu4ljMFvRFYkY0oFowZ5J7SrXp2WHeX My4w== X-Gm-Message-State: AOJu0YwJjisL7fTmuB41CQme/cpCqLsyKYmODy7dQGfpGdckODR/M1Cj yi7rKRPzGp7tOXb0Ow4M4EFIjxbx3/JPuUK4EsU= X-Google-Smtp-Source: AGHT+IFb62BREUPfjWbOVNIJ5iUEG9onYwiuiWAr/WJWgO5E/Rw3dRu3NysvQrmCzHvFT+lowhetpw== X-Received: by 2002:a2e:b001:0:b0:2bc:b46b:686b with SMTP id y1-20020a2eb001000000b002bcb46b686bmr2330235ljk.34.1694804438711; Fri, 15 Sep 2023 12:00:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 4/5] accel/tcg: Have tcg_exec_realizefn() return a boolean Date: Fri, 15 Sep 2023 21:00:07 +0200 Message-ID: <20230915190009.68404-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1694804492855100001 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have tcg_exec_realizefn() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Claudio Fontana --- include/exec/cpu-all.h | 2 +- accel/tcg/cpu-exec.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index c2c62160c6..1e5c530ee1 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -422,7 +422,7 @@ void dump_exec_info(GString *buf); =20 /* accel/tcg/cpu-exec.c */ int cpu_exec(CPUState *cpu); -void tcg_exec_realizefn(CPUState *cpu, Error **errp); +bool tcg_exec_realizefn(CPUState *cpu, Error **errp); void tcg_exec_unrealizefn(CPUState *cpu); =20 /** diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e2c494e75e..fa97e9f191 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -1088,7 +1088,7 @@ int cpu_exec(CPUState *cpu) return ret; } =20 -void tcg_exec_realizefn(CPUState *cpu, Error **errp) +bool tcg_exec_realizefn(CPUState *cpu, Error **errp) { static bool tcg_target_initialized; CPUClass *cc =3D CPU_GET_CLASS(cpu); @@ -1104,6 +1104,8 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp) tcg_iommu_init_notifier_list(cpu); #endif /* !CONFIG_USER_ONLY */ /* qemu_plugin_vcpu_init_hook delayed until cpu_index assigned. */ + + return true; } =20 /* undo the initializations in reverse order */ --=20 2.41.0 From nobody Fri May 17 12:14:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1694804514; cv=none; d=zohomail.com; s=zohoarc; b=WmecuWI5HmkbPVpfH3Fw/a7LGiUoXtdu1N5gXrwP2docwALQ98t56g/3dR5DgDyJPsOMA74AkfobthQDrjXjaULTTDm9gmMrv/A3vUU0cwhS41R1WKogFzq4GPAJ9v6Y2roA89TqKGEgCGeEaqDjvI3siHIW04BjT6TUSdRdiMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694804514; 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=oOpx/VA/+gwdtEbnTetIr2FQsXveadRswnAsnH4GXos=; b=MTra4vD4OXB2gv4/Cqnly/xPfZqOi+kjg3/V5Obns78RCcsuS/UVGVTqnWfkz7GTMEZ7JThWMOCpvUkpYnARGHRIjIv7oS8uvzvdmW0G6Z3lXjDeV5KFytjVEKg0KX+nr4cLs9HrPANHFRm75svy0vUL9jKTIPWjGdfg+RgVxFA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694804514970668.5683821981123; Fri, 15 Sep 2023 12:01:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3r-0006Ua-EY; Fri, 15 Sep 2023 15:01:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3j-0006L0-72 for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:56 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3d-0007cx-RJ for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:52 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9aa0495f9cfso775997966b.1 for ; Fri, 15 Sep 2023 12:00:49 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id mf13-20020a170906cb8d00b0099caf5bed64sm2735321ejb.57.2023.09.15.12.00.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804448; x=1695409248; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oOpx/VA/+gwdtEbnTetIr2FQsXveadRswnAsnH4GXos=; b=T5WE8C4vlwgDcx4Ksk2YfPYahMDkzzf8R18h0z3+Y9S0iZsEOin7R9QRGlogT4hKI9 MlkhNKsMCoM358ZWvUEOwVYQXa4oXQQgaGvAKebkmv4YDxIA1gL7WNzmhdpc115g4bVE S4Bn9ksR5OsX7HAZLkhq/WFfWjW7tz/1nsPtKd23sXEV/+B2H5bfd+zRIqwcEkDfVwC2 oRk60ibugg8HFH8du0ZBsu8AH/vGbXdMp/V73K7u118uLdFZGFR0sgO+c/A140pzS6Jq hfBTcbIrgaWCFX6lU4t7pwMN05CiyKbXL3WrSqR2jLzD/r7kkjRc2ZTQp7BcjspAcidV PJ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804448; x=1695409248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oOpx/VA/+gwdtEbnTetIr2FQsXveadRswnAsnH4GXos=; b=qbkuZpEn/G5+D4robAls3HyqfV9BS42krPA8UVblwpIY1KMB9SX3pDD9ErXeoQEkgt HzM1BnbcQ9RALqFWvIN+ccFkH1K7Q+y1pkIpGYatQERQBrrL5AiL7jCvrUtGDNOL5xer 2cQ1NuAYnWEApOXlXQAIARS92HjhlizVZ+h4JfjCTdEjj740GjAsdIRtt29nAbDMdkT4 E0qME5XrbMps2vzxr3wf/80Bu2mc4LtxtLwKYGqBw4opsVoIVEtLmBgTTA395II0EBY0 CeswzXwkuYubWzZfHseo36Jfsuz05HWdOorEFn/xC9cPVLTBNuoUwFsYmuD3HggJUAuo NGEg== X-Gm-Message-State: AOJu0YxruCXpUy08ey8r+YsLWPZ/JW0ix3VbGzLkZC+zFmMPP5+2KZP6 C9nqqKeBOxII4CABb7aMzmMyWjKXIlUuzS8rz/I= X-Google-Smtp-Source: AGHT+IELleuQSkuMS3U2vjtSOoyli3O0jtH4oH1By3hb7PvHE0MO+UI88qPm19yIOTSyq5wf6F29XQ== X-Received: by 2002:a17:907:3f91:b0:9a5:b247:3ab with SMTP id hr17-20020a1709073f9100b009a5b24703abmr9362665ejc.19.1694804445231; Fri, 15 Sep 2023 12:00:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 5/5] accel/tcg: Restrict tcg_exec_[un]realizefn() to TCG Date: Fri, 15 Sep 2023 21:00:08 +0200 Message-ID: <20230915190009.68404-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=philmd@linaro.org; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1694804516384100003 We don't need to expose these TCG-specific methods to the whole code base. Register them as AccelClass handlers, they will be called by the generic accel_cpu_[un]realize() methods. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Claudio Fontana --- accel/tcg/internal.h | 3 +++ include/exec/cpu-all.h | 2 -- accel/tcg/tcg-all.c | 2 ++ cpu.c | 8 -------- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index e8cbbde581..57ab397df1 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -80,6 +80,9 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, = uintptr_t pc); void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); =20 +bool tcg_exec_realizefn(CPUState *cpu, Error **errp); +void tcg_exec_unrealizefn(CPUState *cpu); + /* Return the current PC from CPU, which may be cached in TB. */ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) { diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 1e5c530ee1..230525ebf7 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -422,8 +422,6 @@ void dump_exec_info(GString *buf); =20 /* accel/tcg/cpu-exec.c */ int cpu_exec(CPUState *cpu); -bool tcg_exec_realizefn(CPUState *cpu, Error **errp); -void tcg_exec_unrealizefn(CPUState *cpu); =20 /** * cpu_set_cpustate_pointers(cpu) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 03dfd67e9e..6942a9766a 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -227,6 +227,8 @@ static void tcg_accel_class_init(ObjectClass *oc, void = *data) AccelClass *ac =3D ACCEL_CLASS(oc); ac->name =3D "tcg"; ac->init_machine =3D tcg_init_machine; + ac->realize_cpu =3D tcg_exec_realizefn; + ac->unrealize_cpu =3D tcg_exec_unrealizefn; ac->allowed =3D &tcg_allowed; ac->gdbstub_supported_sstep_flags =3D tcg_gdbstub_supported_sstep_flag= s; =20 diff --git a/cpu.c b/cpu.c index b928bbed50..1a8e730bed 100644 --- a/cpu.c +++ b/cpu.c @@ -140,11 +140,6 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) return; } =20 - /* NB: errp parameter is unused currently */ - if (tcg_enabled()) { - tcg_exec_realizefn(cpu, errp); - } - /* Wait until cpu initialization complete before exposing cpu. */ cpu_list_add(cpu); =20 @@ -190,9 +185,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) * accel_cpu_unrealize, which may free fields using call_rcu. */ accel_cpu_unrealize(cpu); - if (tcg_enabled()) { - tcg_exec_unrealizefn(cpu); - } } =20 /* --=20 2.41.0