From patchwork Sun Apr 28 22:14:37 2024 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: 792930 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423638wrh; Sun, 28 Apr 2024 15:16:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX2S9+NvywO1Yi4hyEsDpzQk+kraH+ViB+lAArCDA3l/JvjjKUS+gJhteUKPjM8VHW5dukCjflAqECwEJ+4Xn8h X-Google-Smtp-Source: AGHT+IHRd09FnNDV8+7FPippIbpUICqDBhKBs/+XE+tf3Wcl3zIlV+UPrBHuaFLnBADSUqwLWnUk X-Received: by 2002:a05:6808:2a86:b0:3c8:4227:4fb4 with SMTP id fc6-20020a0568082a8600b003c842274fb4mr8868533oib.15.1714342599997; Sun, 28 Apr 2024 15:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342599; cv=none; d=google.com; s=arc-20160816; b=aUVUiNXg8ZDT/vnmAzLOxtET4+lfgzXL1w++IhZ6kdJs0ID6oXGO9du5/mdPTaRZWA m2MFn3K6MnVLrObSlA492EmxRKDmllE4NJYcXkVS9IItSSSomJYpQcrJd5VK3IVHwnbB QEugECX7TX5yslImUfAtlPYQv/ad86LiqULODPAdkJ9TYoTTuVMzCQklUEHmUzT4AnXp ljGNuIh3Hs4UVM2EWnr0PlqwUbu2P/MqInsJ0EOCspHSvOSZWR5nrCdwfGaS0I+3S31m 2Qwo7VKGmYSSPfN8Tci71uNL/BPFDeTK/QuTLH8AQfDdY1lqWfT8KnwOOXIIL/Sr48b/ sy/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6pl64tl5YQ1s8CCdAHkFJJC3DjPcNFHytDHp/sUwDIA=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=eERZQWorhlhQYFNzEOGYyrxLfMapw6kuBUBkbc5C9ANJsRv8eBkh6tYpGDrPM09JP5 oWX0yrKy0OHrHvXdy16bU04KbnoekzXM6y0INq8llc76kB3fO3l+qJGxsG9du8S1/mwY yHiKi/SaOgNf70FONq1QCpJUS4JRwh/iW76SHiLudHq1puKhZFN3wIC5VjwugQeRUQa3 K3Eb4S+jQaLQJF2UkZP/GWGtx0hNMuJtN3LnbUPPaofy5ykseyANfHaux+QZyslSVOCR HrPIEBOmEYO4vEJ0KIrUyaB+UHn0C5aD1OzA09AjQ/4xZTSOW2w6jD/SdULaTFI1TiVA WOqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qlLWQJnR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f12-20020ae9ea0c000000b0078d6b577edfsi24058863qkg.728.2024.04.28.15.16.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qlLWQJnR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CoT-00077d-7O; Sun, 28 Apr 2024 18:16:01 -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 1s1CoO-00072R-26 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:57 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoM-0005eD-9T for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:55 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a58e787130fso204938966b.0 for ; Sun, 28 Apr 2024 15:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342552; x=1714947352; 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=6pl64tl5YQ1s8CCdAHkFJJC3DjPcNFHytDHp/sUwDIA=; b=qlLWQJnReeS3YoeLxcTzzR9/4lIi/DsT/X+cjlHOgJqRHTftSDXM4zRkZiXPgg44Zj BeYLfZyotro96WdQFUeSIffRC72cdYzO3u2CkR0ZzOJQFJRzSbtTtbE+VYQGlyfUvJUY bun6VLkH+OCy0xHV1FffE9m00ouXHhr5O527XZLPmJC5GEMp/+wWqCUenZtpHLarfd3S lrv0H7V0GJ3w4fu26uzOPLOLTZSPzNBAYurehLskolgeTWYZ6dONd9lBgKMrh2OgF0F9 +68WBpbGIgtT26rIMerABRLwTSmjVRchV60HyIByzPc5aQ+cFXvdd1o5RL4N2bwCK+2J ki/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342552; x=1714947352; 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=6pl64tl5YQ1s8CCdAHkFJJC3DjPcNFHytDHp/sUwDIA=; b=Pma81riL/7NV8pl2lkL7wiQdUgR99cQ4NKZC3atQHMMaJPCLev1m+rn9muEJmf+y9g TKPk45fXtNub5asDQ0degOa3ErfEXXIwNwG6z/6HwbWIbx4x7geztQv51k6+r3NpfArU JgqbYFfG5FYrvR+PpCy4sOnNu73kVKrQdLnzOu3UrUUpWl7BRasFnHfcCPEk2RPIO7AK JOygNXLkwQ86L9qY05239Gu4+EySbrAjFttAc89YksHj+Fxf/YIiOrWkUJXxypMmoBOc 8ki/cI91p8KtJSXpTQbIk6S9DvDVYR1zkBbYnMoW6OlOVHoDue5vz6+LJyWVFyPvQtrj 11kw== X-Gm-Message-State: AOJu0YwUFBg40Ue3vWVZDYpcHPRQMR1hJRnKl7kRNlcRgVF9xME7Jwsb yJYGPZiPJA/p+3IKyjGjipRnyLl64qtk8CD4jUOwlKpNTLvY5vXwk3R7l4vkvydawQuYWpfpHBi t X-Received: by 2002:a17:906:a216:b0:a58:bf24:edc7 with SMTP id r22-20020a170906a21600b00a58bf24edc7mr7487607ejy.20.1714342552492; Sun, 28 Apr 2024 15:15:52 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id bi10-20020a170906a24a00b00a54c12de34dsm13120778ejb.188.2024.04.28.15.15.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 11/24] accel/tcg: Allocate per-vCPU accel state in create_vcpu_thread() Date: Mon, 29 Apr 2024 00:14:37 +0200 Message-ID: <20240428221450.26460-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 7 +++++++ accel/tcg/tcg-accel-ops-mttcg.c | 2 ++ accel/tcg/tcg-accel-ops-rr.c | 2 ++ 3 files changed, 11 insertions(+) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index e407d914df..d0dd1bbff8 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -8,6 +8,13 @@ #include "hw/core/cpu.h" +/** + * AccelCPUState: + */ +struct AccelCPUState { + /* Empty */ +}; + #ifdef CONFIG_USER_ONLY static inline TaskState *get_task_state(const CPUState *cs) { diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index c552b45b8e..767b321a0d 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -35,6 +35,7 @@ #include "tcg/startup.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h" +#include "accel/tcg/vcpu-state.h" typedef struct MttcgForceRcuNotifier { Notifier notifier; @@ -135,6 +136,7 @@ void mttcg_start_vcpu_thread(CPUState *cpu) char thread_name[VCPU_THREAD_NAME_SIZE]; g_assert(tcg_enabled()); + cpu->accel = g_new0(AccelCPUState, 1); tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1); cpu->thread = g_new0(QemuThread, 1); diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 894e73e52c..419b94f786 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -36,6 +36,7 @@ #include "tcg-accel-ops.h" #include "tcg-accel-ops-rr.h" #include "tcg-accel-ops-icount.h" +#include "accel/tcg/vcpu-state.h" /* Kick all RR vCPUs */ void rr_kick_vcpu_thread(CPUState *unused) @@ -314,6 +315,7 @@ void rr_start_vcpu_thread(CPUState *cpu) static QemuThread *single_tcg_cpu_thread; g_assert(tcg_enabled()); + cpu->accel = g_new0(AccelCPUState, 1); tcg_cpu_init_cflags(cpu, false); if (!single_tcg_cpu_thread) {