From patchwork Thu Jan 23 23:43:55 2025 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: 13948757 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9D0B1D5AB9 for ; Thu, 23 Jan 2025 23:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675866; cv=none; b=VVwJf4jMShWJE2Ep1gcUCulwTN/8AO3PUcl/93NtnGVh79BMkAIAjoPsGgO+IzA4dGOPtG+kreTgUNYRF5Ht1y4WUNS+6KeX8TyGfPpdJnz4I1Utg/gFhGtWy8fnwDqrwFHfsPMJMYgFX1QJh4K1jROhD1InwucHhSWY4l8Yh8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675866; c=relaxed/simple; bh=MMMuW7B/2orVp6vJiY6H3Sr8YC8XROt2MMvAbMB+csc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JhzqCDGfYBv6EK/Vk6XeWYc07q8+3mwcR+XoclyuXCdmdTrqQ8c02Oi/sFI4I0j14kdNWf3RmolMFEhqVGnFaKputVCYBxyF2KHsX7xCcmIudEJDhMn+9yA1zdG5RQYogH7jcfByBWf59ss/TM7xheKQp328AwQwyQYXM3mNSd4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Hpubz+pa; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Hpubz+pa" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3863703258fso1722948f8f.1 for ; Thu, 23 Jan 2025 15:44:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675862; x=1738280662; 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=7gr0bDqRAyX8smxLdEX+9XpZH40OE0aprdKko/M9qp4=; b=Hpubz+paVXP/yJ7Vyc8xBHOi9hrrEP6LzqFWSIqT1GizeG2iyQbh4hIK+xpoDoRUYH oOgGBZ4ArHM7uFGtbBH3Wu7YfLRcy+BpfvCOk05KIIrOx4GZ/59E1zul+C+UgR0FUDYt /91q2w9vAUv24j/LTcedBAiS09djFJOgfsBbxYatudyvFGeDFv5tXwBoPzl2Pm6BUZQl 1s1754UDokjyjL3bqMpbX5CSkb6CPcsbIhfM9qSrqjrK7lPPSRTQ6O/NQSqp+XS8Z1Ds hHuaSQ6ip/1laYBL/RNcH9RcqyslOgr2w/jScslz0Spmpk8rjPH4fA9HPBw+cA9p1R0R uqYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675862; x=1738280662; 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=7gr0bDqRAyX8smxLdEX+9XpZH40OE0aprdKko/M9qp4=; b=EsBZODTLzFwmR9O3poAAO78zRiAP0oY+RCqzhHfchvj1x45+nAqkD7jIL99qZ5sTgP nR/UelbT3Q7df2eJfvz4XEo1hlARXNgf0ZjKDGvM9wMb8jBDTWAB9x99Ut7LeUVf9CIO lgDk5BP0gUMJMVy1D0zTAeaCEerSIfu6+PZRw9kuyPLgdQ5L0xIgCuMpy3DirpsdrfHa PFiSZB2jexiTZZmmo7mxlE/R2Km3ln8SIHT51bcwX+JMfyX4nCqrdpHXiUQpbMZQfY8a //hk6wXlqwzGSYekeXqa5HVjd4vDg4kUZUOppPeuN6HobqZgDIzeGyjp5ILgBNtCIcaI 8zgA== X-Forwarded-Encrypted: i=1; AJvYcCWzuXpgO5Jb1T5YC9Pq0TPnUmdFs6PDTfFNI7Asin9N851h3T9O9TQMozUjFhaVwYT2FwA=@vger.kernel.org X-Gm-Message-State: AOJu0YzuC5PrIzetwo6aXAbqc9CUCX4v+tI8h9KUzqf3rR31y05KAVxN 8B3U4Q2nKEe4YPLonlC3KTlJti4/5/H2R1it7D42aVY5SHXmRYfak2llkR7aUug= X-Gm-Gg: ASbGncu6GljZ6ZAS7aqo9OwOA9pSQbzluCBhgxeJ89n/WyUZhiHA8c5dYHW9LGl0AmU znzon8+7IUtcd/xwv4TPQRYXlHLo0BwPoW+18enDu/QRRYvT1EcSJbHdmOyFix2XXPOfSe7/HqE CuvHYX39PRYZU70i+FR6PzqXQH2C+Zho274eDMuEXVOKPZxz0g3BEJkbkUrDXWVa3Ji2bM3DYky IFRkTx2liNL4i/5M/uRv8DtlXn5XPagP0FfSW13ubCvWHyxI1KwLJO9zE78N7eYov+GttgwrA+3 rlR7B3p7tQ2vI+VBLaWM5xAlA1fJ+ci7hMGOJVIDcuBfE4deK1LM66Q= X-Google-Smtp-Source: AGHT+IFO1I6JtHdZSiAttwFg1MlQL9TeL6Qp22FcnpRuMJ6TxX0mL0F5rCxwJt2t6SeC+o26N2z+Yw== X-Received: by 2002:a5d:5885:0:b0:386:3213:5b80 with SMTP id ffacd0b85a97d-38c2b7cdc55mr1203868f8f.24.1737675862142; Thu, 23 Jan 2025 15:44:22 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1764c8sm979124f8f.3.2025.01.23.15.44.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Pierrick Bouvier , Kevin Wolf Subject: [PATCH 01/20] qemu/compiler: Absorb 'clang-tsa.h' Date: Fri, 24 Jan 2025 00:43:55 +0100 Message-ID: <20250123234415.59850-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We already have "qemu/compiler.h" for compiler-specific arrangements, automatically included by "qemu/osdep.h" for each source file. No need to explicitly include a header for a Clang particularity. Suggested-by: Pierrick Bouvier Reviewed-by: Pierrick Bouvier Reviewed-by: Alex Bennée Reviewed-by: Kevin Wolf Signed-off-by: Philippe Mathieu-Daudé --- bsd-user/qemu.h | 1 - include/block/block_int-common.h | 1 - include/block/graph-lock.h | 2 - include/exec/page-protection.h | 2 - include/qemu/clang-tsa.h | 114 ------------------------------- include/qemu/compiler.h | 87 +++++++++++++++++++++++ include/qemu/thread.h | 1 - block/create.c | 1 - tests/unit/test-bdrv-drain.c | 1 - tests/unit/test-block-iothread.c | 1 - util/qemu-thread-posix.c | 1 - 11 files changed, 87 insertions(+), 125 deletions(-) delete mode 100644 include/qemu/clang-tsa.h diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 3eaa14f3f56..4e97c796318 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -40,7 +40,6 @@ extern char **environ; #include "target.h" #include "exec/gdbstub.h" #include "exec/page-protection.h" -#include "qemu/clang-tsa.h" #include "accel/tcg/vcpu-state.h" #include "qemu-os.h" diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index bb91a0f62fa..ebb4e56a503 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -28,7 +28,6 @@ #include "block/block-common.h" #include "block/block-global-state.h" #include "block/snapshot.h" -#include "qemu/clang-tsa.h" #include "qemu/iov.h" #include "qemu/rcu.h" #include "qemu/stats64.h" diff --git a/include/block/graph-lock.h b/include/block/graph-lock.h index dc8d9491843..2c26c721081 100644 --- a/include/block/graph-lock.h +++ b/include/block/graph-lock.h @@ -20,8 +20,6 @@ #ifndef GRAPH_LOCK_H #define GRAPH_LOCK_H -#include "qemu/clang-tsa.h" - /** * Graph Lock API * This API provides a rwlock used to protect block layer diff --git a/include/exec/page-protection.h b/include/exec/page-protection.h index bae3355f62c..3e0a8a03331 100644 --- a/include/exec/page-protection.h +++ b/include/exec/page-protection.h @@ -40,8 +40,6 @@ #ifdef CONFIG_USER_ONLY -#include "qemu/clang-tsa.h" - void TSA_NO_TSA mmap_lock(void); void TSA_NO_TSA mmap_unlock(void); bool have_mmap_lock(void); diff --git a/include/qemu/clang-tsa.h b/include/qemu/clang-tsa.h deleted file mode 100644 index ba06fb8c924..00000000000 --- a/include/qemu/clang-tsa.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef CLANG_TSA_H -#define CLANG_TSA_H - -/* - * Copyright 2018 Jarkko Hietaniemi - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without - * limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* http://clang.llvm.org/docs/ThreadSafetyAnalysis.html - * - * TSA is available since clang 3.6-ish. - */ -#ifdef __clang__ -# define TSA(x) __attribute__((x)) -#else -# define TSA(x) /* No TSA, make TSA attributes no-ops. */ -#endif - -/* TSA_CAPABILITY() is used to annotate typedefs: - * - * typedef pthread_mutex_t TSA_CAPABILITY("mutex") tsa_mutex; - */ -#define TSA_CAPABILITY(x) TSA(capability(x)) - -/* TSA_GUARDED_BY() is used to annotate global variables, - * the data is guarded: - * - * Foo foo TSA_GUARDED_BY(mutex); - */ -#define TSA_GUARDED_BY(x) TSA(guarded_by(x)) - -/* TSA_PT_GUARDED_BY() is used to annotate global pointers, the data - * behind the pointer is guarded. - * - * Foo* ptr TSA_PT_GUARDED_BY(mutex); - */ -#define TSA_PT_GUARDED_BY(x) TSA(pt_guarded_by(x)) - -/* The TSA_REQUIRES() is used to annotate functions: the caller of the - * function MUST hold the resource, the function will NOT release it. - * - * More than one mutex may be specified, comma-separated. - * - * void Foo(void) TSA_REQUIRES(mutex); - */ -#define TSA_REQUIRES(...) TSA(requires_capability(__VA_ARGS__)) -#define TSA_REQUIRES_SHARED(...) TSA(requires_shared_capability(__VA_ARGS__)) - -/* TSA_EXCLUDES() is used to annotate functions: the caller of the - * function MUST NOT hold resource, the function first acquires the - * resource, and then releases it. - * - * More than one mutex may be specified, comma-separated. - * - * void Foo(void) TSA_EXCLUDES(mutex); - */ -#define TSA_EXCLUDES(...) TSA(locks_excluded(__VA_ARGS__)) - -/* TSA_ACQUIRE() is used to annotate functions: the caller of the - * function MUST NOT hold the resource, the function will acquire the - * resource, but NOT release it. - * - * More than one mutex may be specified, comma-separated. - * - * void Foo(void) TSA_ACQUIRE(mutex); - */ -#define TSA_ACQUIRE(...) TSA(acquire_capability(__VA_ARGS__)) -#define TSA_ACQUIRE_SHARED(...) TSA(acquire_shared_capability(__VA_ARGS__)) - -/* TSA_RELEASE() is used to annotate functions: the caller of the - * function MUST hold the resource, but the function will then release it. - * - * More than one mutex may be specified, comma-separated. - * - * void Foo(void) TSA_RELEASE(mutex); - */ -#define TSA_RELEASE(...) TSA(release_capability(__VA_ARGS__)) -#define TSA_RELEASE_SHARED(...) TSA(release_shared_capability(__VA_ARGS__)) - -/* TSA_NO_TSA is used to annotate functions. Use only when you need to. - * - * void Foo(void) TSA_NO_TSA; - */ -#define TSA_NO_TSA TSA(no_thread_safety_analysis) - -/* - * TSA_ASSERT() is used to annotate functions: This function will assert that - * the lock is held. When it returns, the caller of the function is assumed to - * already hold the resource. - * - * More than one mutex may be specified, comma-separated. - */ -#define TSA_ASSERT(...) TSA(assert_capability(__VA_ARGS__)) -#define TSA_ASSERT_SHARED(...) TSA(assert_shared_capability(__VA_ARGS__)) - -#endif /* #ifndef CLANG_TSA_H */ diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index d904408e5ed..af0a9b17ff9 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -207,6 +207,93 @@ # define QEMU_USED #endif +/* http://clang.llvm.org/docs/ThreadSafetyAnalysis.html + * + * TSA is available since clang 3.6-ish. + */ +#ifdef __clang__ +# define TSA(x) __attribute__((x)) +#else +# define TSA(x) /* No TSA, make TSA attributes no-ops. */ +#endif + +/* TSA_CAPABILITY() is used to annotate typedefs: + * + * typedef pthread_mutex_t TSA_CAPABILITY("mutex") tsa_mutex; + */ +#define TSA_CAPABILITY(x) TSA(capability(x)) + +/* TSA_GUARDED_BY() is used to annotate global variables, + * the data is guarded: + * + * Foo foo TSA_GUARDED_BY(mutex); + */ +#define TSA_GUARDED_BY(x) TSA(guarded_by(x)) + +/* TSA_PT_GUARDED_BY() is used to annotate global pointers, the data + * behind the pointer is guarded. + * + * Foo* ptr TSA_PT_GUARDED_BY(mutex); + */ +#define TSA_PT_GUARDED_BY(x) TSA(pt_guarded_by(x)) + +/* The TSA_REQUIRES() is used to annotate functions: the caller of the + * function MUST hold the resource, the function will NOT release it. + * + * More than one mutex may be specified, comma-separated. + * + * void Foo(void) TSA_REQUIRES(mutex); + */ +#define TSA_REQUIRES(...) TSA(requires_capability(__VA_ARGS__)) +#define TSA_REQUIRES_SHARED(...) TSA(requires_shared_capability(__VA_ARGS__)) + +/* TSA_EXCLUDES() is used to annotate functions: the caller of the + * function MUST NOT hold resource, the function first acquires the + * resource, and then releases it. + * + * More than one mutex may be specified, comma-separated. + * + * void Foo(void) TSA_EXCLUDES(mutex); + */ +#define TSA_EXCLUDES(...) TSA(locks_excluded(__VA_ARGS__)) + +/* TSA_ACQUIRE() is used to annotate functions: the caller of the + * function MUST NOT hold the resource, the function will acquire the + * resource, but NOT release it. + * + * More than one mutex may be specified, comma-separated. + * + * void Foo(void) TSA_ACQUIRE(mutex); + */ +#define TSA_ACQUIRE(...) TSA(acquire_capability(__VA_ARGS__)) +#define TSA_ACQUIRE_SHARED(...) TSA(acquire_shared_capability(__VA_ARGS__)) + +/* TSA_RELEASE() is used to annotate functions: the caller of the + * function MUST hold the resource, but the function will then release it. + * + * More than one mutex may be specified, comma-separated. + * + * void Foo(void) TSA_RELEASE(mutex); + */ +#define TSA_RELEASE(...) TSA(release_capability(__VA_ARGS__)) +#define TSA_RELEASE_SHARED(...) TSA(release_shared_capability(__VA_ARGS__)) + +/* TSA_NO_TSA is used to annotate functions. Use only when you need to. + * + * void Foo(void) TSA_NO_TSA; + */ +#define TSA_NO_TSA TSA(no_thread_safety_analysis) + +/* + * TSA_ASSERT() is used to annotate functions: This function will assert that + * the lock is held. When it returns, the caller of the function is assumed to + * already hold the resource. + * + * More than one mutex may be specified, comma-separated. + */ +#define TSA_ASSERT(...) TSA(assert_capability(__VA_ARGS__)) +#define TSA_ASSERT_SHARED(...) TSA(assert_shared_capability(__VA_ARGS__)) + /* * Ugly CPP trick that is like "defined FOO", but also works in C * code. Useful to replace #ifdef with "if" statements; assumes diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 7eba27a7049..6f800aad31a 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -3,7 +3,6 @@ #include "qemu/processor.h" #include "qemu/atomic.h" -#include "qemu/clang-tsa.h" typedef struct QemuCond QemuCond; typedef struct QemuSemaphore QemuSemaphore; diff --git a/block/create.c b/block/create.c index 72abafb4c12..6b23a216753 100644 --- a/block/create.c +++ b/block/create.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include "block/block_int.h" -#include "qemu/clang-tsa.h" #include "qemu/job.h" #include "qemu/main-loop.h" #include "qapi/qapi-commands-block-core.h" diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c index 98ad89b390c..7410e6f3528 100644 --- a/tests/unit/test-bdrv-drain.c +++ b/tests/unit/test-bdrv-drain.c @@ -28,7 +28,6 @@ #include "system/block-backend.h" #include "qapi/error.h" #include "qemu/main-loop.h" -#include "qemu/clang-tsa.h" #include "iothread.h" static QemuEvent done_event; diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c index 1de04a8a13d..26a6c051758 100644 --- a/tests/unit/test-block-iothread.c +++ b/tests/unit/test-block-iothread.c @@ -29,7 +29,6 @@ #include "system/block-backend.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" -#include "qemu/clang-tsa.h" #include "qemu/main-loop.h" #include "iothread.h" diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 6fff4162ac6..b2e26e21205 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -17,7 +17,6 @@ #include "qemu-thread-common.h" #include "qemu/tsan.h" #include "qemu/bitmap.h" -#include "qemu/clang-tsa.h" #ifdef CONFIG_PTHREAD_SET_NAME_NP #include From patchwork Thu Jan 23 23:43:56 2025 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: 13948758 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B59351D5CDE for ; Thu, 23 Jan 2025 23:44:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675870; cv=none; b=P1UNjbs7HVxj8n8ftOQ+dTIvp2/ktNiQ4s9iNv3pKvP0X4rG9RzUTisXzD6ukmHi1ijOcmZr1xZOUiBysuT7yrh22Ta7FrhLN6+pP0eBbdOSf0xCGX/M1Rb384+xToXcVdD+jYvT1WtjWGoS6kbLlDQd5ebLDF3JEALjeIKeqQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675870; c=relaxed/simple; bh=h9j7Hcv3N60SkNiwJxa+iXQ3vRq1q6A0wFw0y+Fz1Yw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TuhJ0IzUp6vnz04PTqXIz4VBqn+AAWVnUWxdbBLl7Pea9wgcYWA2lE4cFfMttfFl3pWAa39IZ+P9hy9mF84PH1Xt71ZUEWEgk1xAgiibcsAf8reg6OWC7WBawSohzmt0cZxI+RXj0gJKX0eADRuRijhPsEj04UCxePMk4erCRyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lwbG9DcN; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lwbG9DcN" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so15614735e9.1 for ; Thu, 23 Jan 2025 15:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675867; x=1738280667; 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=4nuXtmGFXC6ord9LKCUcMBdqEKN9u5T/6Xkbf7Pq9+s=; b=lwbG9DcNmomqckoMq5KtsaZcO0k9t+I0xsY34x52tP9Ym2TTM8QcBT6BnszedUx/jB THw6CTDPy4o0zWuwSrF32jAC2Gnsfg1ZWn0JoBMXtD7fazApK0QzKwRjYPcp4b8+pDJw /y2WiRGOEYp4ZR2R3I9hGti8QMHrZDZB54yrIT2S0uiTOxMpTzZGGJUlYoR7R/x6sMCF knETem2l1BFQLgxO+hlDDEmVJJeN5XFqW2tyxN0v6uaOqA9P9kbm8WdCPxN9ZPCJmQ2H BI1z80LnUn8Yo8eLtGqf6Vj1Z7Y5mdTS6oW7xrU906Cy8C3W9SvbC4ttQYS2emSMtRSx tmoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675867; x=1738280667; 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=4nuXtmGFXC6ord9LKCUcMBdqEKN9u5T/6Xkbf7Pq9+s=; b=QoL114joLdmoX8Cy39Qkb8N2417B8Ir7NCoTixeJx26wqTxq9/TPN0ksSBAY9jbQ6I lwXJ9nmqFokIkTWe4twVbwsN6WPU9tNFOCtEX8XEdQf122jF5RqOXxlz4iEyxT+2e9nk hCuzOYxgFekO3hlIRej7SMeJwe1Ffe1cX578jm0oRCfHvZjcWnkLAIy0vNGcYL+qAKlN Yg+na6rVSI76LXnQpf2xtgP6RW1yxMUtUYXPWPpBw2KgLCvyEPipg7qDkqbuAevxfTTp ZvByIolhN6L4ZO9g7mBG4cLKIpiJNndSqra3BP6eHizUi3Gc8hM3PaGtwPmY9pLM0lgT ReMw== X-Forwarded-Encrypted: i=1; AJvYcCVJqiLaou92J1Ln3hsK4E/AorJrtEQmN9XdGaq39375jqRKRbimVan/dlO9DS0/bQlgQrI=@vger.kernel.org X-Gm-Message-State: AOJu0YwHLiH1bmk++uEFw4idr0Ee4gpmJQ0cMJPwWB/RoQB44L2Txzr9 UtcqzwKDPlTRU5f2rfHxXXwVChmw9i4kETiingEE2rGIHBcY5u1WrbVV4zxdBFc= X-Gm-Gg: ASbGncsS523oHWAVYHRYts7eqdqg0dBE0niwN978T+55wrmM+G9y4jSGEYUPxtKaNfs rO9ofJPovZBnwn2XASgUp0a6G2O0Zr9yE6KzXHZttXLmxcRBjbf6c94MOw76rvqoNjSqOc5VCYj ol9Fk5CcQaSjnQAt2s9eoHZxUV5drBbTYt7g7s77B507Mcs5sFyvUr3UcARpblv+eKFtnkxMt3T yE/Loyo0Xp8hNnCOz9TqsusX+0kVtxcC9A1dCy327+2KTpg2n0YRfXDDta5pMOsF7PQyxp61z9F VLC8E7/0ni0qfCtLvlpluq1/70DNQC5k4sJJrkCB8wAe9m3iAymN6+E= X-Google-Smtp-Source: AGHT+IHv5zns5zWE/8mYKYb9FdwvG4F/GC7lN2DJcXXFDd0WLjCHyuvzadU0RlDxZ5dNLmoZuF9u5A== X-Received: by 2002:a05:6000:1887:b0:38a:87cc:fb42 with SMTP id ffacd0b85a97d-38bf56639d5mr27205303f8f.21.1737675867076; Thu, 23 Jan 2025 15:44:27 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d6e2sm989811f8f.23.2025.01.23.15.44.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:26 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 02/20] user: Extract common MMAP API to 'user/mmap.h' Date: Fri, 24 Jan 2025 00:43:56 +0100 Message-ID: <20250123234415.59850-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Keep common MMAP-related declarations in a single place. Note, this disable ThreadSafetyAnalysis on Linux for: - mmap_fork_start() - mmap_fork_end(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 12 +----------- include/user/mmap.h | 32 ++++++++++++++++++++++++++++++++ linux-user/user-mmap.h | 19 ++----------------- 3 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 include/user/mmap.h diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 4e97c796318..c1c508281a8 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -32,6 +32,7 @@ extern char **environ; #include "user/thunk.h" +#include "user/mmap.h" #include "target_arch.h" #include "syscall_defs.h" #include "target_syscall.h" @@ -233,19 +234,8 @@ void print_taken_signal(int target_signum, const target_siginfo_t *tinfo); extern int do_strace; /* mmap.c */ -int target_mprotect(abi_ulong start, abi_ulong len, int prot); -abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, off_t offset); -int target_munmap(abi_ulong start, abi_ulong len); -abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - abi_ulong new_size, unsigned long flags, - abi_ulong new_addr); int target_msync(abi_ulong start, abi_ulong len, int flags); -extern abi_ulong mmap_next_start; -abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size); void mmap_reserve(abi_ulong start, abi_ulong size); -void TSA_NO_TSA mmap_fork_start(void); -void TSA_NO_TSA mmap_fork_end(int child); /* main.c */ extern char qemu_proc_pathname[]; diff --git a/include/user/mmap.h b/include/user/mmap.h new file mode 100644 index 00000000000..4d004e6b822 --- /dev/null +++ b/include/user/mmap.h @@ -0,0 +1,32 @@ +/* + * MMAP declarations for QEMU user emulation + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef USER_MMAP_H +#define USER_MMAP_H + +#include "user/abitypes.h" + +/* + * mmap_next_start: The base address for the next mmap without hint, + * increased after each successful map, starting at task_unmapped_base. + * This is an optimization within QEMU and not part of ADDR_COMPAT_LAYOUT. + */ +extern abi_ulong mmap_next_start; + +int target_mprotect(abi_ulong start, abi_ulong len, int prot); + +abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, + int flags, int fd, off_t offset); +int target_munmap(abi_ulong start, abi_ulong len); +abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + abi_ulong new_size, unsigned long flags, + abi_ulong new_addr); + +abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong); + +void TSA_NO_TSA mmap_fork_start(void); +void TSA_NO_TSA mmap_fork_end(int child); + +#endif diff --git a/linux-user/user-mmap.h b/linux-user/user-mmap.h index b94bcdcf83c..dfc4477a720 100644 --- a/linux-user/user-mmap.h +++ b/linux-user/user-mmap.h @@ -18,6 +18,8 @@ #ifndef LINUX_USER_USER_MMAP_H #define LINUX_USER_USER_MMAP_H +#include "user/mmap.h" + /* * Guest parameters for the ADDR_COMPAT_LAYOUT personality * (at present this is the only layout supported by QEMU). @@ -39,24 +41,7 @@ extern abi_ulong task_unmapped_base; extern abi_ulong elf_et_dyn_base; -/* - * mmap_next_start: The base address for the next mmap without hint, - * increased after each successful map, starting at task_unmapped_base. - * This is an optimization within QEMU and not part of ADDR_COMPAT_LAYOUT. - */ -extern abi_ulong mmap_next_start; - -int target_mprotect(abi_ulong start, abi_ulong len, int prot); -abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, off_t offset); -int target_munmap(abi_ulong start, abi_ulong len); -abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - abi_ulong new_size, unsigned long flags, - abi_ulong new_addr); abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice); -abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong); -void mmap_fork_start(void); -void mmap_fork_end(int child); abi_ulong target_shmat(CPUArchState *cpu_env, int shmid, abi_ulong shmaddr, int shmflg); From patchwork Thu Jan 23 23:43:57 2025 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: 13948759 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 294D41D514F for ; Thu, 23 Jan 2025 23:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675877; cv=none; b=gL2BDl14nV/ZxJ+mdfZ6qHWznxJj6vkEm/XB5lI0+d7LMci4xi5hxzZbLmPpearKXDTS3ilaX3Sni0u3hgRobWwPeH81B6YsvFpmjR2sD4/mdknCRGccJ+6ABGY/HBoWxE5kfceTTcIE9Yduy2olPbjXgP8HZP5BjDbkc1D7Iws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675877; c=relaxed/simple; bh=PUEx9/EVHpZyAG1kaVNeYN369Fav+oisRSkJ3ll29NA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LRGNTR/TvSbQzd/VrE77wqU0P3LO0dpEbu/wgQ0hoWthbFQBx0EJPwV5qTEPzF7qfI+lD/nibunjwyYZVdf+BVpvgkgqfjNAoo8Q1ag8BF1dJKzmGWlreZ3ojTvU/yFVefevrg67+pMAvlX5TOlsbOuFPgonW3wNAKXAVFdriC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=vdFAWnaa; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vdFAWnaa" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-38633b5dbcfso1647970f8f.2 for ; Thu, 23 Jan 2025 15:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675873; x=1738280673; 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=ce4xXqVbqUUJ3kwtGZLdz75HP+CS3yxZeowyzQLM8Ns=; b=vdFAWnaaqWwVaN3hBdl10DoP34NbwDfDuv9zcEIXT/XmwXbmLif001ub/H4+5n7SGb PITMsleujiKjHayiux8o3JI/AuSAM2cOEJvPzyorxJkM5qUfg1gNQWHwuR/BZ0m8wMdN pyvLGnFYt173DrvQLdDM/ur+BGwicJAlroHOunYvhj5JhrKiAfT2orfdTvi9c0K0EY6e NxuIh/txNpSC4cKEwUCue1f+jxSuvu4MDST6aAhpdDOWM19E3/nE5as1rTrftOf/3Av1 xepm2VYNm/0vRPzjpTwG9gW0+p7AR7rK7dK3fYFwQ1cwBe9dGzUanc1ZyRSTaI0fm0hM Aa2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675873; x=1738280673; 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=ce4xXqVbqUUJ3kwtGZLdz75HP+CS3yxZeowyzQLM8Ns=; b=a5kE4+Gz67LhCH1EwbtEF8nfXKQF5LKuA/KpvmQCz7g+WIlQi0WRnBv03adMoxjlhn PYxij/m7uBD6S9jYWQPQzCdoECy95w5g96NwjiSk7cnhYr6+6feUbS9TiZt1aRUeTFg1 bgbM7zVyx5ND48fXJw7hN7FZ4oNh/4/X33egNoxJjKprFjBzxewiYDolVHG20cK4oGBH JkwSe2cvtQsO61LRkQM5JsCIRTbyAKT+14v6dFfw332zlQsVBSgnR0KGIdo8qsDXV/Iw aB1uAvFRnJJPDabq5+3DrhgX3lP7oRda28ROPKeCt5FCsVsYzGaDyTRvyz15h4EPTA20 H1nQ== X-Forwarded-Encrypted: i=1; AJvYcCUYmJcP73c2r8BmhnexYw8QmWhujyAMGmLHT+QF+5krAtu4OBhqgkirnuNjpd9jwZgLUFY=@vger.kernel.org X-Gm-Message-State: AOJu0YyJjv0OPV7KdRity3tsvZdl+hYGqYvgMJ8U27df9jDuQbEeEi6K YDw4BAfBlzELJY6i44fTOrZca0mheig3eYSXiKBHtnC7NdiDqRMFNqkUewDVPtU= X-Gm-Gg: ASbGncs/IVKUUuxYmu7vBI4i8eaybt8uFmQ2kmE/QbwQxiQopN/O9Ghbxzn9Kes/l1a Cxsl5EVC68JNYe5SikW0Xpr/y5Vv59KBs6uohOVP8PePeqEn2xy9OyScjRJUDU0qffz1jc3zzHa bZgkifnY86Zc/gHda9vf9udeJOCKc190hRrrXIULEnn18GNTO+KfPU9lScagaPubRZfoWkLkPp6 eBERxW6T3CXbhwMQRUVT0InIJ1M0AvW5GObz7qn2caYCS7P0LazFkXS5aVwoox77L+toWbcCtJe N72k2eHpiznsUJW5tleCVjtnC3IoV5KgrFYeIJ1xJlPQyTjf9kWJRSg9DsKS3s1Pbw== X-Google-Smtp-Source: AGHT+IF2OW+qflIazHPgiEcST7oe1qZGT6aj/Hik/HFfGWbVcOJj4aFV8515DLdGfzbOF2nObYCMQg== X-Received: by 2002:a05:6000:144a:b0:38a:9c1b:df5b with SMTP id ffacd0b85a97d-38bf566a279mr25563799f8f.30.1737675873434; Thu, 23 Jan 2025 15:44:33 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c4006sm982952f8f.94.2025.01.23.15.44.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 03/20] gdbstub: Check for TCG before calling tb_flush() Date: Fri, 24 Jan 2025 00:43:57 +0100 Message-ID: <20250123234415.59850-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the tcg_enabled() check so the compiler can elide the call when TCG isn't available, allowing to remove the tb_flush() stub. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- accel/stubs/tcg-stub.c | 4 ---- gdbstub/system.c | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index 7f4208fddf2..b2b9881bdfb 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -14,10 +14,6 @@ #include "exec/tb-flush.h" #include "exec/exec-all.h" -void tb_flush(CPUState *cpu) -{ -} - G_NORETURN void cpu_loop_exit(CPUState *cpu) { g_assert_not_reached(); diff --git a/gdbstub/system.c b/gdbstub/system.c index 8ce79fa88cf..7f047a285c8 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -22,6 +22,7 @@ #include "system/cpus.h" #include "system/runstate.h" #include "system/replay.h" +#include "system/tcg.h" #include "hw/core/cpu.h" #include "hw/cpu/cluster.h" #include "hw/boards.h" @@ -171,7 +172,9 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state) } else { trace_gdbstub_hit_break(); } - tb_flush(cpu); + if (tcg_enabled()) { + tb_flush(cpu); + } ret = GDB_SIGNAL_TRAP; break; case RUN_STATE_PAUSED: From patchwork Thu Jan 23 23:43:58 2025 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: 13948760 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 002241D514F for ; Thu, 23 Jan 2025 23:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675881; cv=none; b=OAZIlZqiER8G13VRGFX3xWIxneDOsuqzXq9p5+PSWPrmJboxg0Ak26EhyMdPO5mLPEqyGZ2koEsDmRjZFOFveFg2UlqyaS5g9T0mFFKCh85zvBVa1QvD+QO5G8KEeCobM/PlHa4cwYYSTptl+vsxt6U/AaJ5Qp4cPVHNuDYGTWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675881; c=relaxed/simple; bh=+RWsapKn7VrlZrKBEoJngTX+sgVpkGZpz2JVXzmKACk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MJC5B+h6CUgHyeMTEztBEEqNyWC/SfT/wHyCehlCG9M14C8f2ZeD4LsSZ99nA7S3ypoVYecVjt5+0XFIjmLce+GRDImY+0AtIGiNTtKAGIHg6VbwhpNspmVdLZRgBEYX6parKSbNr3H0xJlGQRM6r0yfyMCSGCWPPMLVeNkpB2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ANldaWBv; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ANldaWBv" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43635796b48so10273525e9.0 for ; Thu, 23 Jan 2025 15:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675878; x=1738280678; 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=JSvw35u1c/GeD9pKIKqf6WHVcOBbPhJhoq/j5sOwl2I=; b=ANldaWBvBZd2jY44kHKuMuEMhGNUpZGch84GdJ+ceroO6862fhSQfwvmn+YEXe4coW thZ0ra3eBi2eyIPRJz2zgfHjuK4qZgS//gtxrSo3ucKPsEzh/jjW8nl2e7KCvgMVUL2F qIIvt+UdJ4rbfLA46SlWKtnMK/RoBpkdz12cg13L+dHnkZ0u5QcTtLTd3a6a+NEIYz57 BRSQzTqo68wZDfqrvnU/VlixIUQcN5xFfHRYZw+LnNQfO9QtI8IjaRFkkI5MUVVCeL+4 b6/aGl8uNZcDVQb97LjxHDIql7aVf0nDxKljWIFxB5/7m0AWVdfFijfGoQrVr9Um0Slh 1B/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675878; x=1738280678; 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=JSvw35u1c/GeD9pKIKqf6WHVcOBbPhJhoq/j5sOwl2I=; b=EPlLsoVTXIJCEsD+Q1JePJPFlZd2M8+JP4Y4pt0XUJsYK4Q8vyMGGV9VOVKWKpJsDD Cl+AEmxmaw1vx1ltunNDNhztkNFW0OOk5Rf0M3BF6ob+XaKPxPZTVbiszDnHNDmSpIP8 nGoKliNOWfDM2UQjQzfqWT16vzLUbKuoS07t4F0YrYUgci3R1WhdhMK4zhPsEbJ7jWPv pFvV6JfyRlt0k5xgvu8TkBD76p/xPpC6RwOI927cfTiycD9AwKWqYM2i/ii+DODQN3c8 inpHrQ/rhn6RIoi9mxOXkb0PjlKSm1XMVgVT+t/s+gxEbcfbz0SzAQ/Jf+WZgUPzaPxo AqhQ== X-Forwarded-Encrypted: i=1; AJvYcCXJqQqO+5gNxfNyWOCFZlIBmCe3fY2h0PKL2zE8nQWzz9woJ9CZAZ1lpbuElUWdZ8pDt0g=@vger.kernel.org X-Gm-Message-State: AOJu0YywEoAim6Us2yl3nwRg747DGT7ZXHp/KOct68uvmQFa4m6zg5l/ cegW0l+CTb9iKb29kTi7OKGjEmLu0siY4i9g3gga32NMqepBbTXlWMdtWBmmC5U= X-Gm-Gg: ASbGncstp1H3TNpiGcfQTV7ISxKgj/GCWnTjh3qgaikiMNd+6y+lI2YcpVj935tilWo dSfZjTCB+vY0q7rC5qd2zvZ3gRGFbGNzzFc8cQDj2PE6IWxgCjl2J6oC40X35PSTok8MHv/jVwP nWmxpqLveItlV+jpfDrsZ0VzdiZlNhz7baUQHvkRm8P0wBsBFuMT8JRO7+KArg+Vh+TED9MlpyJ jK+8xBguAMojsgpE9Z2BIQm7hezFfvqa0KkYyFrGgzNLZh224/0caVXuK73tPwpZWvE9VnT9CA7 YRkhRnzO3GOi1TCP2i8nSsbDlO5gS6oZUsXNMueKZB9JrAkPOcnVlUST7QdFr3Pa1g== X-Google-Smtp-Source: AGHT+IGo8PNbuw90Bq4/JTfJj+icg7kmRyyI+cmqGdvUrpM4r/a237PZVlDOFDC6zvKvXQiH9M0QlA== X-Received: by 2002:a05:600c:3d05:b0:434:9e17:190c with SMTP id 5b1f17b1804b1-438b87f953fmr44596875e9.0.1737675878313; Thu, 23 Jan 2025 15:44:38 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4857c3sm7081075e9.10.2025.01.23.15.44.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 04/20] cpus: Cache CPUClass early in instance_init() handler Date: Fri, 24 Jan 2025 00:43:58 +0100 Message-ID: <20250123234415.59850-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Cache CPUClass as early as possible, when the instance is initialized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- cpu-target.c | 3 --- hw/core/cpu-common.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index 667688332c9..89874496a41 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -134,9 +134,6 @@ const VMStateDescription vmstate_cpu_common = { 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)) { return false; } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index cb79566cc51..ff605059c15 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -238,6 +238,9 @@ static void cpu_common_initfn(Object *obj) { CPUState *cpu = CPU(obj); + /* cache the cpu class for the hotpath */ + cpu->cc = CPU_GET_CLASS(cpu); + gdb_init_cpu(cpu); cpu->cpu_index = UNASSIGNED_CPU_INDEX; cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX; From patchwork Thu Jan 23 23:43:59 2025 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: 13948761 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3F3D1D54FA for ; Thu, 23 Jan 2025 23:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675887; cv=none; b=MAnBhJTvfYRVlif1Vyp2shZI/LMmJJvW+TPYa4SPHhrpsk+4aOjFgrOU15HCDTozUOHIZD6hWO0yHEevMrHhb5ajuNA93baFQFC5Rlu2duNv6SR06JwqPp6KodlAeMydtcPpIm6Jk6Lcdjr06ZEMcSKbHDG3apjGfwoKS9zZf7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675887; c=relaxed/simple; bh=7grupjrAN4h3Wqn2lUGXS0WyifK3HjLlFi/Y64G9+3A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AGbsnS0nT/4Ujrml5Hw8TnItd4DZp6g6l3JfDK6YJ/MgpSoEhAm8YOJYuKwlaeNzrfjV+pbf5jUMK5U2Gq6iveZbMnDh4YwUnKe6JWH9O029AzRxqtwMDUSIRV3jak6ZZzTpgyTiOeuVBdXr6pWaMy/cRceHPF+S5qadYX8kC9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uXeQO0jQ; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uXeQO0jQ" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-38a8b35e168so1073181f8f.1 for ; Thu, 23 Jan 2025 15:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675884; x=1738280684; 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=89WHzW+ji4rB+60gFYzeRD9ADgUNDHjcXvYSPMINgc0=; b=uXeQO0jQRsLrlM9Ynh4b+FajjSpEtTRSZKH62dVWTZ8tCeSBQ8rkhui29FiN7RV1U8 RMSxvldmMbZvj/w0bXkfqnzHfMJUffC+u1Z6kuLilGqWaRedFvZg/nOMfSRwlMPrAJ3/ SMqKkni57YznHppcroTLUAUuULbr2ZSDT/MQzAQcugpkorBiAIpttYGpskf17i0rPYVV v+gWZZZ67D94+YvzU/L8HneeNrWXVovLJH5r6uQxU8AzRKyBtLA0F64kWZOzyOhYWXAC jqXQ8i/CbBWkY3RjsNOZqK3Y2dM68m2qltDiqFml/2kjP/W0fi0xmYfrPtInF1PDdEYb U4tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675884; x=1738280684; 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=89WHzW+ji4rB+60gFYzeRD9ADgUNDHjcXvYSPMINgc0=; b=wTzXpryz1ssPperDJyMYoD0GgfFeXFrYxlftctd6jpXzboGplIQH/uaMK8rMNvKsS4 NP6HIpFUJNZ5VsHHihqvOfJ1bDSvI21UhptmZeTKpWgoaj9izsr61Zuuy5cpt9GkZ/tI OSdJwkaqhLhPjLyNzeqy1gbARX5zPdz016CNpa7Ts2cgCE+3DfppvrqyldKur5T/ASKQ iJixAifZiGCxPmH8905yTACj68TvmIJwr1eb/yk+JNjdFXOsiYPxzmqlp0FR0gsKlraU EogJSEgqdxT8eBwlnMUWN0QiiYoKaeUZ3u4bj8ezsWprFstQcGqcihsvCh4d9EqRLB4R KaTg== X-Forwarded-Encrypted: i=1; AJvYcCUx39+qzq4MZFZFGW+gFAxMlr0WFSHMZjR+YqyVJxS0iVSs/ugfYUZpn9hgdL2MwkRJMhM=@vger.kernel.org X-Gm-Message-State: AOJu0YyyS/HwjOKHuRA6RDXDg2+70X86zYs/nL9pm97n9ZXGJiIMGTyU I8TpVDsvu1Km8TOxpxzFemFJ1rGEb5EgOyOT5/0PA0WZlWFKxfDwlKS9vMOijEA= X-Gm-Gg: ASbGncutX88RftmvRaRbeEOv94iKWDgb6liv0njYNK9sB845nTsy1Ze/5+GcR1TO+2m asXa2POQqsxKjD2uJ6A/LRyXGsaSLlbEIjazBQDykHlIusvpQO8NF6MyWvVhr6Ku5t+5+OSbM1/ dH0LHLJpy6o5jgs9rGSyzaDBXOrCkhIWTuo4wMb1KuMxbBd58STag9J165dvlW9NgGUoCT7dCKL 39tMw0yHG5ferIxchhebr1oVidxYdYVfsmHvy1imELHOgnx8D961lxW6fLuunYmbNnPLg/IzPnr OEOTmPXTxdiR0tDsWIR4pInUoa3am11x4yYUlIzDnwHEU3Z479JzDI8= X-Google-Smtp-Source: AGHT+IHfcp2D5aSm8Sn0VT4IidLdBYhD/KSzWcZHka724j1qpNfMP/dVIsxPCprx8nPoBb5TgAtEpw== X-Received: by 2002:a05:6000:1fa9:b0:38b:f4dc:44ad with SMTP id ffacd0b85a97d-38c2b65ebf8mr997845f8f.5.1737675884076; Thu, 23 Jan 2025 15:44:44 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4d29cesm6991745e9.35.2025.01.23.15.44.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 05/20] cpus: Keep default fields initialization in cpu_common_initfn() Date: Fri, 24 Jan 2025 00:43:59 +0100 Message-ID: <20250123234415.59850-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 cpu_common_initfn() is our target agnostic initializer, while cpu_exec_initfn() is the target specific one. The %as and %num_ases fields are not target specific, so initialize them in the common helper. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- cpu-target.c | 3 --- hw/core/cpu-common.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index 89874496a41..75501a909df 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -234,9 +234,6 @@ void cpu_class_init_props(DeviceClass *dc) void cpu_exec_initfn(CPUState *cpu) { - cpu->as = NULL; - cpu->num_ases = 0; - #ifndef CONFIG_USER_ONLY cpu->memory = get_system_memory(); object_ref(OBJECT(cpu->memory)); diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index ff605059c15..71425cb7422 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -244,6 +244,8 @@ static void cpu_common_initfn(Object *obj) gdb_init_cpu(cpu); cpu->cpu_index = UNASSIGNED_CPU_INDEX; cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX; + cpu->as = NULL; + cpu->num_ases = 0; /* user-mode doesn't have configurable SMP topology */ /* the default value is changed by qemu_init_vcpu() for system-mode */ cpu->nr_threads = 1; From patchwork Thu Jan 23 23:44:00 2025 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: 13948762 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EF8C1D5AB2 for ; Thu, 23 Jan 2025 23:44:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675893; cv=none; b=QPlHxUYJf9oEl3uMb/RS44K9U7NYP9XQMO9FV2EQcMSN1ug9DSnPLNPpRlIbvRp08IhCxLdiD7X+SmIFW8gk9Tbk0YZagQbzppJY5z1JwooNlqEfeE/Hk3VehdbfLIqhFit0PGTpR8tZXEFk56hRPGDoVPMEN8/xPQ2cEyKOcy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675893; c=relaxed/simple; bh=eo8IJSEOw86/rfcioZNtTvsqeN9aNAr23CZR4oAoiiQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DyNC8kGYswp+YbckQmmHAAU4dZN6ujRTlNl+6W2r8ZDUy4qC/LHrgh2xpjGLw3QndDE2gz8FzYfg2crPF+pRTTNWNeep0DXC6d2JCNCqEs6Z8YmbC+K0SV/LNOWz0ynlGxpRydE+9sgJGw87RcMkSgF4JXYA5AOSU6X4K8K5rq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UNHnuNRL; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UNHnuNRL" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-38632b8ae71so1133768f8f.0 for ; Thu, 23 Jan 2025 15:44:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675890; x=1738280690; 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=VK0JABDJF/QMP4ClWDlwjdLf62KvnH3DnM23ZO9feXo=; b=UNHnuNRLKg6XS2nzYre+Cu1KHobhTH7v41aTvT0zmUUu8s3bQoTZ+WwqLk7F20tYkb AOJ42eYqwViFXIeu9O/b3sFuKUdJBDyxW2uI7oJFojlhvaCOROmPibo5g1rYDA1uo0Dr qbllyy9+2YZQpk2DEoRudru1vaB4eKd/eU/LkoPPLrzeOmStwc2WvV+jXwWqmMhiZIXz p/ysEpl5xl20S6LP1PhFrFd6AlXvFRVhdGR5o76UsnabMuJ5tCeXOcjmaRrhTeIAjp1V NkL1S5nVrzTGyMoSa1voos8krSH8HJ8xQTniGSlzyqiSiJZfSW5di7m1qtZISpwWg+jk oZmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675890; x=1738280690; 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=VK0JABDJF/QMP4ClWDlwjdLf62KvnH3DnM23ZO9feXo=; b=XGFu4ScQj3z7Gd7+x8ksQiOpQKYsC+fCpJLQBSX4GRxd9sjw7wb2xpUvf+9Ws3N1QX MEKddg1jvpPwqXIc6HOG3V9TvF5RtYJ/C8lvXSUoyf66LoT3QKZhLTnFZ48TRAyEryx4 +9c8GEGtee1VoVEY4b/29FmguooemZn4soGOsdeZ3u9iasV+xkx6ctlhQGfD2iD7Rsfa qJnUyD/lbStCxdRBp3SHocHVt4VzeSw1WlI0/nKhfadbndFjywlIDNfXerXhRsX2KZGm ElQYK7O7zEMhKr5Dsz+ec1roUyBJ4lai4P0pi+hpoyiJ5nrTCUFCYmsFB28wADdJ5w8J rTkQ== X-Forwarded-Encrypted: i=1; AJvYcCWZbHIaz3cFk79E8zvXsykNcYlqdGZ6Z1fLE6B2t2iKocRW47ieskXv5oOt/oB5QyoziMg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0pw1+JWqMZrRlLIJcTQrxS5DZo5mmU7tDdtYXs6PGxD64Km4D ZYTU9dg7StPsJ28Mh/ALcA1iOQ1V3jifzh3KL20PzTc6ZaVxKDmlqNOrnwxf03Y= X-Gm-Gg: ASbGncvhNfBhqPVuu+0MTlhFsZYyIHrl4znPkeJxnoQ8v6rqAieFEZHuxR6kPqCpUQt 6wzRnu+iMSmF+9Ftq+Uqna6bzkKi9SFD/UHb5jLnNoEZut375HJL9KkNyzhfJQku0P7U1QSqAf7 W3+PMiLsf9fK3uojUPerA4JImBaEZIzXwOxVuV6n6K+LhKUHouV2t5O3zkgJkGSCB12q0u+e9H4 it33tS3jEL5drZkOSEY/asC9ievsPVCgNrzKGyzOITnZ7UmCXN8Inubpejd+7BavjXU6lw+Or7N YWuNRMYWFL9v7lEE3/5eswvHNMdVjxjKmD6fjXcm+InpM1HyHHTMTwg= X-Google-Smtp-Source: AGHT+IGSMRqXknIm20dxUVJ6YnBSj5qdwQEIsknPsDpqx1Ro9qYQKL2SDEG840LoeQHivalI7LVk8Q== X-Received: by 2002:a5d:64a1:0:b0:386:3262:28c6 with SMTP id ffacd0b85a97d-38bf5677c09mr24857649f8f.5.1737675889741; Thu, 23 Jan 2025 15:44:49 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c4161sm952291f8f.88.2025.01.23.15.44.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 06/20] accel/kvm: Remove unused 'system/cpus.h' header in kvm-cpus.h Date: Fri, 24 Jan 2025 00:44:00 +0100 Message-ID: <20250123234415.59850-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Missed in commit b86f59c7155 ("accel: replace struct CpusAccel with AccelOpsClass") which removed the single CpusAccel use. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/kvm/kvm-cpus.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h index b5435286e42..688511151c8 100644 --- a/accel/kvm/kvm-cpus.h +++ b/accel/kvm/kvm-cpus.h @@ -10,8 +10,6 @@ #ifndef KVM_CPUS_H #define KVM_CPUS_H -#include "system/cpus.h" - int kvm_init_vcpu(CPUState *cpu, Error **errp); int kvm_cpu_exec(CPUState *cpu); void kvm_destroy_vcpu(CPUState *cpu); From patchwork Thu Jan 23 23:44:01 2025 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: 13948763 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CC741D54FA for ; Thu, 23 Jan 2025 23:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675899; cv=none; b=thstzfDVd/qPnB0iNBTwoLyQRxUAE8WpOSS/Rd1W6fUyR66Coup8X4EoiarfjFeWOn4EtiDN6kLeJgtuGUyyKsf+YHnHPCyqR+fz0pfBMAmkkQreGxCJafZiJJBwEMqn3m8SdChxCJA+MABfoODe6PYLsv1y2s6XMFs6Eo4SDD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675899; c=relaxed/simple; bh=OjuBiXcltQCC4UOcRjFrzfcpX0XT12BM8UEVdW6DJfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RPANekj/LpGl0cA/DJwC8ENK5u+wOO6zKjd+X014UDaYLLgFmVVSoqYjwZIbkigkXkS5Lzu4iXEKu0G9T7n/LAoQdYJqCHX8/8MWoVLpzOTGOgkVRL0oSlX+sSojonm8ZycPVlSffFl5j/sVdl7NM7B2vXAeG2Vqgz2F5pmYArc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oAo3pyP6; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oAo3pyP6" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43621d27adeso10192155e9.2 for ; Thu, 23 Jan 2025 15:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675895; x=1738280695; 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=zgM0qO1a7TmnAaVr92PdlZQNV8dbDE9Lo8CXyhKvg/4=; b=oAo3pyP6IrJYhI4s7pMbGHX6iMegLiElESYNYsxmqb03G8zGRwJxoXVm3lr7tMwA1Y DgsgHVkkhtwUl+7hbSoBzzOKhMjTqF9CJz4DKh3pdmgw7mlxQXR+nWD4AbQX9oiM2bye wXzxyShVXIw/VEtcWFNduoRP6S1p2122utf22qYn4kSTxThkNrKGwHF6WN70KKMvRNfX M/d+DZ6HVg/JWH4XzYXd6N3z4T7vUkuJNczEW3vZ3yaozhRTtfpVK/12JsdMkex2N49l XDCCSsUKng82mJ4Ztt3olXjqLaWCHaF3zD3SELoGcvW3CK3N1p4KUHLsHRlbP9bv325Y 9d5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675895; x=1738280695; 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=zgM0qO1a7TmnAaVr92PdlZQNV8dbDE9Lo8CXyhKvg/4=; b=IWquMvOOTszn5E5orBtL5iiGQ5b4xglfoSO4QwqvjPro+m9SQRZB47nk4PYKeTSVAX vXFgBhL7Ih8J9YZxpuqev0gYu1kmj5dxo/AxGEvXnifrmt8GwawO6464rhYi/jUh9d03 OKQcWkJDYZ5b0NzLYRclitojd1AUUFmh0mtShircZG2A8Ju3zu3L/JtVNJhjUK0R0kB1 L3wupNjYB54pWqGdRrT4dHrLBgJlSE/bjNP/ZqWpjRIh6SvYoYqLmGEF4B6RPWRNXWHR foruSZSoR/2tI5ACLCfCf7QXqoQK7TwMIxoCh9xz4I7nOGhrM2B4oakt5mgCNfyzu1J9 LuUw== X-Forwarded-Encrypted: i=1; AJvYcCV2yFzkVUBOrUf7xAu3fuNlCdTRPdiVr/SM2DKUItHMScK3B621pOlACyavupZqA0bCQj4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxjux38Oy6ljnm9WZkUVHXOA/GUYZ8PB4ikKTu8vtS4y2YoKBYM BZOMlVboytHwt3zBLK51vaE+4MLWWZ6yhyTNUQZCj0q7SY/OnLPrxTQAlPRK20Y= X-Gm-Gg: ASbGncsdVRr7UvWNO3OyBFDxrrj/sc4K64Qa7YdVKAQBpHTkO20LCKAi0MQZrGCA89X XLppZLT4x63NUxX6RiLz7fiebNxyUk1MaHVGAnnsCa1WkM0Rzq0TRJ10LV2rEXyhAvgRmvPIPqQ fJv7Y2777FNo9VmfB2zE+Lean8BJZuqVfNbjJ1ZZHx+2D6vDsKCAkvA6vIlRZw1RXRwU/uDWw+c OtHMbWBFIE4qJ1FQ7aR9nScCPQuWXfrabs4b4JE1KrEl/48rAoNWtpbyZx7wu7Esq2q1g00BMni 2TsA3INA9fJWy1QZXPkFsiHFQ2D743XZaAeY9ML1xOFtOURnbuTuZl0= X-Google-Smtp-Source: AGHT+IFu3bGh+dR4gXvA0Xd23GoBCnM+yfw+G3EPNj4Vc2jg+fj1VnlHOFgKCDXygKj5XAozIyeBjA== X-Received: by 2002:a05:600c:a09:b0:435:9ed3:5688 with SMTP id 5b1f17b1804b1-438913f86dcmr267603485e9.18.1737675895459; Thu, 23 Jan 2025 15:44:55 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd48a94asm7141855e9.23.2025.01.23.15.44.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:44:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 07/20] accel/tcg: Build tcg_flags helpers as common code Date: Fri, 24 Jan 2025 00:44:01 +0100 Message-ID: <20250123234415.59850-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While cpu-exec.c is build for each target,tcg_flags helpers aren't target specific. Move them to cpu-exec-common.c to build them once. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/cpu-exec-common.c | 33 +++++++++++++++++++++++++++++++++ accel/tcg/cpu-exec.c | 32 -------------------------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 6ecfc4e7c21..100746d555a 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "exec/log.h" #include "system/cpus.h" #include "system/tcg.h" #include "qemu/plugin.h" @@ -25,6 +26,38 @@ bool tcg_allowed; +bool tcg_cflags_has(CPUState *cpu, uint32_t flags) +{ + return cpu->tcg_cflags & flags; +} + +void tcg_cflags_set(CPUState *cpu, uint32_t flags) +{ + cpu->tcg_cflags |= flags; +} + +uint32_t curr_cflags(CPUState *cpu) +{ + uint32_t cflags = cpu->tcg_cflags; + + /* + * Record gdb single-step. We should be exiting the TB by raising + * EXCP_DEBUG, but to simplify other tests, disable chaining too. + * + * For singlestep and -d nochain, suppress goto_tb so that + * we can log -d cpu,exec after every TB. + */ + if (unlikely(cpu->singlestep_enabled)) { + cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1; + } else if (qatomic_read(&one_insn_per_tb)) { + cflags |= CF_NO_GOTO_TB | 1; + } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + cflags |= CF_NO_GOTO_TB; + } + + return cflags; +} + /* exit the current TB, but without causing any exception to be raised */ void cpu_loop_exit_noexc(CPUState *cpu) { diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 8b773d88478..be2ba199d3d 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -148,38 +148,6 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) } #endif /* CONFIG USER ONLY */ -bool tcg_cflags_has(CPUState *cpu, uint32_t flags) -{ - return cpu->tcg_cflags & flags; -} - -void tcg_cflags_set(CPUState *cpu, uint32_t flags) -{ - cpu->tcg_cflags |= flags; -} - -uint32_t curr_cflags(CPUState *cpu) -{ - uint32_t cflags = cpu->tcg_cflags; - - /* - * Record gdb single-step. We should be exiting the TB by raising - * EXCP_DEBUG, but to simplify other tests, disable chaining too. - * - * For singlestep and -d nochain, suppress goto_tb so that - * we can log -d cpu,exec after every TB. - */ - if (unlikely(cpu->singlestep_enabled)) { - cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1; - } else if (qatomic_read(&one_insn_per_tb)) { - cflags |= CF_NO_GOTO_TB | 1; - } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { - cflags |= CF_NO_GOTO_TB; - } - - return cflags; -} - struct tb_desc { vaddr pc; uint64_t cs_base; From patchwork Thu Jan 23 23:44:02 2025 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: 13948764 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF34D1EE02F for ; Thu, 23 Jan 2025 23:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675905; cv=none; b=GtylmMZ5Z+ABmHJl5Aw/r5CXg7u+I3kaFt8WAPAlDJfMOvb1Z36DZp6g484C8jwL2cOX+rZd0ufVkuhovW1YhsrXqlz5Pv353CTa1i9xcKf2QHHe9DjaN2RSqyR8zwzAWi0AA0NAzFfso1T2/xhbHOBP7VsgeMPyF3eVbIfFW/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675905; c=relaxed/simple; bh=KjD/YB+iLnJV/kcWYEO7ZhZXOobErSx+6zpYDpvkb4c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dHXev2xnBcMSFkFqfoUlRcWiHZkBQERzgEebKbjkE8DLgfOGmBT6bX+vd7/gVmbL+tVO1B4De7TAu92A1FOUgJTETMhBj+U5PdOAGbhCz/+MPI1sDK0RiB0YXfnnADfenUtmRiNaH9DVXrEL6cPn0Oo7DYwkyHz4PXIkAvgCR5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cCI+q8H8; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cCI+q8H8" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-436345cc17bso11060485e9.0 for ; Thu, 23 Jan 2025 15:45:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675902; x=1738280702; 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=b+Ptx+X+/4qytTYw1NRizSw3Es7j283R5duCMBs45So=; b=cCI+q8H8FeKVshHUhcELE+hFKZyxffcDuzy1EKLEEE9bM2XhNEvu6wIETYGW/iXBPK dAf9i1u9C+HUZZwCt3Q/HBp2cMww+SAOel7DJbaQuQUK2V6YeX4CAEoCYdNohAp/pgBM mQRPcQM1lbSrcGCuO2epB4YaT2uPTZvckwz301YXz2Fs5jW8FWQdiBHvurQ/qQqxGFsK DVKD9vaG7lDaZjcyyWE7eVRcT/rCLurS/IH2/Ivh6nkiugwFV+yXt18piGnjwXrxTJr6 5/ov4X52EBWovsmSnviwDLMEWpCORiKWfQUw9AK27KXLyJTV2WI66ki+qoxqjEJCmSXJ kTUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675902; x=1738280702; 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=b+Ptx+X+/4qytTYw1NRizSw3Es7j283R5duCMBs45So=; b=HiKzrpNNchj2RiatRV7Bj+rnp3y1H+VA2AiFLTQzPcvNIiJbBwE3IubRTiEfcFktsL 57Z67lPL0l2rx2THhEvMbUd/FIuAXvtkkDy3cMR6DkaY1wXdVwu/cv3PWTzn3qO1DA6t 6R8gl68MFhU10bHBxqKHZjABVDfm1W1uXxjBnJiixR3Yv9QmqPKF7f9f78cvdRH36uck vqVTehekvlg+LJQho/EX4HdyNrOLcAhHntMt8w/WN7Q96dETQBYifcGRwZpaKxz7Yxxz yKhy4OH9oTgs1ph6V4FtRNOkRo0SeyXTfhmwvKZ54LV44X58EPg03myu5gJRZENBTeJV jmJw== X-Forwarded-Encrypted: i=1; AJvYcCW+GktLJiocVoRbXZMYZaB3nENPonr97KPUejtSEkD747qA8TDg9t3mTW19XhHkka1Dwjk=@vger.kernel.org X-Gm-Message-State: AOJu0YwvDHleJeS01kWV/f0pHNGvqyLGiY5AG7o6nMaeOJ/oJcE1NIb/ xX7FF3j1z0gi/0AuNexEhGUwlIDYYGoTXpYvf2UPgKhpzYB0ql/nsEMxvX3cAFc= X-Gm-Gg: ASbGncs4REKe86UnB4bA4dsMHQt6wgMoTO3PZIfqvAQ38ZVS+Bnnl0B5XoModFidlH/ xhio/S8nTeHuTJtkzpdh/CEnqfZWUY0+G69g2V885/SfJId1+cakHH9kfhr4Io5G6bOYem3zdDy NGCOfUlrg8z9SkIpvYvE7Uf/RqgeduJzuqSV2uMpDfssNBU9FmX9EUccZcBWOe4Daa87oHUgvoq Js/sDRizOJyXtbXUhcfwP9XU6UGOoCddpW96zTRDWGSJxA6f5YUsz6Soro5KDOsYZqheUpGHLUE gn1bGxXNNnEK/1wG/urmIe6WcXG4SUPu4nGBVTsUgGM+vlM1kb/Qtg4= X-Google-Smtp-Source: AGHT+IGYKHSOUWuv3Z35/L1kDcj+xko6P82ABEfwOu6IFt4mwFRNrLSNCMYz6YlSXtAKxKsobnoAmQ== X-Received: by 2002:a05:600c:46ca:b0:434:a367:2bd9 with SMTP id 5b1f17b1804b1-438913dfd7fmr310320675e9.14.1737675901922; Thu, 23 Jan 2025 15:45:01 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd54c0ecsm6510925e9.30.2025.01.23.15.44.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH 08/20] accel/tcg: Restrict tlb_init() / destroy() to TCG Date: Fri, 24 Jan 2025 00:44:02 +0100 Message-ID: <20250123234415.59850-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move CPU TLB related methods to accel/tcg/ scope, in "internal-common.h". Suggested-by: Richard Henderson Reviewed-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/internal-common.h | 11 +++++++++++ include/exec/exec-all.h | 16 ---------------- accel/tcg/user-exec-stub.c | 11 +++++++++++ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index c8d714256cb..d3186721839 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -53,6 +53,17 @@ TranslationBlock *tb_link_page(TranslationBlock *tb); void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); +/** + * tlb_init - initialize a CPU's TLB + * @cpu: CPU whose TLB should be initialized + */ +void tlb_init(CPUState *cpu); +/** + * tlb_destroy - destroy a CPU's TLB + * @cpu: CPU whose TLB should be destroyed + */ +void tlb_destroy(CPUState *cpu); + bool tcg_exec_realizefn(CPUState *cpu, Error **errp); void tcg_exec_unrealizefn(CPUState *cpu); diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index d9045c9ac4c..8eb0df48f94 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -29,16 +29,6 @@ #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) /* cputlb.c */ -/** - * tlb_init - initialize a CPU's TLB - * @cpu: CPU whose TLB should be initialized - */ -void tlb_init(CPUState *cpu); -/** - * tlb_destroy - destroy a CPU's TLB - * @cpu: CPU whose TLB should be destroyed - */ -void tlb_destroy(CPUState *cpu); /** * tlb_flush_page: * @cpu: CPU whose TLB should be flushed @@ -223,12 +213,6 @@ void tlb_set_page(CPUState *cpu, vaddr addr, hwaddr paddr, int prot, int mmu_idx, vaddr size); #else -static inline void tlb_init(CPUState *cpu) -{ -} -static inline void tlb_destroy(CPUState *cpu) -{ -} static inline void tlb_flush_page(CPUState *cpu, vaddr addr) { } diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index 4fbe2dbdc88..1d52f48226a 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "hw/core/cpu.h" #include "exec/replay-core.h" +#include "internal-common.h" void cpu_resume(CPUState *cpu) { @@ -18,6 +19,16 @@ void cpu_exec_reset_hold(CPUState *cpu) { } +/* User mode emulation does not support softmmu yet. */ + +void tlb_init(CPUState *cpu) +{ +} + +void tlb_destroy(CPUState *cpu) +{ +} + /* User mode emulation does not support record/replay yet. */ bool replay_exception(void) From patchwork Thu Jan 23 23:44:03 2025 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: 13948765 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5097C1D47CB for ; Thu, 23 Jan 2025 23:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675911; cv=none; b=iwb0dvvPkvBKmFATYpShmKgzkl2atu07RFPH1cqlS0bwglkc7olEU1FYYOzS6B+sr9A48GofUZKRt/JlYfCD727+BO+0leEN7FZ8IX92ojP99oGSabrho8FeJgXmlv7tDWpMkEvfmjfTYuHVKQvAeI4ZnXwGxRMvOH9DBzTE83k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675911; c=relaxed/simple; bh=PnRmCasp/kx/ikQRLih9mkoTj+hCY8Tgy0oIA1UoDng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HEId25MsBwZ1UsKvu7Dj2uIS75wouOl+RN3M/Jcqnu3jFPlTO2BrAuYv9fjGEaIHEgByLo14tloLM1lDPfqweSzlAQVTqoFzM1NZ8DS6GIbpIeDjB8vtyBwVk8tj6u+W/LPLiqGZbvl9nfQGis/QVVXGiqZJflQbEtnQD3IUPUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QpAa3vde; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QpAa3vde" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-385df53e559so1134052f8f.3 for ; Thu, 23 Jan 2025 15:45:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675908; x=1738280708; 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=yDFP15LbfYjBwdgoNtB1SUTPS+QYiGObjjbLDQKpiPc=; b=QpAa3vdeGmquHXJx6lNb9PY6nba9LJ7EX9XeSr8aEuW5IqpSfyVN3FGfmM3LrP1IbP gJE0VMt5TtfvC8Dsv0dVECnGV9fXxayfiMQJsdt1Rc1kem8Hb19It2XcWA3uG2YmwMKO iQFJRw0hfkryd98JDpg5IPXs/P1roo4g69vdRXldDPV07TlfHFkbg+xnzvHolHWkPPMS khXDAIx0rM4UgMGV0N4j555hq3Ge0CacsZxBUkhcH8V3jmQEOe9tPhubqx4yF7g1DHN4 gO7V6kUqfmuWd1A2RfiGR+9r1Wzc678rup5jTrs4dO0IiL6D6IWTgL0AQfoYLAaDf9ac mowQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675908; x=1738280708; 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=yDFP15LbfYjBwdgoNtB1SUTPS+QYiGObjjbLDQKpiPc=; b=h5O1qZtgB+fzfsxsfp3Dyz1j8HdKUdTToxZzC5DRcl0vhABESNeT/elLhoNuZZPc/e PYluzdojcLQsd7r+EerK+3RpwIQ/ImxpOaj7qEPDkVPHCVZvUNt+NFnhUQJuKL2PxGTF KXLXxJC2NLbKkJkC82iiukZcJKvgvrM5cYDwqHvd1lu+GxYO+b3iqVrTLLWWECBr0dz+ dtU3OS9BjsZYr81tAWFbc7TMLZLzvoeqowHhR8jfK2BlICMSe7agDTUHFGh9HqWvXena iygWXYIil92KzXc549TMM0lIOge8zj9KreCBOONhdap7Go+VCdhHRNq6lIxBmEJOsBfT J6sw== X-Forwarded-Encrypted: i=1; AJvYcCV36MsjX/Xk9MKQWc+KLdJFUxQF+nmkgwwecOfmfqBoPf8WsZ6Gw3clPdwxjanOdzPjHDU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9HdUx20X5D08lbQ4cXuaPnJwtlN4qOtwZWdukMh9e586sfDSW U1Mo1Of9yEmGGsiYibE6LnoA34C+Ix7v0zovtikVXxhvjopwwW2nTniI/ycDozA= X-Gm-Gg: ASbGncvDkw78SHom46FaL9litTDcooBvgyY9gNfPuxzllOgwb14LEBnpue8oS3i75R+ a1FKbLm5hizklO9sILuPCO1cY9EU8pvOtmb72znQBIAYq7efPBJUkfs1WkG2umDWAH9QLSD8j3D tQBCEqDEk/yhDxYNOnE+CElwok7lhZWx9CQIP0G6V3VHxnCnEWT0/gJfdBWCmt0rRr79/mfvV0K gEw0dN1aSQiajcqSpff4fq571YTYEAiNOFMLDBWf4/qKG6B/BGXO1T+JG2wj1C1VVxK67EIjcY9 sspxU18eoP3ZPjFszjl4SItIVyMv8UH3Ys3+RcqQQV0dOHMxavZT9vo= X-Google-Smtp-Source: AGHT+IF/y2rn8++eRXtfGXVV9eCNnufdJ4OAKshcVAU/XMr+be4nBaPjnThGR5Wf47h3eLbBgCoQsA== X-Received: by 2002:a05:6000:401f:b0:38c:2677:9bee with SMTP id ffacd0b85a97d-38c26779db8mr3711264f8f.15.1737675907708; Thu, 23 Jan 2025 15:45:07 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17630asm997952f8f.6.2025.01.23.15.45.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 09/20] accel/tcg: Restrict 'icount_align_option' global to TCG Date: Fri, 24 Jan 2025 00:44:03 +0100 Message-ID: <20250123234415.59850-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since commit 740b1759734 ("cpu-timers, icount: new modules") we don't need to expose icount_align_option to all the system code, we can restrict it to TCG. Since it is used as a boolean, declare it as 'bool' type. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/internal-common.h | 2 ++ include/system/cpus.h | 2 -- accel/tcg/icount-common.c | 2 ++ system/globals.c | 1 - 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index d3186721839..7ef620d9631 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -17,6 +17,8 @@ extern int64_t max_advance; extern bool one_insn_per_tb; +extern bool icount_align_option; + /* * 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. diff --git a/include/system/cpus.h b/include/system/cpus.h index 3d8fd368f32..1cffeaaf5c4 100644 --- a/include/system/cpus.h +++ b/include/system/cpus.h @@ -38,8 +38,6 @@ void resume_all_vcpus(void); void pause_all_vcpus(void); void cpu_stop_current(void); -extern int icount_align_option; - /* Unblock cpu */ void qemu_cpu_kick_self(void); diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c index b178dccec45..402d3e3f4e8 100644 --- a/accel/tcg/icount-common.c +++ b/accel/tcg/icount-common.c @@ -48,6 +48,8 @@ static bool icount_sleep = true; /* Arbitrarily pick 1MIPS as the minimum allowable speed. */ #define MAX_ICOUNT_SHIFT 10 +bool icount_align_option; + /* Do not count executed instructions */ ICountMode use_icount = ICOUNT_DISABLED; diff --git a/system/globals.c b/system/globals.c index 4867c93ca6b..b968e552452 100644 --- a/system/globals.c +++ b/system/globals.c @@ -48,7 +48,6 @@ unsigned int nb_prom_envs; const char *prom_envs[MAX_PROM_ENVS]; uint8_t *boot_splash_filedata; int only_migratable; /* turn it off unless user states otherwise */ -int icount_align_option; /* The bytes in qemu_uuid are in the order specified by RFC4122, _not_ in the * little-endian "wire format" described in the SMBIOS 2.6 specification. From patchwork Thu Jan 23 23:44:04 2025 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: 13948766 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 382FC1D47CB for ; Thu, 23 Jan 2025 23:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675919; cv=none; b=k5wwoW7dPYKv7EvXDSaxz+FdrzEr8YKpr+5oGuaOHyyKVROY+8ue4XCxignym4pK/jqbSjZLxeMnkd35yfB4sgW9LUGsTijWNWjd0xYLllHFqWy7E+utHsphw2jBZjN7b/+BGzocS+5OmlF99e9DuPKwJZEZXxxEVAy3d2jM37Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675919; c=relaxed/simple; bh=oXdIJ8BWpFBLQrsu2TO2PfuASUnzaO1uDGX9FR2X6e4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fiqvcdThCPAiApI4IrhZQLrifJxtzu4zLh+Dwa2GkOHLo5eq/iFoV7xKwO3Mo6S5HPXzBLQ893g5Ct71MbYHQ+DhY8bZO8IMNv/RKxop5Uf4BFB7Jg3M6lp9IodWPaEo0oEQTgpKD4u/bxZwucZ1LGhtrRNTq9QSKzwOOmEfJMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=X5ivLsLY; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X5ivLsLY" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4362f61757fso15532945e9.2 for ; Thu, 23 Jan 2025 15:45:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675913; x=1738280713; 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=9nZeRXAiaA5TpZm6lq5Kgnlq642/zMUBUZPLj6lypP8=; b=X5ivLsLYdxOTnG/w8ltvDoLi4XPOaueq8zWHVUtaKXnXYP8oh0sTdifxHBldPSBikx K0H1/RMwVSZlnijSG5lb5g6V3fwaMSjs1U5IUFsgbvsLcM9w4yMdJkMqehicwotiZGTS 0gdrpPRzPUlgj4uVqmT2nbbrGd/wGZkoHspusAdVHVF4G/Utxv42oMEuPBDD4NvBHeHQ 3/DUTvKssObpwKDjG8GK4jUSLdFgQevoRPij4Bznj9jcY6KJwxoH/mm8m+u0vF/oEg8Y pgwWBA8SIzsKcEvgOSZzKbB7y0zLuajmS07Re7wxppXgJxH0EjJmjIQfW1EpWlR1USRX Wy2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675913; x=1738280713; 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=9nZeRXAiaA5TpZm6lq5Kgnlq642/zMUBUZPLj6lypP8=; b=BwA3ZfJh6tqHWj7vhzNyTIZCeR1yLVYELq+0YK6lAcIDUI8ES4+3wfE7ikOh5NhheV 5nRI2LvrI3iK6X6Zu4UCBNZu9czmkaAfkGOqfyUSf7cP3MmKtyoW1UIKnmHmE9zFSyVj WAAP71rU8JMVzRtM+HucYEdH1fRXCheW3odRZH+2RUEJSPrBMhBnZa5efNfZxq+p+Oji Hy735+WOXMrTJWYcjHVjpe19Trb6UPNH/hNx1V5IORo4fW1NEagmNQFcS4C8WlNLmsvy TZejw4aljm5vAl9raHyAzncf0i9O5NTb6JQ1t/aaW0K0Q1lCxwGTiheBYxhuMoeHBQJz jxuw== X-Forwarded-Encrypted: i=1; AJvYcCVcc0V8WP2grdXOEXBrLVT/Kosci3wKFADGGGXH4EgSn6v71/NpmC9Mj0EWEa+gcwxSAFI=@vger.kernel.org X-Gm-Message-State: AOJu0YyMrwzCHJgd2q4uDejZj+mqFofgGn6E7OEbZdnf8tKqnKVUEdj2 Kd8ZPJCSZ372BHcTtXpkVtkIVWhjMsGomXYzffQSPCgTM9kDPT0uaxTuMq8zK6A= X-Gm-Gg: ASbGncuOqSXpxltw4XmAwEScbbWI6btFtVZSgRxgkMdKLQCFIQXG4BQlSNqJBU9VTZN PFPqrhsJCPiQrrS01mRlCCHI8ct0QSqB7/OkRZg14xgBt1llQ8u8PVIzJ873Z6ZSQFJsn1FE+w0 hrI78ayVrxod7SWLdstIlN10vPst2mXbReldZD2aiiJzVbu8vn7Sbjw1P+PaLOdxRKwIbrz2+9g DRlu0Pq6pV0BmmIown5F9fU78FGZUYB6m8xLbMIYx6EB9mKmjFw76lvslZXhBxWXBs7vxc0EVAC N/pPxCEgXKANszud02PjBRjVAJAhCqQwn8Q2luO9xe+3nVFwyFN+74ysp3cYXoWWlA== X-Google-Smtp-Source: AGHT+IEDiDQdxrx2jB8os0igTQ7OuBNE672qZpSpts43JKLj6+qBPVdV+5rplNMJaEPLV2MbkLotbw== X-Received: by 2002:a05:600c:4713:b0:436:9227:915 with SMTP id 5b1f17b1804b1-438913caa3cmr222825345e9.9.1737675913369; Thu, 23 Jan 2025 15:45:13 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd54c04bsm6412735e9.27.2025.01.23.15.45.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 10/20] accel/tcg: Rename 'hw/core/tcg-cpu-ops.h' -> 'accel/tcg/cpu-ops.h' Date: Fri, 24 Jan 2025 00:44:04 +0100 Message-ID: <20250123234415.59850-11-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 TCGCPUOps structure makes more sense in the accelerator context rather than hardware emulation. Move it under the accel/tcg/ scope. Mechanical change doing: $ sed -i -e 's,hw/core/tcg-cpu-ops.h,accel/tcg/cpu-ops.h,g' \ $(git grep -l hw/core/tcg-cpu-ops.h) Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- MAINTAINERS | 2 +- include/{hw/core/tcg-cpu-ops.h => accel/tcg/cpu-ops.h} | 0 accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/cputlb.c | 2 +- accel/tcg/translate-all.c | 2 +- accel/tcg/user-exec.c | 2 +- accel/tcg/watchpoint.c | 2 +- bsd-user/signal.c | 2 +- hw/mips/jazz.c | 2 +- linux-user/signal.c | 2 +- system/physmem.c | 2 +- target/alpha/cpu.c | 2 +- target/arm/cpu.c | 2 +- target/arm/tcg/cpu-v7m.c | 2 +- target/arm/tcg/cpu32.c | 2 +- target/arm/tcg/mte_helper.c | 2 +- target/arm/tcg/sve_helper.c | 2 +- target/avr/cpu.c | 2 +- target/avr/helper.c | 2 +- target/hexagon/cpu.c | 2 +- target/hppa/cpu.c | 2 +- target/i386/tcg/tcg-cpu.c | 2 +- target/loongarch/cpu.c | 2 +- target/m68k/cpu.c | 2 +- target/microblaze/cpu.c | 2 +- target/mips/cpu.c | 2 +- target/openrisc/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/tcg/tcg-cpu.c | 2 +- target/rx/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/s390x/tcg/mem_helper.c | 2 +- target/sh4/cpu.c | 2 +- target/sparc/cpu.c | 2 +- target/tricore/cpu.c | 2 +- target/xtensa/cpu.c | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) rename include/{hw/core/tcg-cpu-ops.h => accel/tcg/cpu-ops.h} (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 7be3d8f431a..fa46d077d30 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -175,7 +175,7 @@ F: include/exec/helper-info.c.inc F: include/exec/page-protection.h F: include/system/cpus.h F: include/system/tcg.h -F: include/hw/core/tcg-cpu-ops.h +F: include/accel/tcg/cpu-ops.h F: host/include/*/host/cpuinfo.h F: util/cpuinfo-*.c F: include/tcg/ diff --git a/include/hw/core/tcg-cpu-ops.h b/include/accel/tcg/cpu-ops.h similarity index 100% rename from include/hw/core/tcg-cpu-ops.h rename to include/accel/tcg/cpu-ops.h diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index be2ba199d3d..8ee76e14b0d 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -22,7 +22,7 @@ #include "qapi/error.h" #include "qapi/type-helpers.h" #include "hw/core/cpu.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "trace.h" #include "disas/disas.h" #include "exec/cpu-common.h" @@ -39,7 +39,7 @@ #include "exec/replay-core.h" #include "system/tcg.h" #include "exec/helper-proto-common.h" -#include "tb-jmp-cache.h" +//#include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" #include "tb-internal.h" diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b4ccf0cdcb7..d68401b35c3 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "exec/exec-all.h" #include "exec/page-protection.h" #include "exec/memory.h" diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index d4189c73860..786e2f6f1a7 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -58,7 +58,7 @@ #include "system/cpu-timers.h" #include "system/tcg.h" #include "qapi/error.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 0561c4f6dc7..c4454100ad7 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -17,7 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg.h" diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index af57d182d5b..40112b2b2e7 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -26,7 +26,7 @@ #include "tb-internal.h" #include "system/tcg.h" #include "system/replay.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "hw/core/cpu.h" #include "internal-common.h" diff --git a/bsd-user/signal.c b/bsd-user/signal.c index b4e1458237a..088fe775c05 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -28,7 +28,7 @@ #include "gdbstub/user.h" #include "signal-common.h" #include "trace.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "host-signal.h" /* target_siginfo_t must fit in gdbstub's siginfo save area. */ diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index c89610639a9..1700c3765de 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -50,7 +50,7 @@ #include "qemu/error-report.h" #include "qemu/help_option.h" #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #endif /* CONFIG_TCG */ #include "cpu.h" diff --git a/linux-user/signal.c b/linux-user/signal.c index 087c4d270e4..b9e9b0a6c03 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -21,7 +21,7 @@ #include "qemu/cutils.h" #include "gdbstub/user.h" #include "exec/page-protection.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include #include diff --git a/system/physmem.c b/system/physmem.c index c76503aea82..8638f8817e6 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -28,7 +28,7 @@ #include "qemu/lockable.h" #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #endif /* CONFIG_TCG */ #include "exec/exec-all.h" diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index e1b898e5755..da21f99a6ac 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -220,7 +220,7 @@ static const struct SysemuCPUOps alpha_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps alpha_tcg_ops = { .initialize = alpha_translate_init, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index dc0231233a6..d59433e33fb 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -29,7 +29,7 @@ #include "cpu.h" #ifdef CONFIG_TCG #include "exec/translation-block.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #endif /* CONFIG_TCG */ #include "internals.h" #include "cpu-features.h" diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 03acdf83e00..29a41fde694 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "internals.h" #if !defined(CONFIG_USER_ONLY) diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c index 2ad21825255..c5913665d12 100644 --- a/target/arm/tcg/cpu32.c +++ b/target/arm/tcg/cpu32.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "internals.h" #include "target/arm/idau.h" #if !defined(CONFIG_USER_ONLY) diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c index f72ce2ae0d4..5d6d8a17ae8 100644 --- a/target/arm/tcg/mte_helper.c +++ b/target/arm/tcg/mte_helper.c @@ -31,7 +31,7 @@ #endif #include "exec/cpu_ldst.h" #include "exec/helper-proto.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "qapi/error.h" #include "qemu/guest-random.h" #include "mte_helper.h" diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index d0865dece35..2268fcd41b0 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -28,7 +28,7 @@ #include "tcg/tcg.h" #include "vec_internal.h" #include "sve_ldst_internal.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #ifdef CONFIG_USER_ONLY #include "user/page-protection.h" #endif diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 8a126ff3222..5a0e21465e5 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -203,7 +203,7 @@ static const struct SysemuCPUOps avr_sysemu_ops = { .get_phys_page_debug = avr_cpu_get_phys_page_debug, }; -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps avr_tcg_ops = { .initialize = avr_cpu_tcg_init, diff --git a/target/avr/helper.c b/target/avr/helper.c index 345708a1b39..9ea6870e44d 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -22,7 +22,7 @@ #include "qemu/log.h" #include "qemu/error-report.h" #include "cpu.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "exec/exec-all.h" #include "exec/page-protection.h" #include "exec/cpu_ldst.h" diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 0b7fc98f6ce..238e63bcea4 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -321,7 +321,7 @@ static void hexagon_cpu_init(Object *obj) { } -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hexagon_tcg_ops = { .initialize = hexagon_translate_init, diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index b0bc9d35e4c..f2441d4d7fb 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -235,7 +235,7 @@ static const struct SysemuCPUOps hppa_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hppa_tcg_ops = { .initialize = hppa_translate_init, diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 14ee038079a..f09ee813ac9 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -105,7 +105,7 @@ static bool x86_debug_check_breakpoint(CPUState *cs) } #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps x86_tcg_ops = { .initialize = tcg_x86_init, diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index d611a604704..ecfd6edefbe 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -813,7 +813,7 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags) } #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps loongarch_tcg_ops = { .initialize = loongarch_translate_init, diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 41dfdf58045..5eac4a38c62 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -547,7 +547,7 @@ static const struct SysemuCPUOps m68k_sysemu_ops = { }; #endif /* !CONFIG_USER_ONLY */ -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps m68k_tcg_ops = { .initialize = m68k_tcg_init, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index f114789abd8..13d194cef88 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -419,7 +419,7 @@ static const struct SysemuCPUOps mb_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps mb_tcg_ops = { .initialize = mb_tcg_init, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 47cd7cfdcef..0b267d2e507 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -544,7 +544,7 @@ static const Property mips_cpu_properties[] = { }; #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps mips_tcg_ops = { .initialize = mips_tcg_init, .translate_code = mips_translate_code, diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index b7bab0d7abf..0669ba2fd10 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -232,7 +232,7 @@ static const struct SysemuCPUOps openrisc_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps openrisc_tcg_ops = { .initialize = openrisc_translate_init, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index c05c2dc42dc..ed85448bc7d 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7427,7 +7427,7 @@ static const struct SysemuCPUOps ppc_sysemu_ops = { #endif #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps ppc_tcg_ops = { .initialize = ppc_translate_init, diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 0a137281de1..e40c8e85b26 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -31,7 +31,7 @@ #include "qemu/error-report.h" #include "qemu/log.h" #include "hw/core/accel-cpu.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "tcg/tcg.h" #ifndef CONFIG_USER_ONLY #include "hw/boards.h" diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 8c50c7a1bc8..d237d007023 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -192,7 +192,7 @@ static const struct SysemuCPUOps rx_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps rx_tcg_ops = { .initialize = rx_translate_init, diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 97d41c23de7..3bea014f9ee 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -322,7 +322,7 @@ static const Property s390x_cpu_properties[] = { #endif #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" void cpu_get_tb_cpu_state(CPUS390XState *env, vaddr *pc, uint64_t *cs_base, uint32_t *pflags) diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index 32717acb7d1..4ce7aa8127f 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -28,7 +28,7 @@ #include "exec/exec-all.h" #include "exec/page-protection.h" #include "exec/cpu_ldst.h" -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" #include "qemu/int128.h" #include "qemu/atomic128.h" diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 24a22724c61..e3c2aea1a64 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -247,7 +247,7 @@ static const struct SysemuCPUOps sh4_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps superh_tcg_ops = { .initialize = sh4_translate_init, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index fbd38ec334a..e3b46137178 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -992,7 +992,7 @@ static const struct SysemuCPUOps sparc_sysemu_ops = { #endif #ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps sparc_tcg_ops = { .initialize = sparc_tcg_init, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 95202fadbfd..eb794674c8d 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -168,7 +168,7 @@ static const struct SysemuCPUOps tricore_sysemu_ops = { .get_phys_page_debug = tricore_cpu_get_phys_page_debug, }; -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps tricore_tcg_ops = { .initialize = tricore_tcg_init, diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 4eb699d1f45..efbfe73fcfb 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -228,7 +228,7 @@ static const struct SysemuCPUOps xtensa_sysemu_ops = { }; #endif -#include "hw/core/tcg-cpu-ops.h" +#include "accel/tcg/cpu-ops.h" static const TCGCPUOps xtensa_tcg_ops = { .initialize = xtensa_translate_init, From patchwork Thu Jan 23 23:44:05 2025 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: 13948767 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BBAD1D47C6 for ; Thu, 23 Jan 2025 23:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675924; cv=none; b=IAfu/FSrYH9GzU7n66seFINFMOk1mcRjjQ5ngyeFktRQuLhN03d1fzQraZY5BD98aoVVJ0x6uGZJiVEvPZ3BzUXTKkl3i2qzmrBM6kMU82m6SIetuOzBLMD8Eo+fNEdk4cLN8eGqXYNBYZ1VdiaB8WEkODAinlUTqtE9ItAssa4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675924; c=relaxed/simple; bh=crQc+e5YegHMpgjh7hJOPVwNQ1Or/+MQ3o6kdJ1gfVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MQZdPrmc2MsFgWRO4umPPmjQfaPdGLDca5XdE3cq5waDX3YSgBKj6LEGXZU6mWJx7wUm5IwncrJNQTmBn5slrHEVQcdkMsbB38SqE8uvge77d98ORUPhnlMgagYgUanhnxOdT8gQ6VxJFmbb8QwgLrVlBM4nP1y0xnDKLIHabt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UJigkRKL; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UJigkRKL" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-436341f575fso16144075e9.1 for ; Thu, 23 Jan 2025 15:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675920; x=1738280720; 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=KLiVQy6/uYr9fS/vE5notUMei/mcFiOsSDRea34SIY0=; b=UJigkRKLG4rbWV+LTtfV6kg2a1JAuaSZ84U1mb0Phis2AwhNc9sUuw+bPknyOPQOHF HFfX6OLsIhq8f3wMqfVIO0cqpHT0kBLmnzRNT1xYdoP7awmFZRXnWTsj7EdgqmZW2jR0 YpWtYFtCJZQPBNSaegFjdxCBeDwVEdtvdK1p5wkYI7D4KxGxXbf5oKQGANTr4FQniJ5Y RsSM6mX/OLWPlQ9ago3ANRuBhed/TRTlEeTEDAqdzFZzpaYPQvYSoHO6qUaexzUzSYA+ 1qGz8DGmUg57+Gls6QUGa+H2+94y6vfcBIubKXOWwl1NFxkdA52dS8CFZc3B2d88BXAV OOag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675920; x=1738280720; 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=KLiVQy6/uYr9fS/vE5notUMei/mcFiOsSDRea34SIY0=; b=TMJOvXy6k7vSlcUcgrNjR4tk/WmUEvt6+GH+iVlB1W0fqxLSUj5s6aqHPsDl0bDk2i u5VxpfmLymdJR2ww//E9O1k6hBLU7ZI44RqRHEa7+IyGqnR+fCRtXRIpAX+aqZYjj/rU PsJBTT5gPhjybxXPQAvReyu5gceLFsfJ3jEYF4WLXreGgWoHCoalmTgqujKQeDwu5d8a 0ZgrhOtFMKUsy5E1gkUlM+z6+kYzHhXFK/e4YChR+gn3kmw2fywtBzxZ9tS7RQWQxgiB T3DzUUTiaQNoVVm8fprvXQ9NuDB3D5aIfuGgrTmcg3FNNL6VLes6VxlLrBoaKtseZwIq gHlA== X-Forwarded-Encrypted: i=1; AJvYcCUknHEI3LjskVUKjeTdknHuvPeVO3uu6iZwnaSh7ZiktrmGUfvvLPt0Mv7Ox3u4rgRY7U0=@vger.kernel.org X-Gm-Message-State: AOJu0YzQUwCl+qH4NKv8g3WC7bCbiyg1rP590fbDh5Ooc0FSoF+Gtihm wMl6swGcUwQq92qla2Zh3tbNE1OOl86n3Zz+189VuntKNYj5h1dIdsVor2DD654= X-Gm-Gg: ASbGncsO1KkA0I4Bd3dRmbOO6yvguhy7hZakz/O6Qc902Ub+k3Ov9WN+nkov8ANzrbT JFJkrXYwCFY1o8/RxLSUwYhmHaPYVpxOHqiz6bIxFugJdsewuQIKYQ5oTMoU1GE9fzt9MqA8bMz h+dFyqLjvM14w+t7NYT780WNZx7XnntERqnqLLgT25mlyFEqAXO8dAVSTGfWbzQq1REIGjkK3FD AqDFACvTcqMO3F3mMX+Yv/iuE+5KWtaiSvDxbyq4d9qv/WsHTDt43r6OO0I9PxKFtxoCAr0AZSZ GlyrzCnzf8HtJW9HJ/heliqsPK0V3BoEYQJhzD54vcfqO1Rybttrazk= X-Google-Smtp-Source: AGHT+IHCUhXEKn4F81kx6ZpXqs9faqGpJN5W9Mj/EUJJpXYvZE3+gYqYLTjnf0hJ5kDL6XLUxlFm9g== X-Received: by 2002:a05:600c:1913:b0:434:f4fa:83c4 with SMTP id 5b1f17b1804b1-43891453fa7mr280858325e9.29.1737675919693; Thu, 23 Jan 2025 15:45:19 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd54c0f7sm6499935e9.28.2025.01.23.15.45.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 11/20] accel: Rename 'hw/core/accel-cpu.h' -> 'accel/accel-cpu-target.h' Date: Fri, 24 Jan 2025 00:44:05 +0100 Message-ID: <20250123234415.59850-12-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 AccelCPUClass is for accelerator to initialize target specific features of a vCPU. Not really related to hardware emulation, rename "hw/core/accel-cpu.h" as "accel/accel-cpu-target.h" (using the explicit -target suffix). More importantly, target specific header often access the target specific definitions which are in each target/FOO/cpu.h header, usually included generically as "cpu.h" relative to target/FOO/. However, there is already a "cpu.h" in hw/core/ which takes precedence. This change allows "accel-cpu-target.h" to include a target "cpu.h". Mechanical change doing: $ git mv include/hw/core/accel-cpu.h \ include/accel/accel-cpu-target.h $ sed -i -e 's,hw/core/accel-cpu.h,accel/accel-cpu-target.h,' \ $(git grep -l hw/core/accel-cpu.h) and renaming header guard 'ACCEL_CPU_TARGET_H'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- MAINTAINERS | 2 +- include/{hw/core/accel-cpu.h => accel/accel-cpu-target.h} | 4 ++-- accel/accel-target.c | 2 +- cpu-target.c | 2 +- target/i386/hvf/hvf-cpu.c | 2 +- target/i386/kvm/kvm-cpu.c | 2 +- target/i386/tcg/tcg-cpu.c | 2 +- target/ppc/kvm.c | 2 +- target/riscv/kvm/kvm-cpu.c | 2 +- target/riscv/tcg/tcg-cpu.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) rename include/{hw/core/accel-cpu.h => accel/accel-cpu-target.h} (95%) diff --git a/MAINTAINERS b/MAINTAINERS index fa46d077d30..e4521852519 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -499,7 +499,7 @@ R: Paolo Bonzini S: Maintained F: include/qemu/accel.h F: include/system/accel-*.h -F: include/hw/core/accel-cpu.h +F: include/accel/accel-cpu-target.h F: accel/accel-*.c F: accel/Makefile.objs F: accel/stubs/Makefile.objs diff --git a/include/hw/core/accel-cpu.h b/include/accel/accel-cpu-target.h similarity index 95% rename from include/hw/core/accel-cpu.h rename to include/accel/accel-cpu-target.h index 24dad45ab9e..0a8e518600d 100644 --- a/include/hw/core/accel-cpu.h +++ b/include/accel/accel-cpu-target.h @@ -8,8 +8,8 @@ * See the COPYING file in the top-level directory. */ -#ifndef ACCEL_CPU_H -#define ACCEL_CPU_H +#ifndef ACCEL_CPU_TARGET_H +#define ACCEL_CPU_TARGET_H /* * This header is used to define new accelerator-specific target-specific diff --git a/accel/accel-target.c b/accel/accel-target.c index 08626c00c2d..09c1e1053e0 100644 --- a/accel/accel-target.c +++ b/accel/accel-target.c @@ -27,7 +27,7 @@ #include "qemu/accel.h" #include "cpu.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #ifndef CONFIG_USER_ONLY #include "accel-system.h" diff --git a/cpu-target.c b/cpu-target.c index 75501a909df..f97f3a14751 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -44,7 +44,7 @@ #include "exec/tb-flush.h" #include "exec/translation-block.h" #include "exec/log.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #include "trace/trace-root.h" #include "qemu/accel.h" diff --git a/target/i386/hvf/hvf-cpu.c b/target/i386/hvf/hvf-cpu.c index 560b5a05940..b5f4c80028f 100644 --- a/target/i386/hvf/hvf-cpu.c +++ b/target/i386/hvf/hvf-cpu.c @@ -14,7 +14,7 @@ #include "system/system.h" #include "hw/boards.h" #include "system/hvf.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #include "hvf-i386.h" static void hvf_cpu_max_instance_init(X86CPU *cpu) diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 1bda403f88b..6269fa80452 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -15,7 +15,7 @@ #include "hw/boards.h" #include "kvm_i386.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" static void kvm_set_guest_phys_bits(CPUState *cs) { diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index f09ee813ac9..b8aff825eec 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -21,7 +21,7 @@ #include "cpu.h" #include "helper-tcg.h" #include "qemu/accel.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #include "exec/translation-block.h" #include "tcg-cpu.h" diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 966c2c65723..216638dee40 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -49,7 +49,7 @@ #include "elf.h" #include "system/kvm_int.h" #include "system/kvm.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #include CONFIG_DEVICES diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 23ce7793594..7e4443c5bda 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -32,7 +32,7 @@ #include "system/kvm_int.h" #include "cpu.h" #include "trace.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #include "hw/pci/pci.h" #include "exec/memattrs.h" #include "exec/address-spaces.h" diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index e40c8e85b26..79345e4b89d 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -30,7 +30,7 @@ #include "qemu/accel.h" #include "qemu/error-report.h" #include "qemu/log.h" -#include "hw/core/accel-cpu.h" +#include "accel/accel-cpu-target.h" #include "accel/tcg/cpu-ops.h" #include "tcg/tcg.h" #ifndef CONFIG_USER_ONLY From patchwork Thu Jan 23 23:44:06 2025 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: 13948768 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57CBD1D356E for ; Thu, 23 Jan 2025 23:45:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675928; cv=none; b=iEAtWtSJ5j8e/BDR18tMahxrbZUlLDJburux4Pkkvd0juVhDwZlGyMtgDuiIy08xdznWTsdabTIZEDe39r14PAojlDwJq6x5LHdreYHiaQ2/8Z0bbiLJX4FNZfmtTYAoco1vseWfU2zDO0ysdV+pMC+clsSyzdYG0sQh2WEPV3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675928; c=relaxed/simple; bh=O//wGbDAj0zhzP0KpRtF1Gd7nMmSH81vAKE65V5ueJ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DXDCcM8R0WMY7Vn+YkmUDNPgIracWt6LRRI29wIuSrGAKhXqRwU+yNctRN2CqF9a5Ko1CFKeWIOPu2eVmlbtPM3qjoeCKPejwKjQRMJwFWpqFwjMU+YG4dpO8OlkeRk5aIaqfHnLtMz0VuVAMPVwikNDsTLG36l9UNFYTo83xOA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HADvKWue; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HADvKWue" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43634b570c1so10895935e9.0 for ; Thu, 23 Jan 2025 15:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675924; x=1738280724; 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=MdlpzTogAHHu3L1/GbHJ1cNEJlm92RpTH1AYDuj/6CU=; b=HADvKWueOmViq/oN3yzRexSfQ0Um2Q0uV40o8eJG2idgLSZ7jrDQ4dbdOipqNwpbjO KTpFa7LB77zzHSFVRfAdpYRFTS6fbR4Gkh1HhTwcRIQdSgVAnMmCg0sEShkxF7IB8NQg 1HC7hSGq1GjJSTbvSCGpu0Hif+/83kv1AKEzk0WvSJP8ueGUfZISSsUUBQILN6CVR8li F8Lma3lOJFdWnQ47PMEDod+oU/i87LTSuebnM/rPSYpF0aXLr8xhcQE3D+b6Avjljifu QgFr1IsEcRxmOPTqhw/OV3orMh9IS/T2m07/1POByu7NN7XqKQ9t/Qv6T2cFM0dXFaly 8RZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675924; x=1738280724; 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=MdlpzTogAHHu3L1/GbHJ1cNEJlm92RpTH1AYDuj/6CU=; b=aDyxUXpDEcOyDQkOh7C2gS6omLGDiML+PESoliOssrnImcMZpJz6U3Na3fW1NzrgCM akBgMtqZ6KOKPuDcSv9BxYuQ1El8mI+qc7Viu58vFVm9YrDpGAzszP0cacEnBA0Ru6zd rEsmsMAtnaBi94ebxRmBp6Km8TovijejuUsT/tpWixfc8HcO8TJUHP8XGyLfH6xQRX6V 1WJ08uZ7X35I8gpVoHCJy0rxESZPQXi7UJVVtUjVhjFg7Nl7RtIpxDLf+N5HLpbFuu6R EmyKAE+0tHS2uxjASN3Azq/maIFDs3M2c0k4YaZbb1mzodYwbT4QuBntcgm3031vh/ht RBFw== X-Forwarded-Encrypted: i=1; AJvYcCWw2tYxJCJnDHLixpuO4KEWJZh0kGCc3YhEa/y7EAUGp7KTwTupFLMz08BhdM6J38ysDjA=@vger.kernel.org X-Gm-Message-State: AOJu0YwixH9gtf9NzEbFG/Sb29ZAW1q0/hDcs02HFnJ12VbJtZB5iKsq NHq8UXh8EIEPvBnzojTtYI6pn92Qpj1ecvFm6Iqd6Jf/td5XckQDMZsb24EReyA= X-Gm-Gg: ASbGnctceoV2AVMCOZwugPie/GGGpE8vvp9rIQlIio7sIS3l5hH0g9MDH9x2qYZP2RR n64Cid5arfKTzVI6FJ1evSoF1Dvi/zE1odxo7Xk2w53Kjsyxc0bsv2++lrgpM4Es54TPw8EnZve iuB4yztHTHf2aXOZ3nIBTAyypUfD8600eNYU3MtpeNSy1kggTQuo/CLQZgdqt+2+xrjlWkv2070 o/GoftZx8iatZMBMIwwe/qvbGTenlo1HuEs0lSXl1GC7lJk6fY01WtDwOUxvebw5/3BJWFKo/lQ 0jx1Mair2yIzf8x/0QMxO/rVIhhkfSVs24hzvtRFy+oQ29sYDE/yUK8= X-Google-Smtp-Source: AGHT+IEwKoXpxcAtZxGgBrKoty0PAI7DEzj3vUSJHkmHg5BnQeEwYri/vD7fXqCVh16ykXZTkiP5lQ== X-Received: by 2002:a05:600c:1987:b0:436:faf1:9da with SMTP id 5b1f17b1804b1-438913c68ebmr255744445e9.2.1737675924510; Thu, 23 Jan 2025 15:45:24 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4fa416sm6932195e9.6.2025.01.23.15.45.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 12/20] accel/accel-cpu-target.h: Include missing 'cpu.h' header Date: Fri, 24 Jan 2025 00:44:06 +0100 Message-ID: <20250123234415.59850-13-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 CPU_RESOLVING_TYPE is declared per target in "cpu.h". Include it (along with "qom/object.h") to avoid when moving code around: include/accel/accel-cpu-target.h:26:50: error: expected ')' 26 | DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU) | ^ include/accel/accel-cpu-target.h:23:33: note: expanded from macro 'TYPE_ACCEL_CPU' 23 | #define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE | ^ include/accel/accel-cpu-target.h:26:1: note: to match this '(' 26 | DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU) | ^ include/qom/object.h:196:14: note: expanded from macro 'DECLARE_CLASS_CHECKERS' 196 | { return OBJECT_GET_CLASS(ClassType, obj, TYPENAME); } \ | ^ include/qom/object.h:558:5: note: expanded from macro 'OBJECT_GET_CLASS' 558 | OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name) | ^ include/qom/object.h:544:74: note: expanded from macro 'OBJECT_CLASS_CHECK' 544 | ((class_type *)object_class_dynamic_cast_assert(OBJECT_CLASS(class), (name), \ | ^ Signed-off-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson --- include/accel/accel-cpu-target.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/accel/accel-cpu-target.h b/include/accel/accel-cpu-target.h index 0a8e518600d..37dde7fae3e 100644 --- a/include/accel/accel-cpu-target.h +++ b/include/accel/accel-cpu-target.h @@ -20,6 +20,9 @@ * subclasses in target/, or the accel implementation itself in accel/ */ +#include "qom/object.h" +#include "cpu.h" + #define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE #define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU) typedef struct AccelCPUClass AccelCPUClass; From patchwork Thu Jan 23 23:44:07 2025 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: 13948769 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E87681D514A for ; Thu, 23 Jan 2025 23:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675935; cv=none; b=K4jsaP/5PF/hoMoXPl+hTJnPEO5Qxbzck9ALBTyUpLM9dSAaEosoqDISiitbFx7TNpZy52wRM5Fuu8yglHr4L6ClmuQVptwbkfmph4VHvO7KPqUuLfMMq7h34joLhZOWzyEGfHzr/0oWzGMDEBXM6AJ1tWHPiMerwhQ5pEeZVUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675935; c=relaxed/simple; bh=Fn+sKVauGezihA42RNfMpurRkUcUgeItpWd87gdoiYY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y433WcJv6ylrGFj1DMYzjffrsrUgOEXay6AW3m/5xXKhtk9P1zy9VlkFgbgoZcppYIoQdMi0SwT7llfTUVW3Kb9XUL47MbUYB1v9A71ghRwsiRdmhqJbBAuRUgBi8SjehK+sBwvEvBKUqwQJRrtbPH72JSL7FuINJ2w3q9TwL7w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LRICaLzt; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LRICaLzt" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-437a92d7b96so15375375e9.2 for ; Thu, 23 Jan 2025 15:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675930; x=1738280730; 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=zGO8rj66FytAuOx0HD2g/yFD3gx++HeKfsSZtvEWB0o=; b=LRICaLztZgGumRgU2LAUvnJ9e3B021VWPgkUPUMgdEwzPmL+31uBTeUXGwm9cgv/yG 2FW3qHv0PjvwgUQtRnYQEhHJSFy4GbFkJoPZo2wdiRAhKKnP2s5w99X3T88a65btTarA AKM7F66ibtv2ceejSuS4krksy54z81erApxuHGh0bZ8pB+Rfzn6pUcp3+6t2NyPMoFKt it6PvdYVX0v9QAizag7BQh2fNUYwwqeKMdyQjAE/ZATGJ7GBbCDMBdA/1QRY71u8Ttqm PngBTa3nuIhr7rbtzJ2ZUAvry3V7in4w6OjIfqVHVg+A/1V8HJeeLC0NvhlmKU4OUr+a U3eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675930; x=1738280730; 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=zGO8rj66FytAuOx0HD2g/yFD3gx++HeKfsSZtvEWB0o=; b=oOV98yViWEKq0y8bt+gmoJYDWlXfHr851lIgoEVKH1HL76+C9rrF1TwLefIeI3LNHT 7Hkhra3j7A8nJqwYoTkf0ByoXR8IrGC9sXtbYrvmcMP2DMMyv7Hqf02YckZRMRA63xo8 mYpTANYnJ922KMNcBc1xJphymz7uERoaOru5OzJM6jwDB874jyUdn0PiE4x+5hgYh2AD l9VkSB4DrV/SfgmGnFfl6e3S3isSrNTo169iiI4DdjSB8q+1RefDDoIvOEdUhz6JMCIo Np/r0qskHlSEcqwurkBz2gp83yG/XLJ7pR5RkNC2tpF0/NfGRqPBd7saARfAJnjFRQrn JK8A== X-Forwarded-Encrypted: i=1; AJvYcCXwGHccpnnYkYXhVnDyaGxCRak/r94e4bFJPqzr1NWFTkAE1F/MwMRRDNz4t16vFDiHHC0=@vger.kernel.org X-Gm-Message-State: AOJu0YzFezO4QPby9Z9QO47U4YuZkswKF7TmA6IVZwwui4SmF2JTfxS4 Z1MxoOFLmAlr9SONvMI1bJ3LsOI3UV3HOWFfm8gqMHQVl0WMNyqFdXaLS2BX3mY= X-Gm-Gg: ASbGncstR1zCefp6qp8yHoLUCl8UXSj4vhUIHTIaEI+DlWfOLCTxirzt9H2hAKfDao+ WPla9AU7Dz2rWOJkCTLRPY6+HpsH4JTnKKNByr9VsJHnmtNljx9sKtXwbB7gPZxI/aKahVvhsYa x87aiPn/275S1LnGeboxjPJOKxUEvbfMvuTJakiRmgeWNyz03DeFNvMd+bujNICYcJkFGGQvgmK StNsAeXjojFSAr80v6LlNQmFahopY50r1C5Uk5fSWU9hWtE2VIednC7VQWnNyBT1tA2MCf6Npqv JyFBnc/YVt98N+hKG18diT21LG+YqtCj+Yi9yeMjSjIX08niCpPJaNE= X-Google-Smtp-Source: AGHT+IGTWWuqfdRG1OdMv1JrJhUNbIyiZqrhlB9MFbw+o6IkF6P0PGvSwNrik0HZ18U5C5r24zY0/A== X-Received: by 2002:a05:600c:1e0e:b0:438:a20b:6a2a with SMTP id 5b1f17b1804b1-438a20b6b71mr242006995e9.14.1737675930187; Thu, 23 Jan 2025 15:45:30 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4b9990sm7076685e9.29.2025.01.23.15.45.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:28 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 13/20] accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h' Date: Fri, 24 Jan 2025 00:44:07 +0100 Message-ID: <20250123234415.59850-14-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The heavily imported "system/cpus.h" header includes "accel-ops.h" to get AccelOpsClass type declaration. Reduce headers pressure by forward declaring it in "qemu/typedefs.h", where we already declare the AccelCPUState type. Reduce "system/cpus.h" inclusions by only including "system/accel-ops.h" when necessary. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/qemu/typedefs.h | 1 + include/system/accel-ops.h | 1 - include/system/cpus.h | 2 -- accel/accel-system.c | 1 + accel/hvf/hvf-accel-ops.c | 1 + accel/kvm/kvm-accel-ops.c | 1 + accel/qtest/qtest.c | 1 + accel/tcg/cpu-exec-common.c | 1 - accel/tcg/cpu-exec.c | 1 - accel/tcg/monitor.c | 1 - accel/tcg/tcg-accel-ops.c | 1 + accel/tcg/translate-all.c | 1 - accel/xen/xen-all.c | 1 + cpu-common.c | 1 - cpu-target.c | 1 + gdbstub/system.c | 1 + system/cpus.c | 1 + target/i386/nvmm/nvmm-accel-ops.c | 1 + target/i386/whpx/whpx-accel-ops.c | 1 + 19 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 3d84efcac47..465cc501773 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -22,6 +22,7 @@ * Please keep this list in case-insensitive alphabetical order. */ typedef struct AccelCPUState AccelCPUState; +typedef struct AccelOpsClass AccelOpsClass; typedef struct AccelState AccelState; typedef struct AddressSpace AddressSpace; typedef struct AioContext AioContext; diff --git a/include/system/accel-ops.h b/include/system/accel-ops.h index 137fb96d444..4c99d25aeff 100644 --- a/include/system/accel-ops.h +++ b/include/system/accel-ops.h @@ -17,7 +17,6 @@ #define TYPE_ACCEL_OPS "accel" ACCEL_OPS_SUFFIX #define ACCEL_OPS_NAME(name) (name "-" TYPE_ACCEL_OPS) -typedef struct AccelOpsClass AccelOpsClass; DECLARE_CLASS_CHECKERS(AccelOpsClass, ACCEL_OPS, TYPE_ACCEL_OPS) /** diff --git a/include/system/cpus.h b/include/system/cpus.h index 1cffeaaf5c4..3226c765d01 100644 --- a/include/system/cpus.h +++ b/include/system/cpus.h @@ -1,8 +1,6 @@ #ifndef QEMU_CPUS_H #define QEMU_CPUS_H -#include "system/accel-ops.h" - /* register accel-specific operations */ void cpus_register_accel(const AccelOpsClass *i); diff --git a/accel/accel-system.c b/accel/accel-system.c index a7596aef59d..5df49fbe831 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "qemu/accel.h" #include "hw/boards.h" +#include "system/accel-ops.h" #include "system/cpus.h" #include "qemu/error-report.h" #include "accel-system.h" diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 945ba720513..12fc30c2761 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -54,6 +54,7 @@ #include "exec/exec-all.h" #include "gdbstub/enums.h" #include "hw/boards.h" +#include "system/accel-ops.h" #include "system/cpus.h" #include "system/hvf.h" #include "system/hvf_int.h" diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c index a81e8f3b03b..54ea60909e2 100644 --- a/accel/kvm/kvm-accel-ops.c +++ b/accel/kvm/kvm-accel-ops.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +#include "system/accel-ops.h" #include "system/kvm.h" #include "system/kvm_int.h" #include "system/runstate.h" diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index ad7e3441a5a..7fae80f6a1b 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -18,6 +18,7 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/accel.h" +#include "system/accel-ops.h" #include "system/qtest.h" #include "system/cpus.h" #include "qemu/guest-random.h" diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 100746d555a..c5c513f1e4a 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "exec/log.h" -#include "system/cpus.h" #include "system/tcg.h" #include "qemu/plugin.h" #include "internal-common.h" diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 8ee76e14b0d..4070d532bf1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -33,7 +33,6 @@ #include "qemu/rcu.h" #include "exec/log.h" #include "qemu/main-loop.h" -#include "system/cpus.h" #include "exec/cpu-all.h" #include "system/cpu-timers.h" #include "exec/replay-core.h" diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c index ae1dbeb79f8..eeb38a4d9ce 100644 --- a/accel/tcg/monitor.c +++ b/accel/tcg/monitor.c @@ -13,7 +13,6 @@ #include "qapi/type-helpers.h" #include "qapi/qapi-commands-machine.h" #include "monitor/monitor.h" -#include "system/cpus.h" #include "system/cpu-timers.h" #include "system/tcg.h" #include "tcg/tcg.h" diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 6e3f1fa92b2..132c5d14613 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "system/accel-ops.h" #include "system/tcg.h" #include "system/replay.h" #include "system/cpu-timers.h" diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 786e2f6f1a7..0914d6e98b2 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -54,7 +54,6 @@ #include "qemu/cacheinfo.h" #include "qemu/timer.h" #include "exec/log.h" -#include "system/cpus.h" #include "system/cpu-timers.h" #include "system/tcg.h" #include "qapi/error.h" diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 852e9fbe5fe..7aa28b9ab93 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -18,6 +18,7 @@ #include "hw/xen/xen_igd.h" #include "chardev/char.h" #include "qemu/accel.h" +#include "system/accel-ops.h" #include "system/cpus.h" #include "system/xen.h" #include "system/runstate.h" diff --git a/cpu-common.c b/cpu-common.c index 4248b2d727e..f5dcc2d136b 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -21,7 +21,6 @@ #include "qemu/main-loop.h" #include "exec/cpu-common.h" #include "hw/core/cpu.h" -#include "system/cpus.h" #include "qemu/lockable.h" #include "trace/trace-root.h" diff --git a/cpu-target.c b/cpu-target.c index f97f3a14751..20933bde7d4 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -35,6 +35,7 @@ #include "exec/address-spaces.h" #include "exec/memory.h" #endif +#include "system/accel-ops.h" #include "system/cpus.h" #include "system/tcg.h" #include "exec/tswap.h" diff --git a/gdbstub/system.c b/gdbstub/system.c index 7f047a285c8..416c1dbe1e9 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -19,6 +19,7 @@ #include "gdbstub/commands.h" #include "exec/hwaddr.h" #include "exec/tb-flush.h" +#include "system/accel-ops.h" #include "system/cpus.h" #include "system/runstate.h" #include "system/replay.h" diff --git a/system/cpus.c b/system/cpus.c index 37e5892c240..2cc5f887ab5 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -31,6 +31,7 @@ #include "qapi/qapi-events-run-state.h" #include "qapi/qmp/qerror.h" #include "exec/gdbstub.h" +#include "system/accel-ops.h" #include "system/hw_accel.h" #include "exec/cpu-common.h" #include "qemu/thread.h" diff --git a/target/i386/nvmm/nvmm-accel-ops.c b/target/i386/nvmm/nvmm-accel-ops.c index e7b56662fee..4e4e63de78e 100644 --- a/target/i386/nvmm/nvmm-accel-ops.c +++ b/target/i386/nvmm/nvmm-accel-ops.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "system/kvm_int.h" #include "qemu/main-loop.h" +#include "system/accel-ops.h" #include "system/cpus.h" #include "qemu/guest-random.h" diff --git a/target/i386/whpx/whpx-accel-ops.c b/target/i386/whpx/whpx-accel-ops.c index ab2e014c9ea..81fdd06e487 100644 --- a/target/i386/whpx/whpx-accel-ops.c +++ b/target/i386/whpx/whpx-accel-ops.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "system/kvm_int.h" #include "qemu/main-loop.h" +#include "system/accel-ops.h" #include "system/cpus.h" #include "qemu/guest-random.h" From patchwork Thu Jan 23 23:44:08 2025 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: 13948770 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B94C91D47CB for ; Thu, 23 Jan 2025 23:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675939; cv=none; b=ZqicBq9EehGKdGVEr3wT2A/d4QjMQ1Wmp0tjEtd4djLUCs/ra9jQ66+mOTsTGSqOjKmrUL7nBCLUBMoNx5NOSV+HnAJBat1mgwvmxRkz77Kw2Ur0gIeUgtGjPoH+I4MAm8vFA5YLnI7lmm4dOR5atlvpeoIH1CEIU3YOdzPnDoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675939; c=relaxed/simple; bh=oICil2Av/WIFxfgmb1hOsCIIQZoAtNIZoxb8rKmknSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RGNkiC04fdnztT0LFH/Egslcd9BeLYuEVNTKZ6p79dAtSSnqBYUqZsq88G2i26u8hoi+FxfBDbze4Q0OJN4uqZLJmED37E9Hg8cppj+UvLjKs5NWKvp8uQBUawCQNCNA0Qsr/t41bVTNUhjkyB8N+U5zuh34kSEg0nSB2g+quuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZTFwX9/o; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZTFwX9/o" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43618283dedso15516405e9.3 for ; Thu, 23 Jan 2025 15:45:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675936; x=1738280736; 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=QhTovaxYyVYo/iAlHiQi1CfSH3sOOBet2z8bCBrBkk0=; b=ZTFwX9/oM1GKyRVPkTnP1S1hsX8tfEEhLFBq0prRdlD591hyaRMXr7yb0wLD6Vllk9 +4GdxHcCkILIoxidUTWwdKLqq/JIyITayPbO0wVkRTNfsqm9F3JdQVMieSR5xMTLrZA8 nsNtK1nX5IH0/kt0G9ijyqIovMoYsI9oyfMYpdfDXqdUY//gHmthUfOCqI14R3pokPFU 2a8e2c2IptyHk9NooFtskIh37JdOk57Am/4RbdcVq1ymIqEl/onF9xbXrD6grJfPrjoH dzVijROM3D5b4m8o4cn0zLKP/Lxj/gR2gDbNM+xv/O/QjE67fwBPs2qXdqJFrCmv036Q YyVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675936; x=1738280736; 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=QhTovaxYyVYo/iAlHiQi1CfSH3sOOBet2z8bCBrBkk0=; b=ZJRpTNLqJ2d2GDYHtOLlx7hIORormPFzBINObL4qtNJ4lTSQwLHKpzkBkwuPoxnqIv 3o7ZwfKi2nhyYH3UVl+9GEMpe6hWGGZIxPsPM/b21uAEVbbGvBWYhnZ6+3cKRD9FCc1s wiq4g4KYahS4mdI5NoUUGOhuZm8wvJNvEbZucsmm/or4UOCO7SCXdbwt+OAglksfh8P7 31EDMAFp0XE+YDCDpwMOrl4m+6ukMsVMaCsKgYF4olo6sL7zaPUoCkosTMlhQDb6bgT/ s0RmleDT53tLu+tIXXOUqgLYljsY0ak2NelGhUuvmyTaatJD4anxUAN/PcrUexoFY9we JQuA== X-Forwarded-Encrypted: i=1; AJvYcCXuHp3w0RgwACtEwfL+zBqCCJzcgBgUmbLTI6VH9jwWkqoqq1bXOQ1MfjSno80OWhw/Szo=@vger.kernel.org X-Gm-Message-State: AOJu0YxJjiGaulC5pKy6UWzG8+1aG8yqm0BGVaT8epc1pv9N0c2xfpaC Fkw8LG7I8ySmFWUS/sIannWUl64toE4frzL/mXC37bv6iXOcfUm+21U3PbSxZN0= X-Gm-Gg: ASbGncv/4B1dNf/HY2YBg4ufBpHH7RB4WlU4m71KsaazOy54HBh74cLYMQG8QQ8pTIt tQP+3ztnB13r5CVNkkZT1L1B8bdknJ8FOxnqx5i8wCq7W3KKJbu1OAiqCUoKNvApGsqgzXQmsnc z9XTKM9+Nsfr4tmn2Sy7q74Tt6b/JUddGAliG/NlFhCjfwq8RTCEcKz2S5gP2vusC/LaBmJ4DT+ 8DE63nXTyv/5D5W0Ughx5rcEKBiEelK2qUtY2ja4EB0vumw2xYOmf41QivDF7s5zfzzBUCzrDSQ LvAmzYMNwN0XRFGnlqEogFqKLIOMKDVH6ND5DnVWqqZsymqSQBk6+gQf/LTHK30FDw== X-Google-Smtp-Source: AGHT+IE1g5Lka6yaX7yxmvTjxCMF9sNPmOLsz1lyorKlxhPYpXBg1FExyYB9qYVhhui8O2rA+ot5eQ== X-Received: by 2002:a05:600c:3b0a:b0:434:9c60:95a3 with SMTP id 5b1f17b1804b1-438913ca93cmr282415605e9.11.1737675935797; Thu, 23 Jan 2025 15:45:35 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd507d60sm6676495e9.18.2025.01.23.15.45.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 14/20] accel/tcg: Move cpu_memory_rw_debug() user implementation to user-exec.c Date: Fri, 24 Jan 2025 00:44:08 +0100 Message-ID: <20250123234415.59850-15-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 cpu_memory_rw_debug() system implementation is defined in system/physmem.c. Move the user one to accel/tcg/user-exec.c to simplify cpu-target.c maintenance. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/user-exec.c | 92 +++++++++++++++++++++++++++++++++++++ cpu-target.c | 102 +----------------------------------------- 2 files changed, 94 insertions(+), 100 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index c4454100ad7..e7e99a46087 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -19,6 +19,8 @@ #include "qemu/osdep.h" #include "accel/tcg/cpu-ops.h" #include "disas/disas.h" +#include "exec/vaddr.h" +#include "exec/tswap.h" #include "exec/exec-all.h" #include "tcg/tcg.h" #include "qemu/bitops.h" @@ -35,6 +37,7 @@ #include "internal-common.h" #include "internal-target.h" #include "tb-internal.h" +#include "qemu.h" __thread uintptr_t helper_retaddr; @@ -969,6 +972,95 @@ static void *cpu_mmu_lookup(CPUState *cpu, vaddr addr, return ret; } +/* physical memory access (slow version, mainly for debug) */ +int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, + void *ptr, size_t len, bool is_write) +{ + int flags; + vaddr l, page; + void * p; + uint8_t *buf = ptr; + ssize_t written; + int ret = -1; + int fd = -1; + + while (len > 0) { + page = addr & TARGET_PAGE_MASK; + l = (page + TARGET_PAGE_SIZE) - addr; + if (l > len) + l = len; + flags = page_get_flags(page); + if (!(flags & PAGE_VALID)) { + goto out_close; + } + if (is_write) { + if (flags & PAGE_WRITE) { + /* XXX: this code should not depend on lock_user */ + p = lock_user(VERIFY_WRITE, addr, l, 0); + if (!p) { + goto out_close; + } + memcpy(p, buf, l); + unlock_user(p, addr, l); + } else { + /* Bypass the host page protection using ptrace. */ + if (fd == -1) { + fd = open("/proc/self/mem", O_WRONLY); + if (fd == -1) { + goto out; + } + } + /* + * If there is a TranslationBlock and we weren't bypassing the + * host page protection, the memcpy() above would SEGV, + * ultimately leading to page_unprotect(). So invalidate the + * translations manually. Both invalidation and pwrite() must + * be under mmap_lock() in order to prevent the creation of + * another TranslationBlock in between. + */ + mmap_lock(); + tb_invalidate_phys_range(addr, addr + l - 1); + written = pwrite(fd, buf, l, + (off_t)(uintptr_t)g2h_untagged(addr)); + mmap_unlock(); + if (written != l) { + goto out_close; + } + } + } else if (flags & PAGE_READ) { + /* XXX: this code should not depend on lock_user */ + p = lock_user(VERIFY_READ, addr, l, 1); + if (!p) { + goto out_close; + } + memcpy(buf, p, l); + unlock_user(p, addr, 0); + } else { + /* Bypass the host page protection using ptrace. */ + if (fd == -1) { + fd = open("/proc/self/mem", O_RDONLY); + if (fd == -1) { + goto out; + } + } + if (pread(fd, buf, l, + (off_t)(uintptr_t)g2h_untagged(addr)) != l) { + goto out_close; + } + } + len -= l; + buf += l; + addr += l; + } + ret = 0; +out_close: + if (fd != -1) { + close(fd); + } +out: + return ret; +} + #include "ldst_atomicity.c.inc" static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi, diff --git a/cpu-target.c b/cpu-target.c index 20933bde7d4..6d8b7825746 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -19,18 +19,12 @@ #include "qemu/osdep.h" #include "qapi/error.h" - -#include "exec/target_page.h" -#include "exec/page-protection.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "migration/vmstate.h" -#ifdef CONFIG_USER_ONLY -#include "qemu.h" -#include "user/page-protection.h" -#else +#ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" #include "exec/address-spaces.h" #include "exec/memory.h" @@ -38,16 +32,15 @@ #include "system/accel-ops.h" #include "system/cpus.h" #include "system/tcg.h" -#include "exec/tswap.h" #include "exec/replay-core.h" #include "exec/cpu-common.h" #include "exec/exec-all.h" #include "exec/tb-flush.h" -#include "exec/translation-block.h" #include "exec/log.h" #include "accel/accel-cpu-target.h" #include "trace/trace-root.h" #include "qemu/accel.h" +#include "hw/core/cpu.h" #ifndef CONFIG_USER_ONLY static int cpu_common_post_load(void *opaque, int version_id) @@ -367,97 +360,6 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...) abort(); } -/* physical memory access (slow version, mainly for debug) */ -#if defined(CONFIG_USER_ONLY) -int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, - void *ptr, size_t len, bool is_write) -{ - int flags; - vaddr l, page; - void * p; - uint8_t *buf = ptr; - ssize_t written; - int ret = -1; - int fd = -1; - - while (len > 0) { - page = addr & TARGET_PAGE_MASK; - l = (page + TARGET_PAGE_SIZE) - addr; - if (l > len) - l = len; - flags = page_get_flags(page); - if (!(flags & PAGE_VALID)) { - goto out_close; - } - if (is_write) { - if (flags & PAGE_WRITE) { - /* XXX: this code should not depend on lock_user */ - p = lock_user(VERIFY_WRITE, addr, l, 0); - if (!p) { - goto out_close; - } - memcpy(p, buf, l); - unlock_user(p, addr, l); - } else { - /* Bypass the host page protection using ptrace. */ - if (fd == -1) { - fd = open("/proc/self/mem", O_WRONLY); - if (fd == -1) { - goto out; - } - } - /* - * If there is a TranslationBlock and we weren't bypassing the - * host page protection, the memcpy() above would SEGV, - * ultimately leading to page_unprotect(). So invalidate the - * translations manually. Both invalidation and pwrite() must - * be under mmap_lock() in order to prevent the creation of - * another TranslationBlock in between. - */ - mmap_lock(); - tb_invalidate_phys_range(addr, addr + l - 1); - written = pwrite(fd, buf, l, - (off_t)(uintptr_t)g2h_untagged(addr)); - mmap_unlock(); - if (written != l) { - goto out_close; - } - } - } else if (flags & PAGE_READ) { - /* XXX: this code should not depend on lock_user */ - p = lock_user(VERIFY_READ, addr, l, 1); - if (!p) { - goto out_close; - } - memcpy(buf, p, l); - unlock_user(p, addr, 0); - } else { - /* Bypass the host page protection using ptrace. */ - if (fd == -1) { - fd = open("/proc/self/mem", O_RDONLY); - if (fd == -1) { - goto out; - } - } - if (pread(fd, buf, l, - (off_t)(uintptr_t)g2h_untagged(addr)) != l) { - goto out_close; - } - } - len -= l; - buf += l; - addr += l; - } - ret = 0; -out_close: - if (fd != -1) { - close(fd); - } -out: - return ret; -} -#endif - bool target_words_bigendian(void) { return TARGET_BIG_ENDIAN; From patchwork Thu Jan 23 23:44:09 2025 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: 13948771 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E251C1BDAB5 for ; Thu, 23 Jan 2025 23:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675945; cv=none; b=eBGpKE1gQP1ZJfQ/uY9hPTnEj0JjZGWSN0PYtuD4PKUY+igrhRRe8X8jlkHPlnkvrstF2MME/ovZ/iscKVpL6KkRJ/N6a5cLQOKnrrwHUMFgTnA+KSoZEimI2TCIlEIS0s9wfGJfmDBZUMZQ7Jo9C4R+VizrsgUGcyIbmnH9ktw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675945; c=relaxed/simple; bh=lFRPiokM9eG16b+LAgFB90BHEa3TmvxS7By0aGgfwio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a6Rh+1r/J4baZzkq+2c1aWcg0neR6rDG2fbojx6LDQhyMeZ8/VQWQ2YvxY9zU+2aOz1tTzEdyFM2Y675FH2tJsf52B/owSrFPlnF2aLxuE0LTsKqfXtKOM1OdhFimCFlHgIsNzyDyXeGq9NU30z2+waJX1CfMZg3k8tXuI1y55k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=l/TzvQku; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l/TzvQku" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-385ddcfc97bso1317272f8f.1 for ; Thu, 23 Jan 2025 15:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675942; x=1738280742; 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=GOf7cXhzVFnELwvvE/9oD0dVEdIwULgdsVx2rdQEX18=; b=l/TzvQkuA2D4s7NbfC7o+A1iGK+cM5S6rxT3yYt/VEo/FYGffhFyXwORUKeVWHrvte 0jApKK43nMzy8OIJR0b4q2lBdvwm9ntoqKZeHk/u1wvvznobnPZG2QTqj66eCHiV1prn qQa/6KgT37QKjKLRRmpJ3tW/ww2ZcKPBUyvoVACvpbCtEuPDi4aDm2jQiYpAdivKw+Tl kF1wzCsMk0vNB0Ga0P4U0krN/OFtjo6j/xWerNBUU2fDiDVaOt5BNc1b6aJ+f1HrCxep 5gq6MMRrpYW/ZJEQkrDgEOoCLZ1M8v6toIkLU8zLvutnEe8nPJSYzxCOKmQeYU4aACfX qnmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675942; x=1738280742; 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=GOf7cXhzVFnELwvvE/9oD0dVEdIwULgdsVx2rdQEX18=; b=t01qs/TA7V5QCY0HS/1OcA4WcBJm2pjxgfmkQ9QtliZzolWKSjkv+OLEpeA9LD5FYf cO9fKm3HNgweCkiJAmbRGX82uL5nNTxNPvPM1l1QTog8F0ev5soTP5DoB2SKs3BZ645c SnMhSLDffJJYAjywTLFlZyJaPzUw1TRLnAm1ZTnIzPN4vz3lyfxTq8q8EWG/x4h5Mw04 RMK14SreUZRv7fmQ0OoZgBq2woGExqu/wd4ZQCyoS6qnvUr2FN4YiJOzei5fc8P+EmAC nCotLlxbrXwPWPKUqwuBQTVy0LHsFexjqm88a3F7d/NFfLyWpPxz6Js3Tm5X5G1gm66g Gaww== X-Forwarded-Encrypted: i=1; AJvYcCVcTmrpEowCNsmgLmko84nwWs1etAzerc5puT5sYJPYAHWoICawX2Ekh4xpFvyRHhb+O6E=@vger.kernel.org X-Gm-Message-State: AOJu0YyHHW+PSpRXhd8QqsMpG/SrPhH1yIB3upcu/XHTGbd3gHvirzzX FSCNf9I7+Z52/zi4hTGm/uA8KXdJRHKVQo1cPQQMqUCDpmMwaN5YkcbHbit1e1Y= X-Gm-Gg: ASbGncvEAAq27QIgFegVAVhoHGRRyOrlhYK5kz9m+gXu4SGCqLMskaHPoCn/+e6GJ46 p57BoZPlQtiOM7kuKum1sWcfJIZGBQimdvXjp7IZMAXvvHEu7himsQm5FoQsac3iRnR/CwlCdDP AMbf81LRE787oibY+boHeAJU1PT9ySZaOhiNyzdL5gAzx1QJhUlwedKzIDNdIcAthJbWpuB1L8o S7ouLlL1bS8SilCveg6YVkXIgltmUxeGlUYph8bMkrbsuoGgW1PopJVH/4EGA3hQKkmW1z9+3Yl K7V9lh+FMjJgNLjvXeuXrbD6cxQV8YQsDX4UET9LGFJTbXhIUE0naac= X-Google-Smtp-Source: AGHT+IFFvdlRkBEFpuvRapz+0/bX2s0BjBYZ6M4itb1IiIpdMWapxxpC9ppUNuB95mK5m+Q7pE4GZw== X-Received: by 2002:a5d:47c9:0:b0:385:fb56:5596 with SMTP id ffacd0b85a97d-38bf5663956mr20431872f8f.19.1737675942270; Thu, 23 Jan 2025 15:45:42 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bad87sm971133f8f.74.2025.01.23.15.45.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 15/20] cpus: Fix style in cpu-target.c Date: Fri, 24 Jan 2025 00:44:09 +0100 Message-ID: <20250123234415.59850-16-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix style on code we are going to modify. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- cpu-target.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index 6d8b7825746..a2999e7c3c0 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -47,12 +47,15 @@ static int cpu_common_post_load(void *opaque, int version_id) { CPUState *cpu = opaque; - /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the - version_id is increased. */ + /* + * 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the + * version_id is increased. + */ cpu->interrupt_request &= ~0x01; tlb_flush(cpu); - /* loadvm has just updated the content of RAM, bypassing the + /* + * loadvm has just updated the content of RAM, bypassing the * usual mechanisms that ensure we flush TBs for writes to * memory we've translated code from. So we must flush all TBs, * which will now be stale. From patchwork Thu Jan 23 23:44:10 2025 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: 13948772 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDD5F1BDAB5 for ; Thu, 23 Jan 2025 23:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675950; cv=none; b=T4yTpzJ2ULAU68GFAmQ475KfTOH+sGFa/Pe30cH2VZ0ghfWHp2rlpgNlA4iJ7ITZr2gVcBzQysszBuvP6SjBa3TkS57kZG9zQKISiaUXaz1rwLztu3uSNnFIyInFA1UrNUhauvk7GtkdPIVqlEtzqCIZ7b8bYAqQEsmnNw+cFIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675950; c=relaxed/simple; bh=ub6bjeSmWlmCdXRczEdgqvKy9WwyzTRj55xBtNaNX3c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BscQeRgJ4TowNpPHfZrWf20V2JSjvPOd1CjmmvQCpTkVMf+pJsd6bEkCpTPbQE5khNJcsshR1RQkZlry/s/dY27XzIC5334OfBSoQHs0jQ/HnZu9sR2Ux0TntQ/Inych+LGrp0KGQTdltSmP7guC8iV82BZE1gH1OQYFOsXqoDM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=BJiu1REt; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BJiu1REt" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so15622185e9.1 for ; Thu, 23 Jan 2025 15:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675947; x=1738280747; 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=OmeiNXwxDOryj9Nk89BSf7ntmaAiV2ODrxL67LjT3oE=; b=BJiu1REtfthomaNMF9UoBdKWKV8RCjZWzw9586QzqntNHbmuyYAEBV34J/fF1iCBiU iW9tJ5odNj7CzroHRLaEv5cll5SfiEuEXzPTcaUhuzeGkSqY/5F7z88To2A0X2FjOmMY zjIQmo1UWOo2NpYC0XVAnvF50wpd06KyxXeHWoOTrIbIswFzHgRr8DElRBC4/VPD+z85 IBVUfeGyrc50E4xMKFREqc6xV8Po5IJo6GKrXGXYK113QKKI4VsPt5wEkzqtOzf5ax0N ItPNy0PdBgMqnRPJSPlC8zGvPrfP7ejamXDPLb8eqOeFpvtPFlSLII0MhvzhDMlcBDt2 n52w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675947; x=1738280747; 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=OmeiNXwxDOryj9Nk89BSf7ntmaAiV2ODrxL67LjT3oE=; b=qFF9U3Jw6su9SjRLmoCvpemPZvcVZuCXEwhg27puSbGHfPMbgwRzVUradg+epkS+C3 fQ8TI3/oT6lofHU38PGYvgyYI08EKhD4Ea/LiLdhrOygu6TLcyCF4QTkxH8sgcyLTNOP ZyEhfp5WV8jV+c9T9W9pmM9Q6iv2LfeowD/d4Y2RQCLgVRaoYwrxjB1wRETNV6Ixxg1q SwDihfMCAEa4HzPaUNg/gDe2oHZ6wJ1FlzZyJPgTkYMXNb5bMFXcW1F3J6j6lNf4tJh9 JQkvUBztnUdfD1A3gtHPiHNc5QOzWaIKMIjy0MumnEf4tpuwaADSnlKCQx7ltJe2mdXo 8bjg== X-Forwarded-Encrypted: i=1; AJvYcCU+jLA4Bd6VTiob6Han3R7Bpg0ELWd2gIYrI0r9J4MQZvjNRqvoDXxDHVA0k9kHePfIxQo=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6Q/tH9bItHlJ90zdtsRLip0ke8+0lR6pB4hgThKoD617B5LYC HbYL5z/yLgBtfAmiCekgBKsOoSqs30gKj2ypbTUuI3couIyidbFVKI/b7SdhPOw= X-Gm-Gg: ASbGncvauWmNEevVMSgone7U9bQr5OVkng2vt4b6Eg+skxARZ0Rw55ec8PcuIEO4F+f ohB6zKfJBAeFULXYeYoH26IPWGzspH0WS3iBWY9TBjiScZjEvxw+evuTYvP0EJnJLQljTysLxn4 bMa6K5t8j2LhX+6uJagiGKTA3l12L7MrqFYZn+aYo28GzZ3kyvO0xBKDy9pR4L1/UB28Hvk9NtS pHXY8V5vQuKSqeqxNdUNW6X7ziCrIDtlMTGbV9rIqgQ93BcdBYfSDMpawISDaGViml8UIhDPX0p XS1JqA2LsoFcMOv0WaunXobBgTItXrYpLOR3R6gr51lunBiBDE9ZwIw= X-Google-Smtp-Source: AGHT+IEFJ1SeJWoUW3YaXnTGBs2yrvL22hVEarb/siWyosLBI70zXEF7xcr/1TRnUm9/lQBURa7m3g== X-Received: by 2002:a05:600c:1e18:b0:436:8a6f:b6db with SMTP id 5b1f17b1804b1-4389141c12emr225835175e9.22.1737675947213; Thu, 23 Jan 2025 15:45:47 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47f355sm7138595e9.4.2025.01.23.15.45.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 16/20] cpus: Restrict cpu_common_post_load() code to TCG Date: Fri, 24 Jan 2025 00:44:10 +0100 Message-ID: <20250123234415.59850-17-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 CPU_INTERRUPT_EXIT was removed in commit 3098dba01c7 ("Use a dedicated function to request exit from execution loop"), tlb_flush() and tb_flush() are related to TCG accelerator. Signed-off-by: Philippe Mathieu-Daudé --- cpu-target.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index a2999e7c3c0..c05ef1ff096 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -45,22 +45,27 @@ #ifndef CONFIG_USER_ONLY static int cpu_common_post_load(void *opaque, int version_id) { - CPUState *cpu = opaque; +#ifdef CONFIG_TCG + if (tcg_enabled()) { + CPUState *cpu = opaque; - /* - * 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the - * version_id is increased. - */ - cpu->interrupt_request &= ~0x01; - tlb_flush(cpu); + /* + * 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the + * version_id is increased. + */ + cpu->interrupt_request &= ~0x01; - /* - * loadvm has just updated the content of RAM, bypassing the - * usual mechanisms that ensure we flush TBs for writes to - * memory we've translated code from. So we must flush all TBs, - * which will now be stale. - */ - tb_flush(cpu); + tlb_flush(cpu); + + /* + * loadvm has just updated the content of RAM, bypassing the + * usual mechanisms that ensure we flush TBs for writes to + * memory we've translated code from. So we must flush all TBs, + * which will now be stale. + */ + tb_flush(cpu); + } +#endif return 0; } From patchwork Thu Jan 23 23:44:11 2025 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: 13948773 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 614731D5145 for ; Thu, 23 Jan 2025 23:45:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675957; cv=none; b=VgHH9TgyyzLcmGWELrX4F58/whUJmU8lTVn6gfcBGSUoQrwQ8to35uX1tyeQQ/dJHACQ4Gd+RB/tGArn/63OH10GlE/1p9SkD/EheXj7l9pWyBosTzKuNv26J86a7OnLwpctcOLSHpRsOF7awbnx5Te3P6VYJv1Ww4CXH44Y4JE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675957; c=relaxed/simple; bh=+n1etEkqGg0BVPRatlhX1kHquhkRghxAJddT9q32VWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OEHi6sS+bSMOoYBQ+9A3Ds873OnVfYX7AcZ5N1sM5qakA+lXsnGrlqPTz94PDVyOPMjS1swiCliTEtpD5ATLMoymrlT5yMD/kebmDKb5skCPyiFjm1S6ygx383NiAbutybf5grKCrvPXTVRzpKJg3dujggLicyq7lJf5rHDMe0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=AM+mBYg6; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AM+mBYg6" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-436341f575fso16147025e9.1 for ; Thu, 23 Jan 2025 15:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675953; x=1738280753; 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=MvtCakZyrGCXwv1NUluQigNUDDDoRJgD07DKcxozaAI=; b=AM+mBYg6hekCtX9q0+NIw/4DXnXxU7izXPM+mKFLP4KLA91n7hwrxKQ4bCP42kucKd 0pR8tAv7uIWmQyFIA4jUz/NmyM1/lKOr5Xr2rrblmpYUKMiWZUVVrf/IkYAHjG1PdBdf XpRv1R7QLGxmEUMquYRZNs4xB7I03xkREc3iv4APmleSSyCRYQLiMk+Nw/OFg/oxX1WO U3WdcHjhRSYIgXcrWricDQSdKD+GovGYZcFZOsiRmul+szJrEEdnLpkQ0OUxx5UeGAL9 uwSO29bwcsM4RB/8TySSTJBpdcdOyBxoQyhVaMUum3e3tY4my5oxLBlMj6qIeexpndC9 yfzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675953; x=1738280753; 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=MvtCakZyrGCXwv1NUluQigNUDDDoRJgD07DKcxozaAI=; b=dwstlcsKPqteNn56XSrGFQrBslmje1IiLq0qM6NLMFKqinDPaq7qdDDwiV8hJwTgfj MEuK1Ivdq+U82io96t9Db9YYkbLDvmzGqm3HDHGJ44n4qVIbBjDmtUe/C3MOuUFZuntV Xx68+LoBCEVC331sHLQbMWSPVkRGlOsMV83o22iplbrKoaYSH2gNX44Pl1AGJEFR4Vz7 f7pYyOayh2Fxw8szsy7Jt/7tt9RWIJRm2km4O3mlYZAAYwycNEJ7hx+DDlHpDJ0cARxE RV+yXCeHZ8Iwj4iGuGdqZybvvjsVlRE/6Fl5kki0tOyzww7sI6IEhEQl2A3W7pgV2wHa t+qQ== X-Forwarded-Encrypted: i=1; AJvYcCVn0SlE/9Xm7JUdrORaQO8DDC1Xuz/tqrmrylY4ZMPSiZoIqER3C1hWORpWtAfnMv4k8Es=@vger.kernel.org X-Gm-Message-State: AOJu0YzXyBnmMNEcslB6ul2/80r3+zvflDBvABJvS9BLICG3vnKIDomY gQTiD8IPqwKzmuULUh0HHYK1yVebd68RuSsjbJHR5acZXKwaEzhnoPtDbrWlNKw= X-Gm-Gg: ASbGncszhECa/K06NBmLRuCWGu/BfWasf3cCNHoJac/xnXH3ROH3ncT5RprqT3kYzbv nL20HliLc4zxPZ18SOwxhZdefJ6b2qIi4dwWHZX4NYmBQFUWR0SHGwbHqYdCxJLs30VtBq7DigM APEIJ0U7dmPnd8L2tNF9+ho9IO1QDmexIpo/xhhk/7Wl35SoFDUZ7bEilAb0t3JTopbIYApP8lQ Q0vQqX5wXfTB7fppye4Gc9lCIl8dXnor/LA2H6Clzaah9RCd8t+Dp76mdMesCQkjqH0bE4AFj/8 TtSZI31H6NE8V1mvyiyI7+GOYvKzh3KBx07m9HVl6fmJYSGSFGTj0hA= X-Google-Smtp-Source: AGHT+IESHbhLNhi6WI+MIsv7kwcNIGaQJ9dXLlWxoyCR3XibduHPGVHiP0CzOiY9OItw0/7PMnFvyA== X-Received: by 2002:a05:600c:1987:b0:434:f753:6012 with SMTP id 5b1f17b1804b1-438913f2f4emr282730315e9.17.1737675953608; Thu, 23 Jan 2025 15:45:53 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd43cdbbsm7488805e9.0.2025.01.23.15.45.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 17/20] cpus: Have cpu_class_init_props() per user / system emulation Date: Fri, 24 Jan 2025 00:44:11 +0100 Message-ID: <20250123234415.59850-18-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than maintaining a mix of system / user code for CPU class properties, move system properties to cpu-system.c and user ones to the new cpu-user.c unit. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- cpu-target.c | 58 -------------------------------------------- hw/core/cpu-system.c | 40 ++++++++++++++++++++++++++++++ hw/core/cpu-user.c | 27 +++++++++++++++++++++ hw/core/meson.build | 5 +++- 4 files changed, 71 insertions(+), 59 deletions(-) create mode 100644 hw/core/cpu-user.c diff --git a/cpu-target.c b/cpu-target.c index c05ef1ff096..dff8c0747f9 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -19,15 +19,12 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "hw/qdev-core.h" -#include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "migration/vmstate.h" #ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" #include "exec/address-spaces.h" -#include "exec/memory.h" #endif #include "system/accel-ops.h" #include "system/cpus.h" @@ -179,61 +176,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) accel_cpu_common_unrealize(cpu); } -/* - * This can't go in hw/core/cpu.c because that file is compiled only - * once for both user-mode and system builds. - */ -static const Property cpu_common_props[] = { -#ifdef CONFIG_USER_ONLY - /* - * Create a property for the user-only object, so users can - * adjust prctl(PR_SET_UNALIGN) from the command-line. - * Has no effect if the target does not support the feature. - */ - DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState, - prctl_unalign_sigbus, false), -#else - /* - * Create a memory property for system CPU object, so users can - * wire up its memory. The default if no link is set up is to use - * the system address space. - */ - DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, - MemoryRegion *), -#endif -}; - -#ifndef CONFIG_USER_ONLY -static bool cpu_get_start_powered_off(Object *obj, Error **errp) -{ - CPUState *cpu = CPU(obj); - return cpu->start_powered_off; -} - -static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp) -{ - CPUState *cpu = CPU(obj); - cpu->start_powered_off = value; -} -#endif - -void cpu_class_init_props(DeviceClass *dc) -{ -#ifndef CONFIG_USER_ONLY - ObjectClass *oc = OBJECT_CLASS(dc); - - /* - * We can't use DEFINE_PROP_BOOL in the Property array for this - * property, because we want this to be settable after realize. - */ - object_class_property_add_bool(oc, "start-powered-off", - cpu_get_start_powered_off, - cpu_set_start_powered_off); -#endif - - device_class_set_props(dc, cpu_common_props); -} - void cpu_exec_initfn(CPUState *cpu) { #ifndef CONFIG_USER_ONLY diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 6aae28a349a..c63c984a803 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -20,7 +20,10 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "exec/memory.h" #include "exec/tswap.h" +#include "hw/qdev-core.h" +#include "hw/qdev-properties.h" #include "hw/core/sysemu-cpu-ops.h" bool cpu_paging_enabled(const CPUState *cpu) @@ -142,3 +145,40 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) } return res; } + +static const Property cpu_system_props[] = { + /* + * Create a memory property for system CPU object, so users can + * wire up its memory. The default if no link is set up is to use + * the system address space. + */ + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, + MemoryRegion *), +}; + +static bool cpu_get_start_powered_off(Object *obj, Error **errp) +{ + CPUState *cpu = CPU(obj); + return cpu->start_powered_off; +} + +static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp) +{ + CPUState *cpu = CPU(obj); + cpu->start_powered_off = value; +} + +void cpu_class_init_props(DeviceClass *dc) +{ + ObjectClass *oc = OBJECT_CLASS(dc); + + /* + * We can't use DEFINE_PROP_BOOL in the Property array for this + * property, because we want this to be settable after realize. + */ + object_class_property_add_bool(oc, "start-powered-off", + cpu_get_start_powered_off, + cpu_set_start_powered_off); + + device_class_set_props(dc, cpu_system_props); +} diff --git a/hw/core/cpu-user.c b/hw/core/cpu-user.c new file mode 100644 index 00000000000..e5ccf6bf13a --- /dev/null +++ b/hw/core/cpu-user.c @@ -0,0 +1,27 @@ +/* + * QEMU CPU model (user specific) + * + * Copyright (c) Linaro, Ltd. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/qdev-core.h" +#include "hw/qdev-properties.h" +#include "hw/core/cpu.h" + +static const Property cpu_user_props[] = { + /* + * Create a property for the user-only object, so users can + * adjust prctl(PR_SET_UNALIGN) from the command-line. + * Has no effect if the target does not support the feature. + */ + DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState, + prctl_unalign_sigbus, false), +}; + +void cpu_class_init_props(DeviceClass *dc) +{ + device_class_set_props(dc, cpu_user_props); +} diff --git a/hw/core/meson.build b/hw/core/meson.build index 65a1698ed1f..b5a545a0edd 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -46,4 +46,7 @@ system_ss.add(files( 'vm-change-state-handler.c', 'clock-vmstate.c', )) -user_ss.add(files('qdev-user.c')) +user_ss.add(files( + 'cpu-user.c', + 'qdev-user.c', +)) From patchwork Thu Jan 23 23:44:12 2025 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: 13948774 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1A551D63DD for ; Thu, 23 Jan 2025 23:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675962; cv=none; b=c+gKuhQc0e6R4f4NiKIyMfMUGWNmZp42J5Sba8M7IwWzmuqU1J/UHzifylLtPL/4CERzpJ3QzH3wc4CL8K5Q8TspTLyuhZFW9l2z8fuTYH7R3OgZeVQP4p54+o/Wn8XdWndcKt9qkzodVNy6HFqfUZCT1rqQSZyAp+P4yCj+xPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675962; c=relaxed/simple; bh=j9QeyZEDciQrvxU6PmCI1XBKPe2C1gsxmtg5jSikSM0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Hf3skVKlfX6Lc2kFWkb8GsStGRbEaZBpfIykYoclX4MzH5nszvyhyiJ8hvfmalzD3t+rzRdRxVY3LbemL/iEC102hvrxUAEsjgO0MI+DtnSbu2Qf4xppl4CEo92UTCYjKCUg4dW5yBKQGpfgzyC/hL6zBp5f+lrjmbGumY4W4Ps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nHda6UVz; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nHda6UVz" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4361f664af5so17051855e9.1 for ; Thu, 23 Jan 2025 15:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675959; x=1738280759; 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=9gXZ2pCmpp3MBAsW4Hnbi8sV5bqYGRAr8w/4hsc1kvQ=; b=nHda6UVzPd84CB7aEepZKZmlRMzQHln0z1fpFa6mHdLPdRrw5yf2qRVHQzrq6Bq3Sd eG5SDb9cw1XHiJ1tTfQgWrFiq3qny7jiieB1rebZ3UmzbyT5in7A6AAcn6xlsc3NZQ9B mlPiUdAwmvRVOC0ia438OkJnCbmi/ZyPHspXFksNpUFGto5PRFDrVK0uT+uG7afZtgPo rU/hH9ml9ZBd6PnYSVp/Iuo1o6VKYGrvtK+86R+VIqlzsAGYqHBxgSkvLNcfVE2vgNQv iedouJ0W1AX7QW8vDHftnYZ5WCbsMMAtZxBKpetrKYVMcEbsINspGfM/FB9QoaMufoEG f6IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675959; x=1738280759; 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=9gXZ2pCmpp3MBAsW4Hnbi8sV5bqYGRAr8w/4hsc1kvQ=; b=IoGYpggV6Or8l4qVgQh9tRToFgytF9mjM5d2WeCxMNGFcdf7RqCCQM85G0GT9eMm+3 9gbnag4A/7T5AKDQoB+oQSDXSFZEOU3DGjJ1cm3U1PGfYlU+j3Qk3VOKrei+jlxh6X4a YbhCVU2OU41TrJe28fLMLtk1uBijYD7CwZSzXvmLvqPa1uxbvgWX5/LucqolyEpo3uoP ctqhJX8Py7iROZaOXvefwwmDEvFO2eVmhya2DGGo1xQfDAmuAc6geLVhmYEC63oLYnW1 GXwi0Rh/t/0wiQikIrbddj8sKovsNa7AWncIQU+8mjCnwEuk+ILzLMcrZawmVAfXl21q H5Lw== X-Forwarded-Encrypted: i=1; AJvYcCXwWwB7OVgSdJ2pD9VkO91aMLPtz174UpFdHuxD9KlBzQZiOTnJVo8fJdxwqX1Xl1RVBvg=@vger.kernel.org X-Gm-Message-State: AOJu0YzSQmKIqB1eeqA72aJxABZ1N2hWBanobjw3BswC1A1EZHyi3Mbk SFLBpCYYZLzQ9A3Vjbh3yrD7IBnq8PGz0aPcVtv5/aYhVDzZo5zdX5b3TXgW3JY= X-Gm-Gg: ASbGncsQ2MllFwu+wcksMOWewKUoje/KiymJteVziKauiATt2VMMJQQ6XU0js7QHJKz LG0m/OdKM49CtG/obrvRft/X0sD95O4OkOy3IUVWhXlH3YxvEEZg1I0TgajObvkF2MYHG67UsUO PYQDJf2BlZ+b1xcM//OFxGoYYAOwnOH8EpjGDtkT5Z5WtFiK8DhUffimvbcHQYCraRcJNWowaiv dXXuNluY4QU21M21VIU7JiX3hPmL98XhMSRIrYG+kkQFET4HCL6MtVou78MtvsmODYVV8t1rRGx q+j/97wpq15nXQaSkUIGShUt+f5lwbge/0acsPCOAoyygARkqpAo2sw= X-Google-Smtp-Source: AGHT+IFkrF3nSiyRp86eT1OfDhljZaIiOgfPlVgQgIeU90j7M027ZvrIkgirhKCWekxtCJUAZQHWLg== X-Received: by 2002:a05:600c:4f48:b0:434:fd15:3adc with SMTP id 5b1f17b1804b1-43891431319mr209632555e9.25.1737675959187; Thu, 23 Jan 2025 15:45:59 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d79csm1009152f8f.39.2025.01.23.15.45.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:45:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 18/20] cpus: Have cpu_exec_initfn() per user / system emulation Date: Fri, 24 Jan 2025 00:44:12 +0100 Message-ID: <20250123234415.59850-19-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Slighly simplify cpu-target.c again by extracting cpu_exec_initfn() to cpu-{system,user}.c, adding an empty stub for user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- Good enough for now... --- cpu-target.c | 9 --------- hw/core/cpu-system.c | 7 +++++++ hw/core/cpu-user.c | 5 +++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index dff8c0747f9..3d33d20b8c8 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -24,7 +24,6 @@ #include "migration/vmstate.h" #ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" -#include "exec/address-spaces.h" #endif #include "system/accel-ops.h" #include "system/cpus.h" @@ -176,14 +175,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) accel_cpu_common_unrealize(cpu); } -void cpu_exec_initfn(CPUState *cpu) -{ -#ifndef CONFIG_USER_ONLY - cpu->memory = get_system_memory(); - object_ref(OBJECT(cpu->memory)); -#endif -} - char *cpu_model_from_type(const char *typename) { const char *suffix = "-" CPU_RESOLVING_TYPE; diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index c63c984a803..0520c362db4 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "exec/address-spaces.h" #include "exec/memory.h" #include "exec/tswap.h" #include "hw/qdev-core.h" @@ -182,3 +183,9 @@ void cpu_class_init_props(DeviceClass *dc) device_class_set_props(dc, cpu_system_props); } + +void cpu_exec_initfn(CPUState *cpu) +{ + cpu->memory = get_system_memory(); + object_ref(OBJECT(cpu->memory)); +} diff --git a/hw/core/cpu-user.c b/hw/core/cpu-user.c index e5ccf6bf13a..cdd8de2fefa 100644 --- a/hw/core/cpu-user.c +++ b/hw/core/cpu-user.c @@ -25,3 +25,8 @@ void cpu_class_init_props(DeviceClass *dc) { device_class_set_props(dc, cpu_user_props); } + +void cpu_exec_initfn(CPUState *cpu) +{ + /* nothing to do */ +} From patchwork Thu Jan 23 23:44:13 2025 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: 13948775 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2E5F1D9A5F for ; Thu, 23 Jan 2025 23:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675968; cv=none; b=gl4Ygv7/9qTBnCwcFNZujSR/C9q/tiyyS9WCRAZ7brWhlGw3VqTcHLhoUE6DQFK2uzIqUVnWNrkgRGpCVcPLJCJOaP0Sjuz5Dz52NdJYlbrr/e4IgRyZhGbnMJFchBxP1cYmOAQ9lYbCovkksw2XnAeCdy+Gxo119ZQOmHLCX4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675968; c=relaxed/simple; bh=163gI4MEUEuRQkHPP8Zd+fD9ueA96D9Tl16HJ/CL2mo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I3yyfP59eQ01jHGapWZDAAnvoRYd5zsTpBv1rlhp9K2igROyYzJEzvXOk76TiH2yCx21sGGU6O1l7pQszKFmOfBl47IJRF8eVFbpwsd+rm9pWTEvPi7DbeeBCC1X568wKj/FEzQjfppQlxOaqjNbxWcVs/tg17VXYZxHycar0R8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ko55gOyb; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ko55gOyb" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-38be3bfb045so1815050f8f.0 for ; Thu, 23 Jan 2025 15:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675965; x=1738280765; 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=sQ+5PubFZrrCYmUor7z2ohXZLQOj0+FDz6CQ50FZwrM=; b=ko55gOybU7Od3+XR9nJgxlgPcELlf7mfj0n6/QO+JJPh9UG8L0eEov7CTPUEQEACJt 8KIhoTgYqHilsE/KF9q5NrrvaFvB6MZWCwgs2Ra36fvn7EIcnYLv8CaBH6u7Hg2JE0Vn HO9CdsHaJAmZebKmqf/cEi0udJcBCZySIYoXPrjHcnoz42ajimMI8yiK2MpcVLixfHl7 0WvG9KAd7sDPKwtgPzVEgx4Z8AcKEbYmOb43LA0U0hGL86RRsoKxqAErn2kMU4m6oMNx nYS2qhOR1BXrS1mHCSQrEmSedOgY+DRNIz12zljE9CuB1owObOLPNOEbkKWO3GQbt0cx FNDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675965; x=1738280765; 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=sQ+5PubFZrrCYmUor7z2ohXZLQOj0+FDz6CQ50FZwrM=; b=eI6ugs0gFRZvLPTB7r6gnVGFYfPzZj+5wG5S6dQNp1n58bAkTmwi6eHKHz7mL7s07h RMx/rofqtTKbXJdFtc42gBsBPtxupuH/G7oWxx6pQfHcCkkUKph17bS1c78q6hfWhVyt GuAgsbXceXYkamMo+JSNyrgHnq7hJvzANMtd9cjyCMfZNMbMTmgO811i07I/29VEfvWp +3FRwrY2qyenIN4vzaXDWAsSDGTQB2+Ue5vCtfPpEoU0rhzvki6f7VhVQm43rFIHAZgh MpqZfwNIf/J/OEirignsRXAZL5veUj48T6oTGY8hX7X5gmifBSzv8PivepD/pO/CRdRu sC5Q== X-Forwarded-Encrypted: i=1; AJvYcCUGs2cl4OzNFjVChn+dUuoKk7Zwrs0pCVRWNC6RCwWXz35jeUYzrRW2djyNg+kQmxLJD94=@vger.kernel.org X-Gm-Message-State: AOJu0YzsZJN8981ZdU7sIBTYbcRvLi6F6xWyJo6Z8DTT/zn/up0DzkhB A2oFEd7G1W9rPfrVuHktp5J/mRkDDqF/wtbEyR1+pXIejSwbGn9dgebrBQuGFjM= X-Gm-Gg: ASbGncsitNQ4rY9DwG1pf/UIzyK5GS30iid6m58JhDnRnA0ra52CowgWud6Knz8q0kE 04zVtUuxi9OQhxFv8/eJYPbb23Ah4zqOEnIYnDqjL0lBfNM3yg/BMGY5e0U5dltHtdHEAbWIxzY RL+wODXkImIaimMc3QZbNfA3zYWWTSMxjtY0/iEFf6PcTbxviBdkOkS0jCu2vXxxqBwXoKLFuis BzsIWGuiwLJGBMFDvmXhi3G9+hawWDzyFo5qtxSof/vK137qU9LkvZrGRepY4xej7jVUgpZLM4A iv432doj/vWz97icl3ogbGfMXGmFHRfL1GdVrFvUhEZ+wn7lY4ZpCLE= X-Google-Smtp-Source: AGHT+IGsiKZVvuhBn67VKbvp7ZCKdJegwhgfqv/IiEk5xyysRNRbKSY3tyJ6LqHq9Om3O3Zv9Xfmsw== X-Received: by 2002:adf:f250:0:b0:38a:5dc4:6dcd with SMTP id ffacd0b85a97d-38c22279dafmr4343550f8f.22.1737675965020; Thu, 23 Jan 2025 15:46:05 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c403asm989733f8f.93.2025.01.23.15.46.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:46:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 19/20] cpus: Register VMState per user / system emulation Date: Fri, 24 Jan 2025 00:44:13 +0100 Message-ID: <20250123234415.59850-20-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Simplify cpu-target.c by extracting mixed vmstate code into the cpu_vmstate_register() / cpu_vmstate_unregister() helpers, implemented in cpu-user.c and cpu-system.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- XXX: tlb_flush() temporary declared manually. Only 2 more CONFIG_USER_ONLY to go. --- include/hw/core/cpu.h | 2 + cpu-target.c | 122 +---------------------------------------- hw/core/cpu-system.c | 123 ++++++++++++++++++++++++++++++++++++++++++ hw/core/cpu-user.c | 12 +++++ 4 files changed, 139 insertions(+), 120 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index fb397cdfc53..aadbd2e1122 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1163,6 +1163,8 @@ G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...) /* $(top_srcdir)/cpu.c */ void cpu_class_init_props(DeviceClass *dc); void cpu_exec_initfn(CPUState *cpu); +void cpu_vmstate_register(CPUState *cpu); +void cpu_vmstate_unregister(CPUState *cpu); bool cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); void cpu_exec_reset_hold(CPUState *cpu); diff --git a/cpu-target.c b/cpu-target.c index 3d33d20b8c8..bfcd48f9ae2 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -21,115 +21,16 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" -#include "migration/vmstate.h" -#ifndef CONFIG_USER_ONLY -#include "hw/core/sysemu-cpu-ops.h" -#endif #include "system/accel-ops.h" #include "system/cpus.h" -#include "system/tcg.h" #include "exec/replay-core.h" #include "exec/cpu-common.h" -#include "exec/exec-all.h" -#include "exec/tb-flush.h" #include "exec/log.h" #include "accel/accel-cpu-target.h" #include "trace/trace-root.h" #include "qemu/accel.h" #include "hw/core/cpu.h" -#ifndef CONFIG_USER_ONLY -static int cpu_common_post_load(void *opaque, int version_id) -{ -#ifdef CONFIG_TCG - if (tcg_enabled()) { - CPUState *cpu = opaque; - - /* - * 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the - * version_id is increased. - */ - cpu->interrupt_request &= ~0x01; - - tlb_flush(cpu); - - /* - * loadvm has just updated the content of RAM, bypassing the - * usual mechanisms that ensure we flush TBs for writes to - * memory we've translated code from. So we must flush all TBs, - * which will now be stale. - */ - tb_flush(cpu); - } -#endif - - return 0; -} - -static int cpu_common_pre_load(void *opaque) -{ - CPUState *cpu = opaque; - - cpu->exception_index = -1; - - return 0; -} - -static bool cpu_common_exception_index_needed(void *opaque) -{ - CPUState *cpu = opaque; - - return tcg_enabled() && cpu->exception_index != -1; -} - -static const VMStateDescription vmstate_cpu_common_exception_index = { - .name = "cpu_common/exception_index", - .version_id = 1, - .minimum_version_id = 1, - .needed = cpu_common_exception_index_needed, - .fields = (const VMStateField[]) { - VMSTATE_INT32(exception_index, CPUState), - VMSTATE_END_OF_LIST() - } -}; - -static bool cpu_common_crash_occurred_needed(void *opaque) -{ - CPUState *cpu = opaque; - - return cpu->crash_occurred; -} - -static const VMStateDescription vmstate_cpu_common_crash_occurred = { - .name = "cpu_common/crash_occurred", - .version_id = 1, - .minimum_version_id = 1, - .needed = cpu_common_crash_occurred_needed, - .fields = (const VMStateField[]) { - VMSTATE_BOOL(crash_occurred, CPUState), - VMSTATE_END_OF_LIST() - } -}; - -const VMStateDescription vmstate_cpu_common = { - .name = "cpu_common", - .version_id = 1, - .minimum_version_id = 1, - .pre_load = cpu_common_pre_load, - .post_load = cpu_common_post_load, - .fields = (const VMStateField[]) { - VMSTATE_UINT32(halted, CPUState), - VMSTATE_UINT32(interrupt_request, CPUState), - VMSTATE_END_OF_LIST() - }, - .subsections = (const VMStateDescription * const []) { - &vmstate_cpu_common_exception_index, - &vmstate_cpu_common_crash_occurred, - NULL - } -}; -#endif - bool cpu_exec_realizefn(CPUState *cpu, Error **errp) { if (!accel_cpu_common_realize(cpu, errp)) { @@ -139,33 +40,14 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp) /* Wait until cpu initialization complete before exposing cpu. */ cpu_list_add(cpu); -#ifdef CONFIG_USER_ONLY - assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || - qdev_get_vmsd(DEVICE(cpu))->unmigratable); -#else - if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { - vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); - } - if (cpu->cc->sysemu_ops->legacy_vmsd != NULL) { - vmstate_register(NULL, cpu->cpu_index, cpu->cc->sysemu_ops->legacy_vmsd, cpu); - } -#endif /* CONFIG_USER_ONLY */ + cpu_vmstate_register(cpu); return true; } void cpu_exec_unrealizefn(CPUState *cpu) { -#ifndef CONFIG_USER_ONLY - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->sysemu_ops->legacy_vmsd != NULL) { - vmstate_unregister(NULL, cc->sysemu_ops->legacy_vmsd, cpu); - } - if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { - vmstate_unregister(NULL, &vmstate_cpu_common, cpu); - } -#endif + cpu_vmstate_unregister(cpu); cpu_list_remove(cpu); /* diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 0520c362db4..3e1f60f23df 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -22,10 +22,21 @@ #include "qapi/error.h" #include "exec/address-spaces.h" #include "exec/memory.h" +#include "exec/tb-flush.h" #include "exec/tswap.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "hw/core/sysemu-cpu-ops.h" +#include "migration/vmstate.h" +#include "system/tcg.h" + +/* + * XXX this series plan is to be applied on top on my exec/cputlb rework series, + * then tlb_flush() won't be declared target-specific in exec-all.h. + * Meanwhile, declare locally. + * XXX + */ +void tlb_flush(CPUState *cs); bool cpu_paging_enabled(const CPUState *cpu) { @@ -189,3 +200,115 @@ void cpu_exec_initfn(CPUState *cpu) cpu->memory = get_system_memory(); object_ref(OBJECT(cpu->memory)); } + +static int cpu_common_post_load(void *opaque, int version_id) +{ +#ifdef CONFIG_TCG + if (tcg_enabled()) { + CPUState *cpu = opaque; + + /* + * 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the + * version_id is increased. + */ + cpu->interrupt_request &= ~0x01; + + tlb_flush(cpu); + + /* + * loadvm has just updated the content of RAM, bypassing the + * usual mechanisms that ensure we flush TBs for writes to + * memory we've translated code from. So we must flush all TBs, + * which will now be stale. + */ + tb_flush(cpu); + } +#endif + + return 0; +} + +static int cpu_common_pre_load(void *opaque) +{ + CPUState *cpu = opaque; + + cpu->exception_index = -1; + + return 0; +} + +static bool cpu_common_exception_index_needed(void *opaque) +{ + CPUState *cpu = opaque; + + return tcg_enabled() && cpu->exception_index != -1; +} + +static const VMStateDescription vmstate_cpu_common_exception_index = { + .name = "cpu_common/exception_index", + .version_id = 1, + .minimum_version_id = 1, + .needed = cpu_common_exception_index_needed, + .fields = (const VMStateField[]) { + VMSTATE_INT32(exception_index, CPUState), + VMSTATE_END_OF_LIST() + } +}; + +static bool cpu_common_crash_occurred_needed(void *opaque) +{ + CPUState *cpu = opaque; + + return cpu->crash_occurred; +} + +static const VMStateDescription vmstate_cpu_common_crash_occurred = { + .name = "cpu_common/crash_occurred", + .version_id = 1, + .minimum_version_id = 1, + .needed = cpu_common_crash_occurred_needed, + .fields = (const VMStateField[]) { + VMSTATE_BOOL(crash_occurred, CPUState), + VMSTATE_END_OF_LIST() + } +}; + +const VMStateDescription vmstate_cpu_common = { + .name = "cpu_common", + .version_id = 1, + .minimum_version_id = 1, + .pre_load = cpu_common_pre_load, + .post_load = cpu_common_post_load, + .fields = (const VMStateField[]) { + VMSTATE_UINT32(halted, CPUState), + VMSTATE_UINT32(interrupt_request, CPUState), + VMSTATE_END_OF_LIST() + }, + .subsections = (const VMStateDescription * const []) { + &vmstate_cpu_common_exception_index, + &vmstate_cpu_common_crash_occurred, + NULL + } +}; + +void cpu_vmstate_register(CPUState *cpu) +{ + if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { + vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); + } + if (cpu->cc->sysemu_ops->legacy_vmsd != NULL) { + vmstate_register(NULL, cpu->cpu_index, cpu->cc->sysemu_ops->legacy_vmsd, cpu); + } +} + +void cpu_vmstate_unregister(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (cc->sysemu_ops->legacy_vmsd != NULL) { + vmstate_unregister(NULL, cc->sysemu_ops->legacy_vmsd, cpu); + } + if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { + vmstate_unregister(NULL, &vmstate_cpu_common, cpu); + } +} diff --git a/hw/core/cpu-user.c b/hw/core/cpu-user.c index cdd8de2fefa..1892acdee0f 100644 --- a/hw/core/cpu-user.c +++ b/hw/core/cpu-user.c @@ -10,6 +10,7 @@ #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "hw/core/cpu.h" +#include "migration/vmstate.h" static const Property cpu_user_props[] = { /* @@ -30,3 +31,14 @@ void cpu_exec_initfn(CPUState *cpu) { /* nothing to do */ } + +void cpu_vmstate_register(CPUState *cpu) +{ + assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || + qdev_get_vmsd(DEVICE(cpu))->unmigratable); +} + +void cpu_vmstate_unregister(CPUState *cpu) +{ + /* nothing to do */ +} From patchwork Thu Jan 23 23:44:14 2025 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: 13948776 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C5AB1D61A3 for ; Thu, 23 Jan 2025 23:46:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675974; cv=none; b=NzChuB2h+xuzt38NUnrfmUitibkFtzQB2TxrlkmD023Z0RdleREojrzYTSyLdHiCrNkMv+fcnVMla1AiGso+y+89GFlNyfrY5XIzcRkmPA6MkkbU/85SVdT9MnsnV31ANiamdaR0E67QIW2qw/jFLenYd5RxY4/X5szBd1r6EVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737675974; c=relaxed/simple; bh=JxV8ICm/dyssa1IQy7DHLpPEFQ9ElMcvH8bEdcJpFNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rI/0SzBLbW4njDXdwGsFKtJxXXij/8q3bGK0wUd9bOMYgiwtgPvABloYtRvkk/TJbmb6qs2odV0BtOjeVGa9x2UgMufwjTtjigX5GEP21UxzzSVJB3sLLxhxfH8GlQflLKjNxQ3vnOlf5JUCnTPRGiZtjM2B/w5F2x8KCURBypA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HaoNOBLb; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HaoNOBLb" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-386329da1d9so841661f8f.1 for ; Thu, 23 Jan 2025 15:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737675971; x=1738280771; 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=xSu/7xOdAlhOhpGqndt0dd/xIMB7MzmL+xgNpZ/1JvM=; b=HaoNOBLb/jWzAAoKNzLdk26cNdmUUG/nmVa/yJYK9ruUf+glCnrPsgKAN/uDiip2ps VGhVf0GoE7eVfh1MGez7ANm1TrXhm/Qs94GyrzMHdraR9PN9AK/eNEQztZZRYdN3f/v5 0fiGg40stoMxo3G3MuI6uFB67d40uHaLNNknc9PLWsMWLlyyfDaJN9c42h9i9wTPKAfj PshPKaSFJejAzFxVbKVea9MSQZknsFvoMApYkk/dmGhhKAxp0zKWcunT6QxYt8Ls+CZ3 lQfSgyAxHB+ekiAfWemSWBEhvMmUtPYsfSEYB/Sr749JKJKPiojipCQz532h2Jzu0El3 +NxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737675971; x=1738280771; 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=xSu/7xOdAlhOhpGqndt0dd/xIMB7MzmL+xgNpZ/1JvM=; b=vpoY/JaQkg7P59aIVtHSlYY50hHtaJWDeQnQ1tSgJnzM+qxhKdlitJ4BwaPKB9CDyw 58K9/ujmISCRmL3FcG2ErUZhphIJKQL1WMAQTT0gcF7vl204ucgBzW7vC+vzAiSzbVhT qukamqj8Ny2AtCLrp4A2Vh1fCHUvq193zqtd9vg78lzWAmavEu+5tUNXZrjMQE7PLu9k UGUNzUE7fTjL8cdQLbU6xINZqbzSZQOBSqgSKDliXQ6LhGuVTt9BYIuciTZ6AW0UqoIW yf8OtfevrVgYkVLNi1/GAx2Do7s2XHI4d4+Q+CfgSDOowEETEx1GpRjlmCpZ8xbbPDhP KJkw== X-Forwarded-Encrypted: i=1; AJvYcCUxT+XPq2JbeA+Zb+DLjvZJenMxeWxnM90Zsqya2R5GgM7+rsS/qj2OUqx236rI+LJ0W4w=@vger.kernel.org X-Gm-Message-State: AOJu0Yw62G6EEteBYnEzvvKSp4nzDHdpDV0ZmdQ4KQtcTpelvbHQ4cMJ DUXe7RmBMZTK3B8snwmcK71RHwQ34Ta0q+0WSrABTDqQSxiGy/OvVybRpcxXScw= X-Gm-Gg: ASbGnctT9Fav4F2NL9lJN9E3iNQb1Pf2gRNC7bMOpfuQt5d5E/LuPrI35j1V/G0bHI8 5LEOxbb1TZz/61d9T0/DKCQVwNRawEgKgAF6cWifAZ3W33vZQfYxIMzHOJWK0jDF6s5M9xHcPsV jKt6GuGHUfHypwWyZKzsZJQwMQmSvUwc04xuMx/LUYFIzaKrqrGkLfFHKoQoRLHbznu6FS/jjw6 WTM3vo4Ykj1GYGqJ0+FiVkW7OpgTB3+Z0Ce2yI5EZZgrCWKYzsIAduTjM/XgBChJxT0lpcDE9Ls Y/oOnGLKfOVa3H3DJDtsc7Pod0NF7wDabmRyp0JnrN0kRGCmBrAzwjA= X-Google-Smtp-Source: AGHT+IFycJysfhMaCpSR16Rzr8MUGZyLqdkkV1WoJ+3KdF//Z7stLVwsFpncYG19E6JH49Nuy1YUSA== X-Received: by 2002:a05:6000:e4a:b0:385:ed16:c91 with SMTP id ffacd0b85a97d-38bf566f3bemr20406552f8f.24.1737675970851; Thu, 23 Jan 2025 15:46:10 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4d34e3sm6953255e9.39.2025.01.23.15.46.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 15:46:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 20/20] cpus: Build cpu_exec_[un]realizefn() methods once Date: Fri, 24 Jan 2025 00:44:14 +0100 Message-ID: <20250123234415.59850-21-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123234415.59850-1-philmd@linaro.org> References: <20250123234415.59850-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that cpu_exec_realizefn() and cpu_exec_unrealizefn() methods don't use any target specific definition anymore, we can move them to cpu-common.c to be able to build them once. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- Eventually they'll be absorbed within cpu_common_[un]realizefn(). --- cpu-target.c | 30 ------------------------------ hw/core/cpu-common.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index bfcd48f9ae2..8f4477be417 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -19,43 +19,13 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "system/accel-ops.h" #include "system/cpus.h" #include "exec/replay-core.h" -#include "exec/cpu-common.h" #include "exec/log.h" #include "accel/accel-cpu-target.h" #include "trace/trace-root.h" -#include "qemu/accel.h" -#include "hw/core/cpu.h" - -bool cpu_exec_realizefn(CPUState *cpu, Error **errp) -{ - if (!accel_cpu_common_realize(cpu, errp)) { - return false; - } - - /* Wait until cpu initialization complete before exposing cpu. */ - cpu_list_add(cpu); - - cpu_vmstate_register(cpu); - - return true; -} - -void cpu_exec_unrealizefn(CPUState *cpu) -{ - cpu_vmstate_unregister(cpu); - - cpu_list_remove(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); -} char *cpu_model_from_type(const char *typename) { diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 71425cb7422..c5382a350fc 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -193,6 +193,20 @@ static void cpu_common_parse_features(const char *typename, char *features, } } +bool cpu_exec_realizefn(CPUState *cpu, Error **errp) +{ + if (!accel_cpu_common_realize(cpu, errp)) { + return false; + } + + /* Wait until cpu initialization complete before exposing cpu. */ + cpu_list_add(cpu); + + cpu_vmstate_register(cpu); + + return true; +} + static void cpu_common_realizefn(DeviceState *dev, Error **errp) { CPUState *cpu = CPU(dev); @@ -234,6 +248,18 @@ static void cpu_common_unrealizefn(DeviceState *dev) cpu_exec_unrealizefn(cpu); } +void cpu_exec_unrealizefn(CPUState *cpu) +{ + cpu_vmstate_unregister(cpu); + + cpu_list_remove(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); +} + static void cpu_common_initfn(Object *obj) { CPUState *cpu = CPU(obj);