From nobody Mon Nov 25 09:58:44 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=1716255136; cv=none; d=zohomail.com; s=zohoarc; b=Jczx6juduSQ3qJ5V1GEGQ05/olWqraX/KHAmOvsB3/gfoEdcNgQeBplx8h3HkVDHjUQ8EumoaUZxccNxKAlbzMRZkvKA6B2j8f4j/ZbAXEQ1P0X06HDisfZCynK7mSgXi4tGdLKyzWQgX2eboXgSMLP68/EQib1BmojQLOAYvNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716255136; 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=UogJLS5LbK3AS3jvsFfTXAjp3CkBWXTUBHu2pm6GqSs=; b=cUn+RgZwBm1PEyERZoRIRib4VXKnhjPTGaYK8TDUR+kiP2uiZr6S4Y8heVy71hej3WE/JB+VmZFW/YUlvpNHncaJGMObEZPYVlMujdzb6HtURkpQprxdcKMWGdJ7AEZB787+pycuoKkwE4BTz2Vc2Qxi0AqGSOrqBTy2JC5jVSQ= 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 1716255136316850.2153827540241; Mon, 20 May 2024 18:32:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9ELY-0007un-6N; Mon, 20 May 2024 21:31: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 1s9ELV-0007tF-Js; Mon, 20 May 2024 21:31:17 -0400 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 1s9ELU-0005Lv-12; Mon, 20 May 2024 21:31:17 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1ee954e0aa6so63336475ad.3; Mon, 20 May 2024 18:31:14 -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 98e67ed59e1d1-2bd7f0cd400sm2514953a91.31.2024.05.20.18.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 18:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716255073; x=1716859873; 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=UogJLS5LbK3AS3jvsFfTXAjp3CkBWXTUBHu2pm6GqSs=; b=RiYRx4hGqqBL04kRrG+biySKnb33eaPqyrM5nMxIeVV9AH/gljiv9HWU/Myt+MowZ2 kAy04uRQJxjDvImgMrJzmZ2w3yaWtbE68ihRDbF8mapuepivM4tEtlPBuDAe+NBi+vUA Jyk8t7F307W1GCkQrrfsND9q3m8llKlgbg6xA2QXKNxjFSiNhGUsyFNLNM/6LOToKYTw tZPtZU2MJ++Ib95onGAkwas9hBnOTToAmTtMgcgyn6zuUGOIVWcSC5A88wOghzOfYTmy G6sDSSU2IKkR4wEJK+cCa8yyUvNzzXOnoAbmF9ggS5dQ9rDt/lUi8VJxVXsLbntUtMi8 cUOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716255073; x=1716859873; 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=UogJLS5LbK3AS3jvsFfTXAjp3CkBWXTUBHu2pm6GqSs=; b=cfkOEMCrylW5fH15PXFUL1yBwtC2cQ7IrmAeTGIRtawOQFA7Iltl5DHsEjLnlY/BCL 2LmtXEsJYzR05nd6nNEaa/FKG4aAk6k4hVs7X1k9Txzryr13xClnY9rP3GJ4JLTvH7MH L04tQ7XPTnEl1Abaq573kSEljFXAaq77eD0BMB942SryRqYkgtv5yGyN3jxG0uFUg193 Hsv3sBZ0lUadT1Wx2PGesRMnGi1tux8XJQ75UAjMRn6PDsMCNWe2lRc9v0WyHrf+a2A/ nuCD8ollbw03k/Z4MqT19DT4QSauvilc2gaYIW+Zkavc5RGPL58aI80CtwV1COvxpsyG ywbQ== X-Forwarded-Encrypted: i=1; AJvYcCXPMHRo89mTpYi903narJXIYPl5cJx5/lj3rmrWDyFDcngnDhQoAUIwR8pzlESzUBuSTRJiiJYCt12STJSFUuZUymeXITM= X-Gm-Message-State: AOJu0YxII5JH3CHJGo+nnLX/f3khX/rpE7iMWrcbF0Fx1tRodvzVo6Q4 TVMIr2SQ+gl1SIEP9W7X53DLDn/JzU3Cdq/8iPgcxiY/wI0+oKIJTeU0Ug== X-Google-Smtp-Source: AGHT+IGtvLHxUi5PyR4zdLbum+I2X6bRb4sgxoE1vgY+KPuTf+GDFeRz+tiEvrELGfp1hiLmOtl/Ow== X-Received: by 2002:a17:90b:4c09:b0:2bd:9255:4738 with SMTP id 98e67ed59e1d1-2bd925558d6mr765591a91.5.1716255073239; Mon, 20 May 2024 18:31:13 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org, Daniel Henrique Barboza , Glenn Miles , Richard Henderson , Chinmay Rath Subject: [PATCH v2 09/12] target/ppc: Add SMT support to PTCR SPR Date: Tue, 21 May 2024 11:30:25 +1000 Message-ID: <20240521013029.30082-10-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240521013029.30082-1-npiggin@gmail.com> References: <20240521013029.30082-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 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: 1716255137985100003 Content-Type: text/plain; charset="utf-8" PTCR is a per-core register. Signed-off-by: Nicholas Piggin Reviewed-by: Glenn Miles --- 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 c688551434..76f829ad12 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -971,6 +971,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