From nobody Sun Sep 28 16:28:21 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758762344; cv=none; d=zohomail.com; s=zohoarc; b=UeAo+AJ6LGUbnZRnkxzZzxbUsJQRnB2hOAuJnfc9YTXAodCeX9zJGSFCg+vfJno/WdQ7U9XJbddNyb+dcBFGkekHqh6Ft5zisn9eFwTVaf9BXlJz/K2en8njU426VFnnhnG9ZjbkcOf2zKFHhp82lobBQQRTLDOkY9T+c6mS1Iw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758762344; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CZMMGDklz6fqAGv14RaNlRfNO0vD6ThQ5dgVd4PnFxg=; b=GykbM/ReiDVQ5ueDMkNKaMikjmS7f2bcbVw5wmrLInFBsH3UKWGIUO7u1t4sUt15jkbhV0ulxgYeqeHq3q+YDsbyvTB+33XV3a5aoptX5E2QaHBpdTf+ZtsAMQ1b9pIQlsVaUaBdRnIW8KK6Fs+iY/A7KHmwaTO7BC1xEckSmeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758762344560141.29956041950618; Wed, 24 Sep 2025 18:05:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v1aPk-0006lp-J6; Wed, 24 Sep 2025 21:04:52 -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 1v1aPh-0006la-5k for qemu-devel@nongnu.org; Wed, 24 Sep 2025 21:04:49 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v1aPd-0006OT-Pd for qemu-devel@nongnu.org; Wed, 24 Sep 2025 21:04:48 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3f2ae6fadb4so369652f8f.1 for ; Wed, 24 Sep 2025 18:04:44 -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-40fc5602f15sm624274f8f.39.2025.09.24.18.04.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Sep 2025 18:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758762281; x=1759367081; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CZMMGDklz6fqAGv14RaNlRfNO0vD6ThQ5dgVd4PnFxg=; b=FvCHflLjEsBiu4s4/qjoGHMIfCFTwn2/FDdWZaMBcmxaaDSBEDuBKgMh1n9rESa5UF dFdiq5o9ArmycwlPUKtUqleROxyosZK0YCUovs9kd21YsQmSVB+HRwI84KGDjK7GW6iI HjK0dtTJ5tf/1JZAwlDVy0qNcLFsmcqfpehOv/E5TJ9Cx65Ddq4szZ97SEdrALUSwlby v/sJ3uWLVksTrt2GhZVqUXkxWjbWDYSoDWdfPbFNdaD1S/jnm15QV9jkwvApm/KSRVgx 9Jld7tR3dlBF6ifIG5nHLSIqS7XKYUHz47pz0tXunOsxuL5Ho5dxuz2bYiKOpTsN8fFp ECSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758762281; x=1759367081; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CZMMGDklz6fqAGv14RaNlRfNO0vD6ThQ5dgVd4PnFxg=; b=cEXTlWKZdEbkzqUeC3iGRWk0BE7QyfLVvJQgZ6tHg5Dv+VghlDljGwSSF4rY8idagT 5h+pPhEtvjU307loNMPcKx6hugEFKzoM1DB8Oj+g3rNEE6hJt/zUCAg4kx6GkucPn4Wj 0ypxMXg+Lnq2LSzcIJ8Q4FPYgnGWdTCKoAJBzURbVktfJXo2Zt5aMLPUA+Om4ZkF8GrW pz9IZq4jnpM4ESJ4QokF9+R9WPAiDZDGyY8gOXbZ+WWcuGP6gPbRJu8Hjw+F6q+f4w2k kT4ZjE8dNWXpY+oH17GFWkTxqy1KLxM8+I8GaW+krUOjbO9eJ0A8e2EcGLlKFs5GisbU yNjw== X-Gm-Message-State: AOJu0Yy4RoGjEc8GYsFtZt6zaU0ketfcjfESDoXk0m/KFFLk7cuI5icm 5x1Tz/8xIHnD4PyjQdC7sE6wvj6SBu3MFnMx6xs7HgYJcKFFVO/5zj0YNQqG3Xaheww4PuuIzDz NY0JknVqj6A== X-Gm-Gg: ASbGncvhC843fSwFqxg0rS5Vb2x69jC1fD2aPVZ0iiUxdHFzJxN2dcNHAUy8Mh/tE0L FTNdvJx6HpJaRw7XhW0RWLupw9PZNcaLTzA2C6eqVMFrhRm4QiGUmSQq96toaxD6vVi9diM6eGT v2RTm9zxcblezYzYsVEIaBDnvxoV4RUMnQVIf4/5lcYuEPKKeaTzYwJNbnPiHSaM3Ayaf8rERBd eWUIN1UrsK+pTdbxgPjYVUYURLfzs3RWSV8EwR1PAoND/oZSiuIo+W6SEypc1EMpkJvEcRy3I7e nHGRuoZz+lZmQMkfysYwQJ8TxGRW4ONnhmDuSo8AbcP8qa+6SzLHtDTfSFN8vLkckgLMHBcfDUM wZZgQDTVu4mW/Ns2ubygfMl6Zu7zv1GIXOBe8OhkgWfRq9s42moBG0YC+RZB0DLO4ZztKZNus X-Google-Smtp-Source: AGHT+IHt96m2X/Xqcun+u7z38gWKeAx2aC1+2c+6APkB0TNk8jZKZmdQ0JgyJ+uPDJaCmS7NErGdwA== X-Received: by 2002:a05:6000:2287:b0:3f2:dc6e:6a89 with SMTP id ffacd0b85a97d-40e4accc7e1mr1240532f8f.57.1758762281274; Wed, 24 Sep 2025 18:04:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Anton Johansson , Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2] target/alpha: Access CPUState::cpu_index via helper Date: Thu, 25 Sep 2025 03:04:38 +0200 Message-ID: <20250925010438.59755-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758762345477116600 CPUState::cpu_index is a target agnostic field, meant for common code (i.e. accel/ and system/ folders). Target specific code should use the CPUClass::get_arch_id() helper, even if there is a 1:1 mapping. In preparation of generic changes around CPU indexing, introduce the whoami helper to access the generic CPUState::cpu_index field. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Anton Johansson Reviewed-by: Richard Henderson --- target/alpha/helper.h | 1 + target/alpha/sys_helper.c | 5 +++++ target/alpha/translate.c | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/target/alpha/helper.h b/target/alpha/helper.h index d60f2087031..be7c8c5b8a7 100644 --- a/target/alpha/helper.h +++ b/target/alpha/helper.h @@ -93,6 +93,7 @@ DEF_HELPER_FLAGS_2(tbis, TCG_CALL_NO_RWG, void, env, i64) DEF_HELPER_FLAGS_1(tb_flush, TCG_CALL_NO_RWG, void, env) =20 DEF_HELPER_1(halt, void, i64) +DEF_HELPER_1(whami, i64, env) =20 DEF_HELPER_FLAGS_0(get_vmtime, TCG_CALL_NO_RWG, i64) DEF_HELPER_FLAGS_0(get_walltime, TCG_CALL_NO_RWG, i64) diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c index 51e32544287..abd80532483 100644 --- a/target/alpha/sys_helper.c +++ b/target/alpha/sys_helper.c @@ -73,3 +73,8 @@ void helper_set_alarm(CPUAlphaState *env, uint64_t expire) timer_del(cpu->alarm_timer); } } + +uint64_t HELPER(whami)(CPUAlphaState *env) +{ + return env_cpu(env)->cpu_index; +} diff --git a/target/alpha/translate.c b/target/alpha/translate.c index cebab0318cf..8a68b90141f 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1128,8 +1128,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, = int palcode) break; case 0x3C: /* WHAMI */ - tcg_gen_ld32s_i64(ctx->ir[IR_V0], tcg_env, - -offsetof(AlphaCPU, env) + offsetof(CPUState, cpu_index)); + gen_helper_whami(ctx->ir[IR_V0], tcg_env); break; =20 case 0x3E: --=20 2.51.0