From patchwork Sat Apr 5 16:13: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: 878413 Delivered-To: patch@linaro.org Received: by 2002:a5d:6dae:0:b0:38f:210b:807b with SMTP id u14csp4288489wrs; Sat, 5 Apr 2025 09:14:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVViyeBF524BOIxrNu5al7FwGFgSHjBCTjhYlrdTNwPQsQMSc+ITDD2mWdeqAg199ru45/1Zg==@linaro.org X-Google-Smtp-Source: AGHT+IGYAJwVQLzMPiXjvu2OZY8hklBXmSyED6NkeVPdfUdg/eNehuc8lFOBGC2ZUr4xM7JObUt6 X-Received: by 2002:a05:622a:1349:b0:477:548:849e with SMTP id d75a77b69052e-47925958054mr80921671cf.15.1743869645929; Sat, 05 Apr 2025 09:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1743869645; cv=none; d=google.com; s=arc-20240605; b=EUvSHWzid3TnhkLAuNBdroBJrarpPj3LGAF5vDjpxsjFHZFSzWg2XOeinW+/fh3sc8 zpow2jL4EA6VXK73YOe2yF+ZnE/GN7L+tSwwCXGpF6wY2aTDY2Gnyvfx/uX4yGJf5gXy 8qiXvf7DGwk3PvvIsDVLpXci5zWm85cypKBjNhFL4mnkd+D5bqGSUUjn4sNTEZ8aL2aP FIHS9DFXJndeZNSdgEqQmpVA+enTHO6jJg7zq/6mFEaEyukOyBI/ZvmuNmLoc9jfXtQp Mf/tjrLxqvYbPV1d4oCzQgUO1ccomtRNowCRdrDECK2xEzT3AS8eXc1bWnum/AZAxqED LiFQ== 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=SfypuBuFqBrJN/RG4a0oTJgQCsI2EHmEmRAR6WvMt9k=; fh=ZXDWg7hKG7Hj19AbRuutTLw+Zvn/B9RsGUUw/YagpFI=; b=FbZ6iF6aOHwYeu+sKTRwKdtAnG1dERUMJgY2CeRjWrasE4kS0hMzSZfWYWimL/NMDT REb6y4LYfQ7DQkhFyCCy+TLA14JJXS3gpaQHrVgr2ZGX7ItmI/7Siowx/rVPAOAZ3yYE vn//+HYVSBbNJy0+wCrC2em/x7h+6fpAvciqCzeeUETOTUr81UrmiSMuLl3SubU0j+YY SL7tfOEd6Q8XJ8daMIUcayaCAZoUYdw3z5413iEoagMm0ON0sAaL3oEaCZfOsXZ5eDh5 +ulOW0rbN9tAmFOaT3vroCpJ7KeeV2+w+hSgsR722DhMLjpVdnZFdOQrOdAVv8YLBzV4 A9PA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vxLHTfg/"; 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-4791b05c956si55055461cf.47.2025.04.05.09.14.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Apr 2025 09:14:05 -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="vxLHTfg/"; 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 1u169K-0000VR-Kt; Sat, 05 Apr 2025 12:13:38 -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 1u169H-0000V8-8K for qemu-devel@nongnu.org; Sat, 05 Apr 2025 12:13:35 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u169F-0005D1-D5 for qemu-devel@nongnu.org; Sat, 05 Apr 2025 12:13:35 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3913d129c1aso2084858f8f.0 for ; Sat, 05 Apr 2025 09:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743869611; x=1744474411; 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=SfypuBuFqBrJN/RG4a0oTJgQCsI2EHmEmRAR6WvMt9k=; b=vxLHTfg/D4TKtTufBIKTh7tG6LRGwIk033RYo5cGKjIBks1ayPus5i6jdRoGNH3zE6 Gz8SgwiNyZAGp9mc0X4FBlDa+6V63op0R2BBMEC7t9q+UjOvzDPZrdGTNrhANWmwLidy V6F5zZeS495+66oM8IeR0MkjIQE/dYPUWoqtnNSA6Gp4O7Q8KFjVxzkxG7QYuFXwPgGW +Od3YKIe3WKm48gtLl/yl+Y7fJ0qLYOxq3kqdOp0wcozmvsm9BeAZQ8ZQ+gU+EZBCE1Q BxONsWILC9zZn8NCSi8sy0MH+Pue5uosl8bJ05i6djOr3Y1ZwmY9foH13QKhEHHXoQWr DDLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743869611; x=1744474411; 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=SfypuBuFqBrJN/RG4a0oTJgQCsI2EHmEmRAR6WvMt9k=; b=JbuHdZQMdUgqPPtMIQHdLMx6kNe+g2VilwbXECvsoDhDZnxQ9lFLidE69oP0LL7Yc/ clElosp/4EvpMziwDmpIhWhYXoSEBWa6qU9hs9vNDfNDRing6T1u4v17qrF5Y21oi/A3 tluC++lfqXw6wO8c5Toe8kaOw5RumDdP/OhQ7b7m+8hrRZUDllvAMMUQaVkKXRMKqHLJ T4X1cPO9VUhhe4Q6/pLL04QPBl6B2w1e70bxHx47cpb0qqFTjHzM25/EV/ffx7HLXn5X B8mvlo3KeFymQklJvt+cVCM0GDbYVcA9U6vza7UoI1xRlxxOVDtichXzdCa4VsudBLmt G4bw== X-Gm-Message-State: AOJu0YxCDWKGWoBhtnbnsA4N/d37KTH2JzMJPIuI3aZKEwFg+OMyaNRn Y352mYe13YOdYIpo0fJUkM6XAEvZQW8NFtDS4tPTc8ClaW2rGhonq9u10dAkS+Gy95/abEPZRTC d X-Gm-Gg: ASbGnctXIMHXWj/FBxDwyzZEFa5Q4EpuL+MVaJfeRlvaiRMg2ECQChXtdcxmgQnfpvw m27UAA/XEyqDFwt1QzzrRmakqxEe6y2r+4dHRh7n6Iz8X8IOCNaEXZKgz9nGQKqKn7Swh8zaEur PVglkbMwG5lZGxh0W44OBTRy1oi030DbK8tNjFf0Wxsjjx3aDPXfEilmtolbkEIdE6xUVTcD6vS TICyGarq9eVxNfHmlqTjYDScFY6vZxu6SwOM+JuKBzwEzD9ZYppRr9fRJY3QCdpIcK0OtsCvm1r IFIImU7ckYloakm206T5VhQPboD1l8WXgbtELRHa0bOr6UhmNm3EPqVyOmIYTuyodGLeDQsPUwy JlBcBDvXflHleb1LLDSxK5o6e X-Received: by 2002:a5d:5f4b:0:b0:38d:ba8e:7327 with SMTP id ffacd0b85a97d-39cb35aeb5amr6857276f8f.8.1743869611520; Sat, 05 Apr 2025 09:13:31 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39d75335591sm1134461f8f.1.2025.04.05.09.13.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 05 Apr 2025 09:13:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v4 02/16] target/i386: Remove AccelCPUClass::cpu_class_init need Date: Sat, 5 Apr 2025 18:13:06 +0200 Message-ID: <20250405161320.76854-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250405161320.76854-1-philmd@linaro.org> References: <20250405161320.76854-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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 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é --- 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 7580f8afb4f..85bcd61678f 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 d930ebd262e..31487f4b282 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 35b17f2b183..27c163d17e2 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 = { .initialize = tcg_x86_init, .translate_code = x86_translate_code, .synchronize_from_tb = x86_cpu_synchronize_from_tb, @@ -148,17 +148,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) \ @@ -207,7 +196,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 = {