From patchwork Tue Oct 3 12:30:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A3D4E75455 for ; Tue, 3 Oct 2023 12:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232206AbjJCMam (ORCPT ); Tue, 3 Oct 2023 08:30:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232139AbjJCMak (ORCPT ); Tue, 3 Oct 2023 08:30:40 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6150691 for ; Tue, 3 Oct 2023 05:30:37 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-405361bba99so8312855e9.2 for ; Tue, 03 Oct 2023 05:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336236; x=1696941036; darn=vger.kernel.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=bqFGd5F05ZVpX+rAUXHuXXrGJSE30XMuMRRy/YP47Yw=; b=kvOZ0xXl8+JgavYiTqtKa6z0sluVA82jIlAHyZd9UzISjLtOgOsgzOPRxidlECdJfl ArL4pcaIH4cF3RPUCY7DdxqZ4UFi/Nu/7g1QYwRBqmz+ZoKae+ljJjVxuTuKwfEGoY2I 1Ao87d945CgxBlI6TtwhqypZFR7xeNKKSMKERcn4/l77F+VHuUOOMbIG6izq62iH3cEo tSsIBPIYtcg0XiiRKPjz9dq/JVC8J2DsFWKAYhowMyJupdgNs12Is8eMO5ah26ZYMLWl cLhMdJwHMTxbFzDDh9apMD3Exju/VIWMJPH1v8Tp6mF7xUPYtf9+lNi2qaNVa/5yvmTF lwxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336236; x=1696941036; 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=bqFGd5F05ZVpX+rAUXHuXXrGJSE30XMuMRRy/YP47Yw=; b=J7sgdp3PehkHtWtMWSyjxRs2IgZpCgrVqiIkzrEjx5mT8GjLhw7ib/PU0XOlb84l24 cZ0+EY6r9/w67iwlMvVdqX5dF6OWuEg3KFs07j8bgWAktMlkkfwwLOk8rdMcrcgfGjO2 q3zm9DnZMNdObIrLalePozuHm585Yqs+kpCJQTmG/aFdmdsaaTHyUUkeFIwODjeCWlCS 08EaKRLx8jw0LBID6gaLG3LOq44ImEfopJNng+ihXmVurJ5T0jLAejOH8n0z1Y98cItB iPl8CP2L1aSjauFgmq0EPpt9aq8NhgmI4WBSamjt8FkaIzv20m4olqytJVzQIgpnTeBJ jZBA== X-Gm-Message-State: AOJu0YzEHOerQ8sk2ThS6bNcE8uFcdpozTMhdLB8NTArMPdBmkjOchUy yRd6rza84y6kxqwBOZLQso3CPA== X-Google-Smtp-Source: AGHT+IHlCemvbL7m1K7IS5TqiHcr5lgRDPenb1BNclDOxWgfEhUSel/BooBOcvOiYSYcDzQ5Hhk7WQ== X-Received: by 2002:a05:600c:210a:b0:3fe:e7b2:c97f with SMTP id u10-20020a05600c210a00b003fee7b2c97fmr12100982wml.36.1696336235719; Tue, 03 Oct 2023 05:30:35 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b004065d72ab19sm9405951wms.0.2023.10.03.05.30.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:30:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 1/7] accel: Rename accel_cpu_realizefn() -> accel_cpu_realize() Date: Tue, 3 Oct 2023 14:30:19 +0200 Message-ID: <20231003123026.99229-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We use the '*fn' suffix for handlers, this is a public method. Drop the suffix. Signed-off-by: Philippe Mathieu-Daudé 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); /** - * 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); /** * 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) } } -bool accel_cpu_realizefn(CPUState *cpu, Error **errp) +bool accel_cpu_realize(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); 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 = CPU_GET_CLASS(cpu); - if (!accel_cpu_realizefn(cpu, errp)) { + if (!accel_cpu_realize(cpu, errp)) { return; } 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 */ From patchwork Tue Oct 3 12:30:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E62CE75455 for ; Tue, 3 Oct 2023 12:30:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbjJCMar (ORCPT ); Tue, 3 Oct 2023 08:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbjJCMaq (ORCPT ); Tue, 3 Oct 2023 08:30:46 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B43BB for ; Tue, 3 Oct 2023 05:30:43 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3247d69ed2cso884268f8f.0 for ; Tue, 03 Oct 2023 05:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336242; x=1696941042; darn=vger.kernel.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=kJP8U3eqs5eoWVLjFoE8nfmBFTz8cZ5KMaYYsencWoY=; b=RdM4euCpZoJxuXCy4QmYBZ4kBeInVH1VbH8MfV94kNchlUBetlLqmCLW00VTWkRJZA 2dGyRf+54xyA87jm67DjYX8tlAonMEOG3CKt9n2lu2vzr64RUTLySIECVp06vZmcXQUY 0dQTgUuvC4k4ufLfOAEqqv8+m+GtHIlUS1MDv076SKTUtbGHPmOuSvCrHqAMhtunMUpg NwGnmN0P5C0+dT79Dpc1OG06a0yY2yWp5kT1hmn3/z7n4uvj+Mvh3uEj73WUFv39XfNy 2n+Gnx3Xg2g1lR3ky4pCPnt0WXMu2AiYLed1COVmoc0UtDe31U1kz+vO160fbFMgQKsa iCgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336242; x=1696941042; 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=kJP8U3eqs5eoWVLjFoE8nfmBFTz8cZ5KMaYYsencWoY=; b=l0uUfOTHKCC3WRM/VOgsTzt6R7DNX6TMlX56USBEtzLTpaDXpgDO1HnQbpuDu32d7p LNSSITZ3ajC2EQCLWjzBgpOfpT9jkujW8Nd7TrSLQTx6C7qAdFUDd2Sr1Wpw++3dW1V0 /YQDmevwhpC7o+5liWkxTBnDouWRDFvtzn5WCIq1+NJOu7GBMzOUw4CL3V1uS1KZFJ5+ OhheTNjK0FucWkvA4g6c62hDsdYW+9RCim66b1J4nx6pBSGovd6LH97Z/czh5fQDPFQB hXso4sdP/MQpyuCwIMR5FZ+GNB/sFNH4G+6yXKqbw5f1s59AZuxd7rPE5kHg7wVBNKBa Sk4w== X-Gm-Message-State: AOJu0Yz55CY0yEnqYS1zFxl8VncBRX3Au71PNu2zbcy0ElSiFTzhAaX8 e1DL9H9Gh70AnnXHk5hAnrEycA== X-Google-Smtp-Source: AGHT+IGUR2wNUuIBOoLxXPGLs96PG6WE7nSADBCjWoauQJ7ZMRjhIbxyisKYzFjcYkRhDb1hGd57iQ== X-Received: by 2002:a5d:4a05:0:b0:317:7af4:5294 with SMTP id m5-20020a5d4a05000000b003177af45294mr12996108wrq.44.1696336241902; Tue, 03 Oct 2023 05:30:41 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id c15-20020a05600c0acf00b003fe29f6b61bsm1193158wmr.46.2023.10.03.05.30.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:30:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 2/7] accel: Rename AccelCPUClass::cpu_realizefn() -> cpu_target_realize() Date: Tue, 3 Oct 2023 14:30:20 +0200 Message-ID: <20231003123026.99229-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The AccelCPUClass::cpu_realizefn handler is meant for target specific code, rename it using '_target_' to emphasis it. Suggested-by: Claudio Fontana Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/accel-cpu.h | 2 +- accel/accel-common.c | 4 ++-- target/i386/hvf/hvf-cpu.c | 2 +- target/i386/kvm/kvm-cpu.c | 2 +- target/i386/tcg/tcg-cpu.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/hw/core/accel-cpu.h b/include/hw/core/accel-cpu.h index 5dbfd79955..24dad45ab9 100644 --- a/include/hw/core/accel-cpu.h +++ b/include/hw/core/accel-cpu.h @@ -32,7 +32,7 @@ typedef struct AccelCPUClass { void (*cpu_class_init)(CPUClass *cc); void (*cpu_instance_init)(CPUState *cpu); - bool (*cpu_realizefn)(CPUState *cpu, Error **errp); + bool (*cpu_target_realize)(CPUState *cpu, Error **errp); } AccelCPUClass; #endif /* ACCEL_CPU_H */ diff --git a/accel/accel-common.c b/accel/accel-common.c index b953855e8b..2e30b9d8f0 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -123,8 +123,8 @@ bool accel_cpu_realize(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->accel_cpu && cc->accel_cpu->cpu_realizefn) { - return cc->accel_cpu->cpu_realizefn(cpu, errp); + if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize) { + return cc->accel_cpu->cpu_target_realize(cpu, errp); } return true; } diff --git a/target/i386/hvf/hvf-cpu.c b/target/i386/hvf/hvf-cpu.c index 333db59898..bb0da3947a 100644 --- a/target/i386/hvf/hvf-cpu.c +++ b/target/i386/hvf/hvf-cpu.c @@ -77,7 +77,7 @@ static void hvf_cpu_accel_class_init(ObjectClass *oc, void *data) { AccelCPUClass *acc = ACCEL_CPU_CLASS(oc); - acc->cpu_realizefn = host_cpu_realizefn; + acc->cpu_target_realize = host_cpu_realizefn; acc->cpu_instance_init = hvf_cpu_instance_init; } diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 4474689f81..9a5e105e4e 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -190,7 +190,7 @@ static void kvm_cpu_accel_class_init(ObjectClass *oc, void *data) { AccelCPUClass *acc = ACCEL_CPU_CLASS(oc); - acc->cpu_realizefn = kvm_cpu_realizefn; + acc->cpu_target_realize = kvm_cpu_realizefn; acc->cpu_instance_init = kvm_cpu_instance_init; } static const TypeInfo kvm_cpu_accel_type_info = { diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index b942c306d6..5c3a508ddc 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -163,7 +163,7 @@ static void tcg_cpu_accel_class_init(ObjectClass *oc, void *data) AccelCPUClass *acc = ACCEL_CPU_CLASS(oc); #ifndef CONFIG_USER_ONLY - acc->cpu_realizefn = tcg_cpu_realizefn; + acc->cpu_target_realize = tcg_cpu_realizefn; #endif /* CONFIG_USER_ONLY */ acc->cpu_class_init = tcg_cpu_class_init; From patchwork Tue Oct 3 12:30:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE974E75452 for ; Tue, 3 Oct 2023 12:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232208AbjJCMay (ORCPT ); Tue, 3 Oct 2023 08:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232168AbjJCMax (ORCPT ); Tue, 3 Oct 2023 08:30:53 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9026DB0 for ; Tue, 3 Oct 2023 05:30:50 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-31427ddd3fbso914215f8f.0 for ; Tue, 03 Oct 2023 05:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336249; x=1696941049; darn=vger.kernel.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=+r9kD/biBFamNwbYJdkWZ0i3n7hbuMnWH0aEsGJ6SFw=; b=bRSHnVzSjOd3X3lo/EaxL1WUWZXX3RrMA4npO3XyOnijhD4zO/RBGk0710vgvInLEs 9OLm7lBlEqaVU6tsKrZ0egfoZbU7mkO8LWgLZP8zb07NY5WZMhs+k/Ucw6XlZLaHsrHJ JG2qceQ7IciqA0Mxzcv/pjpQvfMcGsQm9nyWKh9zRdl8XHfQ6pys6qsBBqasmMzRbFvg umKQMumJOCUKfUOLfvYZmJdtLgvAitDN8vbX+kGiQbOqBuTeFA3BWbdgBpnHwo31TQ8v QzaFx0MgZ+hQWElTrjfsYIVWapGEmQgAFgJgtK+eec6CJX9G5JvG24w9kVpwC7M52gvj XevA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336249; x=1696941049; 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=+r9kD/biBFamNwbYJdkWZ0i3n7hbuMnWH0aEsGJ6SFw=; b=NtUjxaa/kyhl+pLLQEJxRVFMhXKp3azB+KwazeIyu1/BxQhnUE1AW8Lx7QaX8DmLkH UWOgJLrgfxTu87LkBJg9U5P9II7V6/3pA37c5X+xHIIoxLyv/j3Qd/qvf+wdS5KJudrW FAYdwwpQTUGQDBnRi+emGnB/6sZoRhSv9zmVbYnQYLCH6pzwAJxcgRHYA+bK7Wl9J3A+ XOKP45LwKc26BxIXHRVk/QaJ1aUV0TFDjWn4LErAlpP6o0gDAcRPCJftysbAn174+rH9 27vyhSfOpzPUCpw7ie2X4rHFI6TZcnNxNxoEkKbgVOjphpqhXhrwE4W1B2/Rb21GonZP c2EA== X-Gm-Message-State: AOJu0YzjSOhCLZ2MttvJjnoV1Pcc/ZbjhhHivCSSMkipcakly/3M3FN6 Co5aOc9gfk9rqxUdyljvJMhWaA== X-Google-Smtp-Source: AGHT+IHhblTpAoVK9JdeAoL6m9m3WTb9pwO1Prdgl3RZZc3YHqkdykddbrQQUTc7erRRAv19P/MBzw== X-Received: by 2002:a05:6000:186c:b0:327:d08a:1fa2 with SMTP id d12-20020a056000186c00b00327d08a1fa2mr4920150wri.36.1696336248049; Tue, 03 Oct 2023 05:30:48 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id c16-20020a7bc850000000b0040303a9965asm9309683wml.40.2023.10.03.05.30.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:30:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 3/7] accel: Rename accel_cpu_realize() -> accel_cpu_common_realize() Date: Tue, 3 Oct 2023 14:30:21 +0200 Message-ID: <20231003123026.99229-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org accel_cpu_realize() is a generic function working with CPUs from any target. Rename it using '_common_' to emphasis it is not target specific. Suggested-by: Claudio Fontana Signed-off-by: Philippe Mathieu-Daudé --- 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 cb64a07b84..898159c001 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); /** - * accel_cpu_realize: + * accel_cpu_common_realize: * @cpu: The CPU that needs to call accel-specific cpu realization. * @errp: currently unused. */ -bool accel_cpu_realize(CPUState *cpu, Error **errp); +bool accel_cpu_common_realize(CPUState *cpu, Error **errp); /** * accel_supported_gdbstub_sstep_flags: diff --git a/accel/accel-common.c b/accel/accel-common.c index 2e30b9d8f0..53cf08a89a 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -119,7 +119,7 @@ void accel_cpu_instance_init(CPUState *cpu) } } -bool accel_cpu_realize(CPUState *cpu, Error **errp) +bool accel_cpu_common_realize(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); diff --git a/cpu.c b/cpu.c index 61c9760e62..1e2649a706 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 = CPU_GET_CLASS(cpu); - if (!accel_cpu_realize(cpu, errp)) { + if (!accel_cpu_common_realize(cpu, errp)) { return; } diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 9a5e105e4e..56c72f3c45 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_realize() + * -> accel_cpu_common_realize() * kvm_cpu_realizefn() -> host_cpu_realizefn() * -> check/update ucode_rev, phys_bits, mwait */ From patchwork Tue Oct 3 12:30:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407590 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5D68E75455 for ; Tue, 3 Oct 2023 12:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240034AbjJCMbD (ORCPT ); Tue, 3 Oct 2023 08:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbjJCMbA (ORCPT ); Tue, 3 Oct 2023 08:31:00 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9101483 for ; Tue, 3 Oct 2023 05:30:56 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40566f8a093so8171035e9.3 for ; Tue, 03 Oct 2023 05:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336255; x=1696941055; darn=vger.kernel.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=Gkc/bRL42O1meaWPMr7Z06ZuzQxfC9K3bpAdX8HhInA=; b=LNPZgVxfb7h0PfF0beabltDF/mGT8+8ZbEWHsWrZBcZ+kBkVDOFa+CLPO0DsfsmA2s PmO595WYeD/5hdBwCU2h8faa9psqyBXrFKcKiYtAxCOawzfdJ6PeJwqMhADDLJ3EcEsr mtIBa6XD9j4LWB7yDBRMbsiickfhd9o3dtbDF4WlW3pW7mXArU5gxdyxBFQmJQKMpEm5 6xO7QRDsiEy0fuvOmZX7k1O7Offnmpqsfmso7nXCyHawkynHagzFOlF6Xt6rVTBaUvvM S2oq+Q4YZjXXV/Bh80KQPSC4HhwBjiAo40eRnwUhlcofK2W3xx8CZqKoqb6IxJD4A5Cz Q01A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336255; x=1696941055; 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=Gkc/bRL42O1meaWPMr7Z06ZuzQxfC9K3bpAdX8HhInA=; b=AtPXgM26VqfxP3ROCzLbOR5hi/YZMWU2qrUSw1GGOqI+VjI+pDzfgqjZ/PY+Alzy9c bohowBHhIYZuwxsH6B+3XY+9NSY3mgXqydH42OplU2RxCib8ijamlLDroqCZmCrRLNG9 9s8/aUhOpzm046YswiOKsA9pbDKFbWo7NKbFovl2VWqEdHhcKOY48IkWa35oOoLIj1yM IeA0q09pH9GolkjDNesXiNCI+uAmA82V66ag7JtaGLc4aXMHFedI+5/zScDRttBMnys3 o40VmlbXtCUXZu0IGSl3XkSwbEVucnUpzPgmK+UqurP7PxVFaGK16SUY3d//t0S1vKvN 1png== X-Gm-Message-State: AOJu0Yz0lO2/QhlUPHluGcgRV8sOX5Oq43n+AQdZPcHL3W2Nu5flalHt Ygv/fx6Nzykg/Z12F8+0oPEvFA== X-Google-Smtp-Source: AGHT+IFfS3e/r6v/mLNthJlFSJF+tDApG8FXlkYKsMscRfx5bpnxKY35taTyrdcfQ0W4kLclXxkyLQ== X-Received: by 2002:a05:600c:22c8:b0:405:3955:5872 with SMTP id 8-20020a05600c22c800b0040539555872mr11340217wmg.18.1696336254935; Tue, 03 Oct 2023 05:30:54 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id a12-20020a5d570c000000b00327bf4f2f16sm1480932wrv.30.2023.10.03.05.30.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:30:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 4/7] accel: Introduce accel_cpu_common_unrealize() stub Date: Tue, 3 Oct 2023 14:30:22 +0200 Message-ID: <20231003123026.99229-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Prepare the stub for parity with accel_cpu_common_realize(). Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/accel.h | 6 ++++++ accel/accel-common.c | 4 ++++ cpu.c | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 898159c001..446153b145 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_common_realize(CPUState *cpu, Error **errp); +/** + * accel_cpu_common_unrealize: + * @cpu: The CPU that needs to call accel-specific cpu unrealization. + */ +void accel_cpu_common_unrealize(CPUState *cpu); + /** * accel_supported_gdbstub_sstep_flags: * diff --git a/accel/accel-common.c b/accel/accel-common.c index 53cf08a89a..e9548eac29 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -129,6 +129,10 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp) return true; } +void accel_cpu_common_unrealize(CPUState *cpu) +{ +} + int accel_supported_gdbstub_sstep_flags(void) { AccelState *accel = current_accel(); diff --git a/cpu.c b/cpu.c index 1e2649a706..2a1eff948b 100644 --- a/cpu.c +++ b/cpu.c @@ -187,8 +187,10 @@ 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. + * tcg_exec_unrealizefn and + * accel_cpu_common_unrealize, which may free fields using call_rcu. */ + accel_cpu_common_unrealize(cpu); if (tcg_enabled()) { tcg_exec_unrealizefn(cpu); } From patchwork Tue Oct 3 12:30:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCD11E75452 for ; Tue, 3 Oct 2023 12:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbjJCMbH (ORCPT ); Tue, 3 Oct 2023 08:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232413AbjJCMbG (ORCPT ); Tue, 3 Oct 2023 08:31:06 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C7C0CC for ; Tue, 3 Oct 2023 05:31:02 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-313e742a787so506293f8f.1 for ; Tue, 03 Oct 2023 05:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336261; x=1696941061; darn=vger.kernel.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=ng85okrWO1D5JYqF8LxeoCeovtEEGpWasH+P/ldXs4E=; b=bHZBbTKhvXVZMbaaeYuczzHYDSvRiREy19rj/vTZ3lqg2v5/iERp7KNw9v3GkKOynP g0Kzg2LaUHbXWiNQamERpVk1vqnD3YcLOzTTiWoJCoDBITS88CX+yOGVsUDqrdi55IMx SDddha3Ijt9IqnWciGZSi4XFRSzPauSDHVwnaK7vGH0eIVI1IIzOVGvAZexOIWRbClZI dwP7fk0SkOr6dsQtTVYlF0CH9VD3flfXRcS6QJZ4TnHzgn5ajYDVEPI9nO9RzCvOUaQh ENBJzKu1ToAu+1Is8RUZQUqDk6rWHV74WzIpywdPFsgAcNp+wiPBStuAWV6pxCZpkCFI /XXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336261; x=1696941061; 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=ng85okrWO1D5JYqF8LxeoCeovtEEGpWasH+P/ldXs4E=; b=wehKMvasDgHEdkWWs8fHWMSBhxRywuGCXmFpLefiOVXTKBZiGqfxtYggHz62O/mMsy rXGfL1TJ4po0ONL7Lrvx6SVty5fvPHk/GZ/M28Dw3d9ffuOUYNyWLObFoGBFthqaEGMh giyJJMBqgdat+B/b7jbkwZO/+YGaY8wDQWMHHIbFzDPG3IH2pgHvqVr7pRFxxtJ3Xupy Z9fihX8mR20mNg8YeslQkp0wT9ck3Lkcen8aaX+REV3D/6LoRUFJcJeFJqsW0MwkI+gD VI/AQySNB85Td2jgxtl7O+Ti5R+rM8F5SvpWPfSS3RYWc+KnvfDSlLAPWb1AKXiqkFrx dZ6Q== X-Gm-Message-State: AOJu0YxJIlW092Ok9060JitLVEy1fuRZ84CQgZn2RGH94t5VL58OOM5B u2P3W5XovK2RaQpBugrcbM4Mfg== X-Google-Smtp-Source: AGHT+IFSCFREFPhFrsIUBRMw43PEOKH8JJmdGJKi759Gs6/x70jH8Kzl+IQNSQVo5P0jTRrSQFmORg== X-Received: by 2002:adf:e806:0:b0:31f:fa48:2056 with SMTP id o6-20020adfe806000000b0031ffa482056mr1881057wrm.27.1696336261304; Tue, 03 Oct 2023 05:31:01 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id w6-20020a5d6806000000b003196b1bb528sm1483694wru.64.2023.10.03.05.30.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:31:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 5/7] accel: Declare AccelClass::cpu_common_[un]realize() handlers Date: Tue, 3 Oct 2023 14:30:23 +0200 Message-ID: <20231003123026.99229-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Currently accel_cpu_realize() only performs target-specific realization. Introduce the cpu_common_[un]realize fields in the base AccelClass to be able to perform target-agnostic [un]realization of vCPUs. Signed-off-by: Philippe Mathieu-Daudé --- 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 446153b145..972a849a2b 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 (*cpu_common_realize)(CPUState *cpu, Error **errp); + void (*cpu_common_unrealize)(CPUState *cpu); /* gdbstub related hooks */ int (*gdbstub_supported_sstep_flags)(void); diff --git a/accel/accel-common.c b/accel/accel-common.c index e9548eac29..11d74b4ad7 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_common_realize(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); - if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize) { - return cc->accel_cpu->cpu_target_realize(cpu, errp); + /* target specific realization */ + if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize + && !cc->accel_cpu->cpu_target_realize(cpu, errp)) { + return false; } + + /* generic realization */ + if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) { + return false; + } + return true; } void accel_cpu_common_unrealize(CPUState *cpu) { + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); + + /* generic unrealization */ + if (acc->cpu_common_unrealize) { + acc->cpu_common_unrealize(cpu); + } } int accel_supported_gdbstub_sstep_flags(void) From patchwork Tue Oct 3 12:30:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDB1CE75459 for ; Tue, 3 Oct 2023 12:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231127AbjJCMq2 (ORCPT ); Tue, 3 Oct 2023 08:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240058AbjJCMbO (ORCPT ); Tue, 3 Oct 2023 08:31:14 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA15ECE for ; Tue, 3 Oct 2023 05:31:09 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40666aa674fso8377175e9.0 for ; Tue, 03 Oct 2023 05:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336268; x=1696941068; darn=vger.kernel.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=0sreXSXDLh+LVLoU4Gk2cAKXN1sJ3KmjKke0mZhMO3w=; b=WJxD/L/lO3OUZEdKUZ7r2LTbXjn43HZrk96PibPFvedQMDktHgD+5zHwEUYrRuf+8Z Num7RYByAg1Gy5GVKTSEBoao/JK+UJfLNl9hWeaac24tkcb6OLILVN/Jq3TpjBuxzBHM lWCX8vSIr/TNms+eXeIAxb7B2xl51MW3qFWsRjgRYrYF7FGLbtRTTlpIUek8EW9JII6D mBfYBKbPRTgibID9NWBHap6qxuP8D9wqqsvnOtmqHaKiIO8UycJg7F/+xhJrc/SDJxZi mbZODn6oGUYJuBFtyVjQ7JOHRTgFHLjLLhrrthiVCA41H9HW17OPCAFNCJeKruSxvU30 Mq7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336268; x=1696941068; 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=0sreXSXDLh+LVLoU4Gk2cAKXN1sJ3KmjKke0mZhMO3w=; b=V8gZiVNNGFDRm3tD4crLvSDz3C0rNB13acvx7d/DPH6DATKnDyI6IkBiWbARno20sZ AEcbbyLItC443Wz4k4d1ym8kT3/Gqmh+wue2iDYgJruPK0x+5z7CT2cGXuUVNzS0M1Gu aGCBLthNjUHwwooCur6JTkuZtQVpWSXVtJX+1tSmO+qhLKfjWfepK7iumO298RvxVQkB IUSALXo8O4+7rB/14BiEFToEDDAVbx1rWS8NbIJMtGbM0x56DwIzYEHw5IDFBaWFOjCa yr4HfqNOXEy68rdkMaSwHwVHTWPXo8VfbqcIHJRANsv+vSmjugp++Bl6tymHc7OJlhIq vICg== X-Gm-Message-State: AOJu0Yynz0hduQEoy+QJHmOETjmk0odqOB0NWKInUuCYOHnPdbwLAcD7 4n2t+xs/IBTsmk4mz/e6gY2GPQ== X-Google-Smtp-Source: AGHT+IGgHu14QLaTZHtaqcvyhvqRXWFUFqZQ+U9E3BYtwlGQ+0F6OAn0a/YOhlJcZqr8dsHhPOyqvg== X-Received: by 2002:a7b:c858:0:b0:405:40c6:2ba4 with SMTP id c24-20020a7bc858000000b0040540c62ba4mr12060645wml.5.1696336268240; Tue, 03 Oct 2023 05:31:08 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id f20-20020a7bcd14000000b003fc16ee2864sm1183607wmj.48.2023.10.03.05.31.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:31:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 6/7] accel/tcg: Have tcg_exec_realizefn() return a boolean Date: Tue, 3 Oct 2023 14:30:24 +0200 Message-ID: <20231003123026.99229-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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é 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); /* 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); /** diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index c724e8b6f1..60f1986b85 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -1088,7 +1088,7 @@ int cpu_exec(CPUState *cpu) return ret; } -void tcg_exec_realizefn(CPUState *cpu, Error **errp) +bool tcg_exec_realizefn(CPUState *cpu, Error **errp) { static bool tcg_target_initialized; CPUClass *cc = 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; } /* undo the initializations in reverse order */ From patchwork Tue Oct 3 12:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13407613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E72D3E75458 for ; Tue, 3 Oct 2023 12:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231193AbjJCMq2 (ORCPT ); Tue, 3 Oct 2023 08:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbjJCMbT (ORCPT ); Tue, 3 Oct 2023 08:31:19 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA33EB4 for ; Tue, 3 Oct 2023 05:31:15 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32157c8e4c7so913896f8f.1 for ; Tue, 03 Oct 2023 05:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336274; x=1696941074; darn=vger.kernel.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=YCJq244pl4+8992N+SUfSZJnXy6q+2iGjPbprJxjpgU=; b=zW23qhqzX08s2zqM8IC3UiIo4DZiI8VBF7IR4Y5C3jUraRcCOx9JwrFZ4mJa2ShNpO dFu06Nr/PRPEeOvCAovsflillWkcqhiV21xu4K2uJdVDwd5bdyRYF1IAd388N43kN+ZS IZI5kCrH6TV858MtO+viJsMtv3mDllpc6HzqoFE3sRFcVv7QbnfRLzlhAt13ODvzI3Q8 IqjCM9epWEY5/XyEofwdYLO5RRIBqzsBd6dYxbAoybTFi4DoXw/JjLQUlRWpOQ/HhPgp SqpJwnsw68aNzGBr2D1Ryygs1vYp7aC16Dv/bfHrF9OWiihGavnlTtBBS6iLPUHr7ZgJ +3Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336274; x=1696941074; 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=YCJq244pl4+8992N+SUfSZJnXy6q+2iGjPbprJxjpgU=; b=WvqCfLSarzGXgG/GkbN2MQh9OtmkND7n7AkofZVdFU8OODbbgdamruS/qO3u47EzJ4 jfEwYs+g5deIuzuwic+YObJgsidcFUrzmx02b3Wnr+fMHyaNChCQSR243xCQdNHQMdAt LzknF3ypIsQQf9BikMshARAaWyv805xeLs7W+A187wpjsQoGA9KYrQqp/zqPQJeqTfFd lFomT+hGej13cKYyAf5BgcGVyNshvzxI7fLxlnBP5I5I4bXAlYAUJd22BAn4SDd6EmFk KxwIcEnJtA2mSoh2Gs9kggCIVvVGey9z0PrGWY7PlnPEd9HiGOoPWyG55etoUu/gNZsb DYtQ== X-Gm-Message-State: AOJu0Yy+qk46DDTr621KcXnHHlGyjLE7oFSMMfTzpLeLxe3r3Hz3zLpH Ss0rmoB9tZlEQw6Lo3bRf+MWPA== X-Google-Smtp-Source: AGHT+IFOv9460imGFEIgqRm0UvkQ7r6CSfyL7aih3gY5LLipvr1UBoZ7dIbBHQMj6JPYXiQgRbHH4Q== X-Received: by 2002:adf:e852:0:b0:323:2038:944 with SMTP id d18-20020adfe852000000b0032320380944mr13304917wrn.58.1696336274319; Tue, 03 Oct 2023 05:31:14 -0700 (PDT) Received: from m1x-phil.lan (176-131-222-246.abo.bbox.fr. [176.131.222.246]) by smtp.gmail.com with ESMTPSA id j14-20020a5d464e000000b0031f8a59dbeasm1478930wrs.62.2023.10.03.05.31.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 03 Oct 2023 05:31:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Yanan Wang , Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Claudio Fontana , Richard Henderson , Marcelo Tosatti , Roman Bolshakov , Fabiano Rosas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Cameron Esfahani Subject: [PATCH v2 7/7] accel/tcg: Restrict tcg_exec_[un]realizefn() to TCG Date: Tue, 3 Oct 2023 14:30:25 +0200 Message-ID: <20231003123026.99229-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003123026.99229-1-philmd@linaro.org> References: <20231003123026.99229-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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é Reviewed-by: Claudio Fontana --- accel/tcg/internal.h | 3 +++ include/exec/cpu-all.h | 2 -- accel/tcg/tcg-all.c | 2 ++ cpu.c | 9 --------- 4 files changed, 5 insertions(+), 11 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); +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); /* accel/tcg/cpu-exec.c */ int cpu_exec(CPUState *cpu); -bool tcg_exec_realizefn(CPUState *cpu, Error **errp); -void tcg_exec_unrealizefn(CPUState *cpu); /** * cpu_set_cpustate_pointers(cpu) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 03dfd67e9e..8ab873a5ab 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 = ACCEL_CLASS(oc); ac->name = "tcg"; ac->init_machine = tcg_init_machine; + ac->cpu_common_realize = tcg_exec_realizefn; + ac->cpu_common_unrealize = tcg_exec_unrealizefn; ac->allowed = &tcg_allowed; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags; diff --git a/cpu.c b/cpu.c index 2a1eff948b..658d179582 100644 --- a/cpu.c +++ b/cpu.c @@ -140,11 +140,6 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) return; } - /* 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); @@ -187,13 +182,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 and * accel_cpu_common_unrealize, which may free fields using call_rcu. */ accel_cpu_common_unrealize(cpu); - if (tcg_enabled()) { - tcg_exec_unrealizefn(cpu); - } } /*