From patchwork Tue May 28 14:59:47 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: 799501 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp281098wrz; Tue, 28 May 2024 08:01:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWbC4TxE/NSAGH9XcEXKAE2f37FZjD4aKbzAJmkWS0vLCUQK0cPbZcryD6WRjgxyh377URrS2iIEKkZVuAAYJXC X-Google-Smtp-Source: AGHT+IGikuj7UfmsXkVFWDTVOVQkZNqs4aoS1V0z3Wynp2QsVjlrlR42DHpLEfA7giMZK4q58hQc X-Received: by 2002:a05:622a:48b:b0:43a:89c1:6b76 with SMTP id d75a77b69052e-43fb0f02263mr123350401cf.65.1716908517445; Tue, 28 May 2024 08:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908517; cv=none; d=google.com; s=arc-20160816; b=Jz29CHmzA044Lg3LXW3QossNyV0+3OXxSnb32tJ9GWBUkF7jLOPzKmatCoo8w17665 v/dUCIlqguRV4Z18crdTynYBgY76czIownDl3vZowOQqYl9HFaAeZTEd9w58PtjBac3k s2wJJqIJf14uF5ZpVP506IEaNiANzXYccdZxLikW9wGBPOfODnrgacQBpHT7I0dSM8uL EgweWa/q928g5Wz1rIsKIE2UQ481erFW4A/SR8NbEWNTcz/STg5iKQbqdP3n4n6t66Dx Kk1r2K8LIsAiELpcNejIksGHe599VHt5aTBQ4pOu4+B1lffm1MCjymuDfmYgLMwdzpmI pgCA== 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=i1Z65Olw7qFihD1LZKiHkfm7mBVYbNrglt/V1Ou6QFA=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=FmnWtj2eqlZ5KXdDsO2SFTwJmSJU8tuNcuZ4BUpjgKUcPT871ptFdXDeB4NO1hf4Uy UkztIDkkgqnLF705eSE/8cp767HdGV5/ZoiVp0t8pyV7uvx7SZ/gyChcT0zX8J48PQmo kleM+CjhF7fVwJlzZs3J09yiJjj2T8VLzYYZ+k2sNBoHrsGZBxLKzhmZiszs3NNnzTcj VzbuEqSjutnAJLLpZJEyynC1u0T4EWvcQ3ptoBMUNXbxWAacLPuKhNEprw93IU01Exqm AJaW8nmMtr/wpe3PwhejhUbOOAfcKYW+DgjUGNv3fO1NJHw8+NHnoKLoHjyNXAprZrY1 cHlw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SJRmQ+mT; 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 d75a77b69052e-43fba1fab3bsi90183631cf.230.2024.05.28.08.01.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:01:57 -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=SJRmQ+mT; 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 1sByJ5-0000aO-0P; Tue, 28 May 2024 11:00:07 -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 1sByJ3-0000YU-8I for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:05 -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 1sByJ1-0006sY-L4 for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:04 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a6265d48ec3so104009166b.0 for ; Tue, 28 May 2024 08:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908401; x=1717513201; 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=i1Z65Olw7qFihD1LZKiHkfm7mBVYbNrglt/V1Ou6QFA=; b=SJRmQ+mTXs7A0O5UB6trSJBXXBAnbKWFoORq3vpjCQcIIh/xHhIRN+L5QIaHWKYfII JQLexskqh3CfiimM4eNQS8lkIf2drAVxn39pMzn7sXqNLQMBFFz+eGwSxZ2pMMfT+SN5 RRaKyCZ3Wpi3PpIVP4J9E4A7ylAh9nT9QxYzEZXzOIvs9Ioa8I/+OFj7KTh0gODVi7Wt F7X3l0+786N7O+DzSi6vXKwdMIRoo92VoEHynyJ5F0eXWulIpkbQ5vyxtehWL1FDFoJe MFX/N/G0FGl6XZZoEV7udMczsJM9lQ1a6fXcq2thREPPTePaircyXzKM58xY6cLqwJU9 4jJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908401; x=1717513201; 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=i1Z65Olw7qFihD1LZKiHkfm7mBVYbNrglt/V1Ou6QFA=; b=svESAyfyOv3fZNuUiVLNuMwieFDtfF8zbb18ZZQrtoyiekUkU8Lrha8tRrkfVYM2ys MXbUeQjNt9tVcS3wVTLPH5OusJZPSIqzbIdn/gfAPpd/OadfHKfq+Eg4lHxSJmd6482l txFfg6FvdgWs2+AUxFkdAtjVLA2HOk0D+Vi13UxEgDT4dpFM2twZKcS5T7XxgMvAqplq uTUbIUTpwuIXZIGmYMT+YzFcjXnqPc/t+2zQKwBpftbX/DUN5CJoBBgGpfAftLOkPz/F Br3tTbpWk5rlM+iwYcT8quPxTkwmXNjE8ipwEhsbY845AAD77U5T75ooxZ5I6/nJLAWo hvTA== X-Gm-Message-State: AOJu0Yx0th/dB9mTVp+nWjryVAU53dii/7Q7qnWY3vDUNXKwgjQf+/Bp gKLSXcmevaejO9IYyiYwv7voFaIv2LqE5iapxDSoPQojN3uhpXwhmKlnipKsSsmBOlTLPiv5PgP e X-Received: by 2002:a17:906:57d9:b0:a5c:ec66:226d with SMTP id a640c23a62f3a-a62641b1bb4mr854593066b.17.1716908401301; Tue, 28 May 2024 08:00:01 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8e714sm620053766b.186.2024.05.28.08.00.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 1/6] system/runstate: Remove unused 'qemu/plugin.h' header Date: Tue, 28 May 2024 16:59:47 +0200 Message-ID: <20240528145953.65398-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 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 system/runstate.c never required "qemu/plugin.h". Signed-off-by: Philippe Mathieu-Daudé --- system/runstate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/system/runstate.c b/system/runstate.c index cb4905a40f..ec32e270cb 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -45,7 +45,6 @@ #include "qemu/job.h" #include "qemu/log.h" #include "qemu/module.h" -#include "qemu/plugin.h" #include "qemu/sockets.h" #include "qemu/timer.h" #include "qemu/thread.h" From patchwork Tue May 28 14:59:48 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: 799499 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp280934wrz; Tue, 28 May 2024 08:01:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVmxr+6sbNP8Frv+6rSO8quqWMa7j5jWuKCvcpcWBaRxBl54cSF1JtJXgbkAnzejuyBALgCsc/TDvvkNJpDe2rn X-Google-Smtp-Source: AGHT+IHM/X262hvtfFX835jhfjIZmbCefuB1VTkLy7cFFqY9wdoJCCODV6wSVLNc7+5uek42yLMg X-Received: by 2002:a05:6214:3ca0:b0:6a3:2d64:3c55 with SMTP id 6a1803df08f44-6ab9cfdf80fmr180066136d6.14.1716908504759; Tue, 28 May 2024 08:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908504; cv=none; d=google.com; s=arc-20160816; b=OkdZ9V3XMWWl+pFi/vX+AKAHHsnrKspoUY3Gqc7A0hSeC+R7D4tyoT9UYpI26qRO9V Ql73gKvgNKiPBSuwm8bKyEwX7bmgKshDpxJEBJPpAOivoYdgAPl8pcu/Y3snAHBhQS+S fz5yPfM1zvEzEJ5eDMjpwkc67D5NPRuo0VjShQp6HOx3bI8yN4N1z4QaYM8uz/H0p1Vs fEfUYTpMlxboQJ31+BG5s026zZ7Zgb5yUyalY0LV+IhLfgEfvggaFQ6DV+52EZ05XMp3 FElgJOayW6RxAZeaw3eTWA+IgwfwOC1V7ey7/4IaWvEOtq+qDdHtOMJJj1VccgkIpj+O UXGg== 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=MXSsU3bC3/S4MPVHakO32DgE7Q0Emp+SarB3ZR8O4Ck=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=aThG7buxDiHQ+ykbaVqmc0LfB9j9J7Bk983QCgqMcltrfpQgS7AQ5z04MhBzjbOdUe G143yY2LaqoA5XCUsYvmX/592qcWZp+uPbgNYDNQsggu7rHcCGdUDRatvdrQoJjYtYlQ m3QtXqjOXK5btwOUOvTUEngH8UvffhsnABGMitm461xry8oyTh2e57q7WxUmWq79SSNG V4zbREkIP43B7Yhu3ctUIpui7N+88SUYBMctOlpi0xwVFcWyuPYztRGda9qQq99fev9e Ml+0JNqCQkNqPT+7jFTolY00D9V67jtr78nXnRy2JtrF7LlJpuONaKsPYfLhDOaNoJ4d YZeQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W7XO3NKO; 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 d75a77b69052e-43fb17b9a0bsi115630181cf.117.2024.05.28.08.01.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:01:44 -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=W7XO3NKO; 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 1sByJA-0000dK-Pv; Tue, 28 May 2024 11:00:12 -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 1sByJ8-0000bB-C2 for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:10 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJ6-00074i-IZ for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:10 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-57857e0f45cso1129090a12.1 for ; Tue, 28 May 2024 08:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908407; x=1717513207; 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=MXSsU3bC3/S4MPVHakO32DgE7Q0Emp+SarB3ZR8O4Ck=; b=W7XO3NKOwshww8oCZVx82B5CBgBryccqf9NKChMeaVwX+pwrhbRBIKRoVOy1Foettt rIN8KSU22lzCaOLkCV2dBvvJp6M61eZWVYoGnBWfmONWR0d6Ghui2VoldyrJddKxm+K+ vGmfImPjdika6a+Ml8EwotWm32t/UKiMo9qstbSevtpdlCu3cMCsLUfAQyNy1VQHLJGE bhH5j2zwpifUQ3cg7UhKKb3vcIEe+kl/sv0vFBT9WLBgCxZXWwsCFzPuw9QPyvrjuPcs hgCXL13Y9wt9P1KxtdFfkzabGhPK/NaQ98PGpqdJLQaU0xx20pJhUJfmECAIdRpXjlbx AMVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908407; x=1717513207; 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=MXSsU3bC3/S4MPVHakO32DgE7Q0Emp+SarB3ZR8O4Ck=; b=YFdnQH1WqLqZxX9mmeENGNmkucjIl/dIOHs3SbU572wDmjbq5i17o0RR7ezbRY3JMR xo+9ngcgrm/o14b1WiNF0LtEo+7gKa7CM3bMupUj23T8FaaRrZomxIpwiF28CJiOqVMI ExPx0+mpZk99iNwiABZ5B/9wk7jdOOoWiK5//o17hdltRP0mMISFBdSgcDFIAALKpORK HlyBuOno+p/iQGKtbNoGN2JqxjtYvCGE8LpNcsCyWYHnbYNQ65GYofico2YXZId1/DOE spUO6XHgRx3JeQTEcd8/B+Rv08oyqPx84JE5zSR/IfRTvSlhaNu3qHoApg40CKQfe6wz nouw== X-Gm-Message-State: AOJu0YwqOhfkv2h8tHjR5vdRClSuFCR6AxL/JQYJabbMt3EZ4709X0ka PtmWZEK6afkmb1hrLdqvGM6oChmuQdKgKw86SfJHthhKENsNZW5Z2so6/Snja7VpHAL6hu/eXYU X X-Received: by 2002:a50:c04d:0:b0:578:572d:8d1e with SMTP id 4fb4d7f45d1cf-578572d8e3amr7798101a12.6.1716908406774; Tue, 28 May 2024 08:00:06 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-579db5406a7sm2242454a12.63.2024.05.28.08.00.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 2/6] accel/tcg: Move common declarations to 'internal-common.h' Date: Tue, 28 May 2024 16:59:48 +0200 Message-ID: <20240528145953.65398-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.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, T_SCC_BODY_TEXT_LINE=-0.01 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 'internal-target.h' is meant for target-specific declarations, while 'internal-common.h' for common ones. Move common declarations to it. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 15 +++++++++++++++ accel/tcg/internal-target.h | 14 -------------- accel/tcg/tcg-all.c | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index cff43d221b..a8fc3db774 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -15,6 +15,8 @@ extern int64_t max_delay; extern int64_t max_advance; +extern bool one_insn_per_tb; + /* * Return true if CS is not running in parallel with other cpus, either * because there are no other cpus or we are within an exclusive context. @@ -41,4 +43,17 @@ static inline bool cpu_plugin_mem_cbs_enabled(const CPUState *cpu) #endif } +TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc, + uint64_t cs_base, uint32_t flags, + int cflags); +void page_init(void); +void tb_htable_init(void); +void tb_reset_jump(TranslationBlock *tb, int n); +TranslationBlock *tb_link_page(TranslationBlock *tb); +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); + #endif diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index 4e36cf858e..fe109724c6 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -69,19 +69,7 @@ void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); #endif /* CONFIG_SOFTMMU */ -TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc, - uint64_t cs_base, uint32_t flags, - int cflags); -void page_init(void); -void tb_htable_init(void); -void tb_reset_jump(TranslationBlock *tb, int n); -TranslationBlock *tb_link_page(TranslationBlock *tb); 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) @@ -93,8 +81,6 @@ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) } } -extern bool one_insn_per_tb; - /** * tcg_req_mo: * @type: TCGBar diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c6619f5b98..2090907dba 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -38,7 +38,7 @@ #if !defined(CONFIG_USER_ONLY) #include "hw/boards.h" #endif -#include "internal-target.h" +#include "internal-common.h" struct TCGState { AccelState parent_obj; From patchwork Tue May 28 14:59:49 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: 799502 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp281193wrz; Tue, 28 May 2024 08:02:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU6kUnaz6qhQIbiNs9mHxOQ79oAlJ4HeHqz2Yry3gSS0PW30YDaAmTpvdVOAyZ3s9foZultGNhvs21i1bBQxotg X-Google-Smtp-Source: AGHT+IG4wFNE4EODytL/p5EqG0yk7bvlT4+6t5Kzi5GZ3BEPJwGRAGYl5XGurtCtyYSyxukQnxzw X-Received: by 2002:a05:6214:3d0b:b0:6a0:56ad:7d08 with SMTP id 6a1803df08f44-6abcd0dea1bmr164455806d6.43.1716908524190; Tue, 28 May 2024 08:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908524; cv=none; d=google.com; s=arc-20160816; b=T1YjM26cuFUffaXah1CCKAITc0ZZ67mSiw3VTWdfGWaBGvUhvW6+o7bfU8XYcTnIuj CzxwkhDaAVunmsTQ9N5C1nuCgIHHh3a64KHmFBCNlPuo8q0JjflBpl2xd7Rcph8UisRg 16WyRQ+TYklQ3uA1CBxHFSxsjw+8CtmeSR4I/Vq7uVNZDL7mVprBtNJ7sQbdjWVABtar TJXGA80+JabkcSg6lchFfMRIHH871btKKfjqavtSP1nRGJKLwFBYcOimyolqs3zabpli a5n+EDhoknOQFKMtITSOiTEkaR317mF1mJTr0z5CMZDJzJDpLDZQEQ1LHNy8nL+Cjvz0 vk2g== 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=wQcbwizGTPGLe0I7sDsQyBs7g4DJMYLbmLP09XmJRR0=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=JmEZAEzPsTDu+tKl2dmAb/EDQs/EUv2boNm5tUAsS1f3LISPC62mA6seKXJL4T0gqJ SPlhgV8mVxWggc8ln5bWZPqlivR7gycLP7gviVQgnW5PUz8OG4vTGsJGV/yfK3obqDO8 XDYVj10U2t2vN0zTtEQM+8MHvHUX0z3pFn8ClLMvBmF6lYvWPaXPNTVWHom2F+Sn/HTJ ZqGWDi1I8psSHoHhyQX++O9rZkP8J+86otJCrRJjY+zvZogNKAx48wPeoRkJlxyM69Em lkMQsogAbcbkrjrK5WzIn4JYkuXvvYi4/DVT+JnYRoMwNV2p0TGUFIxgA1jt58/ueoUR ao+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Czex2/t8"; 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 6a1803df08f44-6ac06f4eeafsi105311746d6.8.2024.05.28.08.02.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:02:04 -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="Czex2/t8"; 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 1sByJL-0000eZ-1M; Tue, 28 May 2024 11:00:23 -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 1sByJE-0000e8-NK for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:16 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJC-000759-Mk for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:16 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52388d9ca98so1604696e87.0 for ; Tue, 28 May 2024 08:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908412; x=1717513212; 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=wQcbwizGTPGLe0I7sDsQyBs7g4DJMYLbmLP09XmJRR0=; b=Czex2/t8O7se/uXPr0z5QwXQFhYB8DeINFLrTEKcaT90yNsZm7idmEurYh4WEqAJpX jMfr1l0uNx8mKEI4UYmQjreeuAjJTgDzxlLJH/MPw4ATrPoFybMn3ap2lHAUaB1CsCz0 DktJDTOIwSiZQVsBDzD/IXfXJZQvuGjQHS3HKJSP0laHELWCIo4LAsyjfH7CLmOhUErk DFSyHL+R5vXxwLUFjtRfQZnIzrXvnZREHjO7RIqX3JFcjASXqROksFYEKZD+mA9OlE4A 8QZPPxwLEi/NsehS+MD6U0N19fmmqNFGQCFaOqIJwGRKrnzqJdoGYENFfwrE58+BAzxq ru9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908412; x=1717513212; 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=wQcbwizGTPGLe0I7sDsQyBs7g4DJMYLbmLP09XmJRR0=; b=Zrov4+S00WfkrnPhn+UJTRsOiFC6JDAsb2eEwQqvVAoczT0O2GQq45SQ18Zw0ySkFD ejwSjX7meGAkKalVbSKNV50PyjCoMReqTfi7nrcaQt8fBV8d24v6iaOzjcU2LiVqyemF yljwaW68gWD+JqOzwnsn18xXgdTbxg/o5GbPQC8tRTtbC0jErGYtiDfms0uCsD6WBmuf ounJOVWzu7bHQ2Y1ajV0FLcOr3DV+shsQcoWN7q808MWDuEq7GNBGaioaq3dmkUy/8gc Uj6p4npXbFHYUSv2mgzjRKe//udPuBKOV+1GhaYNYARn8a2wTxIhPN6cX8q5AibXUPvd qO1Q== X-Gm-Message-State: AOJu0Yz9akHzZfZyGrFgdh6jD8WPlHtZDic0elHdaV3FGtYWvxAEKrU4 AcAZG+6tTIIZCR/b02b77hXEJ5vVfT1VmzAAqTAO3ep8INnZHF8Igk18/sXHDTU2yTAik6AOPfs A X-Received: by 2002:ac2:46e2:0:b0:51f:4d57:6812 with SMTP id 2adb3069b0e04-5296594cfc7mr9627468e87.19.1716908412379; Tue, 28 May 2024 08:00:12 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cd9fed2sm622256666b.187.2024.05.28.08.00.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 3/6] accel: Clarify accel_cpu_common_[un]realize() use unassigned vCPU Date: Tue, 28 May 2024 16:59:49 +0200 Message-ID: <20240528145953.65398-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=philmd@linaro.org; helo=mail-lf1-x134.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In preparation of introducing [un]realize handlers for when vCPUs are assigned, rename current handlers using the '_unassigned' suffix. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 4 ++-- include/qemu/accel.h | 17 +++++++++++------ accel/accel-target.c | 11 ++++++----- accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/tcg-all.c | 4 ++-- cpu-target.c | 4 ++-- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index a8fc3db774..ec2c6317b7 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -53,7 +53,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb); 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); +bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp); +void tcg_exec_unrealize_unassigned(CPUState *cpu); #endif diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 972a849a2b..dd18c41dc0 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -43,8 +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); + bool (*cpu_common_realize_unassigned)(CPUState *cpu, Error **errp); + void (*cpu_common_unrealize_unassigned)(CPUState *cpu); /* gdbstub related hooks */ int (*gdbstub_supported_sstep_flags)(void); @@ -92,17 +92,22 @@ void accel_setup_post(MachineState *ms); void accel_cpu_instance_init(CPUState *cpu); /** - * accel_cpu_common_realize: + * accel_cpu_common_realize_unassigned: * @cpu: The CPU that needs to call accel-specific cpu realization. * @errp: currently unused. + * + * The @cpu index is not yet assigned. */ -bool accel_cpu_common_realize(CPUState *cpu, Error **errp); +bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp); /** - * accel_cpu_common_unrealize: + * accel_cpu_common_unrealize_unassigned: * @cpu: The CPU that needs to call accel-specific cpu unrealization. + * + * The @cpu index is no more assigned, @cpu has been removed from the global + * #cpus_queue. */ -void accel_cpu_common_unrealize(CPUState *cpu); +void accel_cpu_common_unrealize_unassigned(CPUState *cpu); /** * accel_supported_gdbstub_sstep_flags: diff --git a/accel/accel-target.c b/accel/accel-target.c index 08626c00c2..e0a79c0fce 100644 --- a/accel/accel-target.c +++ b/accel/accel-target.c @@ -119,7 +119,7 @@ void accel_cpu_instance_init(CPUState *cpu) } } -bool accel_cpu_common_realize(CPUState *cpu, Error **errp) +bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); AccelState *accel = current_accel(); @@ -132,21 +132,22 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp) } /* generic realization */ - if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) { + if (acc->cpu_common_realize_unassigned + && !acc->cpu_common_realize_unassigned(cpu, errp)) { return false; } return true; } -void accel_cpu_common_unrealize(CPUState *cpu) +void accel_cpu_common_unrealize_unassigned(CPUState *cpu) { AccelState *accel = current_accel(); AccelClass *acc = ACCEL_GET_CLASS(accel); /* generic unrealization */ - if (acc->cpu_common_unrealize) { - acc->cpu_common_unrealize(cpu); + if (acc->cpu_common_unrealize_unassigned) { + acc->cpu_common_unrealize_unassigned(cpu); } } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 2972f75b96..08769cf91e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -1074,7 +1074,7 @@ int cpu_exec(CPUState *cpu) return ret; } -bool tcg_exec_realizefn(CPUState *cpu, Error **errp) +bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp) { static bool tcg_target_initialized; @@ -1094,7 +1094,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp) } /* undo the initializations in reverse order */ -void tcg_exec_unrealizefn(CPUState *cpu) +void tcg_exec_unrealize_unassigned(CPUState *cpu) { #ifndef CONFIG_USER_ONLY tcg_iommu_free_notifier_list(cpu); diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 2090907dba..c08a6acc21 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -227,8 +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->cpu_common_realize_unassigned = tcg_exec_realize_unassigned; + ac->cpu_common_unrealize_unassigned = tcg_exec_unrealize_unassigned; ac->allowed = &tcg_allowed; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags; diff --git a/cpu-target.c b/cpu-target.c index 5af120e8aa..9ab5a28cb5 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -136,7 +136,7 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp) /* cache the cpu class for the hotpath */ cpu->cc = CPU_GET_CLASS(cpu); - if (!accel_cpu_common_realize(cpu, errp)) { + if (!accel_cpu_common_realize_unassigned(cpu, errp)) { return false; } @@ -176,7 +176,7 @@ void cpu_exec_unrealizefn(CPUState *cpu) * Now that the vCPU has been removed from the RCU list, we can call * accel_cpu_common_unrealize, which may free fields using call_rcu. */ - accel_cpu_common_unrealize(cpu); + accel_cpu_common_unrealize_unassigned(cpu); } /* From patchwork Tue May 28 14:59:50 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: 799497 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp280742wrz; Tue, 28 May 2024 08:01:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUD9j7B26ZTBzVMnXMvCsAr2ct5Z4/UX59PZ/rTyfpXTuozvC2/SxfDMndZHXskpMp740dpeLfmQ1SAP+1uHcks X-Google-Smtp-Source: AGHT+IFQhKrTTNpmNJjkFRUOhJ2Lzgah0+yGZY4Klnjsv0qffRZ038GGFP+Fs2d8hCnPTBQAGyTR X-Received: by 2002:a05:620a:220a:b0:792:92e5:4f1 with SMTP id af79cd13be357-794ab0822e9mr1026469985a.24.1716908487157; Tue, 28 May 2024 08:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908487; cv=none; d=google.com; s=arc-20160816; b=AxTiyPtx7gtMQu0oudof8JchIBbsFVTcwevRjExsO1SA5dvp8Gtr5PMmrcx0Hem9x8 a8FL29XtVTFLapMwrrmbQ9jNUk5W8fG7s7M41yf2h42beUCamjHm+Rz0c0TcPLNKhRKQ f4u571tM3A7ocAFZYu4FDuwO8xb7WqYjgSfRtWvWObOVRPemjl3gjPUaEL2G+B0idxVS Upwyft3tM2BMEPihEZyS5oUmoRPf4edwDKsCXEavQbp5DOIazPu89Btdz+PMOP+kbevj UnoDuLqSOJTdro2Y+iC2ki96ToOSqxLyC4C+CmrG8JiF473C4418bTsX87nllVnwJuq6 EZsw== 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=iWdKhFl+Kfc9kH+fAvMfcLuu2N/gX3v3c37S9xvC8gk=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=hWPyYGefAlrtxo/UYgVdVaRvkmTACG4I/P/yzW5q4aKSSiECB92nnVBJ2Q3RyuKjSQ LJzWYBG3WQK3U2rr1WGlT0Dqq6GdS8PBi+EFkOStUaY2z4elKqyhmo0glN9cKHKjBB4w FAk3Mliw+GptrceSOBCurjGT+IhjWIDG1uT1cQMRrkyHi/uAJ4ndtP4QGTMuhBna9ZYt HKCYW26og/DjHwzcT+7jzFe3lxLC2BI6JAM+DqhhcOYWvP+ATxnFvXQ1WdHEICF+J2cR StfyGGyOeYLvrfwa+eU2vb7ibMgBGCLBmkOTN/TUQOc0GNzvfRJNpmJhnXCgzvN3XJwt hxXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AANWsm1+; 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 af79cd13be357-794c415d300si467591385a.440.2024.05.28.08.01.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:01:27 -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=AANWsm1+; 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 1sByJQ-0000hv-6s; Tue, 28 May 2024 11:00:29 -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 1sByJM-0000gM-DF for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:24 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJJ-000761-OP for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:24 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-57883b25b50so1110572a12.2 for ; Tue, 28 May 2024 08:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908418; x=1717513218; 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=iWdKhFl+Kfc9kH+fAvMfcLuu2N/gX3v3c37S9xvC8gk=; b=AANWsm1+yRse2UmaT4asy9nzleVIFfbw0PmSIUfPAFLgDwrSgmFlHRRBlM3YeG3J7r qXQr/15yxUdgY9hJa3MJOAyeCDYSwywRIqLTQOFeckaAJlW7MhcVa4CyNGyy7aPhN2ho SljMbompI8WEiLHueycMXdBF+Fi/asPJNPSYE7DCq41cHmNgev5SPXhQ59J519mODvAf j65uOwjlZ1UcM2DMUKx09Hr5PAcufNM6GwK7eZxMrpC3ZsvbKvLei+X9fAkqp8MYrro6 P0hHO6yRtOHC13zrwDe/0W01tCG6XRTX41FaDT8hnsHwPHmGxwk9y65IQHk4LRFpoznz HM1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908418; x=1717513218; 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=iWdKhFl+Kfc9kH+fAvMfcLuu2N/gX3v3c37S9xvC8gk=; b=TZdDQ6ZGkO7QMNxAnW762wkZ6hLYLdf4YuJUOTM0Yosul0bbEBVwTOj4/4U0rHgTFq sm/8Epqd/lZXvnbThmSeGlHb0X5/P5XlvsWwL40OhocfviDbrypR/nzfGnQt5jMYkbJF 8PNrpyFhfk/itD+n/2eOioXVbivyj327/0QxCikp5CPN7jrkeKjTr7++pHFdiBAaGOTC PrnE4q4i1g51F6ireMURYvk1IB0vuzAv+bQyfcVHGbXsDFbVXqUo1xLpZjw8JtqQDqjN zwCK2eGJbj+Az2ETX+4P8NUQl+vrBL/Ti2F171xI8rEkH7nkQe3aT9+tQCAw960Ozp99 9YlA== X-Gm-Message-State: AOJu0YwlsBi3YC74PMYBHR3bIoBBPUls9GnQGJ1ioh2n6pK0V/W9/4Fl RerBB8NTo0ebwo78FgZ8FZG7z7ZQZZQ0+mdZB++Ba1/OAintG4vYHEh+lTCBYvwhQtSU+sWRHnC H X-Received: by 2002:a50:870d:0:b0:573:5c1c:4f5e with SMTP id 4fb4d7f45d1cf-578517a4197mr7201696a12.0.1716908417963; Tue, 28 May 2024 08:00:17 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5798d861b05sm4772771a12.25.2024.05.28.08.00.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 4/6] accel: Introduce accel_cpu_common_[un]realize_assigned() handlers Date: Tue, 28 May 2024 16:59:50 +0200 Message-ID: <20240528145953.65398-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=philmd@linaro.org; helo=mail-ed1-x533.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Introduce handlers called while the vCPU has an assigned index and is still in the global %cpus_queue. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/accel.h | 20 ++++++++++++++++++++ accel/accel-target.c | 23 +++++++++++++++++++++++ cpu-target.c | 6 ++++++ 3 files changed, 49 insertions(+) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index dd18c41dc0..f828d32204 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -44,6 +44,8 @@ typedef struct AccelClass { hwaddr start_addr, hwaddr size); #endif bool (*cpu_common_realize_unassigned)(CPUState *cpu, Error **errp); + bool (*cpu_common_realize_assigned)(CPUState *cpu, Error **errp); + void (*cpu_common_unrealize_assigned)(CPUState *cpu); void (*cpu_common_unrealize_unassigned)(CPUState *cpu); /* gdbstub related hooks */ @@ -100,6 +102,24 @@ void accel_cpu_instance_init(CPUState *cpu); */ bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp); +/** + * accel_cpu_common_realize_assigned: + * @cpu: The CPU that needs to call accel-specific cpu realization. + * @errp: currently unused. + * + * The @cpu index is assigned, @cpu is added to the global #cpus_queue. + */ +bool accel_cpu_common_realize_assigned(CPUState *cpu, Error **errp); + +/** + * accel_cpu_common_unrealize_unassigned: + * @cpu: The CPU that needs to call accel-specific cpu unrealization. + * + * The @cpu index is still assigned, @cpu is still part of the global + * #cpus_queue. + */ +void accel_cpu_common_unrealize_assigned(CPUState *cpu); + /** * accel_cpu_common_unrealize_unassigned: * @cpu: The CPU that needs to call accel-specific cpu unrealization. diff --git a/accel/accel-target.c b/accel/accel-target.c index e0a79c0fce..b2ba219a44 100644 --- a/accel/accel-target.c +++ b/accel/accel-target.c @@ -140,6 +140,29 @@ bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp) return true; } +bool accel_cpu_common_realize_assigned(CPUState *cpu, Error **errp) +{ + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); + + if (acc->cpu_common_realize_assigned + && !acc->cpu_common_realize_assigned(cpu, errp)) { + return false; + } + + return true; +} + +void accel_cpu_common_unrealize_assigned(CPUState *cpu) +{ + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); + + if (acc->cpu_common_unrealize_assigned) { + acc->cpu_common_unrealize_assigned(cpu); + } +} + void accel_cpu_common_unrealize_unassigned(CPUState *cpu) { AccelState *accel = current_accel(); diff --git a/cpu-target.c b/cpu-target.c index 9ab5a28cb5..de903f30cb 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -143,6 +143,10 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp) /* Wait until cpu initialization complete before exposing cpu. */ cpu_list_add(cpu); + if (!accel_cpu_common_realize_assigned(cpu, errp)) { + return false; + } + #ifdef CONFIG_USER_ONLY assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || qdev_get_vmsd(DEVICE(cpu))->unmigratable); @@ -171,6 +175,8 @@ void cpu_exec_unrealizefn(CPUState *cpu) } #endif + accel_cpu_common_unrealize_assigned(cpu); + cpu_list_remove(cpu); /* * Now that the vCPU has been removed from the RCU list, we can call From patchwork Tue May 28 14:59:51 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: 799500 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp280960wrz; Tue, 28 May 2024 08:01:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXObttrYUUEDsAMgCZN4kPK68cKjl3WG/0zIS52wEpFKNjC2IWRlvfNp7hVqMnEUcLyZ9cBIIJT0AcaXKOh7edD X-Google-Smtp-Source: AGHT+IHPLXAPZKRM2fw7oEF76S2xmhQKO1wap0TSYkFSwJPDavHQlzM3dBySLa9wNYt8zL0n4zpa X-Received: by 2002:a05:6358:7a97:b0:17b:f721:4565 with SMTP id e5c5f4694b2df-197e50f4f37mr1549383855d.9.1716908506583; Tue, 28 May 2024 08:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908506; cv=none; d=google.com; s=arc-20160816; b=rfg1Dwahkxyo+Guk1x6SsQLs+yNtK6MTf3n1/I6NyWv7yivVrKm/Hodu7njPx+65t8 QTeHnz02OpIcWqwNey1+hiWb+VFTF35o6NjQZ1bLlDzNXgGUeR+0bAlOV1YwoFqXo+CB iTRrsuS2onG8u2BEVjYWNTlC53it8RDrUvUF9XPSJIkcz542yy5TbeXks/Drd7KIQeoX G0VRYmn3gyiqs6JbwAhhTsifPYXmYjnjsJgsdYxcE7BlPxlpMfGhs7crOyXxhnoZ8KLv oz+7bvc25UftM1RE141XPsV9NC3mVIVgtNy4OdQl3Yn3C8B+pQZtlCmnftIAXr6sOIEn FT/Q== 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=zWF1+LjOwHyVGVJbyrAhhwZo8V1u6vIK8N/LCyR6jZU=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=YHFuSm/R9+5mSjy0hz5dtG4Ou1Cqs0+qa1SWWpvhNGsYyTLBFl3s9/LohWloW9G7bl weQq/wfae4oKxBPZsm+k1O1IflHztKCrbcd5JJu3f3zQFkrvQBqJO24+cAMqzX5ePuNK CG2SGnXjJ1cs31YLx2mnSFANDJo5MQQsVIIdHls8Ph2xtC7tHscWipfWRIth80y3IPho v3UXlmGcJGYy1mAXHGd+RyZmv/ILEWtKmTeZe5iUrHY4llrNBV6ckMHigxhtyvahuEvZ ow5ZkXSI6BIAprmI5v8eZKz7q0n+ByVVMe7JEsZx5bLBiFHEGMhwF2HvLqP8TLb+RGYl Vipg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l95LtmX4; 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 af79cd13be357-794abcabb2esi1030069885a.117.2024.05.28.08.01.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:01:46 -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=l95LtmX4; 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 1sByJT-0000id-VI; Tue, 28 May 2024 11: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 1sByJS-0000i7-9z for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:30 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJN-00078d-As for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:26 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a5d67064885so146589566b.1 for ; Tue, 28 May 2024 08:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908424; x=1717513224; 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=zWF1+LjOwHyVGVJbyrAhhwZo8V1u6vIK8N/LCyR6jZU=; b=l95LtmX4tXNiOC0AGpE+akSLkmuDfud8vzNpnGwt1uaFbfHBN0yEC2XvLdrScqgwft Jsw0j4+1Cln8ip7Ewou7S8IycRdtVvCM6deHucg6XW2CLmtXY7yyQ4041o77aWPBdlu5 z3MPKHkVddrmeRrJcpWfOFHv0gYD3z8ZqYyk2DnH1tE250smyCq6vwK5B+1U4Wty5rH8 Nm05p9C1KPittcbaZiomwTNeoi1umB6AbSWdr19Obtklg7uatHnUmpIe3V6Ti0YgZCON OLBiPdMMb0P76LmcSjbG9JgOsKRKbePuq1hcyCbdnxPGWx3t2GpNvaUVAmH1231kQEhC ADaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908424; x=1717513224; 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=zWF1+LjOwHyVGVJbyrAhhwZo8V1u6vIK8N/LCyR6jZU=; b=eFBi3zAEHiSgFxzx+dOphbvVDKT7Aj9OOrW3Eaq+bxLyu2lR1EqP1ZX4Yl+R+0y+9s QPpuGJhnotEcJZIIyaVlAZ2GYdzWEmBBxsULOglHbXHDLbhOhA/5BIfekTIWjSSnjeCQ gLSMC61jojpbMqaxFgm3KFuk82h0jSjuPjce5voAODQCVsioG1l+KeyvUba30hG4sBsK gOGpn9z+x4nBQfbgx5+HC330ph+zLBZsAa65jxRRmzCNch2JrGNdAWyyYTRZX7H5Rx8x spKYEbGqsCvUdMQZmdrBFpb+tcmFo6qaPxXgIOdnViZbjpOoGlymatjJh27xJTzCXMjy /iaA== X-Gm-Message-State: AOJu0YxI4ys1zxzL37w8QQH4KfMOhmRFwYk9tL5VWzJqgXlUs36NAW8z xu1aly5aANTG0VQkHgK4TGeB3vYCqPe2lWGXzSus1unnAX9q7qQRLmYTxjayc1uOVvGL6VgxNzX Z X-Received: by 2002:a17:906:5784:b0:a63:7efd:8ec8 with SMTP id a640c23a62f3a-a637efd9bb7mr8040066b.70.1716908423651; Tue, 28 May 2024 08:00:23 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c97a1fbsm620973466b.92.2024.05.28.08.00.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 5/6] accel: Restrict TCG plugin (un)registration to TCG accel Date: Tue, 28 May 2024 16:59:51 +0200 Message-ID: <20240528145953.65398-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Use the AccelClass::cpu_common_[un]realize_assigned() handlers to [un]register the TCG plugin handlers, allowing to remove accel specific code from the common hw/core/cpu-common.c file. Remove the now unnecessary qemu_plugin_vcpu_init_hook() and qemu_plugin_vcpu_exit_hook() stub. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 2 ++ include/qemu/plugin.h | 6 ------ accel/tcg/cpu-exec-common.c | 27 +++++++++++++++++++++++++++ accel/tcg/tcg-all.c | 2 ++ hw/core/cpu-common.c | 25 ------------------------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index ec2c6317b7..d900897c6e 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -54,6 +54,8 @@ void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp); +bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp); +void tcg_exec_unrealize_assigned(CPUState *cpu); void tcg_exec_unrealize_unassigned(CPUState *cpu); #endif diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index bc5aef979e..d39d105795 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -221,12 +221,6 @@ static inline int qemu_plugin_load_list(QemuPluginList *head, Error **errp) return 0; } -static inline void qemu_plugin_vcpu_init_hook(CPUState *cpu) -{ } - -static inline void qemu_plugin_vcpu_exit_hook(CPUState *cpu) -{ } - static inline void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb) { } diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index bc9b1a260e..3c4a4c9f21 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -56,3 +56,30 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index = EXCP_ATOMIC; cpu_loop_exit_restore(cpu, pc); } + +#ifdef CONFIG_PLUGIN +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) +{ + qemu_plugin_vcpu_init_hook(cpu); +} +#endif + +bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp) +{ +#ifdef CONFIG_PLUGIN + cpu->plugin_state = qemu_plugin_create_vcpu_state(); + /* Plugin initialization must wait until the cpu start executing code */ + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); +#endif + + return true; +} + +/* undo the initializations in reverse order */ +void tcg_exec_unrealize_assigned(CPUState *cpu) +{ +#ifdef CONFIG_PLUGIN + /* Call the plugin hook before clearing the cpu is fully unrealized */ + qemu_plugin_vcpu_exit_hook(cpu); +#endif +} diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c08a6acc21..a32663f507 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -228,6 +228,8 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) ac->name = "tcg"; ac->init_machine = tcg_init_machine; ac->cpu_common_realize_unassigned = tcg_exec_realize_unassigned; + ac->cpu_common_realize_assigned = tcg_exec_realize_assigned; + ac->cpu_common_unrealize_assigned = tcg_exec_unrealize_assigned; ac->cpu_common_unrealize_unassigned = tcg_exec_unrealize_unassigned; ac->allowed = &tcg_allowed; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags; diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 0f0a247f56..fda2c2c1d5 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -30,9 +30,6 @@ #include "hw/boards.h" #include "hw/qdev-properties.h" #include "trace.h" -#ifdef CONFIG_PLUGIN -#include "qemu/plugin.h" -#endif CPUState *cpu_by_arch_id(int64_t id) { @@ -192,13 +189,6 @@ static void cpu_common_parse_features(const char *typename, char *features, } } -#ifdef CONFIG_PLUGIN -static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) -{ - qemu_plugin_vcpu_init_hook(cpu); -} -#endif - static void cpu_common_realizefn(DeviceState *dev, Error **errp) { CPUState *cpu = CPU(dev); @@ -222,14 +212,6 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) cpu_resume(cpu); } - /* Plugin initialization must wait until the cpu start executing code */ -#ifdef CONFIG_PLUGIN - if (tcg_enabled()) { - cpu->plugin_state = qemu_plugin_create_vcpu_state(); - async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); - } -#endif - /* NOTE: latest generic point where the cpu is fully realized */ } @@ -237,13 +219,6 @@ static void cpu_common_unrealizefn(DeviceState *dev) { CPUState *cpu = CPU(dev); - /* Call the plugin hook before clearing the cpu is fully unrealized */ -#ifdef CONFIG_PLUGIN - if (tcg_enabled()) { - qemu_plugin_vcpu_exit_hook(cpu); - } -#endif - /* NOTE: latest generic point before the cpu is fully unrealized */ cpu_exec_unrealizefn(cpu); } From patchwork Tue May 28 14:59:52 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: 799503 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp281189wrz; Tue, 28 May 2024 08:02:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVegSlCMz4g2brRJ2tNY/k7BNe+qZIoKvIKUpe8WWR8PWfFgnjIqJnH4LYCf9prV1KcTrG58JIE1YgWbBUkWi0N X-Google-Smtp-Source: AGHT+IE9Z/VEBBTvTLUY8sn9KRVexeFrR/ejfgYqyExPLVCCA0uNhwjsz0mnV860QvC5CnICgbHz X-Received: by 2002:a05:6e02:152d:b0:372:875a:41dd with SMTP id e9e14a558f8ab-3737b2bd8afmr144328205ab.16.1716908523662; Tue, 28 May 2024 08:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908523; cv=none; d=google.com; s=arc-20160816; b=TSzEEVV8oUW0SExHKSOUbumMOGviVDhzN3R1Oj2rb6DFkn8nZVFEkAGgdrYhcGTvg2 hRaDzzzH3/dbo+yjfwH0DTs7To/NlKJF2U9iQKPJyifPM04fEi4RM84G7gyI0/V20qtk 0+xiAfQOi1sV/249s6ay3myvbviuugN3vY/xzsAZloFsMnGbUM3h5VjpoYNP+auRXljE ZTZR6cge+XDISnlYHxdRAFUff3uMb3r8fzC2jTPsqyYRLgocz9R/yvSdJOR39XjkO27z S76xqyRrfAI477lQBhENKxMsWFTuYoLnf5K1qjsuwFaO5+s9L6v1l/my/6xfa72DlyPT 0nsg== 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=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=vAzxJIlYi9Iv7CyW2Ninqrj2CDy+212f7LGU/5OCVne2wki9X3ppLLBh6arg806yLP u8vteWFSq4cyokkmMO6aF6DFbNY8aokS8g60tIZtlLxglEanfJXDKBtp/bGx9aOfO961 nb+CT4iZGLia3HrpLwaEbZ6zT8Wbj1GmQbZXMZoFWtU3LoLyuHlGJeyrx1BNo3t+ePC/ 7Wui5CMB4GtXMoxdbgeGkkbGeD7k5wWdxtFBtpcyOTiRW02iy0AKq8ozmjBky668ZYAG gDO4dB9100n5obW7Ud3SVJDwE+AHVDJd7Vh6ezj0qrM3LMqwjIrBji31ax9a0agYA4MT pPhQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U5WlW2S6; 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 e9e14a558f8ab-3738969e79esi34274175ab.163.2024.05.28.08.02.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:02:03 -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=U5WlW2S6; 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 1sByJY-0000jV-5L; Tue, 28 May 2024 11:00:36 -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 1sByJW-0000j8-1Y for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:34 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJU-00078y-CU for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:33 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5295f201979so1055197e87.2 for ; Tue, 28 May 2024 08:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908429; x=1717513229; 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=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; b=U5WlW2S6zWgelvtLovxI/v4ub50XSEMhTdcTCwQHDVH1YF1Ibs7qjpC+6QIwXQssjF l1KigkKv1vTJ8oIl9DBOyynkUA5ZtvZB0QZIEFM15Ig8NhPENFM/a7wDRXeDbzpxjCK8 s/TPwtyTFW9t/uYd8btdp1y2Km80Qbd8uBGaLkS7OSGxWwNMr/wAqWW4qC160E0eLAdW 5Wu/DcDl7AneoTJAbFm9tpc7UIrGIcPvhtSk1HvWGGhp2tvi3fJxTDjKVflutrGhUjZ/ VpG90SRMmKCNfz7qykoC0ZftnSOMxHVuAx++FreJw3Yf5slMUjdjWVoaMtUW+ZdOSGEP +0BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908429; x=1717513229; 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=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; b=tGwWn+8p+TlB+CUmwl1+B3D7vyJsSdA2PcYCFTdx01aDVZyzCBUSK/brZeMdXh1wf0 UziJE5ZujXMhYAC4VVedixAo5813lGbD3W9XnAqsNpT5IExZxREiIxjZwCqJh0BrEDMi bbVFG0REJ1tGCWh6x+090frwerQT3kAhHTNVFy7cM7W+pDZ1yTobGDJCiAG094GaPMmd m0KupU4BGHQIGHqK6Kx4rwdYxOL4WAa3VMhRk0hnMICDyLQTC30azVnkoOJnNvX/PF8P KxsWE7v13GbvtUemx6Ez52vzyn4HocCiVAvU8rG9RJ2esVm6n0zLoeYZVUQc10ItwEpJ Kc4w== X-Gm-Message-State: AOJu0YwKXNO8sVzDs3qML+OCJPG/SFTRoCdOG2KzPW84C9OYAx0UD/E6 CY89P/WALX7TJk9mD+w7mE8At6jY8qZixKcog3xH4/rixEiS255cmbXSIby7pY5yuR6feVqXekw 9 X-Received: by 2002:ac2:4acf:0:b0:529:593f:3f3c with SMTP id 2adb3069b0e04-529666d5dfemr8138200e87.53.1716908429187; Tue, 28 May 2024 08:00:29 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc4feadsm617200466b.127.2024.05.28.08.00.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 6/6] accel/tcg: Move qemu_plugin_vcpu_init__async() to plugins/ Date: Tue, 28 May 2024 16:59:52 +0200 Message-ID: <20240528145953.65398-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Calling qemu_plugin_vcpu_init__async() on the vCPU thread is a detail of plugins, not relevant to TCG vCPU management. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec-common.c | 11 ++--------- plugins/core.c | 8 +++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 3c4a4c9f21..02499bfb1d 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -57,19 +57,12 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu_loop_exit_restore(cpu, pc); } -#ifdef CONFIG_PLUGIN -static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) -{ - qemu_plugin_vcpu_init_hook(cpu); -} -#endif - bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp) { #ifdef CONFIG_PLUGIN cpu->plugin_state = qemu_plugin_create_vcpu_state(); - /* Plugin initialization must wait until the cpu start executing code */ - async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); + + qemu_plugin_vcpu_init_hook(cpu); #endif return true; diff --git a/plugins/core.c b/plugins/core.c index 0726bc7f25..0eda47ba33 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -245,7 +245,7 @@ static void plugin_grow_scoreboards__locked(CPUState *cpu) end_exclusive(); } -void qemu_plugin_vcpu_init_hook(CPUState *cpu) +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) { bool success; @@ -261,6 +261,12 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu) plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT); } +void qemu_plugin_vcpu_init_hook(CPUState *cpu) +{ + /* Plugin initialization must wait until the cpu start executing code */ + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); +} + void qemu_plugin_vcpu_exit_hook(CPUState *cpu) { bool success;