From nobody Mon Nov 25 10:54:27 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=1716505906; cv=none; d=zohomail.com; s=zohoarc; b=eT5NYU/FlH3Q3JJWC3VoOcE/vAvJNBO2KEQWU8bsCnbRFaadYwaWyTO5sTDTQrH+GlssMm74dX/h5rCf6+tC86HLUnzPIr7PcGEcSM1dOelACXD8Zqt7dmSgyj/KihgXKjyYjiVyMelaQbinRo1sQpB5JHNVvNFCYYLwiYsDSMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716505906; 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=hShkd4GOKg4gDHb6mULyft69a2vSUmlUUWF0ua7ia3s=; b=C5FOhL3+39xhFktRxjQfrxqr9UYPUf0z50N4suquWY70XSt7rZDQexEnqMl08K8USMMmC9Z6EoCxfI0HLez09a8ALtHoiziMwcAzOSCyZKyXDBbH4eIVm34ZHHfIaqpC1rszefJm47eKH1Hg3ExUI33d8rUuZV7zTQLxQWJLFMg= 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 1716505906623918.2774608469967; Thu, 23 May 2024 16:11:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAHZj-00031Y-2G; Thu, 23 May 2024 19:10:20 -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 1sAHZI-0001Sq-6G; Thu, 23 May 2024 19:09:52 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sAHZE-0005qZ-RL; Thu, 23 May 2024 19:09:51 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6f8ea3e9543so276428b3a.2; Thu, 23 May 2024 16:09:48 -0700 (PDT) Received: from wheely.local0.net (110-175-65-7.tpgi.com.au. [110.175.65.7]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-682227f1838sm87041a12.46.2024.05.23.16.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 16:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716505787; x=1717110587; 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=hShkd4GOKg4gDHb6mULyft69a2vSUmlUUWF0ua7ia3s=; b=g++bAI1vafndb1M4VIN0ZoZ6zkKbyz5luAqNSQ+3XFmboqyqXEEl5t1Bp3hIsM6Af+ 3rC1Luc7XNwlRLhN2eulpDniOsA7nlt989a+iD+n4f59lwX3c8jlSDG4aJQSNrR3ly7E TagrJH+qIpzYUnclwi4oYNKjD5JraYxB2JwZL2FqNVMSTx6kB44oWOmXFrdXFUAZrzpF FWxzhwe60st+rFUnjznMPGSqdgFJxim72TfkStoh9E7g7VOmjosq+SXyoGI7HxAvbSsd sq2fFR4F/3VAbbUxKz4rDLmnZoDIjArjN3eAvYrgWEjeol5QSZkm52nJStZ6bPTCGEBd GZEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716505787; x=1717110587; 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=hShkd4GOKg4gDHb6mULyft69a2vSUmlUUWF0ua7ia3s=; b=eFUaSW9NDTpdWldel8UVVnXX1JjCyQlGMdeetL71pUK6UZDpxd1bIfzMUa5exj/qCI FLRs/NBYwen+yiwgPlcRfI0ncUk2zscdDpHtizRxXtcD0IjdC+PxdIuGtafq1vXVCq4x +JmitnoPgjAaidE6Pu9KdmOkneRKCYrS1aPqhVyvIviamn1s+srM1C5269XLmZZRCqNq +fuQjxhCQmJ7MLZSfim4Qvd9g+ZVkR1SMPA9sOhPDNL0vJO1b4mN+JtpUrTGbps3/Iwe 3dNMNTP9ptsnBUUAH92du2kC7cHBcf6nObA5UDerScqP8xUilFhcBulVLkbvkmlQv9hH eOIQ== X-Forwarded-Encrypted: i=1; AJvYcCVF+fzzSAVJF7KLhmMb1ID4u01Bl7pSqusr8cMC87a9feY9p3FL65fm069SkVB1ayTo8pkfOLrv7g6AEEEAi8Lec23j X-Gm-Message-State: AOJu0YxK4Ggh/9DyhQqyOrHrY5AyKI6J9n3MAFixXjwhX5CqYtDl5y+m DMLBmVvMwVxBAh15vZteMeXYsvbbVp4/L3cQsYLoILDA1jR1Dmxu5bylCA== X-Google-Smtp-Source: AGHT+IHLr7ePqSyIVo8UXCTRdzEHo/AkBb0BNBgD40Jp8H2MQpDApHuv3b0ITxOx9Tn55FHLup5BZA== X-Received: by 2002:a05:6300:6302:b0:1af:ac31:9b99 with SMTP id adf61e73a8af0-1b212ce2018mr944738637.1.1716505786812; Thu, 23 May 2024 16:09:46 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Glenn Miles Subject: [PULL 35/72] target/ppc: Add SMT support to PTCR SPR Date: Fri, 24 May 2024 09:07:08 +1000 Message-ID: <20240523230747.45703-36-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240523230747.45703-1-npiggin@gmail.com> References: <20240523230747.45703-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::433; envelope-from=npiggin@gmail.com; helo=mail-pf1-x433.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 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: 1716505908395100003 Content-Type: text/plain; charset="utf-8" PTCR is a per-core register. Reviewed-by: Glenn Miles 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 6f419c9346..a67930d031 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -173,6 +173,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; @@ -194,8 +195,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 7b525020ef..64131bf15c 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -909,6 +909,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.43.0