From nobody Mon Nov 25 09:56:46 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=1716255148; cv=none; d=zohomail.com; s=zohoarc; b=LoiNlvbH+V7omhpeRQZsb4AbWPivn4eveONM1XdiuxEt5t4aqrJEJYn628c7bs5NgiBVARWfIQq93vzxCVvDepQbVT6I54hDTjiHDH/onH9AKJ1SwVMa1807WJLkTYwE1mfJJZ7+akW1hFI9UQV7i6CZcENggL0LwDxi05R3vA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716255148; 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=IjlPsYtB8Kd+0Ny4SiPL3hIvcQ0jYiMqPq1SDRuz4OE=; b=LWOouj0DEetzs8MqOuPLnVg4JhY6VCoPVZEhan5zUd03dF/ItDCULzpgdmYSwbgK9a0ZbfoEGCpgIIsMxvhVnODXYOgs0Eyg/ltDE83d5NpyAn8ijS4BToqJSCqBCPGgwsLmj2P5n7Cwo6viYMCxp25zcQywMklgMy/ghekjbB4= 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 1716255148279721.0947262224648; Mon, 20 May 2024 18:32:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9ELP-0007nl-PY; Mon, 20 May 2024 21:31:11 -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 1s9ELO-0007mY-24; Mon, 20 May 2024 21:31:10 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s9ELL-0005L7-Hu; Mon, 20 May 2024 21:31:09 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-66986f58b43so1335905a12.0; Mon, 20 May 2024 18:31:06 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 18:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716255065; x=1716859865; 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=IjlPsYtB8Kd+0Ny4SiPL3hIvcQ0jYiMqPq1SDRuz4OE=; b=kHOb56SdVvuHXo7M3VmSIWflImIwDmtaIjPs+ZD5bqU1TKQuhadTxmEfUJYQhyvKxu kssgDGTBIziRJ2vkn96S696OfFstT+o4b6cTypJt4dY7T6YVIT6/7zrgOY6pNCCHK9GG iqwHExMOW0fsnj7Rq26RuFJTZE3RdLDBg8CXlRR/5aOztX1cRZ1fZqHQywObUmeL0lNK ja2sKHfL3xJ/QrTr0cBOkj/4Jy786AkGhkSEgbSVxF4I3m6MLzOQTfqrqC6i77MPjMoQ R5nr9QLfKWl2C7uX3bwZn+zINuMs9UVM5O6SqqsThbpouoMOzf208P6ot8WeLQAcczJ+ SkLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716255065; x=1716859865; 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=IjlPsYtB8Kd+0Ny4SiPL3hIvcQ0jYiMqPq1SDRuz4OE=; b=D40yUuayt0yOUICyhT0eOT7BkOwAyqQTCFSgyns7ofNiDeRzpcl9SoKwzH26+TY7L/ 2cIX2wGSefiMaj7Zy7IsuQ/3fwgQtlqjRwiDL4gISNhl1MjqTiwqYYnO3z7yGuwek2XE iZ6N5wbfb+ulsDjdndkbYJBfmIrxtw46OzpaQgxuags9dE4NT71Ot4IUmAbZs89UWyQV gUHH47MjEyuY29M4BK1mBjo44EqcwYNUKv3MZNEBNRw36nTPCny9oiVEe/4awqe9KQNS awaKRF6rl899POLfWhtwgth4IbGCXZZYoFHQdWbChyiePaq/vLUe3FTZlsbO4O5Nmk0S PlvQ== X-Forwarded-Encrypted: i=1; AJvYcCW9mxXTX6j4/dVSPFb4N1my/J/iOczmJpl8AkYtYSPmMysFbAx8ZgFR1weJ01/XO3VnPSJAstUuKuEXsSSr0wdd4CZZvxE= X-Gm-Message-State: AOJu0YxuUVLurTyO3GCMeQWX+oYTM05GKS8rIg7LVmhksoJpRDOpnjqj tiQ/hcaCDDK/P03YsGcgWVYPXETIfJe9HunUJL8uTQergGZ5mQKulZcjYg== X-Google-Smtp-Source: AGHT+IF5KzDGdGUVIjp7ZnJAXcX+JuBJBSiOWFuaBb0D9cKRNZuE4kKPRenquYdP9NJBqE5NalOSww== X-Received: by 2002:a17:90a:520b:b0:2bd:9255:91b6 with SMTP id 98e67ed59e1d1-2bd9255b060mr918209a91.4.1716255065349; Mon, 20 May 2024 18:31:05 -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 07/12] target/ppc: add helper to write per-LPAR SPRs Date: Tue, 21 May 2024 11:30:23 +1000 Message-ID: <20240521013029.30082-8-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::532; envelope-from=npiggin@gmail.com; helo=mail-pg1-x532.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: 1716255150033100007 Content-Type: text/plain; charset="utf-8" An SPR can be either per-thread, per-core, or per-LPAR. Per-LPAR means per-thread or per-core, depending on 1LPAR mode. Signed-off-by: Nicholas Piggin Reviewed-by: Glenn Miles --- target/ppc/spr_common.h | 2 ++ target/ppc/translate.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/target/ppc/spr_common.h b/target/ppc/spr_common.h index 9e40b3b608..85f73b860b 100644 --- a/target/ppc/spr_common.h +++ b/target/ppc/spr_common.h @@ -83,6 +83,8 @@ void spr_read_generic(DisasContext *ctx, int gprn, int sp= rn); void spr_write_generic(DisasContext *ctx, int sprn, int gprn); void spr_write_generic32(DisasContext *ctx, int sprn, int gprn); void spr_core_write_generic(DisasContext *ctx, int sprn, int gprn); +void spr_core_write_generic32(DisasContext *ctx, int sprn, int gprn); +void spr_core_lpar_write_generic(DisasContext *ctx, int sprn, int gprn); void spr_write_MMCR0(DisasContext *ctx, int sprn, int gprn); void spr_write_MMCR1(DisasContext *ctx, int sprn, int gprn); void spr_write_MMCRA(DisasContext *ctx, int sprn, int gprn); diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 137370b649..c688551434 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -535,6 +535,34 @@ void spr_core_write_generic(DisasContext *ctx, int spr= n, int gprn) spr_store_dump_spr(sprn); } =20 +void spr_core_write_generic32(DisasContext *ctx, int sprn, int gprn) +{ + TCGv t0; + + if (!(ctx->flags & POWERPC_FLAG_SMT)) { + spr_write_generic32(ctx, sprn, gprn); + return; + } + + if (!gen_serialize(ctx)) { + return; + } + + t0 =3D tcg_temp_new(); + tcg_gen_ext32u_tl(t0, cpu_gpr[gprn]); + gen_helper_spr_core_write_generic(tcg_env, tcg_constant_i32(sprn), t0); + spr_store_dump_spr(sprn); +} + +void spr_core_lpar_write_generic(DisasContext *ctx, int sprn, int gprn) +{ + if (ctx->flags & POWERPC_FLAG_SMT_1LPAR) { + spr_core_write_generic(ctx, sprn, gprn); + } else { + spr_write_generic(ctx, sprn, gprn); + } +} + static void spr_write_CTRL_ST(DisasContext *ctx, int sprn, int gprn) { /* This does not implement >1 thread */ --=20 2.43.0