From patchwork Tue Apr 22 19:28:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 883072 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2591907wrs; Tue, 22 Apr 2025 12:47:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXqdCuIOK8fdM2szAWj/miHeR/Xe9yaVgDR8ijx7dAkW585BEJUp8HUt5ioDj03Nqi8I/JLA==@linaro.org X-Google-Smtp-Source: AGHT+IE1YtW4K2cB3HI1OF/FJtvQxbjS24dZZkwetkiZl97U3YCQ16fmSc3/vGpo2ov52kDBJa2F X-Received: by 2002:a05:622a:19a0:b0:475:ce:3c59 with SMTP id d75a77b69052e-47aec3cc71dmr299922021cf.30.1745351277206; Tue, 22 Apr 2025 12:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745351277; cv=none; d=google.com; s=arc-20240605; b=UzflYkkuZ5rkS5xQ0pSolTSP9SS3N0MgfjhFbD9Ff+EO9nhvSZMSc4izT97fzzq93O Aa2XxmoYthT0pHLbdEeY/NI/RMuH3IkqTHbnkTpgaWK9ndT0tKIvRFJ3cEUQFZY/+t1s 84PVgT62K/vlLFkCgYjp3oA64ih90K5ylpJsMfR+Rusctp0sDEKXq/kay5FZNUlrt06J uIkUr2OY2B/uTyMzn7+gyb+DDwXhxtxHNxK9+iAtL62h/er7bsJ9DTeHPyz43uISSQNq rjiisL4nodgVK+ZFqKJWIKMKQ6nIkly9+3uNSs+g0JNQMcwcx9PtrVTwubZoNmZW3/kA vhOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TW4N3ReYmKveN3DtkTRFhUmPoxz9JDSNytNFvFcor3s=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=hEMXxA6YIhz+3PDAXN9LSWcxO7RBRuHcvURlJOyvNoY4T4j7Ws6XqAqDnph4BRGsiE F7COGGLHKGmc43G1gG7GEOPWxseyw4VklmTsKiNgthgtBGOWwk9Q2aVRXrnLfJB6kt9M MrYPvphzOTxkDQzOGLiPh32cRXgpzHlwUiEPIPsvyKuyWZdht97UpRGVKtQTPzyH3Nfr zQEhhncDCT0RCOzpeqRiuGzk665lXJE84Scf+4Mt3nfgaQ8rkYNiY4EYJwxqeYTywfAg pjSG7ue8yJ7QqwcAfmZziXnBJCEDz2NcAGHRtbb06Up0QNj0s8wuAMnnwihm87K1jNyN arEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ltj6Rp4P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47ae9c1210fsi120232641cf.5.2025.04.22.12.47.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Apr 2025 12:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ltj6Rp4P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7JT7-0006N7-LB; Tue, 22 Apr 2025 15:39:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7JSQ-0004MB-1n for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:39:02 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7JSN-0007Nw-73 for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:39:01 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-22c33677183so65874685ad.2 for ; Tue, 22 Apr 2025 12:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745350737; x=1745955537; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TW4N3ReYmKveN3DtkTRFhUmPoxz9JDSNytNFvFcor3s=; b=ltj6Rp4PuGgS1vYQe7Q1ica0xDvbxsNvFGUjeYwi59ukvKceSaNefi59UHP9agYH/V /qdy4jsHi+hdaXyVDIEweBsGbMuOmdxoqe7yXHlJWPc7912360tV8Q2lD3L/eo3wOUIC XI2wQp+XIHoUx63FdLdBbPH85q0MoFRkuqB+IeeZj9TUTTIJXDIo+Shu5tGvz8sZYAzS MlnDEYaQJWTI7fKfJltXZuvwwaEPZ3RtC6Yw13y6tSHktUdx+Zz0C4VbcKngcwuoh3uh 6mC1sj6WO/S9qlY9zt/QfoFkxp4Rk8Za5yzjfyc/KRTwkmqIus3vG0rhWSZQGdOFeEIz TRoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745350737; x=1745955537; 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=TW4N3ReYmKveN3DtkTRFhUmPoxz9JDSNytNFvFcor3s=; b=FrsZprrkcfdMjF+WajURaKV4EWEYg6qrBv9JWubq0tTQOyXLiLQzRfFUwLEH2UEsDJ 41Pw7+R6wb4KEHKksdSKzUA8pV8o+2LdDgr6Oi64BKDInYfI0kYhfrRZuSQAHS9UdC4E DVvpUsYwbiIJqRuVSJRuwcPW7QMHq9sqppWPILAiQUlGdZ6rr0q4MrqCRCwCIxm+kCK9 A15k1VzKJYDIub1C7sACy5UIgnvSJnpLmK6pIU5acNo3Gkkf6i2Feu2NaYUZNC3eISqj TzjASLIve2q6exxbjYZyk8Y/185KV88rcYGWSyGVLyKP/tMODULGBltfdyah3hcB+rTo Dsjw== X-Gm-Message-State: AOJu0YyvSpZ93aev7F7oTWnWepNVMHBLH4Q90bKDynbWxN0bEdIaGytY RhrFSHpV6NjSACtTyrMF1iROGRDLVpf4fIuTKWdM3MBgf7hQ/EdX+IUQsh9r8mtnrP8IEhwjev6 X X-Gm-Gg: ASbGncuhSS3Elk4nwExYYOkqzgV2Qpila3acvB/61+BEOCvYCSKabNXrMBJXCIYbycI RAGx088/vCfagEk7nLSdwl8pbGSya04uWK8GpLxxu6RZa06tK+XFks7+YluQeii193W/LKJ0Ifv Nj4e1Cr+WyXiKcEVC2wrUWy5GlC89z100LgWr/iY66GBV7vB+JiMmFSm3ssTBxWRp6C/5NSYCoA +nSsZ5btVmhBkdfxFYjdCcir9ZoxPQUkOr86BGQyM31VueXaI9gF0DtoSt7YqCkk0pOhRh9rFjm i0mbVinVvXoxZloA0e0nzZyqQLITH1wlSM9Dqtf2VMR13D1WDDt6eAsVHfI14LoEgUhIYBGnbXb 1kwOC51xgTw== X-Received: by 2002:a17:903:11c5:b0:221:85:f384 with SMTP id d9443c01a7336-22c5359c36cmr229258785ad.16.1745350737383; Tue, 22 Apr 2025 12:38:57 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c50eb484dsm88951765ad.148.2025.04.22.12.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 12:38:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 146/147] target/i386: Remove AccelCPUClass::cpu_class_init need Date: Tue, 22 Apr 2025 12:28:15 -0700 Message-ID: <20250422192819.302784-147-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250422192819.302784-1-richard.henderson@linaro.org> References: <20250422192819.302784-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Expose x86_tcg_ops symbol, then directly set it as CPUClass::tcg_ops in TYPE_X86_CPU's class_init(), using CONFIG_TCG #ifdef'ry. No need for the AccelCPUClass::cpu_class_init() handler anymore. Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20250405161320.76854-3-philmd@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- target/i386/tcg/tcg-cpu.h | 4 ++++ target/i386/cpu.c | 4 ++++ target/i386/tcg/tcg-cpu.c | 14 +------------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/target/i386/tcg/tcg-cpu.h b/target/i386/tcg/tcg-cpu.h index 7580f8afb4..85bcd61678 100644 --- a/target/i386/tcg/tcg-cpu.h +++ b/target/i386/tcg/tcg-cpu.h @@ -19,6 +19,8 @@ #ifndef TCG_CPU_H #define TCG_CPU_H +#include "cpu.h" + #define XSAVE_FCW_FSW_OFFSET 0x000 #define XSAVE_FTW_FOP_OFFSET 0x004 #define XSAVE_CWD_RIP_OFFSET 0x008 @@ -76,6 +78,8 @@ QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, zmm_hi256_state) != XSAVE_ZMM_HI256_OFF QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, hi16_zmm_state) != XSAVE_HI16_ZMM_OFFSET); QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, pkru_state) != XSAVE_PKRU_OFFSET); +extern const TCGCPUOps x86_tcg_ops; + bool tcg_cpu_realizefn(CPUState *cs, Error **errp); int x86_mmu_index_pl(CPUX86State *env, unsigned pl); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d930ebd262..31487f4b28 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -43,6 +43,7 @@ #include "hw/boards.h" #include "hw/i386/sgx-epc.h" #endif +#include "tcg/tcg-cpu.h" #include "disas/capstone.h" #include "cpu-internal.h" @@ -8903,6 +8904,9 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ +#ifdef CONFIG_TCG + cc->tcg_ops = &x86_tcg_ops; +#endif /* CONFIG_TCG */ cc->gdb_arch_name = x86_gdb_arch_name; #ifdef TARGET_X86_64 diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index d941df0956..e13d0f6f86 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -124,7 +124,7 @@ static bool x86_debug_check_breakpoint(CPUState *cs) #include "accel/tcg/cpu-ops.h" -static const TCGCPUOps x86_tcg_ops = { +const TCGCPUOps x86_tcg_ops = { /* * The x86 has a strong memory model with some store-after-load re-ordering */ @@ -152,17 +152,6 @@ static const TCGCPUOps x86_tcg_ops = { #endif /* !CONFIG_USER_ONLY */ }; -static void x86_tcg_cpu_init_ops(AccelCPUClass *accel_cpu, CPUClass *cc) -{ - /* for x86, all cpus use the same set of operations */ - cc->tcg_ops = &x86_tcg_ops; -} - -static void x86_tcg_cpu_class_init(CPUClass *cc) -{ - cc->init_accel_cpu = x86_tcg_cpu_init_ops; -} - static void x86_tcg_cpu_xsave_init(void) { #define XO(bit, field) \ @@ -211,7 +200,6 @@ static void x86_tcg_cpu_accel_class_init(ObjectClass *oc, void *data) acc->cpu_target_realize = tcg_cpu_realizefn; #endif /* CONFIG_USER_ONLY */ - acc->cpu_class_init = x86_tcg_cpu_class_init; acc->cpu_instance_init = x86_tcg_cpu_instance_init; } static const TypeInfo x86_tcg_cpu_accel_type_info = {