From nobody Sat Sep 21 04:38:17 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1705590853; cv=none; d=zohomail.com; s=zohoarc; b=McQ/tTgVtjBrTmgCzWV7zeRSb4k+KG4RM63HHGJfrCP3fwkseXGzi6oTvUnHPdYQBmO9nXu9xDbPH7sxwwv0Djhfth1ZsaFV8y5JOkvQNNAwB3zI9oqarOgZ27YeTOSElaLqn33RC7epNQiaHfcdT4S4NpaXDPslDXrJsrxo6zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705590853; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RGAerpKRGk2C4dVMvisx4cAfj+SiYpk9Hj4bX7sW76k=; b=ABUjuXtswdEXvOca65vqmzXToRFvhPY1epDEPoovUP4DXDw56aYCi/Tg45BeQp83DOawifRrJy17IhHQe7jZ0+Cfrh1Yqs5fniyIcUuajew4n3Ta5E4eCYP0OGWNcQeRxScpn6sXp/ZF5/CiHUdbR9bQkhmtQ/enenaoCeK5qIM= 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 170559085302257.10690826206792; Thu, 18 Jan 2024 07:14:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQU2p-0004sR-E2; Thu, 18 Jan 2024 10:11:03 -0500 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 1rQU0Z-0000lI-UE; Thu, 18 Jan 2024 10:08:44 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQU0Y-0008BA-Dv; Thu, 18 Jan 2024 10:08:43 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1d5cdb4a444so38971965ad.1; Thu, 18 Jan 2024 07:08:41 -0800 (PST) Received: from wheely.local0.net (124-171-76-150.tpgi.com.au. [124.171.76.150]) by smtp.gmail.com with ESMTPSA id e17-20020a170902cf5100b001d052d1aaf2sm1509401plg.101.2024.01.18.07.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 07:08:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705590520; x=1706195320; 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=RGAerpKRGk2C4dVMvisx4cAfj+SiYpk9Hj4bX7sW76k=; b=DZfxcNUhsGpI0tieWFRiGJFMQyvYGud01QBUe9IH+IeWmEQRoOt1ior2GsuOcaHbNe Xr39jmzoXNaoNA0/AItyXoSF9uVD45BrzinIZ4Mp1sT+HkHvWOkP2b7r/rkWiNSUZhMr X1zpy9WrIuCeCKGIqTyBxmECbCJpYxIUfTVVPto+gn10U53wa9kiwWa6bf59d24Mrbom 6yjYGAD8DUFIOZggYHbSSlyuIFhzQoXvZTRanjBGKhG6oMtExbqGTCeExHGFowu+FAqm aDm0uIvF17MAbztuFY/7pBxcMqG+i9Rr2jFl+o6QF2FlgIoE30O9gbU+Z2wqiCKv5iv6 3qFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705590520; x=1706195320; 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=RGAerpKRGk2C4dVMvisx4cAfj+SiYpk9Hj4bX7sW76k=; b=B+2jlI6D4nG7bXXE4DxFCUgSdcVsa+nEwIfvw4BRYe8i1mgXntwVfBD85KGgWgMb+e 4RrD8t1kzrghLsyp6yaJJFYsZ0MGOK8zqYbQtua0RO8rNeJ+JBfL377abgOYlpxxCU5y dKCDLvh/2AXn3hITwOjJJ473bvqKvsDtbEAixP8oJIT5nzcSVYJeiZqyTmJusqHi8irC BNHWvrJPHge0aGFclMsIn5rl0mfYTrg8iVsRTl18oYJboRrYv4x9+t2r/IoLve5lQFaF CIevzYUaIkwKqd0dg7WR8IJGkh4qPLhJhHOXLcElGo56nQv1CZIyMGT7DrL+/HB/LlSU wDUQ== X-Gm-Message-State: AOJu0Yx2CiEg3b55i4DKGcCazjbLneLK6gEcAvN7YbsgE6zN5zA7VjEa 5cYNiXtdByjhwaeCAIR3s8BKvZ29xoo1KukxxrS5x2XpFIP87SKWSkUHW+/y X-Google-Smtp-Source: AGHT+IHkRZdfzJp8vxDgId2ggwSBIoRw0oOsQW0wi46UxIcxtkuD/UyW/yQhpqZP7a9BGNc4tRKKHw== X-Received: by 2002:a17:903:1c5:b0:1d5:efcb:3cd1 with SMTP id e5-20020a17090301c500b001d5efcb3cd1mr1197276plh.81.1705590520697; Thu, 18 Jan 2024 07:08:40 -0800 (PST) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barrat?= , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , qemu-devel@nongnu.org Subject: [PATCH 23/26] target/ppc: Add SMT support to PTCR SPR Date: Fri, 19 Jan 2024 01:06:41 +1000 Message-ID: <20240118150644.177371-24-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240118150644.177371-1-npiggin@gmail.com> References: <20240118150644.177371-1-npiggin@gmail.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::62b; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62b.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1705590853664100005 Content-Type: text/plain; charset="utf-8" PTCR is a per-core register. Signed-off-by: Nicholas Piggin --- target/ppc/misc_helper.c | 16 ++++++++++++++-- target/ppc/translate.c | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c index e3b20a8935..5317713fc3 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -176,6 +176,7 @@ void helper_store_sdr1(CPUPPCState *env, target_ulong v= al) void helper_store_ptcr(CPUPPCState *env, target_ulong val) { if (env->spr[SPR_PTCR] !=3D val) { + CPUState *cs =3D env_cpu(env); PowerPCCPU *cpu =3D env_archcpu(env); target_ulong ptcr_mask =3D PTCR_PATB | PTCR_PATS; target_ulong patbsize =3D val & PTCR_PATS; @@ -197,8 +198,19 @@ void helper_store_ptcr(CPUPPCState *env, target_ulong = val) return; } =20 - env->spr[SPR_PTCR] =3D val; - tlb_flush(env_cpu(env)); + if (cs->nr_threads =3D=3D 1 || !(env->flags & POWERPC_FLAG_SMT_1LP= AR)) { + env->spr[SPR_PTCR] =3D val; + tlb_flush(cs); + } else { + CPUState *ccs; + + THREAD_SIBLING_FOREACH(cs, ccs) { + PowerPCCPU *ccpu =3D POWERPC_CPU(ccs); + CPUPPCState *cenv =3D &ccpu->env; + cenv->spr[SPR_PTCR] =3D val; + tlb_flush(ccs); + } + } } } =20 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e7749d9b32..41aeb2d06e 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -906,6 +906,10 @@ void spr_write_hior(DisasContext *ctx, int sprn, int g= prn) } void spr_write_ptcr(DisasContext *ctx, int sprn, int gprn) { + if (!gen_serialize_core(ctx)) { + return; + } + gen_helper_store_ptcr(tcg_env, cpu_gpr[gprn]); } =20 --=20 2.42.0