From nobody Mon May 13 02:29:20 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=1710263203; cv=none; d=zohomail.com; s=zohoarc; b=an6gt1e1FHDguy27vqbvCrP6syrqBT3xWoX5Lhf6BhC07WgkXCgZRqWjTVCU4upDIbMmic/KwuAQknuts6BjHl54wWlRVqG1syhGhLcMQ8n9be390I2nrQFsShq9Y1Xwc7y0O08NYsVa5KNvIzws3esHNdvMqpo/8Zf87AeIuTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263203; 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=AVLie48lBIC5AzjD7aKAS9bkmqBPGd9+Xi/qx49qlpw=; b=NjsLSbAgHAscFW0aecUEeRAVpP9FRgBpAulnKih6sfXOZey2LcyDt/t2hmsXCiK0H9tdI9LaDh5Lga+tPR0dZwg49B48PwPZPtA8HIOd+dIxXe939Lr196aAT5D3kEBqUXH7Hueou4vQwdqFGnqNJu0puv6s2mqTWFRMJuau95Q= 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 1710263203638547.7157062908869; Tue, 12 Mar 2024 10:06:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TL-0004eI-Dj; Tue, 12 Mar 2024 12:59:27 -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 1rk5T6-0004YW-Tp; Tue, 12 Mar 2024 12:59:16 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5T4-0007ug-4t; Tue, 12 Mar 2024 12:59:12 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e6a9fafacdso560625b3a.2; Tue, 12 Mar 2024 09:59:09 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262748; x=1710867548; 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=AVLie48lBIC5AzjD7aKAS9bkmqBPGd9+Xi/qx49qlpw=; b=lezqaG75+25ck6m3g3SDed714nGhLZS2M/heiQf0j+ifOMBJQTZZ4CDU6APW92A7D9 8Qp6fIbF05Z2MiUMMmeG9udS1FSl7J1Y/wLp5no71vRhfckC6OS5ANEk9aaxszCf7XPX JYWrrnhG1JRY00FsGJZn6dcRYd+fQvuDSzWFROKoo0JGh/A9J2reKzfD58Ze2Oc9SV/N wU8iX8OcaUwMFiIsgc3+yH/pXJibL6xixAknyYN45noCl1k690nCGCAc1tFRQYfnDOT2 LUwYMQNcIK9E1ruFgUEt86Phh8ZWYWBr71QDML95q8G/qKJFka05QtnWHdBuEdHGoVDz 2mfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262748; x=1710867548; 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=AVLie48lBIC5AzjD7aKAS9bkmqBPGd9+Xi/qx49qlpw=; b=QcRshae4g+HVWxBUz0QjAcuKHcjYGpgIlM7ydEpswaUfogEOFiPnHT9YXd1ufegBEa Kl/Do4DiCU3W74c+ggPTGfgo/B+M/t1FaWW8YnLRClp5pXTawuBx33w6RpAjKoWl7iqt KbGbBgHfH/PfsWum/Xnu6GjtpWIl+3Ok2sXZpozyVIyKVMEVPfEfJKfY+f8qgifOoMyP qIBgSZTVs4gRBW7nCgpitclpbTHdYSiFwkxpPIpuSCtwaJHxYGUfJAwac6v+4BIux9Vj XVnH0+i2YxxnT+CYACFIiBYGSn1UcnH2f3u+FrVzngAYOd81KWWmqlwZre5RT3GNTfPU vc/w== X-Forwarded-Encrypted: i=1; AJvYcCV5HAkwPGOj20aTLtMOMYQOkQlKllsByM511SGkZKQ13ARzoCqr08DyPxR2sk0pZHswh2lqVevZ+S67BjBeQfsDSYCR X-Gm-Message-State: AOJu0Ywismwtaeb3iZk8KUHtZ/YPd7BeaW1jStJIlyl9MI+FZqY52kad GUxfYbxwlR4IA3+1Jpb2LsKIoOoXL55fOvGVdQipP52XfyMIHrJoPYXD+Rp0oek= X-Google-Smtp-Source: AGHT+IHhWglLuzxH6nmx7sh/7myZzdrDAM4wrIOPgfoKRBf1P9RDHyfLgSZTEanFlO1G9GnFXsw8gw== X-Received: by 2002:a05:6a00:3a2a:b0:6e6:4705:a07f with SMTP id fj42-20020a056a003a2a00b006e64705a07fmr11329pfb.31.1710262748005; Tue, 12 Mar 2024 09:59:08 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Akihiko Odaki Subject: [PULL 01/38] target/ppc: Fix GDB SPR regnum indexing Date: Wed, 13 Mar 2024 02:58:12 +1000 Message-ID: <20240312165851.2240242-2-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::434; envelope-from=npiggin@gmail.com; helo=mail-pf1-x434.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: 1710263204987100009 Content-Type: text/plain; charset="utf-8" Fix an off by one bug. Fixes: 1b53948ff8f70 ("target/ppc: Use GDBFeature for dynamic XML") Reviewed-by: Akihiko Odaki Signed-off-by: Nicholas Piggin --- target/ppc/gdbstub.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 122ea9d0c0..80a2e7990b 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -324,6 +324,9 @@ static void gdb_gen_spr_feature(CPUState *cs) continue; } =20 + gdb_feature_builder_append_reg(&builder, g_ascii_strdown(spr->name= , -1), + TARGET_LONG_BITS, num_regs, + "int", "spr"); /* * GDB identifies registers based on the order they are * presented in the XML. These ids will not match QEMU's @@ -334,10 +337,6 @@ static void gdb_gen_spr_feature(CPUState *cs) */ spr->gdb_id =3D num_regs; num_regs++; - - gdb_feature_builder_append_reg(&builder, g_ascii_strdown(spr->name= , -1), - TARGET_LONG_BITS, num_regs, - "int", "spr"); } =20 gdb_feature_builder_end(&builder); --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263309; cv=none; d=zohomail.com; s=zohoarc; b=g2EfyqN6XFoFWEJscO8FP2H36JcNO8oAVhomWMI9kTqEFAf66c4U4kNRRQ04QUmuxJxxlSgJVURyol7OOBGAU1KyBbEWMl89ScBXesl6uYENsE8eYdo2FRceE7ohoMeN0DY2EkOWxhoSxkt6+iJjrm0pNXNU3hYZQMyfYYM6YmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263309; 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=GmKs3OLijRDjxbbgFJRC36Pyehi0EZh4ofDu2FesM1g=; b=H+ta0FzcwqWBobeQc8atAKPF8yozs1YCHPQ5FvLgL+ZJgBvfR45U1sufCZf/8rDt0ZoK5qPxf/LxF+GQ4lQr6jkiO3WzBw02VDjCQTbFmU44bMsocQ6NOEKX29yfTe7Jp6QCBl2+LtIUG3gakeqadlkFUYvhWLAc6lIM0PjlcXo= 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 1710263309579382.5002509816418; Tue, 12 Mar 2024 10:08:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TM-0004gy-Id; Tue, 12 Mar 2024 12:59:28 -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 1rk5TD-0004a8-AS; Tue, 12 Mar 2024 12:59:21 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5T9-0007v9-JZ; Tue, 12 Mar 2024 12:59:19 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e617b39877so4232495b3a.3; Tue, 12 Mar 2024 09:59:12 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262751; x=1710867551; 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=GmKs3OLijRDjxbbgFJRC36Pyehi0EZh4ofDu2FesM1g=; b=ZGhyanoRt226wX03Gwg1rwK8CUiVrh9X/HSwjE7fMGt0ZOkdCAlHYBEsAueFc8DuHn sXy+HDcyGQLa9loHdxlfIije4+ax+Gm0+ELw1qdqR1/gzQzraJPBCgTqE3jF2YA1qlJ/ vOrG6/Ot71lYSBrcHAy2uxhz1LxnAkIYFWK6Fag5M0dDtZJc3ljiLJKsINWwtohR4hTe ukVrSW85E+TSe1NNdoBAbj1yxlERMa8CzpBZleGXhw4/j5oOmUdTllbwfDEq9C2xTfu+ mJtFG8NiIy3/nXLnzZht0gFEJPwoxtBmDMy0J9utgZCO1QwjJaAUSqzwRxJLSR4XDVec qokw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262751; x=1710867551; 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=GmKs3OLijRDjxbbgFJRC36Pyehi0EZh4ofDu2FesM1g=; b=XWDW+r6tu7/ufmwlS0qfeMyl07kQMhFyI1yy8l+k59SfXVxbGaGIdygmX7ZZ2dtxi8 5Mb+KKfRKK1HAOtLcWv3YWhyxjQd7K514aVBPZd2HyOSFcUbqYkUhsGGhS4fciV9XPw4 alDEre8CXd6cRqRGeFWc3WWsqmSPzYjqSY4bBS6xyYbLudOyPW1KJJZFpbaY0cpeQJo1 HSRgmzyxQF5umRWVsRkcVjS5HjYyuPxJHc4aZ0lk25BXFZzVFsQVEXBmGT4Rt3Aa/kvI KwQ+6FT7lJmoXG9aHxQZu62ekJ1+DXSj7wZuA1Fx7vHGK4UYX14BzwXxrf77Ua/KwB/D PYUw== X-Forwarded-Encrypted: i=1; AJvYcCX2EQcWM0YJsERGIUlwjtmD1uRkIoizVGKT0ta64MvOgeXfzntco1Ky+ujh23UL9IjsQ2/5wOHfJFGQZGwQQnGzqmcV X-Gm-Message-State: AOJu0YxSwUrhGjyypBXJKgj6PdeXT5LQ0SEUUcSd9iD4DPAreQmRWAyG RFuLJZ3gLY5ndl7zs0DnHcBL798VQLFU1DgXBnfzbg33eHpZFOw9WWlXDOKmWXQ= X-Google-Smtp-Source: AGHT+IF2mKu9LkEIW1Hxx++Bm0ctDSuSyujbEp9m1DagvhBvp5GJ3iOjoUb1qZR09taMdDQ758WynA== X-Received: by 2002:a05:6a00:23d2:b0:6e6:9f47:38c6 with SMTP id g18-20020a056a0023d200b006e69f4738c6mr5169pfc.27.1710262751462; Tue, 12 Mar 2024 09:59:11 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 02/38] target/ppc: Prevent supervisor from modifying MSR[ME] Date: Wed, 13 Mar 2024 02:58:13 +1000 Message-ID: <20240312165851.2240242-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.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: 1710263311372100003 Content-Type: text/plain; charset="utf-8" Prevent guest state modifying the MSR[ME] bit. Per ISA: An attempt to modify MSR[ME] in privileged but non-hypervisor state is ignored (i.e., the bit is not changed). Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- target/ppc/helper_regs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c index 410b39c231..25258986e3 100644 --- a/target/ppc/helper_regs.c +++ b/target/ppc/helper_regs.c @@ -264,6 +264,11 @@ int hreg_store_msr(CPUPPCState *env, target_ulong valu= e, int alter_hv) value &=3D ~MSR_HVB; value |=3D env->msr & MSR_HVB; } + /* Attempt to modify MSR[ME] in guest state is ignored */ + if (is_book3s_arch2x(env) && !(env->msr & MSR_HVB)) { + value &=3D ~(1 << MSR_ME); + value |=3D env->msr & (1 << MSR_ME); + } if ((value ^ env->msr) & (R_MSR_IR_MASK | R_MSR_DR_MASK)) { cpu_interrupt_exittb(cs); } --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263239; cv=none; d=zohomail.com; s=zohoarc; b=bY4tiZt1HRcKqcm+2p3tO/TuT3Kv7+SqNcveG6QnkcIczbhRWIQ1nCkvBW4bxU+jJOgLkVENDKNJV+UN8N3GNbyY1hG4cRhMVDkIcO3FVhgpwwx3MAVZJUvL3T72LUR8ZiBKImDxW0150nZ0R4zzTYxrd5oc/gv0XXftWm9yoNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263239; 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=jbdn/uveWvd2PFXff/mZFgoDGVsNpp8ewKrdvUUPnz0=; b=g2CjhSV4pEec/cBcDj6mvteDqIfFqnOwQkXdO13g4VZ46BBrwLqiygqJFKGnB/9P95oUtxtBHIVlEUbT/9kavTbYwgfi56VAW1rxGBn9nV/uk0Ps9tTNVtDDpNp9/kNVy7iyyHjkMKmOSR03ky4Q6jZT19ZccSBtOv3ER0YGmnA= 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 1710263239085622.9235661600801; Tue, 12 Mar 2024 10:07:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TM-0004g2-Ct; Tue, 12 Mar 2024 12:59:28 -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 1rk5TD-0004ar-Ri; Tue, 12 Mar 2024 12:59:21 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TC-0007wl-Bh; Tue, 12 Mar 2024 12:59:19 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6e6ab012eb1so789287b3a.3; Tue, 12 Mar 2024 09:59:16 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262755; x=1710867555; 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=jbdn/uveWvd2PFXff/mZFgoDGVsNpp8ewKrdvUUPnz0=; b=A6GTud+/fXJGEC6ejhrBxkxAuFotFRzElXh125M1ZGAYC2c7dEsXMGpaAnxlyJLfjB 0xYZN/oPv5Gtm2IZ3m0qkKMYq04M8pbfQlfVAvwEQuX632EC0pPHQpbMmDeN2clDBvYv 2jBevQQh/pw0jj0V7VRk4gNAM3q9mAY8I5BFlGAiVjGF8f/Dz9DyBLsC5PsoQVY+Lf7s F5NjXSibOP3guLwuBwC77SZ/Z0eyIWslEBnNmPXrXheTsZWu1dx8W59MJHnvC1Cu0RMe OUD5PCE8bkE5oripv+DKyZBcISrLV1e8RwcjlO41Mo97uMhKXOiPY++0KCE60IgjRJ8N rx1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262755; x=1710867555; 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=jbdn/uveWvd2PFXff/mZFgoDGVsNpp8ewKrdvUUPnz0=; b=ME1gflrsfyfRu1h0RFnaTMR9MkkJaSvGDxlleN4tTC0lqRYZMKS/0x+Ya3ar3HiUC3 qCkWQ1yIkUa7fsRZD57RzyLj4wNmm3yJLZznN9XqrtaqIsSwTNAa0PiO50slO7zbA+v2 Kwq6BzArYLwTakf5lW88b97Gn8+o7Yvszc4sIBaCRkpOjymnIt8yUJ85YmP0lXC8gw+2 WIDWSn/B4B6Y5aCJPTJTqSb/R+8D8Bi4EyG2HGpMtyzGfR9+QRrqvqqo+AJAcKfnJjOB va5le2jdCv5AQ7rNL099NxR9R7ekyC16Wrf83hH3YRzPQP0sUsSlKOkMfCf8zwfS0Ma5 WCEA== X-Forwarded-Encrypted: i=1; AJvYcCUfypupp/6HZxcrSFuvpHP7+sT+wVmPVXShYecJjNZh1xHR4zXob/xhyqyawHiVnXk0tcNka6HAbwG4q5xAtB+eKqN4 X-Gm-Message-State: AOJu0YwKsHBQlMg17BWfN08aDNspH0c7KPMB4nvKuFBBd0VPClVL3/Ih Yibqa8Jccb6l/hcxE2+0+7U7ibFQ5Qm9BYQNwgEp0W1MWs94nQMc/zo82TqgOQQ= X-Google-Smtp-Source: AGHT+IHdGcGg69wSlDkf8NVkKtITCvwFnrs8ytDghHyL1IigZtloERgTy9GeDWZ/ruQ1WA6ysJMZCA== X-Received: by 2002:a05:6a20:7d8c:b0:1a1:6ab9:9139 with SMTP id v12-20020a056a207d8c00b001a16ab99139mr8560049pzj.11.1710262754843; Tue, 12 Mar 2024 09:59:14 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 03/38] spapr: set MSR[ME] and MSR[FP] on client entry Date: Wed, 13 Mar 2024 02:58:14 +1000 Message-ID: <20240312165851.2240242-4-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42b; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42b.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: 1710263241090100003 Content-Type: text/plain; charset="utf-8" The initial MSR state for the OpenFirmware binding specifies MSR[ME] and MSR[FP] are set. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_cpu_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 40b7c52f7f..58cb992609 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -39,9 +39,13 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu) =20 /* * "PowerPC Processor binding to IEEE 1275" defines the initial MSR st= ate - * as 32bit (MSR_SF=3D0) in "8.2.1. Initial Register Values". + * as 32bit (MSR_SF=3D0) with MSR_ME=3D1 and MSR_FP=3D1 in "8.2.1. Ini= tial + * Register Values". This can also be found in "LoPAPR 1.1" "C.9.2.1 + * Initial Register Values". */ env->msr &=3D ~(1ULL << MSR_SF); + env->msr |=3D (1ULL << MSR_ME) | (1ULL << MSR_FP); + env->spr[SPR_HIOR] =3D 0; =20 lpcr =3D env->spr[SPR_LPCR]; --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263056; cv=none; d=zohomail.com; s=zohoarc; b=G+RmC9TcnpZeng1KGt8AJHpbVE+U2zKBbZcpy1lljiATI93IxKT67rzKduwt6rIBBf7SKjWrFuo8aNzHhwnedmE+qwcC0/cShfzXanmNvhIX0XeGa9a4BcGmkvI+WvpYzmXCyJhe10o43VMn8ADdXJGnY7cJdlWb2Pem1G+1GHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263056; 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=vQN5FrIT5FE3k5QbCnhPfKluszDyxySXf7QR9utsA34=; b=L0I7D0nHhzXp+b+AQk7KQgMFzT46IRkDvQIVwkBk7+cAs6sh05a/I415YerP8DoNLWLLUYw1U4NxfKOqyxFbnvzWiJOmknjWRJLYMG4ouzaF0o0CwdX3Nm54WT+yMnYbZF9QBsuFv754yqvO0vxV7sinG7j4iWu2YZeG2vnVKqA= 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 171026305648155.6705433124838; Tue, 12 Mar 2024 10:04:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TN-0004ho-3e; Tue, 12 Mar 2024 12:59:29 -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 1rk5TG-0004ay-HP; Tue, 12 Mar 2024 12:59:23 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TE-0007x6-Sy; Tue, 12 Mar 2024 12:59:22 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6e6afd8da93so496030b3a.3; Tue, 12 Mar 2024 09:59:19 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262758; x=1710867558; 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=vQN5FrIT5FE3k5QbCnhPfKluszDyxySXf7QR9utsA34=; b=jCJSrY+5ahaCxQ/iiVYorUBq2YmXdNPqoGCQQ5P3TUfdhEt60FKrfP3ZpYZMfjTfMO axBK1DPCmCaalh7oaZ09A1Yx/GbNMRvHrAWS7ro8L8Un/BC4rXz99Z0qRgkMjJ/2SV15 xXIBoQK7OrR4ttWpw8dzv33cOOmkEzEXcpxwjy1TwcYbVn/RSytIuAaquRuig1BgissR nAKA2EQ3yOMoSvSt5hLCKQVj6uSkAPJp0pBIzAtIW8/EmGd0oobjjO6up7zvAakZPB+I Q3YsftwE1cTVZ7qGdDtSrQ+KfurARlCCJ112nz1uSzgYbMMtqhz/lbcD1W9O9iM9l2CG 5I1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262758; x=1710867558; 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=vQN5FrIT5FE3k5QbCnhPfKluszDyxySXf7QR9utsA34=; b=CXhEL3g1yPFs9v4kGmK4GvfwGj/RXBtyLoPnK5m54WndGRVUTq0PPRvb06APv7HJMd 8cNT0JNb75NLglEfLHDqYdqlKv6QBCTnyq+wM3B5ndBCyV3f2u46fsu1uAVFaXy2IFL/ IrwfkMFhUw2t4NTJXk9o3ceW6RKEYUoeP2p3EOfXW0S+HM8Vtos43eVg8dQCCbwURndj miozoxCaoZtrBAJl3iXsUC/6FGq/6iY/mPJSjS9cr50Geyifu1wSmKmzhSxRcoLVBrkU QAOiT1+z+oYEM57fnJdR1c41uAy0UGn5RGXAET+YfUVX42H0KrUejxkRKCMdNb3UYFA7 kiOg== X-Forwarded-Encrypted: i=1; AJvYcCUlCpnlQxWYoiCfneS6cxSCCBlSu7TUMTMNThFEwQYJ5x0y9fBsJsaRbbnA3HpQ3rrvVSlNpavbIx+yG1cJWBwy1pez X-Gm-Message-State: AOJu0YzaXXYFrqyIHRxiKEspUKJzHmMkzyxQXZaH/LiV6Hsj+g/nAGSV fMaklidQqwOCF0clg991NxbXTfjqJwEkg0reuW7IAH4dPsyzitlm61kll9uKcXs= X-Google-Smtp-Source: AGHT+IFK60JQMRYcSX8UFhpY2xqloPriSHO2VH/ub9lJcgSE60yi1Gf0irI01fYPYTfbG0wkZAeRag== X-Received: by 2002:a05:6a21:3403:b0:1a3:1048:3dfe with SMTP id yn3-20020a056a21340300b001a310483dfemr7310687pzb.38.1710262757982; Tue, 12 Mar 2024 09:59:17 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 04/38] ppc: Drop support for POWER9 and POWER10 DD1 chips Date: Wed, 13 Mar 2024 02:58:15 +1000 Message-ID: <20240312165851.2240242-5-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::436; envelope-from=npiggin@gmail.com; helo=mail-pf1-x436.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: 1710263058226100006 Content-Type: text/plain; charset="utf-8" The POWER9 DD1 and POWER10 DD1 chips are not public and are no longer of any use in QEMU. Remove them. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_cpu_core.c | 2 -- target/ppc/cpu-models.c | 4 ---- target/ppc/cpu_init.c | 7 ++----- target/ppc/kvm.c | 11 ----------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 58cb992609..e7c9edd033 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -398,10 +398,8 @@ static const TypeInfo spapr_cpu_core_type_infos[] =3D { DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power8e_v2.1"), DEFINE_SPAPR_CPU_CORE_TYPE("power8nvl_v1.0"), - DEFINE_SPAPR_CPU_CORE_TYPE("power9_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.2"), - DEFINE_SPAPR_CPU_CORE_TYPE("power10_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power10_v2.0"), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"), diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c index 36e465b390..f2301b43f7 100644 --- a/target/ppc/cpu-models.c +++ b/target/ppc/cpu-models.c @@ -728,14 +728,10 @@ "POWER8 v2.0") POWERPC_DEF("power8nvl_v1.0", CPU_POWERPC_POWER8NVL_v10, POWER= 8, "POWER8NVL v1.0") - POWERPC_DEF("power9_v1.0", CPU_POWERPC_POWER9_DD1, POWER= 9, - "POWER9 v1.0") POWERPC_DEF("power9_v2.0", CPU_POWERPC_POWER9_DD20, POWER= 9, "POWER9 v2.0") POWERPC_DEF("power9_v2.2", CPU_POWERPC_POWER9_DD22, POWER= 9, "POWER9 v2.2") - POWERPC_DEF("power10_v1.0", CPU_POWERPC_POWER10_DD1, POWER= 10, - "POWER10 v1.0") POWERPC_DEF("power10_v2.0", CPU_POWERPC_POWER10_DD20, POWER= 10, "POWER10 v2.0") #endif /* defined (TARGET_PPC64) */ diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 1d3d1db7c3..572cbdf25f 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -6350,10 +6350,7 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *pc= c, uint32_t pvr, bool best) return false; } =20 - if ((pvr & 0x0f00) =3D=3D 0x100) { - /* DD1.x always matches power9_v1.0 */ - return true; - } else if ((pvr & 0x0f00) =3D=3D 0x200) { + if ((pvr & 0x0f00) =3D=3D 0x200) { if ((pvr & 0xf) < 2) { /* DD2.0, DD2.1 match power9_v2.0 */ if ((pcc->pvr & 0xf) =3D=3D 0) { @@ -6536,7 +6533,7 @@ static bool ppc_pvr_match_power10(PowerPCCPUClass *pc= c, uint32_t pvr, bool best) } =20 if ((pvr & 0x0f00) =3D=3D (pcc->pvr & 0x0f00)) { - /* Major DD version matches to power10_v1.0 and power10_v2.0 */ + /* Major DD version matches power10_v2.0 */ return true; } =20 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index bcf30a5400..525fbe3892 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2369,17 +2369,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *= oc, void *data) =20 #if defined(TARGET_PPC64) pcc->radix_page_info =3D kvmppc_get_radix_page_info(); - - if ((pcc->pvr & 0xffffff00) =3D=3D CPU_POWERPC_POWER9_DD1) { - /* - * POWER9 DD1 has some bugs which make it not really ISA 3.00 - * compliant. More importantly, advertising ISA 3.00 - * architected mode may prevent guests from activating - * necessary DD1 workarounds. - */ - pcc->pcr_supported &=3D ~(PCR_COMPAT_3_00 | PCR_COMPAT_2_07 - | PCR_COMPAT_2_06 | PCR_COMPAT_2_05); - } #endif /* defined(TARGET_PPC64) */ } =20 --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263013; cv=none; d=zohomail.com; s=zohoarc; b=i1qwDenNvih+QD0svsEo04UMZmQxN8ZRw0mqL9gdI0pP6b2fZBk/VaVpNNB2Gumv9RvSh5+I2jw6Uwhycl5ewSWWWEUtloIqWjVJUbv6Ap2IeKocirqOdPnEca/yqWJ3RA3jVJ8G85mWj2pyaWvoNKWbAZegkeS9Inc+X64vnVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263013; 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=2hIrP+GOO7mqBVQBlneIZNaQyZ+Zlpvjob7t6Cp/ux0=; b=aX1fXbDTRvhM9k3yZfusPSdK2eSus46IPVHiHbLY9g6me91clhViC+auT0Lj1JdmilhwO5aCWbBf12DkZDzk0Q2OsTWYwxe02KGXr+KZKucDr1A0Yigjc7jpSxx63M7EsyaAWQ6k0LrOdYVeB1YPkRFVrUQLeUzypKw58eOAOs0= 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 1710263013690872.4995140555116; Tue, 12 Mar 2024 10:03:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TN-0004it-Uu; Tue, 12 Mar 2024 12:59:29 -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 1rk5TK-0004d5-GF; Tue, 12 Mar 2024 12:59:26 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TH-0007xM-Ay; Tue, 12 Mar 2024 12:59:25 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e5c0be115aso80380b3a.3; Tue, 12 Mar 2024 09:59:22 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262761; x=1710867561; 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=2hIrP+GOO7mqBVQBlneIZNaQyZ+Zlpvjob7t6Cp/ux0=; b=HJb7wkV9Xory+0sMHc5wcGXZUAuE9AA20v5f9E42YDlGDOFcZ0KxfYgt24000iVf7R Av80iu8tiohxNHnuPSXINxChS/O2UvCDtSVNjwMYP2GDu9B6fmnzagQbpaRpVGEJKB5R aDdVb6o9GEGEs5utkDr8jyhsw1kiOAzrTPw1uX6A1YjOBs5XWzRPu/amikCkgwmlYNNc z0ZLGgLS2mTAZyap6RHx2LdJNqdLeWLzqHkpSFkB09XajlRhCSp1B3EZ2VJxbDwdhC6m IbEDkVRZFtVzAV3qz035J3MEHAx/mBVzAICNObMCMRTHE7XJeWJt5Q5bgfP4oFQsc8j0 USCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262761; x=1710867561; 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=2hIrP+GOO7mqBVQBlneIZNaQyZ+Zlpvjob7t6Cp/ux0=; b=jhYinOvoUP4wERzaomNTvInqyuceSTA/K0jRAiosCwPQkKV/YnnAvA8ihMkaaY9u/6 otf9U2mdTZ6OsjeWaJErYMQwLZKrcm1+TO+Fq3VWzgD66ibj0kN0PpK+uT5T/P6NGT1L iQorI+IaJzE0ac14lf//b6KgPk19j8RJAQ0ybCyj6Errdk7vY3vFa+eZlf0scGDOpAfB xGdN47oyJwAULhtH5VqWd9AU1/+Nfr2UO83m94bIvEODAh0YupUeOTJYLB8XRT3GfjgK kbfHRMoLqT1XRK4AJJLLf+XKgYTcsluI1PuFMm6nWj32JYqK7KkAOJ9ihtOuk/iT2F+w jcpg== X-Forwarded-Encrypted: i=1; AJvYcCWYP+ji8EOQLL58UDjMta6P39xxtsN+Qfzugrs1mQIyuduNI+uTXUEjph2RmncYpbTi9SpXxfsGO4wHRzD03Ggk2dX3 X-Gm-Message-State: AOJu0YxmHCVqo4tSzVFz9exLXTuef0eObU0vEf8aRsWNwGViiZMwnRy1 DC7lSudNmTTUqObq/Cv8AhwR2u0DGQeOzKTuBB+NkfBUzoDSApnRDbA9L1+IHMA= X-Google-Smtp-Source: AGHT+IG5cDMQmDShI4v5/qJWIFcWmnXg36TxA1wPQkWCdPcpo+/gYQqwvMMo7rTJSCGOjkTsYkPGwg== X-Received: by 2002:a05:6a00:2d0a:b0:6e2:de02:598e with SMTP id fa10-20020a056a002d0a00b006e2de02598emr14132pfb.33.1710262761034; Tue, 12 Mar 2024 09:59:21 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 05/38] target/ppc: POWER10 does not have transactional memory Date: Wed, 13 Mar 2024 02:58:16 +1000 Message-ID: <20240312165851.2240242-6-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.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: 1710263014028100001 Content-Type: text/plain; charset="utf-8" POWER10 hardware implements a degenerate transactional memory facility in POWER8/9 PCR compatibility modes to permit migration from older CPUs, but POWER10 / ISA v3.1 mode does not support it so the CPU model should not support it. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- target/ppc/cpu_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 572cbdf25f..b160926a93 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -6573,11 +6573,10 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 | - PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL | PPC2_ISA310 | + PPC2_ISA300 | PPC2_PRCNTL | PPC2_ISA310 | PPC2_MEM_LWSYNC | PPC2_BCDA_ISA206; pcc->msr_mask =3D (1ull << MSR_SF) | (1ull << MSR_HV) | - (1ull << MSR_TM) | (1ull << MSR_VR) | (1ull << MSR_VSX) | (1ull << MSR_EE) | @@ -6617,7 +6616,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) pcc->flags =3D POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | - POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV; + POWERPC_FLAG_VSX | POWERPC_FLAG_SCV; pcc->l1_dcache_size =3D 0x8000; pcc->l1_icache_size =3D 0x8000; } --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262829; cv=none; d=zohomail.com; s=zohoarc; b=dwSdIxXFtYKb1H0zN59mP3uHueBEavGOAG4MGMDccgRUwiZTeAWdBNqEUnUKHFFiA0zhP0a7nGFChJjRb/1Wc4hRoGkBhPnAoVWHN2iV3WZVyy2KY9+HX6RQaD/TainRRFgimOoif5zAU9VEBes8V3TKGuDH+HkVNFocTTy79LI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262829; 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=6B7WRsdl13z1HZyfIAIaADMcs0Ruf91d8bxZELsi1fE=; b=ZNmsLUBLM+1Q+Cdg2Qf53iZmZxaiXaGyGi8gcwKvmqDBFcxCcelxa37ZFO+TFXG3eFFuGjbTEl7B6OVCJvgCMa9ndXBDiWkZjHoMTF+EtjyuJWdjQdxuIk+a2yJd1Bwtxr5c58TIKjoF3060AJrEiHt8pdkm2bR1htUruABGRdo= 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 1710262829118935.3194897477592; Tue, 12 Mar 2024 10:00:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TO-0004jF-Uz; Tue, 12 Mar 2024 12:59:31 -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 1rk5TM-0004fX-8P; Tue, 12 Mar 2024 12:59:28 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TK-0007xo-KB; Tue, 12 Mar 2024 12:59:27 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e6aaa2f02cso603081b3a.2; Tue, 12 Mar 2024 09:59:25 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262764; x=1710867564; 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=6B7WRsdl13z1HZyfIAIaADMcs0Ruf91d8bxZELsi1fE=; b=DHfb7al31EaCi01vEwLvLqKCLR1b0uaoMFTxcxY3LgRe0tyWKR353SupheUiyyZJcr rI/QawgzIZq8fuN6Em4aNwA1MH6emEkfhDXq+rHnPonE4RuU6AuIydG94mFiwZcw/fOf VhQrYmdWiupyUDo51y0ZROaJ+7+h/pQ/vKZKmzun8EK0CNH3kthvfaA42jtimcDvHcOw 6elzRNlxkH1dpikIDyhDxx4tK8Bl6LEGzrCEPoN/VetmIw9ZF8uZqMXKe6iBh7TFZIhP Ah/2DRonuwk+STPjkxXMHyK/VOfvdkeSH3DN0fuV/XebZqx0yXIwS+QktSfzTYglnAuD tskg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262764; x=1710867564; 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=6B7WRsdl13z1HZyfIAIaADMcs0Ruf91d8bxZELsi1fE=; b=XThuQpHHb3efELt7nzcmtmM5PkcjaSJRtbWqb4LWnq67dXJoQjmo00GaphkyqmKf7v EVLF443AAzvll60HCf/Pnv2epsRnefvf07yUE8C4Qarhi9cZ+NpEm+MKPKMw02G5Egqy GnBKEy6RimQp4EXBl0hwL9iaeO7XME+/9W9pNVsxOsbmPSQqaBChhaK/XUYyswvg52mV RVcfe+Iqd/awGMwW3jvHp1KAqzC40GS6GpneodcF64MO7a3Y88R6MunSR15nBHQUlteh Tfaf4CQoGTaFIi63eQQg8QLLtk05yPPf4a32rGcWZzIAQovpB3EyUK0k2TPbnb5ZuLP0 Hw9A== X-Forwarded-Encrypted: i=1; AJvYcCXRKgATBNF6E9/5WcntlXUxsGCYW0/eJPKKqWJZZnvKSyWRmekEMTvSA5Vav6x43rlVbDm9lGWiCpBSNdlDKvmrX7di X-Gm-Message-State: AOJu0Ywhtvagd/WdtNoEtDxsSJjY++mU67u8PsS/xIilt+YorU8Mbhos WgjYVVDdcDTdv/L58U7zBpf6vqRTrYfs2faSngx/rLg/YggcxNPCeOooqJzaMKI= X-Google-Smtp-Source: AGHT+IEf/go7mpI9jac0k38HbY+U7RGEcqKX+0Bugem3eCc2Xu3PGJkoSj+sfTp6eW51Q/+7NQv/WQ== X-Received: by 2002:a05:6a00:22d6:b0:6e6:97d2:ba3b with SMTP id f22-20020a056a0022d600b006e697d2ba3bmr57483pfj.4.1710262764253; Tue, 12 Mar 2024 09:59:24 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 06/38] ppc/spapr|pnv: Remove SAO from pa-features Date: Wed, 13 Mar 2024 02:58:17 +1000 Message-ID: <20240312165851.2240242-7-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.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: 1710262831128100003 Content-Type: text/plain; charset="utf-8" SAO is a page table attribute that strengthens the memory ordering of accesses. QEMU with MTTCG does not implement this, so clear it in ibm,pa-features. This is an obscure feature that has been removed from POWER10 ISA v3.1, there isn't much concern with removing it. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/pnv.c | 2 +- hw/ppc/spapr.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 0b47b92baa..aa9786e970 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -150,7 +150,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, voi= d *fdt) uint32_t page_sizes_prop[64]; size_t page_sizes_prop_size; const uint8_t pa_features[] =3D { 24, 0, - 0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xf0, + 0xf6, 0x3f, 0xc7, 0xc0, 0x00, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 55263f0815..3108d7c532 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -233,17 +233,23 @@ static void spapr_dt_pa_features(SpaprMachineState *s= papr, PowerPCCPU *cpu, void *fdt, int offset) { + /* + * SSO (SAO) ordering is supported on KVM and thread=3Dsingle hosts, + * but not MTTCG, so disable it. To advertise it, a cap would have + * to be added, or support implemented for MTTCG. + */ + uint8_t pa_features_206[] =3D { 6, 0, - 0xf6, 0x1f, 0xc7, 0x00, 0x80, 0xc0 }; + 0xf6, 0x1f, 0xc7, 0x00, 0x00, 0xc0 }; uint8_t pa_features_207[] =3D { 24, 0, - 0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, + 0xf6, 0x1f, 0xc7, 0xc0, 0x00, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00 }; uint8_t pa_features_300[] =3D { 66, 0, /* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110= */ - /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, SSO, 5: LE|CFAR|EB|LS= Q */ - 0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, /* 0 - 5 */ + /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ + 0xf6, 0x1f, 0xc7, 0xc0, 0x00, 0xf0, /* 0 - 5 */ /* 6: DS207 */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 - 11 */ /* 16: Vector */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262878; cv=none; d=zohomail.com; s=zohoarc; b=NfB0YrSARQ1hpjTtj1v0vr+MZKrnRHQgsYywpG8lPzLZUYjFA+qvjA19XSUiyItM9ZhOmuxqJY/LZHFaFvINs4eGLMOwIViffbmLUo7CLvFl3/W2IOQCH+tR2AOQVe/7F5LpWR61zEoOqv+oaTlcVrX7W/lXh5O/kUZoQHpZGFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262878; 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=KRNFEd2YKSH0GA9c/OZVzyVQTq0v73fyutt9t+Ehgsc=; b=DCRaHxYJW//1UFoBdttVoAxHRk6OY1PMzNAQ48vpEoy7LcphjTmt0hxlOXtaC43Dqo0pQmlunNoIwo1QFM74GtAnCB8apxZ1S7HeOejDxca+J/6bZWPx3LvC2BaG6iJkgYmw6zaRBSVCc/weh4pDs+tFT/zYFT72KhM3f/FMPys= 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 171026287828073.09055902703892; Tue, 12 Mar 2024 10:01:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5TS-0004ln-RK; Tue, 12 Mar 2024 12:59:36 -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 1rk5TP-0004jZ-Cv; Tue, 12 Mar 2024 12:59:31 -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 1rk5TN-0007yY-LC; Tue, 12 Mar 2024 12:59:30 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6e6ab012eb1so789511b3a.3; Tue, 12 Mar 2024 09:59:28 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262767; x=1710867567; 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=KRNFEd2YKSH0GA9c/OZVzyVQTq0v73fyutt9t+Ehgsc=; b=hc7dq1M/EV5VCGd/tyRWW/ke6HVsBaFvlFLIN2IJ3nUCTjOwl7r8Yll/PQbu+491Bv gNPl+RYToH4ikTPHCxEb/3zLmH8c0EZZ91+apmutiKZuoC8w4akn8o3eJ9rTIHGNK5JG qFtAweMH47An7SclcJgQkv1gwRZCnD4mpwAlKWN5DbM1EFQFS4Mk22SedgdFO6cmOrwx HIIvFt3bDbUurrm5bqp8cCBTL9GGwzKjr0vtxD0ymLhosOAKUYMDg4q+pIUJFp/AOTkl JTNb9DoqURbfMEv0jPP832f60skPykXWYGNH0N6Vn46Y8l87GIxqF2CZjRt1gkrZEE8N j8Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262767; x=1710867567; 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=KRNFEd2YKSH0GA9c/OZVzyVQTq0v73fyutt9t+Ehgsc=; b=iZm89YPHCkYOgb2f/cPUqCwAibTRXnJXc9iGDHSjpTZPe3p4rEtYZZsS9ttdhvw1Ub atyp1liH887pgKQeCKMQ8nydj7xXkTmtcw2LB81GzqRk/WTvnp00MtSu4HUq/ei5hIyf ag9K8RlegeZjKjTn4k8dasCzkdqlK1C+OmaSpq5ecCiR5vE+9Dq9e/B3aM7WEbIJ1XbS oxieneZpKtwrVxVR9ECUXGd+ktwUZxSprA7DMY8Q/mk1VxjfLKtl1dcMv+FtvMlJBX1y /eYcF9h6PwiNOw3K+TSXurcKaSe6tqpCCXjoyXgiVo89D2hprLrdnlGSVcw412sXvOwk HNTQ== X-Forwarded-Encrypted: i=1; AJvYcCWn+Lh4kTjv6XURD5SafHmUllWbfG0XtgIKsFvOsfl1sAss/vmf91KsX5QXqyIq99u5oEUJy6trYxQApOJUeS0AvImf X-Gm-Message-State: AOJu0YxhzGmQs85tFUqjp1M1T2wEoKCNzjesTr/l2CDSo//Yxgv7FPN+ g0xI8to81dGvQEfo7KDlYySyog1VpT7stGPRRh59RJZ8xVfagCzLopNSLp92oMw= X-Google-Smtp-Source: AGHT+IG28lI/09tFi8g+Up8daFHwEYz6/TUsGvDHno3TwhIpI1pyKc0SgKP5ufOOsFOO6deJWVwwug== X-Received: by 2002:a05:6a00:22d4:b0:6e4:e43e:dc1f with SMTP id f20-20020a056a0022d400b006e4e43edc1fmr12415pfj.32.1710262767620; Tue, 12 Mar 2024 09:59:27 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 07/38] ppc/spapr: Remove copy-paste from pa-features Date: Wed, 13 Mar 2024 02:58:18 +1000 Message-ID: <20240312165851.2240242-8-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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, 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: 1710262879357100001 Content-Type: text/plain; charset="utf-8" TCG does not support copy/paste instructions. Remove it from ibm,pa-features. This has never been implemented under TCG or practically usable under KVM, so it won't be missed. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3108d7c532..4192cd8d6c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -237,6 +237,10 @@ static void spapr_dt_pa_features(SpaprMachineState *sp= apr, * SSO (SAO) ordering is supported on KVM and thread=3Dsingle hosts, * but not MTTCG, so disable it. To advertise it, a cap would have * to be added, or support implemented for MTTCG. + * + * Copy/paste is not supported by TCG, so it is not advertised. KVM + * can execute them but it has no accelerator drivers which are usable, + * so there isn't much need for it anyway. */ =20 uint8_t pa_features_206[] =3D { 6, 0, @@ -260,8 +264,8 @@ static void spapr_dt_pa_features(SpaprMachineState *spa= pr, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 24 - 29 */ /* 30: MMR, 32: LE atomic, 34: EBB + ext EBB */ 0x80, 0x00, 0x80, 0x00, 0xC0, 0x00, /* 30 - 35 */ - /* 36: SPR SO, 38: Copy/Paste, 40: Radix MMU */ - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 36 - 41 */ + /* 36: SPR SO, 40: Radix MMU */ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 36 - 41 */ /* 42: PM, 44: PC RA, 46: SC vec'd */ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 42 - 47 */ /* 48: SIMD, 50: QP BFP, 52: String */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262822; cv=none; d=zohomail.com; s=zohoarc; b=OvUL5ovUvn2LqDv73+gj1cpcESp9w48uGyzj9SGnjh80iq3MeNS9/3bzkriB3Ad7pK7KrmFuzKgooH2U+s8GHvmOvgKWggvvBqn29ZqHbSv315tYepd/e8fmzJXv3e7YLFWPco0dkgkCs5Tg66Hc12WaGtRds1tvHLYHC2VfO8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262822; 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=PcqLLu3u5PZ1llo42lrjUzLPqI0T1odBfRlVjyR5kEI=; b=ZyAmadqPiHniluKWjz810vnoSDdKwkOt4HBoAfsLsT22Y75FtUite7SfPszy3TzhqTnIbAyIW1H2tAH0a7XflDeDjTA7xtb2s0NNzQlt4UR2odiDGAPVCNAO0+Tr015nFYrVfnB6PiGaznQaJuzF/55pjLF1vCzBxNU2Ez4DNu0= 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 1710262822480721.0698938225243; Tue, 12 Mar 2024 10:00:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Tj-0004qn-C4; Tue, 12 Mar 2024 12:59:54 -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 1rk5TS-0004mD-R5; Tue, 12 Mar 2024 12:59:36 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TQ-0007z1-VV; Tue, 12 Mar 2024 12:59:34 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6e55731af5cso3022828b3a.0; Tue, 12 Mar 2024 09:59:32 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262771; x=1710867571; 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=PcqLLu3u5PZ1llo42lrjUzLPqI0T1odBfRlVjyR5kEI=; b=kj6IpqmogIbVH8ZHZ9ln0KZOIsdM0yCS4bPOtptK+7R1tCkmf9NhjaeT0gI5VEYLvu lIRnRwEXE2vmaz/D1je9cUWbMalVm9ZYitPe2WxiR+S9utzpeQ0WhXD+e8L4/6+CpR5k Kre2soHO24Gxn8WII4cQXrHunT1eiIjfpf5mqyLl2fYk+FJilmCSa2GgdIfsNDjgyHnb BEnnfs58vevzCEPEAzcBTC6LsY4SNfbqhYEQVjADB076YV3id9JT/5n+ic1Bp2UpA+qH Qvy1YAceTaJ7FUW7YD3Wa9aNGV7M1BihonvSpgrJufLKSMWn3YMCeqirAXo5S5C2ZsQz 9/vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262771; x=1710867571; 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=PcqLLu3u5PZ1llo42lrjUzLPqI0T1odBfRlVjyR5kEI=; b=hIrmKFKfs5jI9rULfACVzSIcUVQs+jNkBY07VD4qbAdcxYD3mx2B9XadkCfTCpBjPA 24wBbqY5EK3whp801r/C1MMvTUnwXBHtuEH95ZaHe80j4+rvEyGoLoFHMdbBTbUVlLXD J+nPJQLbFqKh5yyMuZSQ67p3/X3Ec+cjXyvf+tuxMxX1AfFZexoS3SavsIuyVXL7THzf yqgldRXkrqe7CvTvYOIPMmvwDhofQdJTyYFcmFngqb2MYXhQlQEHfriS08Y4ETytR/Sx pwH45ZeUIxXeEusxEncoEhaFB6IUsOS4lH5UvJRCdj1AjzZjcJRQ5BZ1WEKxv2M2MlsH dptw== X-Forwarded-Encrypted: i=1; AJvYcCVgRSMWWODP4NuyUNBFyZLAl7t5lzZjhotIaKEP/JxmlVYaaHN5azh0DCUdZiTb+3QmCmAnZ/AqVxM5j6tKKX1T8il6 X-Gm-Message-State: AOJu0YybjFkXx3Z2g0rYrFJc730oC05YxMn/wy45emQPh5L/5xDyfkHg QUIHdy2msp7C3eafEnHZBuDiPRNVkFU5RpHzNyVWTQOhnQElLARvPOwhwmUDx0g= X-Google-Smtp-Source: AGHT+IHKYY55vw/e3nunZ/pBaebhhFimXzjk3cW/BrNnJDjU4cAXY0Yjo+VZYzsCDjgPRpOzhG+brg== X-Received: by 2002:a05:6a00:2309:b0:6e6:8dac:5c74 with SMTP id h9-20020a056a00230900b006e68dac5c74mr48509pfh.12.1710262770995; Tue, 12 Mar 2024 09:59:30 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 08/38] ppc/spapr: Adjust ibm,pa-features for POWER9 Date: Wed, 13 Mar 2024 02:58:19 +1000 Message-ID: <20240312165851.2240242-9-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42b; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42b.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: 1710262823070100001 Content-Type: text/plain; charset="utf-8" "MMR" and "SPR SO" are not implemented in POWER9, so clear those bits. HTM is not set by default, and only later if the cap is set, so remove the comment that suggests otherwise. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4192cd8d6c..5bbd0d7a04 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -258,14 +258,14 @@ static void spapr_dt_pa_features(SpaprMachineState *s= papr, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 - 11 */ /* 16: Vector */ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 12 - 17 */ - /* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ + /* 18: Vec. Scalar, 20: Vec. XOR */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 18 - 23 */ /* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 24 - 29 */ - /* 30: MMR, 32: LE atomic, 34: EBB + ext EBB */ - 0x80, 0x00, 0x80, 0x00, 0xC0, 0x00, /* 30 - 35 */ - /* 36: SPR SO, 40: Radix MMU */ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 36 - 41 */ + /* 32: LE atomic, 34: EBB + ext EBB */ + 0x00, 0x00, 0x80, 0x00, 0xC0, 0x00, /* 30 - 35 */ + /* 40: Radix MMU */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 36 - 41 */ /* 42: PM, 44: PC RA, 46: SC vec'd */ 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 42 - 47 */ /* 48: SIMD, 50: QP BFP, 52: String */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262972; cv=none; d=zohomail.com; s=zohoarc; b=Xf7aMLdsRsYwBBL9+4obqXEXY+jyRg7lRFsIp4hXjjLrB0QPH4V4cjM54sh8GhJQdthfFWxf78JKiUoMv37a724yX2KUn3+wq/fi1zj2yEOMNZX90F+FgSdqfbBhRlJ29I2HkOrD+cTYurwkPflHrdf6bVKInD4TqsaIBZ4OdP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262972; 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=tdyNcmPgux9//jKV7mWfb1o9E6QFQPrGkdX2/VZm364=; b=ZKRmNppAf02cIQ+GSsUbwokRKpnrcv4Hs4X+K20FqEJYubM4WkWzE4sqFNiPd+lfrytnLk+cbL/97LpD8hidxt5N1EErYJrO91BvygOa2nhU4dmHleucKwAwHyYS48PpnZdPHInn79VKDHE3RZYerorrvEXBD87w/FgOwHgedW0= 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 1710262972712637.5051053958395; Tue, 12 Mar 2024 10:02:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5U4-0005GK-Vz; Tue, 12 Mar 2024 13:00:13 -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 1rk5TW-0004nS-1J; Tue, 12 Mar 2024 12:59:40 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TU-0007zM-Hy; Tue, 12 Mar 2024 12:59:37 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6b3dc3564so99991b3a.2; Tue, 12 Mar 2024 09:59:35 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262774; x=1710867574; 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=tdyNcmPgux9//jKV7mWfb1o9E6QFQPrGkdX2/VZm364=; b=T7mWu47/jmsrIAvtFPjuUAXtbj3jlrC2o9HUBTgsW7EdjvpdpON4EBDi2ja5uxqcIr mXay+j9xpQzw6E054rgxPvY6MWG40OsugBEVRepv7zyBw1Uzb2MmexTeEdjl2Qk8WQNk ABV3h/+nB2UWsdKluy5cYHRSxZVo53MLEzaMjbgF9S2HXAe1PrpOn7t+iY2Cb7K6J2pE wrPl2pAmmXpy+WJ2yKhMBjyQABsYdbFhS1kKOIccTFWCUHvCJ4Wif8UBC+9ZHxaCypUh 3L523/ITJoBNWBmX76jUPB7lDfOykdnxKCZiL+6BekpWgTOCD37fK2xKWXn9Lv959Llh rLZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262774; x=1710867574; 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=tdyNcmPgux9//jKV7mWfb1o9E6QFQPrGkdX2/VZm364=; b=BDBiaEsH/WdKexk1tNcfV1slAYHxHHCSq2in+ey79itG2egvh1jBu5aL6LhgtUmXzN OPPr02IQEF30teq2VNe2OR7c4nImFUxlReJ6UwcnyevRefCSlUH0NATprB+qVN0PQD70 0yL5Nu1VRrg9Pe9L6ntFM8iv5b2h/+DE3ysGAyQDmc29Dh8zaD3IbjjFRDnqfZJfomf2 4eq6EaX1zaEMEd+Dr+gtXJe4C0AFodTZXaFpV2/W62xvtM5ulkJ2sgEdTer0vQIpGtK1 Wyd8ASHluoILS5vEyYDHCphAvim1m6TMasyITNbKQP1rWEqoi5gRobAwAgHqNv0rfzYu oeKA== X-Forwarded-Encrypted: i=1; AJvYcCWAIfjohgWggHvWQPSVuV05oj+mZ9tgGm0s9iLsgoGTNiq9XIhfgB3dhgdtcktRRsznFZEAdJidronrDV8anXmkZgZB X-Gm-Message-State: AOJu0YyqG8k5Z/kfjbf5oFO0odZvHGH/Gw+9Vg0aH61+P1Tto4hoMyqx pPZl52gf7iN7/kDIRZlIdkaQDf2IbcJJ0Husy2RVzZGhmnDNg2PDptGVx8VkZ9k= X-Google-Smtp-Source: AGHT+IEFOILjHhBN5alYEBU7o9V6xVJvwgF5xc0Lam/p6hDTuLFL7i+IrwggShQO2yGffL5KEQB3aQ== X-Received: by 2002:a05:6a21:6d85:b0:1a1:5000:225d with SMTP id wl5-20020a056a216d8500b001a15000225dmr1203987pzb.11.1710262774546; Tue, 12 Mar 2024 09:59:34 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Benjamin Gray Subject: [PULL 09/38] ppc/spapr: Add pa-features for POWER10 machines Date: Wed, 13 Mar 2024 02:58:20 +1000 Message-ID: <20240312165851.2240242-10-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.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: 1710262973875100002 Content-Type: text/plain; charset="utf-8" From: Benjamin Gray Add POWER10 pa-features entry. Notably DEXCR and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE). Reviewed-by: Harsh Prateek Bora Signed-off-by: Benjamin Gray [npiggin: reword title and changelog, adjust a few bits] Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 5bbd0d7a04..a684e0d9dc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -275,6 +275,36 @@ static void spapr_dt_pa_features(SpaprMachineState *sp= apr, /* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; + /* 3.1 removes SAO, HTM support */ + uint8_t pa_features_31[] =3D { 74, 0, + /* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110= */ + /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ + 0xf6, 0x1f, 0xc7, 0xc0, 0x00, 0xf0, /* 0 - 5 */ + /* 6: DS207 */ + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 - 11 */ + /* 16: Vector */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 12 - 17 */ + /* 18: Vec. Scalar, 20: Vec. XOR */ + 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 18 - 23 */ + /* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 24 - 29 */ + /* 32: LE atomic, 34: EBB + ext EBB */ + 0x00, 0x00, 0x80, 0x00, 0xC0, 0x00, /* 30 - 35 */ + /* 40: Radix MMU */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 36 - 41 */ + /* 42: PM, 44: PC RA, 46: SC vec'd */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 42 - 47 */ + /* 48: SIMD, 50: QP BFP, 52: String */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 - 53 */ + /* 54: DecFP, 56: DecI, 58: SHA */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 54 - 59 */ + /* 60: NM atomic, 62: RNG */ + 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ + /* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ + 0x00, 0x00, 0xce, 0x00, 0x00, 0x00, /* 66 - 71 */ + /* 72: [P]HASHST/[P]HASHCHK */ + 0x80, 0x00, /* 72 - 73 */ + }; uint8_t *pa_features =3D NULL; size_t pa_size; =20 @@ -290,6 +320,10 @@ static void spapr_dt_pa_features(SpaprMachineState *sp= apr, pa_features =3D pa_features_300; pa_size =3D sizeof(pa_features_300); } + if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_10, 0, cpu->compat_pvr= )) { + pa_features =3D pa_features_31; + pa_size =3D sizeof(pa_features_31); + } if (!pa_features) { return; } --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262874; cv=none; d=zohomail.com; s=zohoarc; b=iPDrcHiTxNlIHNVRruy7a3qgr/ObrtQeNVyZK4LHgiZ12gCKIcd+igZb9EtxS//5vt72tEohq68HiVCj/YhV0w8Sy+hdIO0kZ9zKRZyv475MWJP2lmz2FIs1r9hGy+gPRY5nIZhfsRpkrEzargpOnUWmOuy/wHzCO1154AnYvNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262874; 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=w35+jwPrelPa7X2eQPlqmFbK07FqTTswrxsLnmnA24g=; b=aeouoSm53Viog23eDQsZXZp5KGcdKY61vCWK37sYNGv+q8u99/PeRT1FIZSnQ1ZD/m/GIBjgDmLNNYhwCmZ8EWDvgDKLtwA7KA+VS9YfGxUI50FuL7kpNL36yKSQmdbzDqMZdT3eIzzqpJiYs4Web2/WZ6I7Bk/pF29sKe3V6nM= 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 1710262874466510.65041317288194; Tue, 12 Mar 2024 10:01:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5U8-0005Tu-R1; Tue, 12 Mar 2024 13:00:17 -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 1rk5Tb-0004pK-Ih; Tue, 12 Mar 2024 12:59:44 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5TY-0007zb-NA; Tue, 12 Mar 2024 12:59:43 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e6afd8da93so496369b3a.3; Tue, 12 Mar 2024 09:59:40 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262779; x=1710867579; 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=w35+jwPrelPa7X2eQPlqmFbK07FqTTswrxsLnmnA24g=; b=hfbFlOJKoWTgeS58BgaLfJNuUzVhhqqT6duk9QNyMjBnhOflgVMSkbNNjrukDqf1Iw r1qKN5Uz5ZWBush16Yy+lZIQBeE06WuPOXydv6oF4+PfrVzHsPYmGOqvowTcOlU2DNGd /zSgRHZvr30BYPxv3W/Im8OKNzeZMfxxqZLC/ASfM8MU877bP3sNAI+T7SVYMO5yTT0E sVCmrKywk9d5UWVFsIXKGEtTH+AYn0d+FZv6RQE+0vsaGgAwdqJHwim/ZEOYt2FHCCvp jcuGgf/iA0jYeJxFPk429ysj+Kfr+lquIJdeeMfD9/v7+IDbGsnsvliDplLWpXK50Jer 5hzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262779; x=1710867579; 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=w35+jwPrelPa7X2eQPlqmFbK07FqTTswrxsLnmnA24g=; b=bPfrMVK5fHeVlOpUUEeBLEigZKlIXG6i5oZ10SRmLPCWbtzv56S+aCo+5qBotXqeMY 4sEN+fP9KVDmEdv4kWL0Ep8GItTRAbBrjTwCVaURs+CqBKWCrHiWadmny0bMRiGUQ7++ hs3Eavrkdx+KdvV6eZ6Xf6h8m216fH2gJITM0A85Nt1bwma7XUh4SsV3lXNtW76rHzdn 4Tk7hMco02qAF8S7FgU4c62wHofCO0TFhvBWYEJCvKX6xMZ3IZ8ZgWp1w+HbyYxlguTC 1UIa6fy65Adg5zWPImyniYx+AUNbGI/mgQPiyes9hZLppHMz5/bG4udsLdBEKJkrhOLW +Pdw== X-Forwarded-Encrypted: i=1; AJvYcCXLSp81+g2G7Go66iU9ohJyj9tnrofqlmXK9+8G1drY36J4ae6Rg/1m1ZTi3iTZ0DWevsE4SV1wQMKLL397g9aie62R X-Gm-Message-State: AOJu0YxTJdCYDs9lXZ/2LeECbpM7cfRf323Z/lcWki/IxNqZhtEUg/A8 Kz4dcYpt/wbtEVdCYYcmfl77xy6u2CtKMai+kQknjwvJrVwz0YFhHScCuDrjDQA= X-Google-Smtp-Source: AGHT+IGfKxFY4NxFqAsenCTUT2mheuuKi91aSofn8Jep/ZtSeI4GOS+bF8iEYEHtMG9BlL8HRuULPQ== X-Received: by 2002:a05:6a20:da82:b0:1a1:87a9:5cb6 with SMTP id iy2-20020a056a20da8200b001a187a95cb6mr9274996pzb.6.1710262778732; Tue, 12 Mar 2024 09:59:38 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 10/38] ppc/pnv: Permit ibm,pa-features set per machine variant Date: Wed, 13 Mar 2024 02:58:21 +1000 Message-ID: <20240312165851.2240242-11-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::431; envelope-from=npiggin@gmail.com; helo=mail-pf1-x431.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: 1710262875387100001 Content-Type: text/plain; charset="utf-8" This allows different pa-features for powernv8/9/10. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/pnv.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index aa9786e970..52d964f77a 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -133,7 +133,7 @@ static int get_cpus_node(void *fdt) * device tree, used in XSCOM to address cores and in interrupt * servers. */ -static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) +static int pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) { PowerPCCPU *cpu =3D pc->threads[0]; CPUState *cs =3D CPU(cpu); @@ -149,11 +149,6 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, vo= id *fdt) uint32_t cpufreq =3D 1000000000; uint32_t page_sizes_prop[64]; size_t page_sizes_prop_size; - const uint8_t pa_features[] =3D { 24, 0, - 0xf6, 0x3f, 0xc7, 0xc0, 0x00, 0xf0, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; int offset; char *nodename; int cpus_offset =3D get_cpus_node(fdt); @@ -236,15 +231,14 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, v= oid *fdt) page_sizes_prop, page_sizes_prop_size))); } =20 - _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", - pa_features, sizeof(pa_features)))); - /* Build interrupt servers properties */ for (i =3D 0; i < smt_threads; i++) { servers_prop[i] =3D cpu_to_be32(pc->pir + i); } _FDT((fdt_setprop(fdt, offset, "ibm,ppc-interrupt-server#s", servers_prop, sizeof(*servers_prop) * smt_threads))= ); + + return offset; } =20 static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir, @@ -299,6 +293,17 @@ PnvChip *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb) return chip; } =20 +/* + * Same as spapr pa_features_207 except pnv always enables CI largepages b= it. + * HTM is always enabled because TCG does implement HTM, it's just a + * degenerate implementation. + */ +static const uint8_t pa_features_207[] =3D { 24, 0, + 0xf6, 0x3f, 0xc7, 0xc0, 0x00, 0xf0, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; + static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt) { static const char compat[] =3D "ibm,power8-xscom\0ibm,xscom"; @@ -311,8 +316,12 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip,= void *fdt) =20 for (i =3D 0; i < chip->nr_cores; i++) { PnvCore *pnv_core =3D chip->cores[i]; + int offset; + + offset =3D pnv_dt_core(chip, pnv_core, fdt); =20 - pnv_dt_core(chip, pnv_core, fdt); + _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", + pa_features_207, sizeof(pa_features_207)))); =20 /* Interrupt Control Presenters (ICP). One per core. */ pnv_dt_icp(chip, fdt, pnv_core->pir, CPU_CORE(pnv_core)->nr_thread= s); @@ -335,8 +344,12 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip,= void *fdt) =20 for (i =3D 0; i < chip->nr_cores; i++) { PnvCore *pnv_core =3D chip->cores[i]; + int offset; =20 - pnv_dt_core(chip, pnv_core, fdt); + offset =3D pnv_dt_core(chip, pnv_core, fdt); + + _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", + pa_features_207, sizeof(pa_features_207)))); } =20 if (chip->ram_size) { @@ -358,8 +371,12 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip= , void *fdt) =20 for (i =3D 0; i < chip->nr_cores; i++) { PnvCore *pnv_core =3D chip->cores[i]; + int offset; + + offset =3D pnv_dt_core(chip, pnv_core, fdt); =20 - pnv_dt_core(chip, pnv_core, fdt); + _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", + pa_features_207, sizeof(pa_features_207)))); } =20 if (chip->ram_size) { --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262849; cv=none; d=zohomail.com; s=zohoarc; b=ClpG7Qup4yJd0jlslEFbfYphT9ZZg3u6CcrexZfGX1jSQ9uAq1gGk66haOP5to0GgH8l4+SKCOWMJJU9jTBipwNzQ3zlTaNE/p2xSkwqi0ulQaQskVyOQZRKBBaexdvH2nuJYRDWebDmkwut4dSRw1RZyURgThASZvEwXvGlbqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262849; 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=F7T1ZChcLzusNnwL87W8EEDPWZnsiSOzBtB10TW+wJ0=; b=msOGoAXqODThW5CcfrG70qeYDyjJjjaLm2WSkYoLWTsjrmJnw7rDzZS73qwR3BbBHzWcnrS+kRDpoMElr2ufNoywHz+O/EJAXQ1bEgNSShqrxi4vOJQmch091NyPlKtsZGWJFD8W8U/K632di7Kg7Y2TpGBCksGqB/8AfDjSHE4= 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 1710262849759602.056171735843; Tue, 12 Mar 2024 10:00:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5UF-0005ku-Fd; Tue, 12 Mar 2024 13:00:24 -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 1rk5Td-0004pl-Ve; Tue, 12 Mar 2024 12:59:46 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Tc-0007zw-9S; Tue, 12 Mar 2024 12:59:45 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e6aaa2f02cso603385b3a.2; Tue, 12 Mar 2024 09:59:43 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262782; x=1710867582; 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=F7T1ZChcLzusNnwL87W8EEDPWZnsiSOzBtB10TW+wJ0=; b=nUcTL0JPSPz1hLDnPb9f9naJl/1bc949HROf0Okp6uD0nNrqaH71t0UeZFnceS6lAn ZGwyfhDq1iV4So1mSloU/6fpKhJZuZG/pQI5Tgg1i9sYDuvsFqdzhIWNp2iERrj7qmG2 Gnn1J8U+0tBUBkR6OLn+DZXOgKpP9iO/zfYwzz0D9y+IA8BXJRkb6G39fbQjunujAJVK aUr68u/SX5QYFsUd6H92BAV3aMxZEtWMexYg1kzgPjOT+lntoGyA7LKEnzedupKv6f7L VFfUVP2sz0BgvNnr+PgREKoFn2PP6b4WRY8o3NImhKUsmBUZLerMOndTelrry4XzS/pw 0e9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262782; x=1710867582; 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=F7T1ZChcLzusNnwL87W8EEDPWZnsiSOzBtB10TW+wJ0=; b=w8R/yEDp4CYLJ7n4mcHdxfvOv1FlKwvZQesRfKPNBXAlpI3/0VuGX1BZgyHuyR3A3e wLxTko5tWFIcQll+FNpc/uu1NCvA7/QxF97g6FVoaRKRhCWDTL5BZRy1aGBAuQJ49WBO Mo7B21cmz1Wl/LKgndSb5ErRNMnD6HZd09/Q2EGnjzpQJ8hVWACKs1SngvB3J0/sShEr WaSMcgfdfRy1E8fwCnNmAd0lIyKvIDhBetpqNbZE1qE0I+Ub1ZTms0Ir44aGFSkuyKWD Z5nugpoBYReNrUkl3w5XXeBr+46p3sAx9nc6kQn8fKgOX3NlvHWIb0M1b9qvdILEXlLd Qqsw== X-Forwarded-Encrypted: i=1; AJvYcCVbx5EF84WL06jC4/qKM1T9G+J7pf/lr1ErbHCpWi7ny0eUn4H4SAc8jjmcBoaDRg+bH7TnIB5vTNNQ28hScJBUwSWb X-Gm-Message-State: AOJu0YygTnT0OncxwgyAEUJ8lqHzopMCKt/OnH4z6ewMLDTWOY2JMc4K BXxr0P9j8SuYCsx2G8wNSdbq7QrPg/bvmPURai+X9oLq1iGN5X5RVH/EUUbYlwM= X-Google-Smtp-Source: AGHT+IGRUdDRF5763BIkw9ejxeMNGYPEvp221iHsHjGETcaS1PduF0lHogn0rhh/1h26Gc75yXFcUQ== X-Received: by 2002:a05:6a00:2306:b0:6e6:77a4:258e with SMTP id h6-20020a056a00230600b006e677a4258emr36371pfh.10.1710262782277; Tue, 12 Mar 2024 09:59:42 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 11/38] ppc/pnv: Set POWER9, POWER10 ibm,pa-features bits Date: Wed, 13 Mar 2024 02:58:22 +1000 Message-ID: <20240312165851.2240242-12-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.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: 1710262851211100003 Content-Type: text/plain; charset="utf-8" Copy the pa-features arrays from spapr, adjusting slightly as described in comments. Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/pnv.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++-- hw/ppc/spapr.c | 1 + 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 52d964f77a..8a502dea90 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -332,6 +332,35 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip,= void *fdt) } } =20 +/* + * Same as spapr pa_features_300 except pnv always enables CI largepages b= it. + */ +static const uint8_t pa_features_300[] =3D { 66, 0, + /* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP1= 10 */ + /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ + 0xf6, 0x3f, 0xc7, 0xc0, 0x00, 0xf0, /* 0 - 5 */ + /* 6: DS207 */ + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 - 11 */ + /* 16: Vector */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 12 - 17 */ + /* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 18 - 23 */ + /* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 24 - 29 */ + /* 32: LE atomic, 34: EBB + ext EBB */ + 0x00, 0x00, 0x80, 0x00, 0xC0, 0x00, /* 30 - 35 */ + /* 40: Radix MMU */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 36 - 41 */ + /* 42: PM, 44: PC RA, 46: SC vec'd */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 42 - 47 */ + /* 48: SIMD, 50: QP BFP, 52: String */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 - 53 */ + /* 54: DecFP, 56: DecI, 58: SHA */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 54 - 59 */ + /* 60: NM atomic, 62: RNG */ + 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ +}; + static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt) { static const char compat[] =3D "ibm,power9-xscom\0ibm,xscom"; @@ -349,7 +378,7 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, = void *fdt) offset =3D pnv_dt_core(chip, pnv_core, fdt); =20 _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", - pa_features_207, sizeof(pa_features_207)))); + pa_features_300, sizeof(pa_features_300)))); } =20 if (chip->ram_size) { @@ -359,6 +388,40 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip,= void *fdt) pnv_dt_lpc(chip, fdt, 0, PNV9_LPCM_BASE(chip), PNV9_LPCM_SIZE); } =20 +/* + * Same as spapr pa_features_31 except pnv always enables CI largepages bi= t, + * always disables copy/paste. + */ +static const uint8_t pa_features_31[] =3D { 74, 0, + /* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP1= 10 */ + /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ + 0xf6, 0x3f, 0xc7, 0xc0, 0x00, 0xf0, /* 0 - 5 */ + /* 6: DS207 */ + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 - 11 */ + /* 16: Vector */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 12 - 17 */ + /* 18: Vec. Scalar, 20: Vec. XOR */ + 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 18 - 23 */ + /* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 24 - 29 */ + /* 32: LE atomic, 34: EBB + ext EBB */ + 0x00, 0x00, 0x80, 0x00, 0xC0, 0x00, /* 30 - 35 */ + /* 40: Radix MMU */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, /* 36 - 41 */ + /* 42: PM, 44: PC RA, 46: SC vec'd */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 42 - 47 */ + /* 48: SIMD, 50: QP BFP, 52: String */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 - 53 */ + /* 54: DecFP, 56: DecI, 58: SHA */ + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 54 - 59 */ + /* 60: NM atomic, 62: RNG */ + 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ + /* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ + 0x00, 0x00, 0xce, 0x00, 0x00, 0x00, /* 66 - 71 */ + /* 72: [P]HASHST/[P]HASHCHK */ + 0x80, 0x00, /* 72 - 73 */ +}; + static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt) { static const char compat[] =3D "ibm,power10-xscom\0ibm,xscom"; @@ -376,7 +439,7 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip,= void *fdt) offset =3D pnv_dt_core(chip, pnv_core, fdt); =20 _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", - pa_features_207, sizeof(pa_features_207)))); + pa_features_31, sizeof(pa_features_31)))); } =20 if (chip->ram_size) { diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a684e0d9dc..abd484023a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -243,6 +243,7 @@ static void spapr_dt_pa_features(SpaprMachineState *spa= pr, * so there isn't much need for it anyway. */ =20 + /* These should be kept in sync with pnv */ uint8_t pa_features_206[] =3D { 6, 0, 0xf6, 0x1f, 0xc7, 0x00, 0x00, 0xc0 }; uint8_t pa_features_207[] =3D { 24, 0, --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262974; cv=none; d=zohomail.com; s=zohoarc; b=CU1oQwPi59qA4vfSZBgZu+xGAjfcu6jBTzzJo4rAdH4JspC076NSGI1yWS4pUEpUfRy2Z2pHFK2dZGv2Bb30cyQ/3Gf3a3aq+dW1jB9JV4cIY6lJ2nSS4tuYqRP0/RHR3dkuda6AbRDTw17+tKcBsA1wHPxqxieM380/HXhmrSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262974; h=Content-Type: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=RR4P414fAdBrmZ13qWAjaQrr8Q0qRPrUxoYoLYFQP4Y=; b=HUtfyLkzulgBuSCLDMR5qYUSkTpF3yLOqLaKL0VYs00C5JrUp4pUDERRxSk7kpNJoUfnwN7YPrHmGr451Jm9dqI5F3Y3YH+oXK/aWWgnX44Y8FxzvNUS/W+W2KfkZZ5+tvNOEUHONjbkS/+Si1Fd6vWs8dn5JxEjHKahCDrBCB8= 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 17102629744341019.4037481976909; Tue, 12 Mar 2024 10:02:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Uw-0006WS-SM; Tue, 12 Mar 2024 13:01:10 -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 1rk5Th-0004r5-36; Tue, 12 Mar 2024 12:59:50 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Tf-00080f-Lx; Tue, 12 Mar 2024 12:59:48 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6ac00616cso651183b3a.0; Tue, 12 Mar 2024 09:59:46 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262786; x=1710867586; 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=RR4P414fAdBrmZ13qWAjaQrr8Q0qRPrUxoYoLYFQP4Y=; b=CWdsxo4P4KMjjJJgIPWsDWgzaVz3FYUdnL6fccBl/yqVT/EhmvNrKVPMylmBF0ZHNh lmzBsKt60VWc87WaRoTuFbl5iy0mmJpJ1MPNio/zcEwvYu4K3kWoVV1M/Jr8oRdVhiMg nTs0qPQv7DHwPmOKboBQbRsPKSX6dejQ3dv2H2jBm3p3EkeWwWE1LRMPtuILmpth4H1Z wOBo7dzeCSeh6uZZFT8z0WfCva45fcoLSJWI/ckmOysMIlbbLtfADJ+X4WdYLe+VP7tz OEfA9fVdGEoTN1T+/6EQ7fC/t83xV2s3YM8IgWJwoXlrWmkVSBvK0NuMCzxT+SAFJ4xT R29w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262786; x=1710867586; 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=RR4P414fAdBrmZ13qWAjaQrr8Q0qRPrUxoYoLYFQP4Y=; b=FD0WLs1H3oFSqWqLR4w7hVwYBVJoxMnwNf/vF8fyg/SyJRq6iKSS4ZtrBCAX5vkk7v 9GaeroHE7o0Q1jFXkKXN+51cgZ8Goee51RksA9lgDjKb1YIw8fUH8xv1nLbe7m7VaUxk S7ZMfztzUNyb0Eoto1KzmuQrA/cfuoI4sgD3K/ld7BwlWJTDVXrbEKSF57EKHd5dbdae vhqM5+jN/priknKbODjL+O7Gmg9qjPL+b+7AeK4RZc5ycLelCbUUvFH0a1KOkKM0jCt5 WSFxeMjMDcnABs+5Yq+Nn9ZUa9PMqUj2/RaDNpTw/NQBeujk08tFBt8zf607BkBF/Cju QRMw== X-Forwarded-Encrypted: i=1; AJvYcCUB2bvz2xw6xm+edzqLJfePjuUG8BaIp9+nChKnBY4MRwhnyplvv+MfSWF9wBBsqzygMfEuZAr0YsNqXbizHviipxvr X-Gm-Message-State: AOJu0YyeUvnY0kS7IxLkhQX9SJhBICuVA2ZiAyUv8Bpev3PDQP71QwOR 9VIE7rE5i5p6ykDV5LCe3KJlbAvbHt+9on4h+fBbrniBeH5RIxJ+uTKydtOC95Y= X-Google-Smtp-Source: AGHT+IF+oq9z/eloDRaOHluE8HjeVBydTbPXJSa4y/gGhkG92aTj2q8M68vn8dHitimbZ47Aukzzhw== X-Received: by 2002:a05:6a20:d807:b0:1a3:18be:9b18 with SMTP id iv7-20020a056a20d80700b001a318be9b18mr6155005pzb.26.1710262785750; Tue, 12 Mar 2024 09:59:45 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 12/38] MAINTAINERS: Remove myself as reviewer from PPC Date: Wed, 13 Mar 2024 02:58:23 +1000 Message-ID: <20240312165851.2240242-13-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.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: 1710262975925100005 From: C=C3=A9dric Le Goater PPC maintainership has been a side activity for the last 2 years and it is time to let go some of it now that Nick has taken over. Signed-off-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- MAINTAINERS | 3 --- 1 file changed, 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0087e4f1c7..fe8a7454ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -316,7 +316,6 @@ F: tests/tcg/openrisc/ PowerPC TCG CPUs M: Nicholas Piggin M: Daniel Henrique Barboza -R: C=C3=A9dric Le Goater L: qemu-ppc@nongnu.org S: Odd Fixes F: target/ppc/ @@ -468,7 +467,6 @@ F: target/mips/sysemu/ PPC KVM CPUs M: Nicholas Piggin R: Daniel Henrique Barboza -R: C=C3=A9dric Le Goater S: Odd Fixes F: target/ppc/kvm.c =20 @@ -1508,7 +1506,6 @@ F: tests/avocado/ppc_prep_40p.py sPAPR (pseries) M: Nicholas Piggin R: Daniel Henrique Barboza -R: C=C3=A9dric Le Goater R: David Gibson R: Harsh Prateek Bora L: qemu-ppc@nongnu.org --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263024; cv=none; d=zohomail.com; s=zohoarc; b=LbiwpOSwkV1nAxQO6d1wUt69dmLWOb3WGoYRT3kSc1Be4067QZGqRFYCNe/xnL4tnUwHrb3twK6XuI83AnN8JBgIx8zUGOpFP42ecQQDK/H2yao4gOXajP2funoSX1EDPfalK25jp8Zdm6KEvRNXaWfsPkPCSirrggb5/e8ZPYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263024; h=Content-Type: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=M7kmXgqtdcMD9RJbt2RdUSSdzZ9tGHMF/tncpvYDkjQ=; b=cv7+OyBUOXlEoQhr0g+8JjwAUQsXVqKyujWrlCcpoHx3qXgbi9NMtFg4wHE+MSqdpZy7T34e21hzm7OEbCaPl57PX0/DobqbgzcxDz0Kj8n3v/073JukuTtBc1MFW0TIpnZYRp9w84jak87xjv+U0E+5uA3Oxe+IfHnHaqwptsU= 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 1710263024741474.81896115056725; Tue, 12 Mar 2024 10:03:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5U5-0005JZ-D6; Tue, 12 Mar 2024 13:00:13 -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 1rk5Tn-00052j-QA; Tue, 12 Mar 2024 12:59:57 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Tj-00081L-8o; Tue, 12 Mar 2024 12:59:55 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e6adc557f3so572407b3a.1; Tue, 12 Mar 2024 09:59:50 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262789; x=1710867589; 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=M7kmXgqtdcMD9RJbt2RdUSSdzZ9tGHMF/tncpvYDkjQ=; b=CnQzzrw8BUsv8dgX3bl5Q+DMzDv2v8LmjwQL/ahLTxT71PIKdHpeIZn5iqnu9BRq6E jNeuQbVFtUya4d2JfS60EtFM8iff/sk+zev6RcQBLWvt/XDMkCO1dupo6STNgt3JPzaK nxpZCeZXshR5bD/7zGLyzrd/54PB2Wm1h4R6j1kTMweHU2X7yJRmQ8eParEIzOC5+R0Y NXqog4klTi6heqTSBznO5EksaxAttk7KqxR5o+KrpRKPQ3JsMyjs+qJkjo+8SEdd/clC sMhh0wTwfDT2T7pBaOxodir410mWb2AutSnPL1ZCMhYmcsXop9B97U8ShX0c/PsTlWhL wkHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262789; x=1710867589; 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=M7kmXgqtdcMD9RJbt2RdUSSdzZ9tGHMF/tncpvYDkjQ=; b=lhvfgMNhFG1PwTp17S4cKV5aWwPmXbEudfwKhpee9rFbO6kSA43gEd8E2nn7XW0FEN GLaCgVpYZ/e7pZbhWTmbX8TnIjnNEoUSJKgUSfQ5xjluBFf3ZOZCTrGRV8vd3HMpEMpr qlKmi2rDGq6mxw5qfZEhMMd/YGTQSPbN11hagpDkKIX7qeL5MlrSJwAnIJj6fOLH9OQL KTR2ykpJrWJDJ/ZWJ9eInvoqv0X+lLIMaUIjX2wFzf5vNTYN2JKJgt1OYdByRdIsv9+2 PBSYkKzMKcuVuuVK7ZbROFvu+8UN1L6PKjcNo8S6YpvXlzgd+K8bbEmwgfEAaec16u2h hf/g== X-Forwarded-Encrypted: i=1; AJvYcCUc/IrVQEvLV4GCVFpwNxItXJNhCDjJVcA3R8vaVTKaX6/bGorBLRE36cvxafl+WpoYyO1AmMkEb4j5tPzCfqfOwD2y X-Gm-Message-State: AOJu0YzLGb4Zo4MQvfl2860dnuAu9bzkC2HqLuFl/Bu5U9Mxr8gwhIy5 3hlUmpn6HTLMCW8OgGEDBTqjamOTMsbF4i/QFHIj86OqsQAZ8rONsXQPd2qSnv8= X-Google-Smtp-Source: AGHT+IExJJzpys6WiWWedS4/RTEYMS7L60ZlSWHvW9TgnXeE2wvWKCq6ozj+BRzBAikBr9nZr+DLCg== X-Received: by 2002:a05:6a20:9591:b0:1a3:2f5e:d4fb with SMTP id iu17-20020a056a20959100b001a32f5ed4fbmr716528pzb.61.1710262789198; Tue, 12 Mar 2024 09:59:49 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 13/38] docs: Deprecate the pseries-2.12 machines Date: Wed, 13 Mar 2024 02:58:24 +1000 Message-ID: <20240312165851.2240242-14-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42c; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42c.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: 1710263026276100001 From: Philippe Mathieu-Daud=C3=A9 pSeries machines before 3.0 have complex migration back compatibility code we'd like to get ride of. The last one is 2.12, which is 6 years old. We just deprecated up to the 2.11 machine in commit 1392617d35 ("spapr: Tag pseries-2.1 - 2.11 machines as deprecated"). Take to opportunity to also deprecate the 2.12 machines. Acked-by: Nicholas Piggin Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Nicholas Piggin --- docs/about/deprecated.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 4fb86608e4..7b548519b5 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -237,13 +237,13 @@ The Nios II architecture is orphan. The machine is no longer in existence and has been long unmaintained in QEMU. This also holds for the TC51828 16MiB flash that it uses. =20 -``pseries-2.1`` up to ``pseries-2.11`` (since 9.0) +``pseries-2.1`` up to ``pseries-2.12`` (since 9.0) '''''''''''''''''''''''''''''''''''''''''''''''''' =20 -Older pseries machines before version 2.12 have undergone many changes +Older pseries machines before version 3.0 have undergone many changes to correct issues, mostly regarding migration compatibility. These are no longer maintained and removing them will make the code easier to -read and maintain. Use versions 2.12 and above as a replacement. +read and maintain. Use versions 3.0 and above as a replacement. =20 Arm machines ``akita``, ``borzoi``, ``cheetah``, ``connex``, ``mainstone``= , ``n800``, ``n810``, ``spitz``, ``terrier``, ``tosa``, ``verdex``, ``z2`` = (since 9.0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= ''''''''''' --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263042; cv=none; d=zohomail.com; s=zohoarc; b=PQUiw1PVr3OQzS/Q7p4uMg1cURghfUbKYPdF2WnQ2nYjRUUqHXJ5Wmkx1vbq6cEdDlc5bzn+gk2fL+K3wMu7/trcN8eIuJAvoeLlZZHNLlzy1Cl/MYumiQwUkgDDtLRSvvqRn5KFjDv9mWj4fDWS0V9t/6eLMr3COsvd8g1Z9pI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263042; h=Content-Type: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=JY6w3rpqFyxoTa5NCkYJFl6Arjw1dSCb+uD0G8jkaLo=; b=nyxbu4f19LbK2rp9f9re9CmcqNJKUjxz+tpLyE8Xb9sCLP3Pm+dBShhpcaqHT8whSVvAt1MpqorLuBhqeU0mh6QEVCF1GuXmBeufdgYxnce7mFQx+ZXxtpwkxLDP5I5jvTQQRPofxfMQOrNk8c7OJaYX6saPKOgVzAj2JVWLPDQ= 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 1710263042395606.1797030485186; Tue, 12 Mar 2024 10:04:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5VG-00078D-6U; Tue, 12 Mar 2024 13:01:31 -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 1rk5Tp-00053R-Qp; Tue, 12 Mar 2024 13:00:00 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Tn-00081f-34; Tue, 12 Mar 2024 12:59:57 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5e42b4bbfa4so3027921a12.1; Tue, 12 Mar 2024 09:59:54 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262793; x=1710867593; 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=JY6w3rpqFyxoTa5NCkYJFl6Arjw1dSCb+uD0G8jkaLo=; b=eQ26zxCxGBdaEvadLlfBzUFriZA2776ZHrH2d/owsCFBPg1YmvFRyN5oZQLB+diMNo 6LJ2ULPmz07/fERmWcaBzAOk1QcNGVUYdaz/KfQ7RG7HcB0rpni+fcHNMiQ/ko8/Exoz hiUZbb9QjChZyJmrGAWCws9WHyBR4pG9pM1fJW4GhVl9W3C+ir+0EOtMRzg85xG+EaJE pY9P3+qxkozBQrCwIGErLZKdR7Zzfs9ej+aaT6AuHljVkg5PbvV8p8K+PFORmiiEb4m0 lKJ63x9QeaEjAUB29NMiu0JJhQH4OuGnaNF83BlaAh11s+zLDpQAijHEhDEfqni0GFDu 0a5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262793; x=1710867593; 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=JY6w3rpqFyxoTa5NCkYJFl6Arjw1dSCb+uD0G8jkaLo=; b=UwM/7D7kQuRtSMfWYnm53P7gL0foROkL98puFnwVzVzUHKjhyLn2CNQZ2N8DiWZvc8 7la0v8B6vKv0zANwhQ3h1OGwzx5+f3qIJ0wr7b7jq16gcmW5Q2LO8LZg0FFR0ytqr1FW zrYxrxZunuqYmppm3KDKq7mjT2Au1vUvGNyd7QBsbwSpRrYUew1XVreLAxlvJXnlqJnc Vx4xcznY1aScECasJewDg/S+zTS/g3nOtuZhQxLaC++MZroNV7BWswwHurQQ9vgbyeD3 4Vuygrx3pIMEsWGLdSIAvFhr/F2VVMoOQB2E7iToun9oT4K82aFioR6Q9V0Myn/abQE2 d24g== X-Forwarded-Encrypted: i=1; AJvYcCW9dEhr0vyKO9XkfNQxXDtz9Rukc3mYW1aaPLrD4JOiKZfBn98MmmixDaRkq9CxnTBB0LlXqHtSO/YqR3yTW2lsoVxX X-Gm-Message-State: AOJu0YyIJ/zm3EYkjRTixPlJfMjGNi8c90+qdDjCrj2C4bSHsOA199Jv tht3OoB1cmjLW0v8TULxNqKi1L9fH4z1xrG5+9Tqu3iJWVSFqwnVanQtfuWDOBw= X-Google-Smtp-Source: AGHT+IGqz+XXbed8souHFSokxReA1YWz6jKymYEJM/JJWWvULQsWhXfF+WLYGlIEJEJz/pbKGsOKyw== X-Received: by 2002:a05:6a20:94c7:b0:1a3:10d5:688a with SMTP id ht7-20020a056a2094c700b001a310d5688amr819076pzb.57.1710262792962; Tue, 12 Mar 2024 09:59:52 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan , Bernhard Beschow Subject: [PULL 14/38] docs/system/ppc: Document running Linux on AmigaNG machines Date: Wed, 13 Mar 2024 02:58:25 +1000 Message-ID: <20240312165851.2240242-15-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::535; envelope-from=npiggin@gmail.com; helo=mail-pg1-x535.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: 1710263044396100003 From: BALATON Zoltan Documentation on how to run Linux on the amigaone, pegasos2 and sam460ex machines is currently buried in the depths of the qemu-devel mailing list and in the source code. Let's collect the information in the QEMU handbook for a one stop solution. Tested-by: Bernhard Beschow Reviewed-by: Bernhard Beschow Reviewed-by: Nicholas Piggin Co-authored-by: Bernhard Beschow Signed-off-by: Bernhard Beschow Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- MAINTAINERS | 1 + docs/system/ppc/amigang.rst | 161 ++++++++++++++++++++++++++++++++++++ docs/system/target-ppc.rst | 1 + 3 files changed, 163 insertions(+) create mode 100644 docs/system/ppc/amigang.rst diff --git a/MAINTAINERS b/MAINTAINERS index fe8a7454ba..1f89e274d3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1572,6 +1572,7 @@ F: hw/rtc/m41t80.c F: pc-bios/canyonlands.dt[sb] F: pc-bios/u-boot-sam460ex-20100605.bin F: roms/u-boot-sam460ex +F: docs/system/ppc/amigang.rst =20 pegasos2 M: BALATON Zoltan diff --git a/docs/system/ppc/amigang.rst b/docs/system/ppc/amigang.rst new file mode 100644 index 0000000000..ba1a3d80b9 --- /dev/null +++ b/docs/system/ppc/amigang.rst @@ -0,0 +1,161 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +AmigaNG boards (``amigaone``, ``pegasos2``, ``sam460ex``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + +These PowerPC machines emulate boards that are primarily used for +running Amiga like OSes (AmigaOS 4, MorphOS and AROS) but these can +also run Linux which is what this section documents. + +Eyetech AmigaOne/Mai Logic Teron (``amigaone``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The ``amigaone`` machine emulates an AmigaOne XE mainboard by Eyetech +which is a rebranded Mai Logic Teron board with modified U-Boot +firmware to support AmigaOS 4. + +Emulated devices +---------------- + + * PowerPC 7457 CPU (can also use``-cpu g3, 750cxe, 750fx`` or ``750gx``) + * Articia S north bridge + * VIA VT82C686B south bridge + * PCI VGA compatible card (guests may need other card instead) + * PS/2 keyboard and mouse + +Firmware +-------- + +A firmware binary is necessary for the boot process. It is a modified +U-Boot under GPL but its source is lost so it cannot be included in +QEMU. A binary is available at +https://www.hyperion-entertainment.com/index.php/downloads?view=3Dfiles&pa= rent=3D28. +The ROM image is in the last 512kB which can be extracted with the +following command: + +.. code-block:: bash + + $ tail -c 524288 updater.image > u-boot-amigaone.bin + +The BIOS emulator in the firmware is unable to run QEMU=E2=80=98s standard +vgabios so ``VGABIOS-lgpl-latest.bin`` is needed instead which can be +downloaded from http://www.nongnu.org/vgabios. + +Running Linux +------------- + +There are some Linux images under the following link that work on the +``amigaone`` machine: +https://sourceforge.net/projects/amigaone-linux/files/debian-installer/. +To boot the system run: + +.. code-block:: bash + + $ qemu-system-ppc -machine amigaone -bios u-boot-amigaone.bin \ + -cdrom "A1 Linux Net Installer.iso" \ + -device ati-vga,model=3Drv100,romfile=3DVGABIOS-lgpl-l= atest.bin + +From the firmware menu that appears select ``Boot sequence`` =E2=86=92 +``Amiga Multiboot Options`` and set ``Boot device 1`` to +``Onboard VIA IDE CDROM``. Then hit escape until the main screen appears a= gain, +hit escape once more and from the exit menu that appears select either +``Save settings and exit`` or ``Use settings for this session only``. It m= ay +take a long time loading the kernel into memory but eventually it boots an= d the +installer becomes visible. The ``ati-vga`` RV100 emulation is not +complete yet so only frame buffer works, DRM and 3D is not available. + +Genesi/bPlan Pegasos II (``pegasos2``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The ``pegasos2`` machine emulates the Pegasos II sold by Genesi and +designed by bPlan. Its schematics are available at +https://www.powerdeveloper.org/platforms/pegasos/schematics. + +Emulated devices +---------------- + + * PowerPC 7457 CPU (can also use``-cpu g3`` or ``750cxe``) + * Marvell MV64361 Discovery II north bridge + * VIA VT8231 south bridge + * PCI VGA compatible card (guests may need other card instead) + * PS/2 keyboard and mouse + +Firmware +-------- + +The Pegasos II board has an Open Firmware compliant ROM based on +SmartFirmware with some changes that are not open-sourced therefore +the ROM binary cannot be included in QEMU. An updater was available +from bPlan, it can be found in the `Internet Archive +`_. +The ROM image can be extracted from it with the following command: + +.. code-block:: bash + + $ tail -c +85581 up050404 | head -c 524288 > pegasos2.rom + +Running Linux +------------- + +The PowerPC version of Debian 8.11 supported Pegasos II. The BIOS +emulator in the firmware binary is unable to run QEMU=E2=80=98s standard +vgabios so it needs to be disabled. To boot the system run: + +.. code-block:: bash + + $ qemu-system-ppc -machine pegasos2 -bios pegasos2.rom \ + -cdrom debian-8.11.0-powerpc-netinst.iso \ + -device VGA,romfile=3D"" -serial stdio + +At the firmware ``ok`` prompt enter ``boot cd install/pegasos``. + +Alternatively, it is possible to boot the kernel directly without +firmware ROM using the QEMU built-in minimal Virtual Open Firmware +(VOF) emulation which is also supported on ``pegasos2``. For this, +extract the kernel ``install/powerpc/vmlinuz-chrp.initrd`` from the CD +image, then run: + +.. code-block:: bash + + $ qemu-system-ppc -machine pegasos2 -serial stdio \ + -kernel vmlinuz-chrp.initrd -append "---" \ + -cdrom debian-8.11.0-powerpc-netinst.iso + +aCube Sam460ex (``sam460ex``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +The ``sam460ex`` machine emulates the Sam460ex board by aCube which is +based on the AMCC PowerPC 460EX SoC (that despite its name has a +PPC440 CPU core). + +Firmware +-------- + +The board has a firmware based on an older U-Boot version with +modifications to support booting AmigaOS 4. The firmware ROM is +included with QEMU. + +Emulated devices +---------------- + + * PowerPC 460EX SoC + * M41T80 serial RTC chip + * Silicon Motion SM501 display parts (identical to SM502 on real board) + * Silicon Image SiI3112 2 port SATA controller + * USB keyboard and mouse + +Running Linux +------------- + +The only Linux distro that supported Sam460ex out of box was CruxPPC +2.x. It can be booted by running: + +.. code-block:: bash + + $ qemu-system-ppc -machine sam460ex -serial stdio \ + -drive if=3Dnone,id=3Dcd,format=3Draw,file=3Dcrux-ppc-= 2.7a.iso \ + -device ide-cd,drive=3Dcd,bus=3Dide.1 + +There are some other kernels and instructions for booting other +distros on aCube's product page at +https://www.acube-systems.biz/index.php?page=3Dhardware&pid=3D5 +but those are untested. diff --git a/docs/system/target-ppc.rst b/docs/system/target-ppc.rst index 4f6eb93b17..87bf412ce5 100644 --- a/docs/system/target-ppc.rst +++ b/docs/system/target-ppc.rst @@ -17,6 +17,7 @@ help``. .. toctree:: :maxdepth: 1 =20 + ppc/amigang ppc/embedded ppc/powermac ppc/powernv --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262855; cv=none; d=zohomail.com; s=zohoarc; b=nsEE/uCRYzt3abuTK/anfyOEftWGP5x6Yjl7uhCGdXlQzQt2o6LfKM6GRBjAZT+KnB2Y1T4V4SjtgVFtvCivy1lfNXSiAc1mN8eXc4jboyQypQeaxrlHzYnPOdi0xCT6Uuk5Pp3vf3Md+wFgNbnTucq95IfLeuaojG/i52FNyGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262855; 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=pO6mZ3ihoSGafLIwgUzLPkb62fib8teyllOyNvYifLE=; b=eJmfZt8F1dcLVh+HfGjzA7y7jMHXwsePe5FgCtkQPo30PiQhSiTpgxSBBME4FDrga1Oq34Uu05YMyNP/6oeC5JLPoYGC+MVa3D2zV1PqQKdeSm07N8meFd61eYpsOH81W4O4745yNXxpSewW/HZhQrjd/Hv1GuMP7MVwBTUVHfU= 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 1710262855748262.9437705766469; Tue, 12 Mar 2024 10:00:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5UB-0005ak-T9; Tue, 12 Mar 2024 13:00: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 1rk5Tt-00057h-2c; Tue, 12 Mar 2024 13:00:04 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Tq-00082d-Pp; Tue, 12 Mar 2024 13:00:00 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e649a2548cso4018487b3a.3; Tue, 12 Mar 2024 09:59:58 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262797; x=1710867597; 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=pO6mZ3ihoSGafLIwgUzLPkb62fib8teyllOyNvYifLE=; b=bvc1m2D4WdjIoL/20Evt7ThLdzGkL30gpxYJ4ApDrIrhe1zMeI99AojtAxlOr2YQyo Xzo1EskcCunBboT6hN3wJPR4rISYGVntv6DtS5O7qvIYKTw5TIR2SehRwm9EJ4P0RJZY DMcxYFuRgU50ZEQAY9ZTlq4rndylz1ITERtyeok1nREUA9l1ShOdqk9l1Bmy2Pf+z1gO VO9mzBxVY5XHhkjxlgJRfYhWsF+yTbe7VK9KzE2zl7oMYQ96Y9qUx2pynlURzefaanzK JO7a/oMzyQvOC2v4cFhymCwQNlOk6t45ZK/QwUf1ZEih9cMxziviiaQmISfhCMFpk+SR 5yKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262797; x=1710867597; 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=pO6mZ3ihoSGafLIwgUzLPkb62fib8teyllOyNvYifLE=; b=Duwp5eq4t21e62rjEgIWRO/MmFhuVTobiLZLm4RYzEYpq8zLYqNI+afJfkFz3PAcm0 r2JejW9nmiYWLajIASSUsWzj9JSIxzlgx50ObrW85I+PVRjuXTSQYaEzx05mfgSDkH+u 8tagDgUV6Wp5wQg7sHhtm/7ZDFzF73Wj1XoQCUMCFxcWG7E/KLzKvoqssVADPzvfxD52 /ed4Xp0DiMsGQ8gEIpdTFSrgyxld8+EYbZqbAIA6woa6VaJDhEnSUoGP5ie7dDyiXBEa fc37iN1riU0OeYIBlcXWMXUy8OUxSGabV1bCzzlOatuZ0podZgpR7revOvIQMB0yYKbC E6UA== X-Forwarded-Encrypted: i=1; AJvYcCXfxhssQ/Qt0hYKdp/5F9CTGI9qi8kRCrW8qK6LFg+7dwbQ49hlYSlgt4snQ8W3tS6qPQgJWb9WIEefxb4gx+4RwKxs X-Gm-Message-State: AOJu0Yy8K4q2/Fq36n2eQ88kO64NmJx4kJ5vkxOiii5/qGk05xC28IqR F2jVFxSPr7t1Rz/vHpFQ8qCO5k4iJCHf9cedNEmL3ctfVXKapFl4yfVJ/28aWSc= X-Google-Smtp-Source: AGHT+IFzZRgrK9aGoPxJ3SBkzeXUGTujfaQQ+8BzFpPdfUMEg6/XC604okA1h/YkY5ZdvjqmW0mAig== X-Received: by 2002:a05:6a20:7faa:b0:1a3:1327:a3e with SMTP id d42-20020a056a207faa00b001a313270a3emr967765pzj.44.1710262796710; Tue, 12 Mar 2024 09:59:56 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Chinmay Rath , Richard Henderson Subject: [PULL 15/38] target/ppc: Move add and subf type fixed-point arithmetic instructions to decodetree Date: Wed, 13 Mar 2024 02:58:26 +1000 Message-ID: <20240312165851.2240242-16-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::429; envelope-from=npiggin@gmail.com; helo=mail-pf1-x429.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: 1710262857292100003 Content-Type: text/plain; charset="utf-8" From: Chinmay Rath This patch moves the below instructions to decodetree specification: {add, subf}[c,e,me,ze][o][.] : XO-form addic[.], subfic : D-form addex : Z23-form This patch introduces XO form instructions into decode tree specification, for which all the four variations([o][.]) have been handled with a single pattern. The changes were verified by validating that the tcg ops generated by those instructions remain the same, which were captured with the '-d in_asm,op' flag. Reviewed-by: Richard Henderson Reviewed-by: Harsh Prateek Bora Signed-off-by: Chinmay Rath Signed-off-by: Nicholas Piggin --- target/ppc/insn32.decode | 26 ++++ target/ppc/translate.c | 136 --------------------- target/ppc/translate/fixedpoint-impl.c.inc | 70 +++++++++++ 3 files changed, 96 insertions(+), 136 deletions(-) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 4fcf3af8d0..eada59f59f 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -187,6 +187,12 @@ &X_a ra @X_a ...... ra:3 .. ..... ..... .......... . &X_a =20 +&XO rt ra rb oe:bool rc:bool +@XO ...... rt:5 ra:5 rb:5 oe:1 ......... rc:1 &XO + +&XO_ta rt ra oe:bool rc:bool +@XO_ta ...... rt:5 ra:5 ..... oe:1 ......... rc:1 &XO_ta + %xx_xt 0:1 21:5 %xx_xb 1:1 11:5 %xx_xa 2:1 16:5 @@ -322,10 +328,30 @@ CMPLI 001010 ... - . ..... ................= @D_bfu =20 ### Fixed-Point Arithmetic Instructions =20 +ADD 011111 ..... ..... ..... . 100001010 . @XO +ADDC 011111 ..... ..... ..... . 000001010 . @XO +ADDE 011111 ..... ..... ..... . 010001010 . @XO + +# ADDEX is Z23-form, with CY=3D0; all other values for CY are reserved. +# This works out the same as X-form. +ADDEX 011111 ..... ..... ..... 00 10101010 - @X + ADDI 001110 ..... ..... ................ @D ADDIS 001111 ..... ..... ................ @D +ADDIC 001100 ..... ..... ................ @D +ADDIC_ 001101 ..... ..... ................ @D =20 ADDPCIS 010011 ..... ..... .......... 00010 . @DX +ADDME 011111 ..... ..... ----- . 011101010 . @XO_ta +ADDZE 011111 ..... ..... ----- . 011001010 . @XO_ta + +SUBF 011111 ..... ..... ..... . 000101000 . @XO +SUBFIC 001000 ..... ..... ................ @D +SUBFC 011111 ..... ..... ..... . 000001000 . @XO +SUBFE 011111 ..... ..... ..... . 010001000 . @XO + +SUBFME 011111 ..... ..... ----- . 011101000 . @XO_ta +SUBFZE 011111 ..... ..... ----- . 011001000 . @XO_ta =20 ## Fixed-Point Logical Instructions =20 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 28fc7791af..4f6f7dcd89 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1735,61 +1735,6 @@ static inline void gen_op_arith_add(DisasContext *ct= x, TCGv ret, TCGv arg1, tcg_gen_mov_tl(ret, t0); } } -/* Add functions with two operands */ -#define GEN_INT_ARITH_ADD(name, opc3, ca, add_ca, compute_ca, compute_ov) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ -{ = \ - gen_op_arith_add(ctx, cpu_gpr[rD(ctx->opcode)], = \ - cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], = \ - ca, glue(ca, 32), = \ - add_ca, compute_ca, compute_ov, Rc(ctx->opcode)); = \ -} -/* Add functions with one operand and one immediate */ -#define GEN_INT_ARITH_ADD_CONST(name, opc3, const_val, ca, = \ - add_ca, compute_ca, compute_ov) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ -{ = \ - TCGv t0 =3D tcg_constant_tl(const_val); = \ - gen_op_arith_add(ctx, cpu_gpr[rD(ctx->opcode)], = \ - cpu_gpr[rA(ctx->opcode)], t0, = \ - ca, glue(ca, 32), = \ - add_ca, compute_ca, compute_ov, Rc(ctx->opcode)); = \ -} - -/* add add. addo addo. */ -GEN_INT_ARITH_ADD(add, 0x08, cpu_ca, 0, 0, 0) -GEN_INT_ARITH_ADD(addo, 0x18, cpu_ca, 0, 0, 1) -/* addc addc. addco addco. */ -GEN_INT_ARITH_ADD(addc, 0x00, cpu_ca, 0, 1, 0) -GEN_INT_ARITH_ADD(addco, 0x10, cpu_ca, 0, 1, 1) -/* adde adde. addeo addeo. */ -GEN_INT_ARITH_ADD(adde, 0x04, cpu_ca, 1, 1, 0) -GEN_INT_ARITH_ADD(addeo, 0x14, cpu_ca, 1, 1, 1) -/* addme addme. addmeo addmeo. */ -GEN_INT_ARITH_ADD_CONST(addme, 0x07, -1LL, cpu_ca, 1, 1, 0) -GEN_INT_ARITH_ADD_CONST(addmeo, 0x17, -1LL, cpu_ca, 1, 1, 1) -/* addex */ -GEN_INT_ARITH_ADD(addex, 0x05, cpu_ov, 1, 1, 0); -/* addze addze. addzeo addzeo.*/ -GEN_INT_ARITH_ADD_CONST(addze, 0x06, 0, cpu_ca, 1, 1, 0) -GEN_INT_ARITH_ADD_CONST(addzeo, 0x16, 0, cpu_ca, 1, 1, 1) -/* addic addic.*/ -static inline void gen_op_addic(DisasContext *ctx, bool compute_rc0) -{ - TCGv c =3D tcg_constant_tl(SIMM(ctx->opcode)); - gen_op_arith_add(ctx, cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode= )], - c, cpu_ca, cpu_ca32, 0, 1, 0, compute_rc0); -} - -static void gen_addic(DisasContext *ctx) -{ - gen_op_addic(ctx, 0); -} - -static void gen_addic_(DisasContext *ctx) -{ - gen_op_addic(ctx, 1); -} =20 static inline void gen_op_arith_divw(DisasContext *ctx, TCGv ret, TCGv arg= 1, TCGv arg2, int sign, int compute_ov) @@ -2210,47 +2155,6 @@ static inline void gen_op_arith_subf(DisasContext *c= tx, TCGv ret, TCGv arg1, tcg_gen_mov_tl(ret, t0); } } -/* Sub functions with Two operands functions */ -#define GEN_INT_ARITH_SUBF(name, opc3, add_ca, compute_ca, compute_ov) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ -{ = \ - gen_op_arith_subf(ctx, cpu_gpr[rD(ctx->opcode)], = \ - cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], = \ - add_ca, compute_ca, compute_ov, Rc(ctx->opcode)); = \ -} -/* Sub functions with one operand and one immediate */ -#define GEN_INT_ARITH_SUBF_CONST(name, opc3, const_val, = \ - add_ca, compute_ca, compute_ov) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ -{ = \ - TCGv t0 =3D tcg_constant_tl(const_val); = \ - gen_op_arith_subf(ctx, cpu_gpr[rD(ctx->opcode)], = \ - cpu_gpr[rA(ctx->opcode)], t0, = \ - add_ca, compute_ca, compute_ov, Rc(ctx->opcode)); = \ -} -/* subf subf. subfo subfo. */ -GEN_INT_ARITH_SUBF(subf, 0x01, 0, 0, 0) -GEN_INT_ARITH_SUBF(subfo, 0x11, 0, 0, 1) -/* subfc subfc. subfco subfco. */ -GEN_INT_ARITH_SUBF(subfc, 0x00, 0, 1, 0) -GEN_INT_ARITH_SUBF(subfco, 0x10, 0, 1, 1) -/* subfe subfe. subfeo subfo. */ -GEN_INT_ARITH_SUBF(subfe, 0x04, 1, 1, 0) -GEN_INT_ARITH_SUBF(subfeo, 0x14, 1, 1, 1) -/* subfme subfme. subfmeo subfmeo. */ -GEN_INT_ARITH_SUBF_CONST(subfme, 0x07, -1LL, 1, 1, 0) -GEN_INT_ARITH_SUBF_CONST(subfmeo, 0x17, -1LL, 1, 1, 1) -/* subfze subfze. subfzeo subfzeo.*/ -GEN_INT_ARITH_SUBF_CONST(subfze, 0x06, 0, 1, 1, 0) -GEN_INT_ARITH_SUBF_CONST(subfzeo, 0x16, 0, 1, 1, 1) - -/* subfic */ -static void gen_subfic(DisasContext *ctx) -{ - TCGv c =3D tcg_constant_tl(SIMM(ctx->opcode)); - gen_op_arith_subf(ctx, cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcod= e)], - c, 0, 1, 0, 0); -} =20 /* neg neg. nego nego. */ static inline void gen_op_arith_neg(DisasContext *ctx, bool compute_ov) @@ -6524,8 +6428,6 @@ GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, P= PC_NONE, PPC2_ISA300), GEN_HANDLER_E(cmpb, 0x1F, 0x1C, 0x0F, 0x00000001, PPC_NONE, PPC2_ISA205), GEN_HANDLER_E(cmprb, 0x1F, 0x00, 0x06, 0x00400001, PPC_NONE, PPC2_ISA300), GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL), -GEN_HANDLER(addic, 0x0C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), -GEN_HANDLER2(addic_, "addic.", 0x0D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(mulhw, 0x1F, 0x0B, 0x02, 0x00000400, PPC_INTEGER), GEN_HANDLER(mulhwu, 0x1F, 0x0B, 0x00, 0x00000400, PPC_INTEGER), GEN_HANDLER(mullw, 0x1F, 0x0B, 0x07, 0x00000000, PPC_INTEGER), @@ -6536,7 +6438,6 @@ GEN_HANDLER(mulld, 0x1F, 0x09, 0x07, 0x00000000, PPC_= 64B), #endif GEN_HANDLER(neg, 0x1F, 0x08, 0x03, 0x0000F800, PPC_INTEGER), GEN_HANDLER(nego, 0x1F, 0x08, 0x13, 0x0000F800, PPC_INTEGER), -GEN_HANDLER(subfic, 0x08, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER2(andi_, "andi.", 0x1C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(cntlzw, 0x1F, 0x1A, 0x00, 0x00000000, PPC_INTEGER), @@ -6747,25 +6648,6 @@ GEN_HANDLER_E(maddhd_maddhdu, 0x04, 0x18, 0xFF, 0x00= 000000, PPC_NONE, GEN_HANDLER_E(maddld, 0x04, 0x19, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA300), #endif =20 -#undef GEN_INT_ARITH_ADD -#undef GEN_INT_ARITH_ADD_CONST -#define GEN_INT_ARITH_ADD(name, opc3, add_ca, compute_ca, compute_ov) = \ -GEN_HANDLER(name, 0x1F, 0x0A, opc3, 0x00000000, PPC_INTEGER), -#define GEN_INT_ARITH_ADD_CONST(name, opc3, const_val, = \ - add_ca, compute_ca, compute_ov) = \ -GEN_HANDLER(name, 0x1F, 0x0A, opc3, 0x0000F800, PPC_INTEGER), -GEN_INT_ARITH_ADD(add, 0x08, 0, 0, 0) -GEN_INT_ARITH_ADD(addo, 0x18, 0, 0, 1) -GEN_INT_ARITH_ADD(addc, 0x00, 0, 1, 0) -GEN_INT_ARITH_ADD(addco, 0x10, 0, 1, 1) -GEN_INT_ARITH_ADD(adde, 0x04, 1, 1, 0) -GEN_INT_ARITH_ADD(addeo, 0x14, 1, 1, 1) -GEN_INT_ARITH_ADD_CONST(addme, 0x07, -1LL, 1, 1, 0) -GEN_INT_ARITH_ADD_CONST(addmeo, 0x17, -1LL, 1, 1, 1) -GEN_HANDLER_E(addex, 0x1F, 0x0A, 0x05, 0x00000000, PPC_NONE, PPC2_ISA300), -GEN_INT_ARITH_ADD_CONST(addze, 0x06, 0, 1, 1, 0) -GEN_INT_ARITH_ADD_CONST(addzeo, 0x16, 0, 1, 1, 1) - #undef GEN_INT_ARITH_DIVW #define GEN_INT_ARITH_DIVW(name, opc3, sign, compute_ov) = \ GEN_HANDLER(name, 0x1F, 0x0B, opc3, 0x00000000, PPC_INTEGER) @@ -6804,24 +6686,6 @@ GEN_INT_ARITH_MUL_HELPER(mulhd, 0x02), GEN_INT_ARITH_MUL_HELPER(mulldo, 0x17), #endif =20 -#undef GEN_INT_ARITH_SUBF -#undef GEN_INT_ARITH_SUBF_CONST -#define GEN_INT_ARITH_SUBF(name, opc3, add_ca, compute_ca, compute_ov) = \ -GEN_HANDLER(name, 0x1F, 0x08, opc3, 0x00000000, PPC_INTEGER), -#define GEN_INT_ARITH_SUBF_CONST(name, opc3, const_val, = \ - add_ca, compute_ca, compute_ov) = \ -GEN_HANDLER(name, 0x1F, 0x08, opc3, 0x0000F800, PPC_INTEGER), -GEN_INT_ARITH_SUBF(subf, 0x01, 0, 0, 0) -GEN_INT_ARITH_SUBF(subfo, 0x11, 0, 0, 1) -GEN_INT_ARITH_SUBF(subfc, 0x00, 0, 1, 0) -GEN_INT_ARITH_SUBF(subfco, 0x10, 0, 1, 1) -GEN_INT_ARITH_SUBF(subfe, 0x04, 1, 1, 0) -GEN_INT_ARITH_SUBF(subfeo, 0x14, 1, 1, 1) -GEN_INT_ARITH_SUBF_CONST(subfme, 0x07, -1LL, 1, 1, 0) -GEN_INT_ARITH_SUBF_CONST(subfmeo, 0x17, -1LL, 1, 1, 1) -GEN_INT_ARITH_SUBF_CONST(subfze, 0x06, 0, 1, 1, 0) -GEN_INT_ARITH_SUBF_CONST(subfzeo, 0x16, 0, 1, 1, 1) - #undef GEN_LOGICAL1 #undef GEN_LOGICAL2 #define GEN_LOGICAL2(name, tcg_op, opc, type) = \ diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index 51c6fa7330..0c66465d96 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -325,6 +325,76 @@ static bool trans_ADDPCIS(DisasContext *ctx, arg_DX *a) return true; } =20 +static bool trans_ADDEX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS2(ctx, ISA300); + gen_op_arith_add(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], cpu_gpr[a->rb], + cpu_ov, cpu_ov32, true, true, false, false); + return true; +} + +static bool do_add_D(DisasContext *ctx, arg_D *a, bool add_ca, bool comput= e_ca, + bool compute_ov, bool compute_rc0) +{ + gen_op_arith_add(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], + tcg_constant_tl(a->si), cpu_ca, cpu_ca32, + add_ca, compute_ca, compute_ov, compute_rc0); + return true; +} + +static bool do_add_XO(DisasContext *ctx, arg_XO *a, bool add_ca, + bool compute_ca) +{ + gen_op_arith_add(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], cpu_gpr[a->rb], + cpu_ca, cpu_ca32, add_ca, compute_ca, a->oe, a->rc); + return true; +} + +static bool do_add_const_XO(DisasContext *ctx, arg_XO_ta *a, TCGv const_va= l, + bool add_ca, bool compute_ca) +{ + gen_op_arith_add(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], const_val, + cpu_ca, cpu_ca32, add_ca, compute_ca, a->oe, a->rc); + return true; +} + +TRANS(ADD, do_add_XO, false, false); +TRANS(ADDC, do_add_XO, false, true); +TRANS(ADDE, do_add_XO, true, true); +TRANS(ADDME, do_add_const_XO, tcg_constant_tl(-1LL), true, true); +TRANS(ADDZE, do_add_const_XO, tcg_constant_tl(0), true, true); +TRANS(ADDIC, do_add_D, false, true, false, false); +TRANS(ADDIC_, do_add_D, false, true, false, true); + +static bool trans_SUBFIC(DisasContext *ctx, arg_D *a) +{ + gen_op_arith_subf(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], + tcg_constant_tl(a->si), false, true, false, false); + return true; +} + +static bool do_subf_XO(DisasContext *ctx, arg_XO *a, bool add_ca, + bool compute_ca) +{ + gen_op_arith_subf(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], cpu_gpr[a->rb], + add_ca, compute_ca, a->oe, a->rc); + return true; +} + +static bool do_subf_const_XO(DisasContext *ctx, arg_XO_ta *a, TCGv const_v= al, + bool add_ca, bool compute_ca) +{ + gen_op_arith_subf(ctx, cpu_gpr[a->rt], cpu_gpr[a->ra], const_val, + add_ca, compute_ca, a->oe, a->rc); + return true; +} + +TRANS(SUBF, do_subf_XO, false, false) +TRANS(SUBFC, do_subf_XO, false, true) +TRANS(SUBFE, do_subf_XO, true, true) +TRANS(SUBFME, do_subf_const_XO, tcg_constant_tl(-1LL), true, true) +TRANS(SUBFZE, do_subf_const_XO, tcg_constant_tl(0), true, true) + static bool trans_INVALID(DisasContext *ctx, arg_INVALID *a) { gen_invalid(ctx); --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263345; cv=none; d=zohomail.com; s=zohoarc; b=MaLJWeu4cdtxh2MUx1MrXAEILEeHRIAxf33umtBjSj8VScCfWIDmTVpodE3nw+hx5e1PxQS3SyU2BFdZ3GSq72dNlNat1uVHuYRQjJachVyuhjrCFDOPmbPnTnQ4uhTysKgDpK1XSPqkaCFf67iVqBXz+aL3KYrMdu2R1R7rT48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263345; 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=hR5QAE7pCDJxhb5ipA2/sp4RETHxBXAwKTTkzbd/fU0=; b=XYgRPgS/uiSLl/R/Z1Dw/EZx4iIeruplUFW02g1ELVMfSp8/4tU0jP2ez4IGR22J4axRQEiGB5Q3cvG60FE+WhQ1P1tJCOA7plKT/9X2NBozRzwwSPDqPReyGjN7xVybH03wZrlIu0GpvVlsLEjkqyvrCXAKVVzEVUD0RPRcPyI= 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 1710263345129516.6277645782158; Tue, 12 Mar 2024 10:09:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Vy-0008Ge-PG; Tue, 12 Mar 2024 13:02:12 -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 1rk5U0-0005C3-Av; Tue, 12 Mar 2024 13:00:09 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Tx-00083A-7q; Tue, 12 Mar 2024 13:00:08 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e6adc557b6so612687b3a.2; Tue, 12 Mar 2024 10:00:01 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.09.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262800; x=1710867600; 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=hR5QAE7pCDJxhb5ipA2/sp4RETHxBXAwKTTkzbd/fU0=; b=G7e1Z9XRKVxPkjsJTQdJvjJom1sHIHmpmvquRvB7Gysu6RYTfp3tYM7nNmi78mxyS8 1oDoFQktaOv8yqNSh8HWfLT5ZuxDXAFjcFMScDWCA1qzFs2z6Lsn7yN9ZJD+4Rg/Zefq omFbLWWy8PhwOKBVH76Kyb/QzHYNAdPiQHA17hAzVsANnZ39mS5q3VFuTQGXUOha59qf RkjfFE80rir6WN0RnjZ5opuwP4Ycm9tvVDRHkQM/JCyrGXwHt6yQnpoFZa6CGLYdFlaC dSZiCdkEvs0JtJ9SCYUzjfo5dRVWv4RRzr8c1huw5sXRK383p5t0VQ72lG418WCHeWIa 984Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262800; x=1710867600; 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=hR5QAE7pCDJxhb5ipA2/sp4RETHxBXAwKTTkzbd/fU0=; b=h5Nfv5cu5qUolKH8BOVM+Fu/86LVQKD2jYewu+PnTDh4sCwiEwvc7ufxuwMxjnDBfN 5qfIPwRTX7Dg3cXJeGlhy8WAlUXrGx8K0oPDofCkSwPEHwmp09lE2yqF08oHX8G+KXwP Mh0H0fIo+AmAP7GXzLarZGW0UiaCZx7Lxuhmg5V7UHFIndlfVyy7Y6cKmPZnNAE0fHo1 dNSFtAd054hr4P6eS93af3dLR3BT9MbJU2Z6T1cbQJrSUfBMa3+yhuo3aZBlPnqlkoSJ 39W7nwjTLGZNnQ4ozbvHq53EiuBXTJQ3238hUCkAonHana79O32flKQI7rJA4yGEi2Sc YGKg== X-Forwarded-Encrypted: i=1; AJvYcCWjViF74hMGVkkh9EG4/DKCxz8ZsUVzVz0BUgjwwApk89kTA6mcJcALACoh1Ld3FbsYtlJw52Hj1YE0aT0yp5+lwatS X-Gm-Message-State: AOJu0YzuL33Heg0WsdCjQhuI/Dy1oSrTseoPkS7gCRSLck95KM2bngoH qgCB016uZjS/kRutaUQvjF78bNqHv78MyIu/Ep8boq/maYsqHCnjXg9wySLl2Vo= X-Google-Smtp-Source: AGHT+IGurJn5i/C18O+WR7QMOKE03Hp+sOkCLv5Zo/oNUMvjGngTH2RxLvbDgPm2iYoXqEi3PCIS7A== X-Received: by 2002:a05:6a20:6f8c:b0:1a1:4879:1d72 with SMTP id gv12-20020a056a206f8c00b001a148791d72mr1022208pzb.55.1710262800046; Tue, 12 Mar 2024 10:00:00 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Madhavan Srinivasan Subject: [PULL 16/38] target/ppc: Add power10 pmu SPRs Date: Wed, 13 Mar 2024 02:58:27 +1000 Message-ID: <20240312165851.2240242-17-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::431; envelope-from=npiggin@gmail.com; helo=mail-pf1-x431.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: 1710263345540100001 Content-Type: text/plain; charset="utf-8" From: Madhavan Srinivasan Currently in tcg mode, when reading from power10 pmu spr like MMCR3, qemu logs this message (when starting qemu with -d guest_errors) Trying to read invalid spr 754 (0x2f2) at 0000000030056bb0 This is becuase, no read/write call-backs are registered for these SPRs. Add support to register generic read/write functions to these power10 pmu sprs to fix it. Reviewed-by: Nicholas Piggin Signed-off-by: Madhavan Srinivasan Signed-off-by: Nicholas Piggin --- target/ppc/cpu.h | 6 ++++++ target/ppc/cpu_init.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 0133da4e07..ed04351f27 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1951,6 +1951,12 @@ void ppc_compat_add_property(Object *obj, const char= *name, #define SPR_BOOKE_TLB2CFG (0x2B2) #define SPR_BOOKE_TLB3CFG (0x2B3) #define SPR_BOOKE_EPR (0x2BE) +#define SPR_POWER_USIER2 (0x2E0) +#define SPR_POWER_USIER3 (0x2E1) +#define SPR_POWER_UMMCR3 (0x2E2) +#define SPR_POWER_SIER2 (0x2F0) +#define SPR_POWER_SIER3 (0x2F1) +#define SPR_POWER_MMCR3 (0x2F2) #define SPR_PERF0 (0x300) #define SPR_RCPU_MI_RBA0 (0x300) #define SPR_MPC_MI_CTR (0x300) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index b160926a93..df31490b07 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -5308,6 +5308,38 @@ static void register_power8_pmu_user_sprs(CPUPPCStat= e *env) 0x00000000); } =20 +static void register_power10_pmu_sup_sprs(CPUPPCState *env) +{ + spr_register_kvm(env, SPR_POWER_MMCR3, "MMCR3", + SPR_NOACCESS, SPR_NOACCESS, + &spr_read_generic, &spr_write_generic, + KVM_REG_PPC_MMCR3, 0x00000000); + spr_register_kvm(env, SPR_POWER_SIER2, "SIER2", + SPR_NOACCESS, SPR_NOACCESS, + &spr_read_generic, &spr_write_generic, + KVM_REG_PPC_SIER2, 0x00000000); + spr_register_kvm(env, SPR_POWER_SIER3, "SIER3", + SPR_NOACCESS, SPR_NOACCESS, + &spr_read_generic, &spr_write_generic, + KVM_REG_PPC_SIER3, 0x00000000); +} + +static void register_power10_pmu_user_sprs(CPUPPCState *env) +{ + spr_register(env, SPR_POWER_UMMCR3, "UMMCR3", + &spr_read_generic, &spr_write_generic, + &spr_read_generic, &spr_write_generic, + 0x00000000); + spr_register(env, SPR_POWER_USIER2, "USIER2", + &spr_read_generic, SPR_NOACCESS, + &spr_read_generic, &spr_write_generic, + 0x00000000); + spr_register(env, SPR_POWER_USIER3, "USIER3", + &spr_read_generic, SPR_NOACCESS, + &spr_read_generic, &spr_write_generic, + 0x00000000); +} + static void register_power5p_ear_sprs(CPUPPCState *env) { /* External access control */ @@ -6502,6 +6534,8 @@ static void init_proc_POWER10(CPUPPCState *env) register_power9_mmu_sprs(env); register_power10_hash_sprs(env); register_power10_dexcr_sprs(env); + register_power10_pmu_sup_sprs(env); + register_power10_pmu_user_sprs(env); =20 /* FIXME: Filter fields properly based on privilege level */ spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL, --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262897; cv=none; d=zohomail.com; s=zohoarc; b=FfKDuTCaQNMXNWhkaM+IVsdTU/xl4drwmvcR0oZN+R7xkvKS85FLjMT5Mmx+Y84/J4DgxovEqIYdFcezXOj9i+lCrRog23fgZK62tBORvCAqLnIz0Cqf7+m+Mb+0nyfpSpuQsFhz7IGWy+//hBaIH7PLV0p3x1CK9DuprNlwHdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262897; h=Content-Type: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=rcMR/66QO66SZZwZGEJJBpBsXptqItMqgKZ6913Z6c0=; b=Bzsv4gOVnFI6xNpRmniuFAmYWPOWY3LHGXUNbenZqxbGhE2XqGwBRCvNGPpo3acsLVQ+EwjHcYIotOxeyTaoMraa97+kBdgeX3ZYvD54OHNDEWZEl+5ZTVKa91vP2PZV3Lkc4zTr5b2/j69QhMB59tlDHEjK8vuvrYPfE3qN27Y= 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 1710262897761522.9876973262553; Tue, 12 Mar 2024 10:01:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5UA-0005Ww-0z; Tue, 12 Mar 2024 13:00:18 -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 1rk5U0-0005C4-Nk; Tue, 12 Mar 2024 13:00:10 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Ty-0008FA-0R; Tue, 12 Mar 2024 13:00:08 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6aa5c5a6fso139409b3a.0; Tue, 12 Mar 2024 10:00:05 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262804; x=1710867604; 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=rcMR/66QO66SZZwZGEJJBpBsXptqItMqgKZ6913Z6c0=; b=Qmajckl+uWnhNE/bKJHU3PvCX6JdW1oe7n6wtAeltqCeA3osxrTnd7T4iPqlSM+1c0 Z47fvG1v0M2ENoLrDye0alMBUZb3eP40jS59iIkSoxcXdA2ZTwD9fdxW6FZXgguMik4F 2tvDHt7oQe+EPKJG02av+tuISPjWccUKv4Rh6NmYu/CyO/VOITZyMz/tc/rdUbBpRB/G Srrd2Nxg048sGs/tpOfPzw0WFVrvZQgYT55ZMXcxzz2FBUqWEw9bLQj8OnuVz95eq/WQ aj4LSpHzURSGsQHDKQyJgWudXAqE4q/RB19c2JeFJm/RnCG90pWSPzAtNqrar8T1Fbat qaYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262804; x=1710867604; 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=rcMR/66QO66SZZwZGEJJBpBsXptqItMqgKZ6913Z6c0=; b=pd/cD9BNCRoFT0JJGRbgYVwi78+DcW9ZhXL8yBr2p2n+WO6iIRziNyyo2BKOwaHFQc Ir47XakGXKr3JhLhNDLDlxTcp8DDtjzamNcmmfCAW7+Fjy5YompJ7OuicwChEUNdcwq9 MMFbf2OmAq/xzxkUQOxl6L864HELJ6napqfA3El2CGNd4tqSgyXeTEFZUgYNLC89L9y6 N0SDywazF1MN0/AA1vGuyEV37lm/OGhOQwiLd1Ly9caTndHLM42/RPNKpi2VBooKlRmL ZMb+tWPv0ptE5IPsUcYpSUVm7anBX0FilLkQ1MZrWRoj90mw2t44JYuBATW12jVUf0SJ ex7A== X-Forwarded-Encrypted: i=1; AJvYcCWJcdlvHfuBN0uXMW88ZLIIY1k7k/Kf2Us8N4jpS3p69R5XZbMVqmUBzkO494hhSP8DPSrDicy3TTSapTS1QtlbXSSc X-Gm-Message-State: AOJu0YzM4047erazfSjovg5ZOpuVcnUBMjOc3Np0BxgBGFRyzM4Knr4o 2Y282wX5T4L6cAv6OT0wxNUKaR1CjxZCiKMwle2By/e6yLHYm8p58Cnr7DfwwJA= X-Google-Smtp-Source: AGHT+IGITJxxJSIevwlUtHc4qrjGU3LE1ZlINtXgTMI7D1uuU3af6iZsfAfjad9Q7RfPTSz4T0neYA== X-Received: by 2002:a05:6a20:958c:b0:1a3:b42:a22d with SMTP id iu12-20020a056a20958c00b001a30b42a22dmr4794246pzb.57.1710262803697; Tue, 12 Mar 2024 10:00:03 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Caleb Schlossin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 17/38] ppc/pnv: Improve pervasive topology calculation for big-core Date: Wed, 13 Mar 2024 02:58:28 +1000 Message-ID: <20240312165851.2240242-18-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.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: 1710262899580100003 From: Caleb Schlossin Big (SMT8) cores have a complicated function to map the core, thread ID to pervasive topology (PIR). Fix this for power8, power9, and power10. Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Caleb Schlossin Signed-off-by: Nicholas Piggin --- hw/ppc/pnv.c | 71 ++++++++++++++++++++++++++++----------- hw/ppc/pnv_core.c | 8 ++--- include/hw/ppc/pnv_chip.h | 2 +- include/hw/ppc/pnv_core.h | 1 + target/ppc/misc_helper.c | 3 -- 5 files changed, 57 insertions(+), 28 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 8a502dea90..6fad628d9f 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -141,8 +141,10 @@ static int pnv_dt_core(PnvChip *chip, PnvCore *pc, voi= d *fdt) int smt_threads =3D CPU_CORE(pc)->nr_threads; CPUPPCState *env =3D &cpu->env; PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cs); + PnvChipClass *pnv_cc =3D PNV_CHIP_GET_CLASS(chip); g_autofree uint32_t *servers_prop =3D g_new(uint32_t, smt_threads); int i; + uint32_t pir; uint32_t segs[] =3D {cpu_to_be32(28), cpu_to_be32(40), 0xffffffff, 0xffffffff}; uint32_t tbfreq =3D PNV_TIMEBASE_FREQ; @@ -153,15 +155,17 @@ static int pnv_dt_core(PnvChip *chip, PnvCore *pc, vo= id *fdt) char *nodename; int cpus_offset =3D get_cpus_node(fdt); =20 - nodename =3D g_strdup_printf("%s@%x", dc->fw_name, pc->pir); + pir =3D pnv_cc->chip_pir(chip, pc->hwid, 0); + + nodename =3D g_strdup_printf("%s@%x", dc->fw_name, pir); offset =3D fdt_add_subnode(fdt, cpus_offset, nodename); _FDT(offset); g_free(nodename); =20 _FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id", chip->chip_id))); =20 - _FDT((fdt_setprop_cell(fdt, offset, "reg", pc->pir))); - _FDT((fdt_setprop_cell(fdt, offset, "ibm,pir", pc->pir))); + _FDT((fdt_setprop_cell(fdt, offset, "reg", pir))); + _FDT((fdt_setprop_cell(fdt, offset, "ibm,pir", pir))); _FDT((fdt_setprop_string(fdt, offset, "device_type", "cpu"))); =20 _FDT((fdt_setprop_cell(fdt, offset, "cpu-version", env->spr[SPR_PVR]))= ); @@ -233,7 +237,7 @@ static int pnv_dt_core(PnvChip *chip, PnvCore *pc, void= *fdt) =20 /* Build interrupt servers properties */ for (i =3D 0; i < smt_threads; i++) { - servers_prop[i] =3D cpu_to_be32(pc->pir + i); + servers_prop[i] =3D cpu_to_be32(pnv_cc->chip_pir(chip, pc->hwid, i= )); } _FDT((fdt_setprop(fdt, offset, "ibm,ppc-interrupt-server#s", servers_prop, sizeof(*servers_prop) * smt_threads))= ); @@ -241,9 +245,11 @@ static int pnv_dt_core(PnvChip *chip, PnvCore *pc, voi= d *fdt) return offset; } =20 -static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir, +static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t hwid, uint32_t nr_threads) { + PnvChipClass *pcc =3D PNV_CHIP_GET_CLASS(chip); + uint32_t pir =3D pcc->chip_pir(chip, hwid, 0); uint64_t addr =3D PNV_ICP_BASE(chip) | (pir << 12); char *name; const char compat[] =3D "IBM,power8-icp\0IBM,ppc-xicp"; @@ -257,6 +263,7 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32= _t pir, rsize =3D sizeof(uint64_t) * 2 * nr_threads; reg =3D g_malloc(rsize); for (i =3D 0; i < nr_threads; i++) { + /* We know P8 PIR is linear with thread id */ reg[i * 2] =3D cpu_to_be64(addr | ((pir + i) * 0x1000)); reg[i * 2 + 1] =3D cpu_to_be64(0x1000); } @@ -324,7 +331,7 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, = void *fdt) pa_features_207, sizeof(pa_features_207)))); =20 /* Interrupt Control Presenters (ICP). One per core. */ - pnv_dt_icp(chip, fdt, pnv_core->pir, CPU_CORE(pnv_core)->nr_thread= s); + pnv_dt_icp(chip, fdt, pnv_core->hwid, CPU_CORE(pnv_core)->nr_threa= ds); } =20 if (chip->ram_size) { @@ -1075,9 +1082,10 @@ static void pnv_init(MachineState *machine) * 25:28 Core number * 29:31 Thread ID */ -static uint32_t pnv_chip_core_pir_p8(PnvChip *chip, uint32_t core_id) +static uint32_t pnv_chip_pir_p8(PnvChip *chip, uint32_t core_id, + uint32_t thread_id) { - return (chip->chip_id << 7) | (core_id << 3); + return (chip->chip_id << 7) | (core_id << 3) | thread_id; } =20 static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu, @@ -1129,14 +1137,37 @@ static void pnv_chip_power8_intc_print_info(PnvChip= *chip, PowerPCCPU *cpu, * * We only care about the lower bits. uint32_t is fine for the moment. */ -static uint32_t pnv_chip_core_pir_p9(PnvChip *chip, uint32_t core_id) +static uint32_t pnv_chip_pir_p9(PnvChip *chip, uint32_t core_id, + uint32_t thread_id) { - return (chip->chip_id << 8) | (core_id << 2); + if (chip->nr_threads =3D=3D 8) { + return (chip->chip_id << 8) | ((thread_id & 1) << 2) | (core_id <<= 3) | + (thread_id >> 1); + } else { + return (chip->chip_id << 8) | (core_id << 2) | thread_id; + } } =20 -static uint32_t pnv_chip_core_pir_p10(PnvChip *chip, uint32_t core_id) +/* + * 0:48 Reserved - Read as zeroes + * 49:52 Node ID + * 53:55 Chip ID + * 56 Reserved - Read as zero + * 57:59 Quad ID + * 60 Core Chiplet Pair ID + * 61:63 Thread/Core Chiplet ID t0-t2 + * + * We only care about the lower bits. uint32_t is fine for the moment. + */ +static uint32_t pnv_chip_pir_p10(PnvChip *chip, uint32_t core_id, + uint32_t thread_id) { - return (chip->chip_id << 8) | (core_id << 2); + if (chip->nr_threads =3D=3D 8) { + return (chip->chip_id << 8) | ((core_id / 4) << 4) | + ((core_id % 2) << 3) | thread_id; + } else { + return (chip->chip_id << 8) | (core_id << 2) | thread_id; + } } =20 static void pnv_chip_power9_intc_create(PnvChip *chip, PowerPCCPU *cpu, @@ -1315,7 +1346,7 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Err= or **errp) int core_hwid =3D CPU_CORE(pnv_core)->core_id; =20 for (j =3D 0; j < CPU_CORE(pnv_core)->nr_threads; j++) { - uint32_t pir =3D pcc->core_pir(chip, core_hwid) + j; + uint32_t pir =3D pcc->chip_pir(chip, core_hwid, j); PnvICPState *icp =3D PNV_ICP(xics_icp_get(chip8->xics, pir)); =20 memory_region_add_subregion(&chip8->icp_mmio, pir << 12, @@ -1428,7 +1459,7 @@ static void pnv_chip_power8e_class_init(ObjectClass *= klass, void *data) k->chip_cfam_id =3D 0x221ef04980000000ull; /* P8 Murano DD2.1 */ k->cores_mask =3D POWER8E_CORE_MASK; k->num_phbs =3D 3; - k->core_pir =3D pnv_chip_core_pir_p8; + k->chip_pir =3D pnv_chip_pir_p8; k->intc_create =3D pnv_chip_power8_intc_create; k->intc_reset =3D pnv_chip_power8_intc_reset; k->intc_destroy =3D pnv_chip_power8_intc_destroy; @@ -1452,7 +1483,7 @@ static void pnv_chip_power8_class_init(ObjectClass *k= lass, void *data) k->chip_cfam_id =3D 0x220ea04980000000ull; /* P8 Venice DD2.0 */ k->cores_mask =3D POWER8_CORE_MASK; k->num_phbs =3D 3; - k->core_pir =3D pnv_chip_core_pir_p8; + k->chip_pir =3D pnv_chip_pir_p8; k->intc_create =3D pnv_chip_power8_intc_create; k->intc_reset =3D pnv_chip_power8_intc_reset; k->intc_destroy =3D pnv_chip_power8_intc_destroy; @@ -1476,7 +1507,7 @@ static void pnv_chip_power8nvl_class_init(ObjectClass= *klass, void *data) k->chip_cfam_id =3D 0x120d304980000000ull; /* P8 Naples DD1.0 */ k->cores_mask =3D POWER8_CORE_MASK; k->num_phbs =3D 4; - k->core_pir =3D pnv_chip_core_pir_p8; + k->chip_pir =3D pnv_chip_pir_p8; k->intc_create =3D pnv_chip_power8_intc_create; k->intc_reset =3D pnv_chip_power8_intc_reset; k->intc_destroy =3D pnv_chip_power8_intc_destroy; @@ -1749,7 +1780,7 @@ static void pnv_chip_power9_class_init(ObjectClass *k= lass, void *data) =20 k->chip_cfam_id =3D 0x220d104900008000ull; /* P9 Nimbus DD2.0 */ k->cores_mask =3D POWER9_CORE_MASK; - k->core_pir =3D pnv_chip_core_pir_p9; + k->chip_pir =3D pnv_chip_pir_p9; k->intc_create =3D pnv_chip_power9_intc_create; k->intc_reset =3D pnv_chip_power9_intc_reset; k->intc_destroy =3D pnv_chip_power9_intc_destroy; @@ -2061,7 +2092,7 @@ static void pnv_chip_power10_class_init(ObjectClass *= klass, void *data) =20 k->chip_cfam_id =3D 0x120da04900008000ull; /* P10 DD1.0 (with NX) */ k->cores_mask =3D POWER10_CORE_MASK; - k->core_pir =3D pnv_chip_core_pir_p10; + k->chip_pir =3D pnv_chip_pir_p10; k->intc_create =3D pnv_chip_power10_intc_create; k->intc_reset =3D pnv_chip_power10_intc_reset; k->intc_destroy =3D pnv_chip_power10_intc_destroy; @@ -2151,8 +2182,8 @@ static void pnv_chip_core_realize(PnvChip *chip, Erro= r **errp) chip->nr_threads, &error_fatal); object_property_set_int(OBJECT(pnv_core), CPU_CORE_PROP_CORE_ID, core_hwid, &error_fatal); - object_property_set_int(OBJECT(pnv_core), "pir", - pcc->core_pir(chip, core_hwid), &error_fat= al); + object_property_set_int(OBJECT(pnv_core), "hwid", core_hwid, + &error_fatal); object_property_set_int(OBJECT(pnv_core), "hrmor", pnv->fw_load_ad= dr, &error_fatal); object_property_set_link(OBJECT(pnv_core), "chip", OBJECT(chip), diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index 8c7afe037f..f40ab721d6 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -226,7 +226,7 @@ static void pnv_core_cpu_realize(PnvCore *pc, PowerPCCP= U *cpu, Error **errp, int thread_index) { CPUPPCState *env =3D &cpu->env; - int core_pir; + int core_hwid; ppc_spr_t *pir =3D &env->spr_cb[SPR_PIR]; ppc_spr_t *tir =3D &env->spr_cb[SPR_TIR]; Error *local_err =3D NULL; @@ -242,10 +242,10 @@ static void pnv_core_cpu_realize(PnvCore *pc, PowerPC= CPU *cpu, Error **errp, return; } =20 - core_pir =3D object_property_get_uint(OBJECT(pc), "pir", &error_abort); + core_hwid =3D object_property_get_uint(OBJECT(pc), "hwid", &error_abor= t); =20 tir->default_value =3D thread_index; - pir->default_value =3D core_pir + thread_index; + pir->default_value =3D pcc->chip_pir(pc->chip, core_hwid, thread_index= ); =20 /* Set time-base frequency to 512 MHz */ cpu_ppc_tb_init(env, PNV_TIMEBASE_FREQ); @@ -342,7 +342,7 @@ static void pnv_core_unrealize(DeviceState *dev) } =20 static Property pnv_core_properties[] =3D { - DEFINE_PROP_UINT32("pir", PnvCore, pir, 0), + DEFINE_PROP_UINT32("hwid", PnvCore, hwid, 0), DEFINE_PROP_UINT64("hrmor", PnvCore, hrmor, 0), DEFINE_PROP_LINK("chip", PnvCore, chip, TYPE_PNV_CHIP, PnvChip *), DEFINE_PROP_END_OF_LIST(), diff --git a/include/hw/ppc/pnv_chip.h b/include/hw/ppc/pnv_chip.h index af4cd7a8b8..8589f3291e 100644 --- a/include/hw/ppc/pnv_chip.h +++ b/include/hw/ppc/pnv_chip.h @@ -147,7 +147,7 @@ struct PnvChipClass { =20 DeviceRealize parent_realize; =20 - uint32_t (*core_pir)(PnvChip *chip, uint32_t core_id); + uint32_t (*chip_pir)(PnvChip *chip, uint32_t core_id, uint32_t thread_= id); void (*intc_create)(PnvChip *chip, PowerPCCPU *cpu, Error **errp); void (*intc_reset)(PnvChip *chip, PowerPCCPU *cpu); void (*intc_destroy)(PnvChip *chip, PowerPCCPU *cpu); diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h index 4db21229a6..c6d62fd145 100644 --- a/include/hw/ppc/pnv_core.h +++ b/include/hw/ppc/pnv_core.h @@ -36,6 +36,7 @@ struct PnvCore { /*< public >*/ PowerPCCPU **threads; uint32_t pir; + uint32_t hwid; uint64_t hrmor; PnvChip *chip; =20 diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c index a9d41d2802..58e808dc96 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -49,9 +49,6 @@ void helper_spr_core_write_generic(CPUPPCState *env, uint= 32_t sprn, CPUState *cs =3D env_cpu(env); CPUState *ccs; uint32_t nr_threads =3D cs->nr_threads; - uint32_t core_id =3D env->spr[SPR_PIR] & ~(nr_threads - 1); - - assert(core_id =3D=3D env->spr[SPR_PIR] - env->spr[SPR_TIR]); =20 if (nr_threads =3D=3D 1) { env->spr[sprn] =3D val; --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263241; cv=none; d=zohomail.com; s=zohoarc; b=DAdpDdjHHIbPqFkSOL4HseR9x53YGPuRlhdeL41yIwT6ydvHiq/sCwXRTbs8Du2PkGvTDcmfiJZdWLGC04tlvx4WeyGpeK6lgNAMYQfNytlZc87v47YvVyjtVtPF65e/ewdiw8zH/kUb6+BTMSYaMwo2X4ErCzUXFy4jCs5Qvzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263241; h=Content-Type: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=rVf/h4PI+3Z76hKAbw499YFjHfc8Pmr7sIWjABUIFRU=; b=fF+/5JI0ZV7/9qV+PS+LnQcEnvEZD+Fy5MhEsg07KjZcw016523QjxxNH3Ekq8thIMSzT9f6iUJwFhQrdmuC31oliZJNlD3C5RGXx4FQCy/bWB2TuZFwA0n7uuRndDhJ0OxDjY37T6MPO2CX2Wj1SNHbA2ml2b5gey9FpUjd1Xo= 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 1710263241021557.84936253739; Tue, 12 Mar 2024 10:07:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WH-00007D-K4; Tue, 12 Mar 2024 13:02:31 -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 1rk5UA-0005Yr-14; Tue, 12 Mar 2024 13:00:18 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5U6-0008GH-C6; Tue, 12 Mar 2024 13:00:17 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e5760eeb7aso4198354b3a.1; Tue, 12 Mar 2024 10:00:09 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262807; x=1710867607; 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=rVf/h4PI+3Z76hKAbw499YFjHfc8Pmr7sIWjABUIFRU=; b=j6ivl4oREg+0hFBLs2TkCwe5Z3BHqPpGxXG4azhtxuAQDUDzhCrv6dv8mvIrbIvXxR YUPreFpeEROekVIIsEmGxNTvATfqnuZWAMnptdK0iP+nNfNHDdFmudhxLzVFoZ85YIrs Sz3XtqfS+j2skOaUwuaFt9ixnREE9DroRDup4LhCN+zFdcIskeePe07NEBVJ46jq20oX v7rNkUzw2FRL64hFyGRiyIka+ZCDBl0FOQbFwICrG43JU7KhqqI+UCP0jJIgQEFiSJEV 8mTgkdOeyIsdHNnOSsY/Ek4/5Tc1uaQfVSq6OfBO1KYuEppLMvvhoRGOWyBFfL434yD9 OV6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262807; x=1710867607; 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=rVf/h4PI+3Z76hKAbw499YFjHfc8Pmr7sIWjABUIFRU=; b=YBd4rW1HBfDfZd+Jjv79gxAlPSeS7HziTApC/h0EcvZWbkY3xUqfqF84r79Qmnpfgi oQnCmVq1IsksnVXjUz3ulP90tAsC1eygfQBCRH6McmLgtOxyAqU0udGmMjjBOqhUXlR7 EsfwFV/5sXWjep8mBIuBRTjqE6afiwUrcN0Lz6ZgaQS5N2BFlc10LKbjOHnU9WSWYpgg SrUI3O6p6BzVw3VKoEopllKsuVUFa39tVUawaK5jvTJl+Zsoxp0qvZZrgG7YQQ7N2e9z hJjELANUItA41ZO6z6SASTSJLxnyUzae/tHPWoBoqiNjSFLlkw85bl4mvcmHh1EsF6h5 98EQ== X-Forwarded-Encrypted: i=1; AJvYcCWaMHEYqyIEu8xNzjtJuOB1yR8GE2rUFnG8R+VPNPE71jxp2a02Efxs1NcJowV8PFWJ0uPystprOBsdCBMcxwxmAJt+ X-Gm-Message-State: AOJu0Yx9Lu+CVlSwZu0DmOdsnbHBQZjE9y4JEYGGlRIURWTfcZDEAv9x Uu3xWvh/3LnCJnj9I7sj/sMHCjfjIbVWXf4HwlzvC76BJDWylCFt+/v83weutbs= X-Google-Smtp-Source: AGHT+IE2BWYpxkin3d2quXeWGkHTSNyrpq3ejZ4Khbf1skactvbitmdRvtpAS22JzEH5Fh2a0bV29Q== X-Received: by 2002:a05:6a20:72a0:b0:1a3:1553:b425 with SMTP id o32-20020a056a2072a000b001a31553b425mr7674251pzk.15.1710262807455; Tue, 12 Mar 2024 10:00:07 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 18/38] target/ppc: Use env_cpu for cpu_abort in excp_helper Date: Wed, 13 Mar 2024 02:58:29 +1000 Message-ID: <20240312165851.2240242-19-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::434; envelope-from=npiggin@gmail.com; helo=mail-pf1-x434.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: 1710263243199100007 From: BALATON Zoltan Use the env_cpu function to get the CPUState for cpu_abort. These are only needed in case of fatal errors so this allows to avoid casting and storing CPUState in a local variable wnen not needed. Reviewed-by: Harsh Prateek Bora Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/excp_helper.c | 118 +++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 98952de267..56a5fe7f3b 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -445,7 +445,6 @@ static void powerpc_mcheck_checkstop(CPUPPCState *env) =20 static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; int srr0, srr1; @@ -473,8 +472,8 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) =20 vector =3D env->excp_vectors[excp]; if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); + cpu_abort(env_cpu(env), + "Raised an exception without defined vector %d\n", excp); } =20 vector |=3D env->excp_prefix; @@ -523,7 +522,7 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) env->spr[SPR_40x_ESR] =3D ESR_PTR; break; default: - cpu_abort(cs, "Invalid program exception %d. Aborting\n", + cpu_abort(env_cpu(env), "Invalid program exception %d. Abortin= g\n", env->error_code); break; } @@ -550,11 +549,12 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int exc= p) trace_ppc_excp_print("PIT"); break; case POWERPC_EXCP_DEBUG: /* Debug interrupt = */ - cpu_abort(cs, "%s exception not implemented\n", + cpu_abort(env_cpu(env), "%s exception not implemented\n", powerpc_excp_name(excp)); break; default: - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); break; } =20 @@ -569,7 +569,6 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) =20 static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; =20 @@ -592,8 +591,8 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) =20 vector =3D env->excp_vectors[excp]; if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); + cpu_abort(env_cpu(env), + "Raised an exception without defined vector %d\n", excp); } =20 vector |=3D env->excp_prefix; @@ -653,7 +652,7 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) break; default: /* Should never occur */ - cpu_abort(cs, "Invalid program exception %d. Aborting\n", + cpu_abort(env_cpu(env), "Invalid program exception %d. Abortin= g\n", env->error_code); break; } @@ -675,8 +674,9 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) break; case POWERPC_EXCP_RESET: /* System reset exception = */ if (FIELD_EX64(env->msr, MSR, POW)) { - cpu_abort(cs, "Trying to deliver power-saving system reset " - "exception %d with no HV support\n", excp); + cpu_abort(env_cpu(env), + "Trying to deliver power-saving system reset excepti= on " + "%d with no HV support\n", excp); } break; case POWERPC_EXCP_TRACE: /* Trace exception = */ @@ -703,11 +703,12 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int exc= p) case POWERPC_EXCP_SMI: /* System management interrupt = */ case POWERPC_EXCP_MEXTBR: /* Maskable external breakpoint = */ case POWERPC_EXCP_NMEXTBR: /* Non maskable external breakpoint = */ - cpu_abort(cs, "%s exception not implemented\n", + cpu_abort(env_cpu(env), "%s exception not implemented\n", powerpc_excp_name(excp)); break; default: - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); break; } =20 @@ -730,7 +731,6 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) =20 static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; =20 @@ -753,8 +753,8 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) =20 vector =3D env->excp_vectors[excp]; if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); + cpu_abort(env_cpu(env), + "Raised an exception without defined vector %d\n", excp); } =20 vector |=3D env->excp_prefix; @@ -812,7 +812,7 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) break; default: /* Should never occur */ - cpu_abort(cs, "Invalid program exception %d. Aborting\n", + cpu_abort(env_cpu(env), "Invalid program exception %d. Abortin= g\n", env->error_code); break; } @@ -854,8 +854,9 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) break; case POWERPC_EXCP_RESET: /* System reset exception = */ if (FIELD_EX64(env->msr, MSR, POW)) { - cpu_abort(cs, "Trying to deliver power-saving system reset " - "exception %d with no HV support\n", excp); + cpu_abort(env_cpu(env), + "Trying to deliver power-saving system reset excepti= on " + "%d with no HV support\n", excp); } break; case POWERPC_EXCP_TRACE: /* Trace exception = */ @@ -875,11 +876,12 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int exc= p) case POWERPC_EXCP_SMI: /* System management interrupt = */ case POWERPC_EXCP_THERM: /* Thermal interrupt = */ case POWERPC_EXCP_PERFM: /* Embedded performance monitor interrupt= */ - cpu_abort(cs, "%s exception not implemented\n", + cpu_abort(env_cpu(env), "%s exception not implemented\n", powerpc_excp_name(excp)); break; default: - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); break; } =20 @@ -902,7 +904,6 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) =20 static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; =20 @@ -925,8 +926,8 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp) =20 vector =3D env->excp_vectors[excp]; if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); + cpu_abort(env_cpu(env), + "Raised an exception without defined vector %d\n", excp); } =20 vector |=3D env->excp_prefix; @@ -984,7 +985,7 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp) break; default: /* Should never occur */ - cpu_abort(cs, "Invalid program exception %d. Aborting\n", + cpu_abort(env_cpu(env), "Invalid program exception %d. Abortin= g\n", env->error_code); break; } @@ -1026,7 +1027,8 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int ex= cp) break; case POWERPC_EXCP_RESET: /* System reset exception = */ if (FIELD_EX64(env->msr, MSR, POW)) { - cpu_abort(cs, "Trying to deliver power-saving system reset " + cpu_abort(env_cpu(env), + "Trying to deliver power-saving system reset " "exception %d with no HV support\n", excp); } break; @@ -1039,11 +1041,12 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int = excp) case POWERPC_EXCP_THERM: /* Thermal interrupt = */ case POWERPC_EXCP_PERFM: /* Embedded performance monitor interrupt= */ case POWERPC_EXCP_VPUA: /* Vector assist exception = */ - cpu_abort(cs, "%s exception not implemented\n", + cpu_abort(env_cpu(env), "%s exception not implemented\n", powerpc_excp_name(excp)); break; default: - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); break; } =20 @@ -1066,7 +1069,6 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int ex= cp) =20 static void powerpc_excp_booke(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; int srr0, srr1; @@ -1103,8 +1105,8 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int e= xcp) =20 vector =3D env->excp_vectors[excp]; if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); + cpu_abort(env_cpu(env), + "Raised an exception without defined vector %d\n", excp); } =20 vector |=3D env->excp_prefix; @@ -1135,6 +1137,7 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int e= xcp) break; case POWERPC_EXCP_EXTERNAL: /* External input = */ if (env->mpic_proxy) { + CPUState *cs =3D env_cpu(env); /* IACK the IRQ on delivery */ env->spr[SPR_BOOKE_EPR] =3D ldl_phys(cs->as, env->mpic_iack); } @@ -1173,7 +1176,7 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int e= xcp) break; default: /* Should never occur */ - cpu_abort(cs, "Invalid program exception %d. Aborting\n", + cpu_abort(env_cpu(env), "Invalid program exception %d. Abortin= g\n", env->error_code); break; } @@ -1214,7 +1217,8 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int e= xcp) =20 /* DBSR already modified by caller */ } else { - cpu_abort(cs, "Debug exception triggered on unsupported model\= n"); + cpu_abort(env_cpu(env), + "Debug exception triggered on unsupported model\n"); } break; case POWERPC_EXCP_SPEU: /* SPE/embedded floating-point unavailable/V= PU */ @@ -1228,17 +1232,19 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int= excp) break; case POWERPC_EXCP_RESET: /* System reset exception = */ if (FIELD_EX64(env->msr, MSR, POW)) { - cpu_abort(cs, "Trying to deliver power-saving system reset " + cpu_abort(env_cpu(env), + "Trying to deliver power-saving system reset " "exception %d with no HV support\n", excp); } break; case POWERPC_EXCP_EFPDI: /* Embedded floating-point data interrupt= */ case POWERPC_EXCP_EFPRI: /* Embedded floating-point round interrup= t */ - cpu_abort(cs, "%s exception not implemented\n", + cpu_abort(env_cpu(env), "%s exception not implemented\n", powerpc_excp_name(excp)); break; default: - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); break; } =20 @@ -1376,7 +1382,6 @@ static bool is_prefix_insn_excp(PowerPCCPU *cpu, int = excp) =20 static void powerpc_excp_books(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; int srr0, srr1, lev =3D -1; @@ -1415,8 +1420,8 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int e= xcp) =20 vector =3D env->excp_vectors[excp]; if (vector =3D=3D (target_ulong)-1ULL) { - cpu_abort(cs, "Raised an exception without defined vector %d\n", - excp); + cpu_abort(env_cpu(env), + "Raised an exception without defined vector %d\n", excp); } =20 vector |=3D env->excp_prefix; @@ -1512,7 +1517,7 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int e= xcp) break; default: /* Should never occur */ - cpu_abort(cs, "Invalid program exception %d. Aborting\n", + cpu_abort(env_cpu(env), "Invalid program exception %d. Abortin= g\n", env->error_code); break; } @@ -1578,7 +1583,8 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int e= xcp) new_msr |=3D (target_ulong)MSR_HVB; } else { if (FIELD_EX64(env->msr, MSR, POW)) { - cpu_abort(cs, "Trying to deliver power-saving system reset= " + cpu_abort(env_cpu(env), + "Trying to deliver power-saving system reset " "exception %d with no HV support\n", excp); } } @@ -1650,11 +1656,12 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int= excp) case POWERPC_EXCP_VPUA: /* Vector assist exception = */ case POWERPC_EXCP_MAINT: /* Maintenance exception = */ case POWERPC_EXCP_HV_MAINT: /* Hypervisor Maintenance exception = */ - cpu_abort(cs, "%s exception not implemented\n", + cpu_abort(env_cpu(env), "%s exception not implemented\n", powerpc_excp_name(excp)); break; default: - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); break; } =20 @@ -1687,8 +1694,8 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int e= xcp) } else { /* Sanity check */ if (!(env->msr_mask & MSR_HVB) && srr0 =3D=3D SPR_HSRR0) { - cpu_abort(cs, "Trying to deliver HV exception (HSRR) %d with " - "no HV support\n", excp); + cpu_abort(env_cpu(env), "Trying to deliver HV exception (HSRR)= %d " + "with no HV support\n", excp); } =20 /* This can update new_msr and vector if AIL applies */ @@ -1706,11 +1713,11 @@ static inline void powerpc_excp_books(PowerPCCPU *c= pu, int excp) =20 static void powerpc_excp(PowerPCCPU *cpu, int excp) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; =20 if (excp <=3D POWERPC_EXCP_NONE || excp >=3D POWERPC_EXCP_NB) { - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp); + cpu_abort(env_cpu(env), "Invalid PowerPC exception %d. Aborting\n", + excp); } =20 qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx @@ -2244,7 +2251,6 @@ void ppc_maybe_interrupt(CPUPPCState *env) static void p7_deliver_interrupt(CPUPPCState *env, int interrupt) { PowerPCCPU *cpu =3D env_archcpu(env); - CPUState *cs =3D env_cpu(env); =20 switch (interrupt) { case PPC_INTERRUPT_MCK: /* Machine check exception */ @@ -2288,14 +2294,14 @@ static void p7_deliver_interrupt(CPUPPCState *env, = int interrupt) assert(!env->resume_as_sreset); break; default: - cpu_abort(cs, "Invalid PowerPC interrupt %d. Aborting\n", interrup= t); + cpu_abort(env_cpu(env), "Invalid PowerPC interrupt %d. Aborting\n", + interrupt); } } =20 static void p8_deliver_interrupt(CPUPPCState *env, int interrupt) { PowerPCCPU *cpu =3D env_archcpu(env); - CPUState *cs =3D env_cpu(env); =20 switch (interrupt) { case PPC_INTERRUPT_MCK: /* Machine check exception */ @@ -2359,7 +2365,8 @@ static void p8_deliver_interrupt(CPUPPCState *env, in= t interrupt) assert(!env->resume_as_sreset); break; default: - cpu_abort(cs, "Invalid PowerPC interrupt %d. Aborting\n", interrup= t); + cpu_abort(env_cpu(env), "Invalid PowerPC interrupt %d. Aborting\n", + interrupt); } } =20 @@ -2438,7 +2445,8 @@ static void p9_deliver_interrupt(CPUPPCState *env, in= t interrupt) assert(!env->resume_as_sreset); break; default: - cpu_abort(cs, "Invalid PowerPC interrupt %d. Aborting\n", interrup= t); + cpu_abort(env_cpu(env), "Invalid PowerPC interrupt %d. Aborting\n", + interrupt); } } #endif @@ -2446,7 +2454,6 @@ static void p9_deliver_interrupt(CPUPPCState *env, in= t interrupt) static void ppc_deliver_interrupt_generic(CPUPPCState *env, int interrupt) { PowerPCCPU *cpu =3D env_archcpu(env); - CPUState *cs =3D env_cpu(env); =20 switch (interrupt) { case PPC_INTERRUPT_RESET: /* External reset */ @@ -2543,7 +2550,8 @@ static void ppc_deliver_interrupt_generic(CPUPPCState= *env, int interrupt) assert(!env->resume_as_sreset); break; default: - cpu_abort(cs, "Invalid PowerPC interrupt %d. Aborting\n", interrup= t); + cpu_abort(env_cpu(env), "Invalid PowerPC interrupt %d. Aborting\n", + interrupt); } } =20 --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263407; cv=none; d=zohomail.com; s=zohoarc; b=gTH3FcMonBLMQEK5DLChhVzGnyQc8yPrWE4pVuPXc2wo3+QooTHS5M0kWMDwHnQfy9wDs6sA7zmoZzg9mKbsxFi168Nk1YXKTuJNenda33YWic1a33CcaP2AfxtCn+lKdqLAcxvcBwWJTroIaNvcAsqwy7D1PDm0IoIj8fw9h/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263407; 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=D3JKe0TJbmxuyIYttlWu8sUSbcX+C6UWX04Pn1Totdg=; b=GfUWldgOAWKOXRiHayqdqvbI2XhGC8lHBPm4Bha14QX4JAYcJcTJ0eV5RZl6JcoKaz7HG+BC4RI3A9UPTugg5ZpvFPQh1baF2gPeZOfySGHiTV2je4sNRkABtouCTxc4/jrHtA2BwbVrPZI3rYpXiHT8szsg9RnrXNcp9z2HxqA= 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 17102634076961023.8534971175046; Tue, 12 Mar 2024 10:10:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5VW-0007sG-E4; Tue, 12 Mar 2024 13:01:44 -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 1rk5U9-0005Yq-W8; Tue, 12 Mar 2024 13:00:18 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0: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 1rk5U6-0008HC-Mk; Tue, 12 Mar 2024 13:00:17 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6e5dddd3b95so28154b3a.1; Tue, 12 Mar 2024 10:00:12 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262811; x=1710867611; 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=D3JKe0TJbmxuyIYttlWu8sUSbcX+C6UWX04Pn1Totdg=; b=YUkF6fRgFuvcprAOxKP7clKp0Wn1IhpLZsveWbqsz8ITNQ4WNtqgeTyL0PqGhlC7Vn htzoCXPqjT5YkIhBFX9og7n+UbU9qU6kSJOhv+1wxLRp6awTfejYdIp8wvQp1Mdd3bG1 thfO52TT/t7bKxq9wPDBxXZILSr4MSRf6y04j+1vU4CxPfS6CSMjEw8ECJdAp57+jVO4 BXA4xfRXn9xEFgjHjd4xkh0bKxjWBGFBeGItmU7UIW/bbfTm7Ge+t4cAl2An3TBJaPki bsxFcjcvddWS4RrjDSFtRUrU7nL8I40Xxqu/ZoXqq9Y1dHTSafPrLE0n9seDkhSNr9KE Fdug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262811; x=1710867611; 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=D3JKe0TJbmxuyIYttlWu8sUSbcX+C6UWX04Pn1Totdg=; b=FVmq2TjolZ5WVhnqXWUHv4vQNDfzAoLcyhrAVFlpMf0Q+50bX1+ePRxWJCP+z6XlGu Z2UHcSl+/1p1kXwQde+i1x2V+ZUq2Sscv+i/V3mUPBZgrVp2pdtEfV/U6eU2H6QnkdwS ZxT2XPXMNXKPIwYXMq6VfedCTh2NK28pCGR24EFIm8CP17OS8HLjiotRFvJLnrY/MYL9 mpgwSuENhGuk5oZq1fDeLXzo2WZJknB0fqXgVCdaz3Da73xQx3kiJ8aXm1ZqD91Ev1J5 EWfbgNloI9KsakAsUpyHuAamQ6cNLpHSZsamFIgkSx0K5MDzATS7OTFKESP0L/qP7cfk JReg== X-Forwarded-Encrypted: i=1; AJvYcCUXRcBGBNK9R30H0YL8MlvJcEqr4+P7F5Co3Ux7dRm67SY7O01yHfL5AesjplhxvuN/S7umVLAxleW4bGefAZDCkUgL X-Gm-Message-State: AOJu0YwVEN3sT73yn99fX+WbSw+CXM5kfhuFFZ2l6HdZGacCtK97C0UQ TCCP7RC1d4rs+fUTZGzzZryAx1O8hW70S0X/Wr+BQxjnNPA1XZdeS7bV4NiXozg= X-Google-Smtp-Source: AGHT+IEskltlhsoxre2zLCNOSsty/tDCmNGkmRYkwQWp2Co+ZSeQm8B2eJeRIa9THswOKBTAgdSGlQ== X-Received: by 2002:a05:6a00:a0c:b0:6e6:75d8:3d19 with SMTP id p12-20020a056a000a0c00b006e675d83d19mr30954pfh.8.1710262811212; Tue, 12 Mar 2024 10:00:11 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan Subject: [PULL 19/38] target/ppc: Readability improvements in exception handlers Date: Wed, 13 Mar 2024 02:58:30 +1000 Message-ID: <20240312165851.2240242-20-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42a; envelope-from=npiggin@gmail.com; helo=mail-pf1-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, 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: 1710263409884100003 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Improve readability by shortening some long comments, removing comments that state the obvious and dropping some empty lines so they don't distract when reading the code. Acked-by: Nicholas Piggin Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/cpu.h | 1 + target/ppc/excp_helper.c | 179 +++++++-------------------------------- 2 files changed, 33 insertions(+), 147 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index ed04351f27..7c48b2eadb 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2954,6 +2954,7 @@ static inline bool ppc_has_spr(PowerPCCPU *cpu, int s= pr) } =20 #if !defined(CONFIG_USER_ONLY) +/* Sort out endianness of interrupt. Depends on the CPU, HV mode, etc. */ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv) { PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 56a5fe7f3b..c15cd904d1 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -403,9 +403,8 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu, tar= get_ulong vector, * We don't use hreg_store_msr here as already have treated any * special case that could occur. Just store MSR and update hflags * - * Note: We *MUST* not use hreg_store_msr() as-is anyway because it - * will prevent setting of the HV bit which some exceptions might need - * to do. + * Note: We *MUST* not use hreg_store_msr() as-is anyway because it wi= ll + * prevent setting of the HV bit which some exceptions might need to d= o. */ env->nip =3D vector; env->msr =3D msr; @@ -447,25 +446,15 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int exc= p) { CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; - int srr0, srr1; + int srr0 =3D SPR_SRR0, srr1 =3D SPR_SRR1; =20 /* new srr1 value excluding must-be-zero bits */ msr =3D env->msr & ~0x783f0000ULL; =20 - /* - * new interrupt handler msr preserves existing ME unless - * explicitly overridden. - */ + /* new interrupt handler msr preserves ME unless explicitly overridden= */ new_msr =3D env->msr & (((target_ulong)1 << MSR_ME)); =20 - /* target registers */ - srr0 =3D SPR_SRR0; - srr1 =3D SPR_SRR1; - - /* - * Hypervisor emulation assistance interrupt only exists on server - * arch 2.05 server or later. - */ + /* HV emu assistance interrupt only exists on server arch 2.05 or late= r */ if (excp =3D=3D POWERPC_EXCP_HV_EMU) { excp =3D POWERPC_EXCP_PROGRAM; } @@ -475,7 +464,6 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) cpu_abort(env_cpu(env), "Raised an exception without defined vector %d\n", excp); } - vector |=3D env->excp_prefix; =20 switch (excp) { @@ -487,7 +475,6 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) powerpc_mcheck_checkstop(env); /* machine check exceptions don't have ME set */ new_msr &=3D ~((target_ulong)1 << MSR_ME); - srr0 =3D SPR_40x_SRR2; srr1 =3D SPR_40x_SRR3; break; @@ -558,12 +545,8 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp) break; } =20 - /* Save PC */ env->spr[srr0] =3D env->nip; - - /* Save MSR */ env->spr[srr1] =3D msr; - powerpc_set_excp_state(cpu, vector, new_msr); } =20 @@ -575,16 +558,10 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int exc= p) /* new srr1 value excluding must-be-zero bits */ msr =3D env->msr & ~0x783f0000ULL; =20 - /* - * new interrupt handler msr preserves existing ME unless - * explicitly overridden - */ + /* new interrupt handler msr preserves ME unless explicitly overridden= */ new_msr =3D env->msr & ((target_ulong)1 << MSR_ME); =20 - /* - * Hypervisor emulation assistance interrupt only exists on server - * arch 2.05 server or later. - */ + /* HV emu assistance interrupt only exists on server arch 2.05 or late= r */ if (excp =3D=3D POWERPC_EXCP_HV_EMU) { excp =3D POWERPC_EXCP_PROGRAM; } @@ -594,7 +571,6 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) cpu_abort(env_cpu(env), "Raised an exception without defined vector %d\n", excp); } - vector |=3D env->excp_prefix; =20 switch (excp) { @@ -604,7 +580,6 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) powerpc_mcheck_checkstop(env); /* machine check exceptions don't have ME set */ new_msr &=3D ~((target_ulong)1 << MSR_ME); - break; case POWERPC_EXCP_DSI: /* Data storage exception = */ trace_ppc_excp_dsi(env->spr[SPR_DSISR], env->spr[SPR_DAR]); @@ -632,11 +607,9 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) powerpc_reset_excp_state(cpu); return; } - /* - * FP exceptions always have NIP pointing to the faulting - * instruction, so always use store_next and claim we are - * precise in the MSR. + * NIP always points to the faulting instruction for FP except= ions, + * so always use store_next and claim we are precise in the MS= R. */ msr |=3D 0x00100000; break; @@ -712,20 +685,11 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int exc= p) break; } =20 - /* - * Sort out endianness of interrupt, this differs depending on the - * CPU, the HV mode, etc... - */ if (ppc_interrupts_little_endian(cpu, !!(new_msr & MSR_HVB))) { new_msr |=3D (target_ulong)1 << MSR_LE; } - - /* Save PC */ env->spr[SPR_SRR0] =3D env->nip; - - /* Save MSR */ env->spr[SPR_SRR1] =3D msr; - powerpc_set_excp_state(cpu, vector, new_msr); } =20 @@ -737,16 +701,10 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int exc= p) /* new srr1 value excluding must-be-zero bits */ msr =3D env->msr & ~0x783f0000ULL; =20 - /* - * new interrupt handler msr preserves existing ME unless - * explicitly overridden - */ + /* new interrupt handler msr preserves ME unless explicitly overridden= */ new_msr =3D env->msr & ((target_ulong)1 << MSR_ME); =20 - /* - * Hypervisor emulation assistance interrupt only exists on server - * arch 2.05 server or later. - */ + /* HV emu assistance interrupt only exists on server arch 2.05 or late= r */ if (excp =3D=3D POWERPC_EXCP_HV_EMU) { excp =3D POWERPC_EXCP_PROGRAM; } @@ -756,7 +714,6 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) cpu_abort(env_cpu(env), "Raised an exception without defined vector %d\n", excp); } - vector |=3D env->excp_prefix; =20 switch (excp) { @@ -764,7 +721,6 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) powerpc_mcheck_checkstop(env); /* machine check exceptions don't have ME set */ new_msr &=3D ~((target_ulong)1 << MSR_ME); - break; case POWERPC_EXCP_DSI: /* Data storage exception = */ trace_ppc_excp_dsi(env->spr[SPR_DSISR], env->spr[SPR_DAR]); @@ -792,11 +748,9 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp) powerpc_reset_excp_state(cpu); return; } - /* - * FP exceptions always have NIP pointing to the faulting - * instruction, so always use store_next and claim we are - * precise in the MSR. + * NIP always points to the faulting instruction for FP except= ions, + * so always use store_next and claim we are precise in the MS= R. */ msr |=3D 0x00100000; break; @@ -865,12 +819,10 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int exc= p) case POWERPC_EXCP_DLTLB: /* Data load TLB miss = */ case POWERPC_EXCP_DSTLB: /* Data store TLB miss = */ ppc_excp_debug_sw_tlb(env, excp); - msr |=3D env->crf[0] << 28; msr |=3D env->error_code; /* key, D/I, S/L bits */ /* Set way using a LRU mechanism */ msr |=3D ((env->last_way + 1) & (env->nb_ways - 1)) << 17; - break; case POWERPC_EXCP_IABR: /* Instruction address breakpoint = */ case POWERPC_EXCP_SMI: /* System management interrupt = */ @@ -885,20 +837,11 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int exc= p) break; } =20 - /* - * Sort out endianness of interrupt, this differs depending on the - * CPU, the HV mode, etc... - */ if (ppc_interrupts_little_endian(cpu, !!(new_msr & MSR_HVB))) { new_msr |=3D (target_ulong)1 << MSR_LE; } - - /* Save PC */ env->spr[SPR_SRR0] =3D env->nip; - - /* Save MSR */ env->spr[SPR_SRR1] =3D msr; - powerpc_set_excp_state(cpu, vector, new_msr); } =20 @@ -910,16 +853,10 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int ex= cp) /* new srr1 value excluding must-be-zero bits */ msr =3D env->msr & ~0x783f0000ULL; =20 - /* - * new interrupt handler msr preserves existing ME unless - * explicitly overridden - */ + /* new interrupt handler msr preserves ME unless explicitly overridden= */ new_msr =3D env->msr & ((target_ulong)1 << MSR_ME); =20 - /* - * Hypervisor emulation assistance interrupt only exists on server - * arch 2.05 server or later. - */ + /* HV emu assistance interrupt only exists on server arch 2.05 or late= r */ if (excp =3D=3D POWERPC_EXCP_HV_EMU) { excp =3D POWERPC_EXCP_PROGRAM; } @@ -929,7 +866,6 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp) cpu_abort(env_cpu(env), "Raised an exception without defined vector %d\n", excp); } - vector |=3D env->excp_prefix; =20 switch (excp) { @@ -937,7 +873,6 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp) powerpc_mcheck_checkstop(env); /* machine check exceptions don't have ME set */ new_msr &=3D ~((target_ulong)1 << MSR_ME); - break; case POWERPC_EXCP_DSI: /* Data storage exception = */ trace_ppc_excp_dsi(env->spr[SPR_DSISR], env->spr[SPR_DAR]); @@ -965,11 +900,9 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int exc= p) powerpc_reset_excp_state(cpu); return; } - /* - * FP exceptions always have NIP pointing to the faulting - * instruction, so always use store_next and claim we are - * precise in the MSR. + * NIP always points to the faulting instruction for FP except= ions, + * so always use store_next and claim we are precise in the MS= R. */ msr |=3D 0x00100000; break; @@ -1050,20 +983,11 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int e= xcp) break; } =20 - /* - * Sort out endianness of interrupt, this differs depending on the - * CPU, the HV mode, etc... - */ if (ppc_interrupts_little_endian(cpu, !!(new_msr & MSR_HVB))) { new_msr |=3D (target_ulong)1 << MSR_LE; } - - /* Save PC */ env->spr[SPR_SRR0] =3D env->nip; - - /* Save MSR */ env->spr[SPR_SRR1] =3D msr; - powerpc_set_excp_state(cpu, vector, new_msr); } =20 @@ -1071,24 +995,18 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int = excp) { CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; - int srr0, srr1; - - msr =3D env->msr; + int srr0 =3D SPR_SRR0, srr1 =3D SPR_SRR1; =20 /* - * new interrupt handler msr preserves existing ME unless - * explicitly overridden + * Book E does not play games with certain bits of xSRR1 being MSR save + * bits and others being error status. xSRR1 is the old MSR, period. */ - new_msr =3D env->msr & ((target_ulong)1 << MSR_ME); + msr =3D env->msr; =20 - /* target registers */ - srr0 =3D SPR_SRR0; - srr1 =3D SPR_SRR1; + /* new interrupt handler msr preserves ME unless explicitly overridden= */ + new_msr =3D env->msr & ((target_ulong)1 << MSR_ME); =20 - /* - * Hypervisor emulation assistance interrupt only exists on server - * arch 2.05 server or later. - */ + /* HV emu assistance interrupt only exists on server arch 2.05 or late= r */ if (excp =3D=3D POWERPC_EXCP_HV_EMU) { excp =3D POWERPC_EXCP_PROGRAM; } @@ -1108,7 +1026,6 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int e= xcp) cpu_abort(env_cpu(env), "Raised an exception without defined vector %d\n", excp); } - vector |=3D env->excp_prefix; =20 switch (excp) { @@ -1152,11 +1069,9 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int = excp) powerpc_reset_excp_state(cpu); return; } - /* - * FP exceptions always have NIP pointing to the faulting - * instruction, so always use store_next and claim we are - * precise in the MSR. + * NIP always points to the faulting instruction for FP except= ions, + * so always use store_next and claim we are precise in the MS= R. */ msr |=3D 0x00100000; env->spr[SPR_BOOKE_ESR] =3D ESR_FP; @@ -1257,12 +1172,8 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int = excp) } #endif =20 - /* Save PC */ env->spr[srr0] =3D env->nip; - - /* Save MSR */ env->spr[srr1] =3D msr; - powerpc_set_excp_state(cpu, vector, new_msr); } =20 @@ -1384,21 +1295,17 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int= excp) { CPUPPCState *env =3D &cpu->env; target_ulong msr, new_msr, vector; - int srr0, srr1, lev =3D -1; + int srr0 =3D SPR_SRR0, srr1 =3D SPR_SRR1, lev =3D -1; =20 /* new srr1 value excluding must-be-zero bits */ msr =3D env->msr & ~0x783f0000ULL; =20 /* - * new interrupt handler msr preserves existing HV and ME unless - * explicitly overridden + * new interrupt handler msr preserves HV and ME unless explicitly + * overridden */ new_msr =3D env->msr & (((target_ulong)1 << MSR_ME) | MSR_HVB); =20 - /* target registers */ - srr0 =3D SPR_SRR0; - srr1 =3D SPR_SRR1; - /* * check for special resume at 0x100 from doze/nap/sleep/winkle on * P7/P8/P9 @@ -1423,7 +1330,6 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int e= xcp) cpu_abort(env_cpu(env), "Raised an exception without defined vector %d\n", excp); } - vector |=3D env->excp_prefix; =20 if (is_prefix_insn_excp(cpu, excp)) { @@ -1440,7 +1346,6 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int e= xcp) */ new_msr |=3D (target_ulong)MSR_HVB; } - /* machine check exceptions don't have ME set */ new_msr &=3D ~((target_ulong)1 << MSR_ME); =20 @@ -1458,23 +1363,17 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int= excp) { bool lpes0; =20 - /* - * LPES0 is only taken into consideration if we support HV - * mode for this CPU. - */ + /* LPES0 is only taken into consideration if we support HV mode */ if (!env->has_hv_mode) { break; } - lpes0 =3D !!(env->spr[SPR_LPCR] & LPCR_LPES0); - if (!lpes0) { new_msr |=3D (target_ulong)MSR_HVB; new_msr |=3D env->msr & ((target_ulong)1 << MSR_RI); srr0 =3D SPR_HSRR0; srr1 =3D SPR_HSRR1; } - break; } case POWERPC_EXCP_ALIGN: /* Alignment exception = */ @@ -1497,11 +1396,9 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int = excp) powerpc_reset_excp_state(cpu); return; } - /* - * FP exceptions always have NIP pointing to the faulting - * instruction, so always use store_next and claim we are - * precise in the MSR. + * NIP always points to the faulting instruction for FP except= ions, + * so always use store_next and claim we are precise in the MS= R. */ msr |=3D 0x00100000; break; @@ -1665,21 +1562,13 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int= excp) break; } =20 - /* - * Sort out endianness of interrupt, this differs depending on the - * CPU, the HV mode, etc... - */ if (ppc_interrupts_little_endian(cpu, !!(new_msr & MSR_HVB))) { new_msr |=3D (target_ulong)1 << MSR_LE; } - new_msr |=3D (target_ulong)1 << MSR_SF; =20 if (excp !=3D POWERPC_EXCP_SYSCALL_VECTORED) { - /* Save PC */ env->spr[srr0] =3D env->nip; - - /* Save MSR */ env->spr[srr1] =3D msr; } =20 @@ -1688,19 +1577,15 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int= excp) PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); /* Deliver interrupt to L1 by returning from the H_ENTER_NESTED ca= ll */ vhc->deliver_hv_excp(cpu, excp); - powerpc_reset_excp_state(cpu); - } else { /* Sanity check */ if (!(env->msr_mask & MSR_HVB) && srr0 =3D=3D SPR_HSRR0) { cpu_abort(env_cpu(env), "Trying to deliver HV exception (HSRR)= %d " "with no HV support\n", excp); } - /* This can update new_msr and vector if AIL applies */ ppc_excp_apply_ail(cpu, excp, msr, &new_msr, &vector); - powerpc_set_excp_state(cpu, vector, new_msr); } } --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263361; cv=none; d=zohomail.com; s=zohoarc; b=CoMLwkznUdxjfgscWQwtmsoBcHM88djxAVCX0jzalqhpzDqFshfvZVaHvOSepcRUpM0a1hrJ/aiZqR6rzlWaKs6u2dsi65OoZSlJyMcxKp2AzkeF8LAv+okuaxh3mQpOtBx0Pn/CGXNxvJxk2SnMPqkR5AMnS1WdBFVUu7hsgh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263361; 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=MVnACJjCRHkL5fGbYyOvVToKgvTOItd5ebsk72DNyJw=; b=aZdltsqMQkT4nRNc9jf+Z3UZiGgughPHwEd+cIDRCxbS3N14iQk6TqTQEuG+k34t2dpyTMPDBUxNZkdaRdvbx5mPiQgtVh67YQTLtIuK2TH8MJ8uCADD5c5AHdCk3xZIVYytaQI4/DstC6aa7zB3+8XTrXlwkcgdUXoMjEk/1/g= 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 1710263361974766.6523630733087; Tue, 12 Mar 2024 10:09:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WR-0000oK-9E; Tue, 12 Mar 2024 13:02:39 -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 1rk5UB-0005dn-Kn; Tue, 12 Mar 2024 13:00:19 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UA-0008Im-05; Tue, 12 Mar 2024 13:00:19 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e6a6d486d6so20497b3a.1; Tue, 12 Mar 2024 10:00:16 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262815; x=1710867615; 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=MVnACJjCRHkL5fGbYyOvVToKgvTOItd5ebsk72DNyJw=; b=aHir01ygjt6ycDGebkiouKscHOWAZAW/zxM9+7s2j7C+FQZM/KSFVAcSuxnw9LovSH 92cZRIRFLC+59xWwZdHWwGPEqkkW526ohb5XSodU/Q/GIfUmDIKrLRqWwEyMQGaSSE3J XJis1A6/SP6QUHj9uYkGqj7AIxt50P1myyupeMSV0D3lyW3PY6dum4MElYUub+RruyCy Ngsiq8OFDkmUcp4V3lAJn/WAzwOd6Gspa5S2p6wyiuEN9XNYPDCtof7uz1JHxMSo6VTj OaK8J6uKR8fToY2jiCH0eOK7pcEs4zMkMJrk5jjtxVd0eRthHCejcsJBrcJIa++zpUJv SnQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262815; x=1710867615; 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=MVnACJjCRHkL5fGbYyOvVToKgvTOItd5ebsk72DNyJw=; b=nwbkhvLqeEKVu5hHkfnMlKgLOVCxsvVbG4tTlO6Vgfs3R5SJx++Sa+7WEOEqHngcCi 1I7aD4Jf8ntyRyLvKbFSmQJalkpmovuM/bVw6tms/t/hGFDRUrp+hPZwWAJu34G/C/Lg EZcw7rhQiNW9OMRNj2vWdahAE9VlclLZi5EuNg7bf/A78ThrzGDny2yPFeUfPBWwjnNk NdscNkI+ULJmLZPcJvjaYgu2Eu5Bua+giHr6ZNGJFCR/HI9rR80/vEGRkiygkKBeAXd9 yLS4p9A9Yq4VET7m23h/0xs5IOareRVtYz3MoR7BjO/hnZp+bLsUKNt4P6PiRy2Ip63u jlBA== X-Forwarded-Encrypted: i=1; AJvYcCVC8QniCW0LZN9CQR6TlQNfzf232/PdKLqtsjE9reyqO3Lj4tloKfLk5WTLy/hAGTt61CXXn4AKnmtfNmJ9oEunBLbB X-Gm-Message-State: AOJu0Yx3OwSWYzJWphevAwDNgsBd6yR8mwuyYJqkh15FByeTmqDOkkMp 6nj/oUKbxBez4oms4kk5Xkd1E/mOkS5ps4z/731TaaP5EX7TzZozB0k3WufJFuc= X-Google-Smtp-Source: AGHT+IFw/3ol6LlkhBy0/BVHrEW/tGMUp0I+6GhEnueXhHcUM4yn8kJ9cpOGtiVzhdVTdYXoM6GhbQ== X-Received: by 2002:a05:6a21:a598:b0:1a3:124d:3e8b with SMTP id gd24-20020a056a21a59800b001a3124d3e8bmr204944pzc.16.1710262814800; Tue, 12 Mar 2024 10:00:14 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan Subject: [PULL 20/38] target/ppc: Add gen_exception_err_nip() function Date: Wed, 13 Mar 2024 02:58:31 +1000 Message-ID: <20240312165851.2240242-21-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::434; envelope-from=npiggin@gmail.com; helo=mail-pf1-x434.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: 1710263363654100003 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Add gen_exception_err_nip() that does the same as gen_exception_err() but takes the nip as a parameter to allow specifying it instead of using the current instruction address then change gen_exception_err() to use it. The gen_exception() and gen_exception_nip() functions are similar so remove code duplication from those too while at it. Suggested-by: Nicholas Piggin Reviewed-by: Nicholas Piggin Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/translate.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4f6f7dcd89..93ffec787c 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -296,33 +296,26 @@ static inline void gen_update_nip(DisasContext *ctx, = target_ulong nip) tcg_gen_movi_tl(cpu_nip, nip); } =20 -static void gen_exception_err(DisasContext *ctx, uint32_t excp, uint32_t e= rror) +static void gen_exception_err_nip(DisasContext *ctx, uint32_t excp, + uint32_t error, target_ulong nip) { TCGv_i32 t0, t1; =20 - /* - * These are all synchronous exceptions, we set the PC back to the - * faulting instruction - */ - gen_update_nip(ctx, ctx->cia); + gen_update_nip(ctx, nip); t0 =3D tcg_constant_i32(excp); t1 =3D tcg_constant_i32(error); gen_helper_raise_exception_err(tcg_env, t0, t1); ctx->base.is_jmp =3D DISAS_NORETURN; } =20 -static void gen_exception(DisasContext *ctx, uint32_t excp) +static inline void gen_exception_err(DisasContext *ctx, uint32_t excp, + uint32_t error) { - TCGv_i32 t0; - /* * These are all synchronous exceptions, we set the PC back to the * faulting instruction */ - gen_update_nip(ctx, ctx->cia); - t0 =3D tcg_constant_i32(excp); - gen_helper_raise_exception(tcg_env, t0); - ctx->base.is_jmp =3D DISAS_NORETURN; + gen_exception_err_nip(ctx, excp, error, ctx->cia); } =20 static void gen_exception_nip(DisasContext *ctx, uint32_t excp, @@ -336,6 +329,15 @@ static void gen_exception_nip(DisasContext *ctx, uint3= 2_t excp, ctx->base.is_jmp =3D DISAS_NORETURN; } =20 +static inline void gen_exception(DisasContext *ctx, uint32_t excp) +{ + /* + * These are all synchronous exceptions, we set the PC back to the + * faulting instruction + */ + gen_exception_nip(ctx, excp, ctx->cia); +} + #if !defined(CONFIG_USER_ONLY) static void gen_ppc_maybe_interrupt(DisasContext *ctx) { --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263377; cv=none; d=zohomail.com; s=zohoarc; b=Hdruh45jzlndms20BaesgrrjbhE+SX7d/EVmBUzR5QPomzOalQ/JBfgVhy6+djQ7Xz1kgwob2E8YFZQH2+/QQrZ/H0VWln9wwhjTjCDvuO4vC9rbLsq6Z9+LasflDbPw89oOaZt5C6U8URU5DXk3/hDF9IHjJxZ8KunlSDaG0O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263377; 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=2+eCNzO1amSLOFV/LcUWxHyVkIEDf7pPlXvdB+h7ATA=; b=fDUsJx4FK3jgHOJ1GEoutQzAqjcgGeDqHbCz1mJ3C8ryI0KulJmFR9ea2H0b9cRBBRh1UXh+9tb8QvAfSORupdtktbi3rbSaDRW+yYl7y1Tr7DFvLZnMRSXT6WEb0dBxSlIS42sErQ8WIWjR7OYBuySsUBGSbJSbWIY0jNf76Ms= 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 171026337775082.2715270673583; Tue, 12 Mar 2024 10:09:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WR-0000tG-Sf; Tue, 12 Mar 2024 13:02:40 -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 1rk5UI-0005z5-La; Tue, 12 Mar 2024 13:00:35 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UE-0008Jo-9X; Tue, 12 Mar 2024 13:00:25 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6da202aa138so3772515b3a.2; Tue, 12 Mar 2024 10:00:19 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262818; x=1710867618; 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=2+eCNzO1amSLOFV/LcUWxHyVkIEDf7pPlXvdB+h7ATA=; b=VXSVk4fd9UOGi3/+uVG0W+ZMvMfoj9o8mv3Z15sWXcTi8Kjqoiwa0DKQiNgI0yuwv7 6T/VuV3crMo6pXyMu6RR0tA5rUO257uXsJJIh/PyOOexylp9rKPbNFEjVOVmFq+Vp1sD kIFLtJbvAvCp+c9N342uxLzDTkgCGHsKwLBCucZC6WK1oKIirAEkFVFGn6jA6x2gF+Ld xRmtdmC07R0k2NH5wctykEe+ucAqt3PNcNQgxUNEBowTEQRQbL7EEv2TzLkNETY2zlcP R/OliUGSNP3jygWuMyLjp0HRJEAkxOwhVmVMDvAEmEiVi3O6ixLPPI1/6xb4z9+PNlg6 3g6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262818; x=1710867618; 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=2+eCNzO1amSLOFV/LcUWxHyVkIEDf7pPlXvdB+h7ATA=; b=Z1dIODyNaUD9E+YzW+IYUPpmvxsOLh+dtuNEvFmbCfzqF3BnFLQL9aUbR9OG633Dhw 0DNcOXi0kcrCbku76afGLpahc2pmWYFgUFCUgm3daGhiwgTHWCwduLl+pbsRPKfnlyZq rQakShc8txRagbeG7zrG4Fo4fdkOS6cpPqQZsfeNxBKoM85tNgbVWlEp4VBeQ1rg/sYY ySe1VNrCOm5jKG8wz+brnlH3hkBmnzsMzF4BIBAgxF0qC5Bxm3jHxIYGoWQjYMx6BPEs PBa56HdfTLlgf43yq297CvTjd0l8wgNVohcoeJ0kwYmNuRKfMMwWyJ1HFyLU0F3jmpiw +epg== X-Forwarded-Encrypted: i=1; AJvYcCX5jl/JuZG/BZ7JBau23XXOab04oiOsWYAuItpNr+7TlYQj6BS7PtIByMCbGmRzPEpg2z9Bg0pk1/E0LGFf0Nlo7yzh X-Gm-Message-State: AOJu0YwRJWI5iwWemXE4dVIDMoaqfecXYZFfquRGmpvm3lNyraVasTYB s/yfPXN3tBVFoIULRBpt9Zx6OlIpqg5fhF8OGsSx8VpLCBW+USVyQOKeZMcFl+U= X-Google-Smtp-Source: AGHT+IHPAe3WTc+GxK8j8VsbTE6Jqp3/jnepXwMw+D77EI5v8fTRdzGRb0+tAF4alzy2Nbggyu8Oow== X-Received: by 2002:a05:6a00:21d0:b0:6e6:9dfb:7eff with SMTP id t16-20020a056a0021d000b006e69dfb7effmr33788pfj.20.1710262818478; Tue, 12 Mar 2024 10:00:18 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan Subject: [PULL 21/38] target/ppc: Clean up ifdefs in excp_helper.c, part 1 Date: Wed, 13 Mar 2024 02:58:32 +1000 Message-ID: <20240312165851.2240242-22-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42f; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42f.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: 1710263379698100007 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Use #ifdef, #ifndef for brevity and add comments to #endif that are more than a few lines apart for clarity. Reviewed-by: Harsh Prateek Bora Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/excp_helper.c | 49 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index c15cd904d1..32337c67f4 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -35,7 +35,7 @@ =20 /*************************************************************************= ****/ /* Exception processing */ -#if !defined(CONFIG_USER_ONLY) +#ifndef CONFIG_USER_ONLY =20 static const char *powerpc_excp_name(int excp) { @@ -186,7 +186,7 @@ static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int= excp) env->error_code); } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 static int powerpc_reset_wakeup(CPUPPCState *env, int excp, target_ulong *= msr) { /* We no longer are in a PM state */ @@ -380,7 +380,7 @@ static void ppc_excp_apply_ail(PowerPCCPU *cpu, int exc= p, target_ulong msr, } } } -#endif +#endif /* TARGET_PPC64 */ =20 static void powerpc_reset_excp_state(PowerPCCPU *cpu) { @@ -1163,7 +1163,7 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int e= xcp) break; } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 if (env->spr[SPR_BOOKE_EPCR] & EPCR_ICM) { /* Cat.64-bit: EPCR.ICM is copied to MSR.CM */ new_msr |=3D (target_ulong)1 << MSR_CM; @@ -1594,7 +1594,7 @@ static inline void powerpc_excp_books(PowerPCCPU *cpu= , int excp) { g_assert_not_reached(); } -#endif +#endif /* TARGET_PPC64 */ =20 static void powerpc_excp(PowerPCCPU *cpu, int excp) { @@ -1645,7 +1645,7 @@ void ppc_cpu_do_interrupt(CPUState *cs) powerpc_excp(cpu, cs->exception_index); } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 #define P7_UNUSED_INTERRUPTS \ (PPC_INTERRUPT_RESET | PPC_INTERRUPT_HVIRT | PPC_INTERRUPT_CEXT | = \ PPC_INTERRUPT_WDT | PPC_INTERRUPT_CDOORBELL | PPC_INTERRUPT_FIT | = \ @@ -1976,7 +1976,7 @@ static int p9_next_unmasked_interrupt(CPUPPCState *en= v) =20 return 0; } -#endif +#endif /* TARGET_PPC64 */ =20 static int ppc_next_unmasked_interrupt_generic(CPUPPCState *env) { @@ -2093,7 +2093,7 @@ static int ppc_next_unmasked_interrupt_generic(CPUPPC= State *env) static int ppc_next_unmasked_interrupt(CPUPPCState *env) { switch (env->excp_model) { -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 case POWERPC_EXCP_POWER7: return p7_next_unmasked_interrupt(env); case POWERPC_EXCP_POWER8: @@ -2132,7 +2132,7 @@ void ppc_maybe_interrupt(CPUPPCState *env) } } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 static void p7_deliver_interrupt(CPUPPCState *env, int interrupt) { PowerPCCPU *cpu =3D env_archcpu(env); @@ -2334,7 +2334,7 @@ static void p9_deliver_interrupt(CPUPPCState *env, in= t interrupt) interrupt); } } -#endif +#endif /* TARGET_PPC64 */ =20 static void ppc_deliver_interrupt_generic(CPUPPCState *env, int interrupt) { @@ -2443,7 +2443,7 @@ static void ppc_deliver_interrupt_generic(CPUPPCState= *env, int interrupt) static void ppc_deliver_interrupt(CPUPPCState *env, int interrupt) { switch (env->excp_model) { -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 case POWERPC_EXCP_POWER7: p7_deliver_interrupt(env, interrupt); break; @@ -2553,9 +2553,9 @@ void helper_raise_exception(CPUPPCState *env, uint32_= t exception) { raise_exception_err_ra(env, exception, 0, 0); } -#endif +#endif /* CONFIG_TCG */ =20 -#if !defined(CONFIG_USER_ONLY) +#ifndef CONFIG_USER_ONLY #ifdef CONFIG_TCG void helper_store_msr(CPUPPCState *env, target_ulong val) { @@ -2572,7 +2572,7 @@ void helper_ppc_maybe_interrupt(CPUPPCState *env) ppc_maybe_interrupt(env); } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 void helper_scv(CPUPPCState *env, uint32_t lev) { if (env->spr[SPR_FSCR] & (1ull << FSCR_SCV)) { @@ -2600,7 +2600,7 @@ void helper_pminsn(CPUPPCState *env, uint32_t insn) =20 ppc_maybe_interrupt(env); } -#endif /* defined(TARGET_PPC64) */ +#endif /* TARGET_PPC64 */ =20 static void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr) { @@ -2611,7 +2611,7 @@ static void do_rfi(CPUPPCState *env, target_ulong nip= , target_ulong msr) if (env->flags & POWERPC_FLAG_TGPR) msr &=3D ~(1ULL << MSR_TGPR); =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 /* Switching to 32-bit ? Crop the nip */ if (!msr_is_64bit(env, msr)) { nip =3D (uint32_t)nip; @@ -2640,7 +2640,7 @@ void helper_rfi(CPUPPCState *env) do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffffffful); } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 void helper_rfid(CPUPPCState *env) { /* @@ -2661,7 +2661,7 @@ void helper_hrfid(CPUPPCState *env) { do_rfi(env, env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]); } -#endif +#endif /* TARGET_PPC64 */ =20 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) void helper_rfebb(CPUPPCState *env, target_ulong s) @@ -2738,7 +2738,7 @@ void raise_ebb_perfm_exception(CPUPPCState *env) =20 do_ebb(env, POWERPC_EXCP_PERFM_EBB); } -#endif +#endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */ =20 /*************************************************************************= ****/ /* Embedded PowerPC specific helpers */ @@ -2780,7 +2780,7 @@ void helper_tw(CPUPPCState *env, target_ulong arg1, t= arget_ulong arg2, } } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 void helper_td(CPUPPCState *env, target_ulong arg1, target_ulong arg2, uint32_t flags) { @@ -2793,8 +2793,8 @@ void helper_td(CPUPPCState *env, target_ulong arg1, t= arget_ulong arg2, POWERPC_EXCP_TRAP, GETPC()); } } -#endif -#endif +#endif /* TARGET_PPC64 */ +#endif /* CONFIG_TCG */ =20 #ifdef CONFIG_TCG static uint32_t helper_SIMON_LIKE_32_64(uint32_t x, uint64_t key, uint32_t= lane) @@ -2909,8 +2909,7 @@ HELPER_HASH(HASHSTP, env->spr[SPR_HASHPKEYR], true, P= HIE) HELPER_HASH(HASHCHKP, env->spr[SPR_HASHPKEYR], false, PHIE) #endif /* CONFIG_TCG */ =20 -#if !defined(CONFIG_USER_ONLY) - +#ifndef CONFIG_USER_ONLY #ifdef CONFIG_TCG =20 /* Embedded.Processor Control */ @@ -3019,7 +3018,7 @@ void helper_book3s_msgsnd(target_ulong rb) book3s_msgsnd_common(pir, PPC_INTERRUPT_HDOORBELL); } =20 -#if defined(TARGET_PPC64) +#ifdef TARGET_PPC64 void helper_book3s_msgclrp(CPUPPCState *env, target_ulong rb) { helper_hfscr_facility_check(env, HFSCR_MSGP, "msgclrp", HFSCR_IC_MSGP); --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263120; cv=none; d=zohomail.com; s=zohoarc; b=BLX4If1k46lwYhqN4r5Dm046oZCK93/PC7LRZ163SAdAJq6M2gPDigEdXTxWEfpFJJWwV/rbgCSSsJOYWfDp+p6ScMCq8rgPxIlvZ/SkrHN1Lu0rJDtQ44pD+onwA0aZnTPKm9yNQHqrZ4DjGDLxKxT+dqHWp5jH3byMXgEdFP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263120; 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=hbfazfNwbDHEXhZ5H+0LiE5ZtDTwt7WkBcJyAQIfKdU=; b=X3+7lNl/dDs9diwda6cDj8qLM3scsjPCv1PxPFoNHNMH3nPcYAxAx+pwHpwrBgxf2lTGTd0xBKSZXeJH0RBq2k/UAbxjtA/vYnLlGYytpy6gNVqv3JFLgSDFJupGvaBcMDdOi3F9m5LO23E1kooKnrtE1FWkXrF7ZGMm+JNhskI= 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 1710263120223566.9769299589425; Tue, 12 Mar 2024 10:05:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WT-000176-Bl; Tue, 12 Mar 2024 13:02:41 -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 1rk5UM-0006Ao-Kv; Tue, 12 Mar 2024 13:00:37 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UG-0008KN-Jy; Tue, 12 Mar 2024 13:00:27 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e5a232fe80so40978b3a.0; Tue, 12 Mar 2024 10:00:23 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262822; x=1710867622; 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=hbfazfNwbDHEXhZ5H+0LiE5ZtDTwt7WkBcJyAQIfKdU=; b=g3gPa5YQMrrcpCwt1up/RJtG7Q8/a8ZI7Z2WCsBTF+BnxEmVXtQBR/HQ7AJ0KGqexT JneEhVIwfSvJBc075cJKhESMvowYKiFMyCsLw2uW9CtwI2y9Lip6B1KSDj6u7Bz6OEbW fkoHMQijSwU3HMrOaXLQ5Abv6M86r5SdcD7/xxpgcGNtkQ/mRPPF1k0ntIyLbjAU/91I fdq1dGYj0wBMSjd1VWdb/9MdXjhNY2CjCbrzdP5B36D9Hcz0QeqyFfNlKIHGtGON100X xLHQZfGbb2lHWgmZFkNj/ms8SOQa01iRw3dtyilu2AFyz86780LOjiyUq/mfePIdHM6A blpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262822; x=1710867622; 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=hbfazfNwbDHEXhZ5H+0LiE5ZtDTwt7WkBcJyAQIfKdU=; b=HyPU9DXLoXlPhHr2oueTKVs5GO3XlvNHWNiaTEKEWTkNCJI77RYBa/hsF/tiPQpqPp nGI0OdD4njVml9gUboxLV+GPpwEZ/xfGoJjwnTDc0b083hIVYXRT3/xS4h5kArP6JsG+ L35DyaDT/VMoiS68eK2+dKpE2f4LEZUo98otpFEw5OJXlZOJFQBWQHlgtVQ2Uz0JL8ls RH08zGqhpe/H1y1zZlxpcCx2mWEMoFzKMy9lwcpM5UY0oDHRCRnbVg2LuoTsUP7CAhHn S4Ufkfd9tRgOJ9dNa3f9V/nhJRz3OVkePNFLDZhpPo2k8mN4KYIUl4Lu4Cqpx8IllTJk EWig== X-Forwarded-Encrypted: i=1; AJvYcCV1uzh0penhAIn8BblChhX0d9JpQFlf0fFZEFc9bS98ljNncCpyVXZqLRVUCS79nvta7gwJ5T8HPX1mbZ3JVfRgCqxq X-Gm-Message-State: AOJu0YxXMYI1kdTQnXgJQjr06yJzL8sAgVuEEaOdyfqFcTFucYNT9gMu PQ4HIQ5Cpeu7Yv4718aTlsawWljoHM+JZ4C2IimgWuJ+kkU8mQRwSipHHm1uwhI= X-Google-Smtp-Source: AGHT+IGKbyYj8FLg4m1RHuT++vxFUdBP5WtHa0aGbG5KqECWMghkOWlTPS9TFIDouU1SpFjH8zHETw== X-Received: by 2002:a05:6a00:1908:b0:6e6:30ef:b7e9 with SMTP id y8-20020a056a00190800b006e630efb7e9mr8383pfi.16.1710262822215; Tue, 12 Mar 2024 10:00:22 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan Subject: [PULL 22/38] target/ppc: Clean up ifdefs in excp_helper.c, part 2 Date: Wed, 13 Mar 2024 02:58:33 +1000 Message-ID: <20240312165851.2240242-23-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42e; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42e.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: 1710263120553100001 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Remove check for !defined(CONFIG_USER_ONLY) as this is already within an #ifndef CONFIG_USER_ONLY block. Reviewed-by: Harsh Prateek Bora Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/excp_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 32337c67f4..148b0c3a19 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2663,7 +2663,7 @@ void helper_hrfid(CPUPPCState *env) } #endif /* TARGET_PPC64 */ =20 -#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) +#ifdef TARGET_PPC64 void helper_rfebb(CPUPPCState *env, target_ulong s) { target_ulong msr =3D env->msr; @@ -2738,7 +2738,7 @@ void raise_ebb_perfm_exception(CPUPPCState *env) =20 do_ebb(env, POWERPC_EXCP_PERFM_EBB); } -#endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */ +#endif /* TARGET_PPC64 */ =20 /*************************************************************************= ****/ /* Embedded PowerPC specific helpers */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263057; cv=none; d=zohomail.com; s=zohoarc; b=iAH0pX4kZy9Aswr8oZdAROM4Bfjd/MnpHVnhk9EbFDDxAv8qccOInMmzGa1hOT5TFBkbUFWlDbZaiG8drksT5nK7X+/POjq1OduxX+rrjyvRqRPnR+FClVBi8Btvzdjh8IAPF3HTeCrxsxEIFulSoVwtlMGqY1PjP0O5zMepA5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263057; 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=SwlNJSycCuQXF9GnhGarIkq0/MrxOBJJLSGiFZLu6m4=; b=Mr8scMsH1rheK27zWTfSiGnQsoM176sLNg9atyeb7cUa7KAa/mdrEW80gGg/1iWKtz0w9TBTth9B5/NyY0XXxubO4/Q9gjWQmIcN17bfIdzzRGaHCTFytFSg+qhM1Q/tHgqSW5ALIzt6uUmwtcStUrO36L2dj8pawtZkzwsdmIU= 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 1710263057224384.67244967895897; Tue, 12 Mar 2024 10:04:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WX-0001NC-QB; Tue, 12 Mar 2024 13:02:45 -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 1rk5UQ-0006BS-8C; Tue, 12 Mar 2024 13:00:37 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UM-0008Km-49; Tue, 12 Mar 2024 13:00:32 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e62c65865cso4815347b3a.2; Tue, 12 Mar 2024 10:00:27 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262826; x=1710867626; 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=SwlNJSycCuQXF9GnhGarIkq0/MrxOBJJLSGiFZLu6m4=; b=bIsPOcmLDhu/FOTYFwzsJOc5q7qoUo0Y+BXwEN7OuIyPqDbm+mjeJq7Bcp2SKnBmus QBAEb5R/xjoIqAXRm62kbcYFqPuMrikXsiON/AB72dzm08I11NGuicL9ctIGiPy5hfFr n7dzMTlN9heiASLbdt0lOhco3hNfHABDm4BIUpyj3yUwJEfsRXlgiY0AmEzoX3zjqHzj FBmR/ffa6PBsI/q0AcjWkvaa4xkae6Z8l9n2+ETgTMCKT/h4d57n4ylFNE5Q+/6Ft0h/ bJjZSOB2W5FLVp2gin3GixleIKeqawFYIZyJnfPHvpfpxyvHIdwmUfOPC5NmfOlhpmbp nE+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262826; x=1710867626; 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=SwlNJSycCuQXF9GnhGarIkq0/MrxOBJJLSGiFZLu6m4=; b=KK+EjEhV20zXO5toJAu135qbUpBwDkDoLPl680KscGHgEjgn0d/+Rpyo8VILPrD5zj X4mJndE4+cwQ7WIXDZE/lS3r/Hya3kvmy1q4zUC1pjVvtxl62CBSNAB3BISftkTHI7KM 0pTdvGffX/zL67OLOhaEuOKWatdDW9ajkqxs0lPFrEBBlHqkgUvW3Z+AlmyoS2ktATR3 g1yi3jXlnFwWp7OLFCKzyvIIuV5WIH4wTvGBnI+8XNQyTGSnCX4SQQEsUD5QPzD4/8H1 EKUKLohlOXsGjoG/m//z9/5Ymg1o2jM+IMEB2SZzZQiCG+WP4qjKZqKRNW81s9xwKPQd Xh+Q== X-Forwarded-Encrypted: i=1; AJvYcCX5TVjergH9eH3pZgZ57AvX0V7oHP+MU2YfoaLBZl4glFaeEcO/VAYUHZozJYExW9uUw55ujvaaeQP3FPyo7HRkhGd8 X-Gm-Message-State: AOJu0YyQt3GnZyA0qx/G9Yj/uNQei7xdIk0y8shRAy9YPG6CGINl0gRt boNuYtSRpr/yo2q0NR1XezOQNbhm0l8+OLUrLo+oSAIci5OeFzHtSflyEcDQ858= X-Google-Smtp-Source: AGHT+IGY9IQgl1QOqIcJKz09O9XKRjAsJTorakRxfgtwTIbj8Ii7ybOBFGH6UOdQGw8o/HxLka4/aA== X-Received: by 2002:a05:6a00:21ce:b0:6e6:4946:93e7 with SMTP id t14-20020a056a0021ce00b006e6494693e7mr25802pfj.27.1710262826018; Tue, 12 Mar 2024 10:00:26 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan Subject: [PULL 23/38] target/ppc: Clean up ifdefs in excp_helper.c, part 3 Date: Wed, 13 Mar 2024 02:58:34 +1000 Message-ID: <20240312165851.2240242-24-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.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: 1710263058216100005 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Concatenate #if blocks that are ending then beginning on the next line again. Reviewed-by: Harsh Prateek Bora Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/excp_helper.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 148b0c3a19..a9efda7626 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2553,10 +2553,8 @@ void helper_raise_exception(CPUPPCState *env, uint32= _t exception) { raise_exception_err_ra(env, exception, 0, 0); } -#endif /* CONFIG_TCG */ =20 #ifndef CONFIG_USER_ONLY -#ifdef CONFIG_TCG void helper_store_msr(CPUPPCState *env, target_ulong val) { uint32_t excp =3D hreg_store_msr(env, val, 0); @@ -2661,9 +2659,7 @@ void helper_hrfid(CPUPPCState *env) { do_rfi(env, env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]); } -#endif /* TARGET_PPC64 */ =20 -#ifdef TARGET_PPC64 void helper_rfebb(CPUPPCState *env, target_ulong s) { target_ulong msr =3D env->msr; @@ -2763,10 +2759,8 @@ void helper_rfmci(CPUPPCState *env) /* FIXME: choose CSRR1 or MCSRR1 based on cpu type */ do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]); } -#endif /* CONFIG_TCG */ -#endif /* !defined(CONFIG_USER_ONLY) */ +#endif /* !CONFIG_USER_ONLY */ =20 -#ifdef CONFIG_TCG void helper_tw(CPUPPCState *env, target_ulong arg1, target_ulong arg2, uint32_t flags) { @@ -2794,9 +2788,7 @@ void helper_td(CPUPPCState *env, target_ulong arg1, t= arget_ulong arg2, } } #endif /* TARGET_PPC64 */ -#endif /* CONFIG_TCG */ =20 -#ifdef CONFIG_TCG static uint32_t helper_SIMON_LIKE_32_64(uint32_t x, uint64_t key, uint32_t= lane) { const uint16_t c =3D 0xfffc; @@ -2907,11 +2899,8 @@ HELPER_HASH(HASHST, env->spr[SPR_HASHKEYR], true, NP= HIE) HELPER_HASH(HASHCHK, env->spr[SPR_HASHKEYR], false, NPHIE) HELPER_HASH(HASHSTP, env->spr[SPR_HASHPKEYR], true, PHIE) HELPER_HASH(HASHCHKP, env->spr[SPR_HASHPKEYR], false, PHIE) -#endif /* CONFIG_TCG */ =20 #ifndef CONFIG_USER_ONLY -#ifdef CONFIG_TCG - /* Embedded.Processor Control */ static int dbell2irq(target_ulong rb) { @@ -3258,5 +3247,5 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPU= Watchpoint *wp) return false; } =20 -#endif /* CONFIG_TCG */ #endif /* !CONFIG_USER_ONLY */ +#endif /* CONFIG_TCG */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263366; cv=none; d=zohomail.com; s=zohoarc; b=LSqMaQkvkF9hEs60bLohbevA9L0yeNrN7pyIxfoxSwFvy8GDbMeP2FpHTw70V2KfPZi6jSfEJ+ciiO3sE0we/7CrN0cf3UQw81Ml//UbspW6KfWPlaKEQoT/59WzOHWNOjO9WQ4bN13y8U7dUaNzhtuNO4eGGTSVxWO4hTbjbvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263366; 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=MoKRCKsm4E9lna6+NySazE4WVLMGHBKm/4jK5soogyI=; b=fFGlCGpOitmQ5oYEwKmM+/6gZVPfwjpLU5pEowD3iQ/CHa5LIg8rPDtz7e+FW2tUGzUq9PFjv/RsAWdnZFkJfHnAQvvg0oXI7l7tqL/cf+nGv3+SAZD2FvYgmwuh4jEFv9cg70YFnDj84+xCF+Ay4Zj2yiPOfB7DvpvY3Sa7dV0= 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 1710263366633763.5600104092123; Tue, 12 Mar 2024 10:09:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WP-0000R3-Ai; Tue, 12 Mar 2024 13:02:37 -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 1rk5US-0006Bd-32; Tue, 12 Mar 2024 13:00:38 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UN-0008NB-Lu; Tue, 12 Mar 2024 13:00:35 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e5dddd3b95so28358b3a.1; Tue, 12 Mar 2024 10:00:30 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262830; x=1710867630; 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=MoKRCKsm4E9lna6+NySazE4WVLMGHBKm/4jK5soogyI=; b=h/wPq5d7Hnz2CMC2PHvQdnGYFZ7R/MTebEFEOnc3He/T68OvaGqY1UotH+wxA8Z+Cn L7FejViyW3Iwudr9EtKciPxd/35LAZ4IUB0BqdQCvQ0TQK2oNNX8LRksMptwzLvV6KVB ZbJBPHWTs/movfpv8Z4th/mhb3Q/kGA4U64w7EfEUadxbXi4cJl7DftaRvRh58YmsMsP ZYnk76Yg1qBUGCBY8W6ImnQ54637IWMRdyVWk4+CSGdinUGmxMi0cJJfSiVrFb7su56V zkxb2GNl0dP6TNbNPDSEbSiGx1iL3s9fX1ju2zYddrcJLligzYtPxgXL5OoCWUEm99UZ H1uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262830; x=1710867630; 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=MoKRCKsm4E9lna6+NySazE4WVLMGHBKm/4jK5soogyI=; b=KPVzImCD9dZMScfEXx7Ax+EtfL4Ha6G2Df26SKu35K2xRT+Rz2wAMRfACTrkXrPGWH anRHHWK5PVMnBUnAUwbntZdDNGxcDgToTpGWDG7jLxqpMuRJYuUvCd+xOPwR01NJgTuF ix7+Ynzja2DvVRl/vobWp1ipiKWkYOmaGwsPIU+Tc2CXernO5Oh+3uADnogA7sYG+Cib 3bokJLWGYPBddN7wu1StIeEszfmrA8vSDUAoANn3lCuXCqzqnh6IQjKj4RTBEcWJNHkE 5z/99cXbKS9uIRQs7NmH7OM41Wqgq+0zzRs/dE8pWOI7Xri/oAOKhSnlJ7ZcbhRXMq79 fx7g== X-Forwarded-Encrypted: i=1; AJvYcCWOrxi1aNl8jqCLOFUZDaDxqG7zizkcuzuHrS+vFQDXm0sFM6qwNfTXJMAEtAXs8Hw/330ICK7nj0cqiwEfpooHK+ue X-Gm-Message-State: AOJu0YzKQ6w5HKGYy65bIJGsatsthy+DXje10BZ9KXP4c9s2ArFq+/sq X064pd4jnFcOtOiCXFvrqMxGnL8wUnCdL8gN1++qzFs21d5XgzX0kx14cXuyse8= X-Google-Smtp-Source: AGHT+IF1p01VJJTEl2S+CqTXnh4h3YJRrxS9Kc2zlICgMzRwtJj7wCs+ILpowdv8u55j3xlBrgb2bw== X-Received: by 2002:a05:6a21:32a5:b0:1a1:6cf3:265b with SMTP id yt37-20020a056a2132a500b001a16cf3265bmr207438pzb.18.1710262829814; Tue, 12 Mar 2024 10:00:29 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , BALATON Zoltan Subject: [PULL 24/38] target/ppc: Remove interrupt handler wrapper functions Date: Wed, 13 Mar 2024 02:58:35 +1000 Message-ID: <20240312165851.2240242-25-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42e; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42e.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: 1710263367700100001 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan These wrappers call out to handle POWER7 and newer in separate functions but reduce to the generic case when TARGET_PPC64 is not defined. It is easy enough to include the switch in the beginning of the generic functions to branch out to the specific functions and get rid of these wrappers. This avoids one indirection and entirely compiles out the switch without TARGET_PPC64. Reviewed-by: Harsh Prateek Bora Signed-off-by: BALATON Zoltan Signed-off-by: Nicholas Piggin --- target/ppc/excp_helper.c | 67 +++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index a9efda7626..ded488fcd8 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1978,8 +1978,21 @@ static int p9_next_unmasked_interrupt(CPUPPCState *e= nv) } #endif /* TARGET_PPC64 */ =20 -static int ppc_next_unmasked_interrupt_generic(CPUPPCState *env) +static int ppc_next_unmasked_interrupt(CPUPPCState *env) { +#ifdef TARGET_PPC64 + switch (env->excp_model) { + case POWERPC_EXCP_POWER7: + return p7_next_unmasked_interrupt(env); + case POWERPC_EXCP_POWER8: + return p8_next_unmasked_interrupt(env); + case POWERPC_EXCP_POWER9: + case POWERPC_EXCP_POWER10: + return p9_next_unmasked_interrupt(env); + default: + break; + } +#endif bool async_deliver; =20 /* External reset */ @@ -2090,23 +2103,6 @@ static int ppc_next_unmasked_interrupt_generic(CPUPP= CState *env) return 0; } =20 -static int ppc_next_unmasked_interrupt(CPUPPCState *env) -{ - switch (env->excp_model) { -#ifdef TARGET_PPC64 - case POWERPC_EXCP_POWER7: - return p7_next_unmasked_interrupt(env); - case POWERPC_EXCP_POWER8: - return p8_next_unmasked_interrupt(env); - case POWERPC_EXCP_POWER9: - case POWERPC_EXCP_POWER10: - return p9_next_unmasked_interrupt(env); -#endif - default: - return ppc_next_unmasked_interrupt_generic(env); - } -} - /* * Sets CPU_INTERRUPT_HARD if there is at least one unmasked interrupt to = be * delivered and clears CPU_INTERRUPT_HARD otherwise. @@ -2336,8 +2332,21 @@ static void p9_deliver_interrupt(CPUPPCState *env, i= nt interrupt) } #endif /* TARGET_PPC64 */ =20 -static void ppc_deliver_interrupt_generic(CPUPPCState *env, int interrupt) +static void ppc_deliver_interrupt(CPUPPCState *env, int interrupt) { +#ifdef TARGET_PPC64 + switch (env->excp_model) { + case POWERPC_EXCP_POWER7: + return p7_deliver_interrupt(env, interrupt); + case POWERPC_EXCP_POWER8: + return p8_deliver_interrupt(env, interrupt); + case POWERPC_EXCP_POWER9: + case POWERPC_EXCP_POWER10: + return p9_deliver_interrupt(env, interrupt); + default: + break; + } +#endif PowerPCCPU *cpu =3D env_archcpu(env); =20 switch (interrupt) { @@ -2440,26 +2449,6 @@ static void ppc_deliver_interrupt_generic(CPUPPCStat= e *env, int interrupt) } } =20 -static void ppc_deliver_interrupt(CPUPPCState *env, int interrupt) -{ - switch (env->excp_model) { -#ifdef TARGET_PPC64 - case POWERPC_EXCP_POWER7: - p7_deliver_interrupt(env, interrupt); - break; - case POWERPC_EXCP_POWER8: - p8_deliver_interrupt(env, interrupt); - break; - case POWERPC_EXCP_POWER9: - case POWERPC_EXCP_POWER10: - p9_deliver_interrupt(env, interrupt); - break; -#endif - default: - ppc_deliver_interrupt_generic(env, interrupt); - } -} - void ppc_cpu_do_system_reset(CPUState *cs) { PowerPCCPU *cpu =3D POWERPC_CPU(cs); --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263528; cv=none; d=zohomail.com; s=zohoarc; b=RoaKlwY6ygD9lTuPMwfHG503hIdbcQpGROIO44iObxdHeTd9+bGGSQjtBaECpzi3ULB3/ch0zSOv479lQASP/qUM5DaXxoIIfFV6uiJ5feAQ77T+c1B9BRkw8LadpZ2QDQOtPes8DGJ3ji9VPI3ay25BFcdtsLRfTRB5j2RpPUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263528; 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=pBITymDFeDXiJDgONKwZL8oLgmw8A0Gg/g7pdbBRahU=; b=NlXk8RdFQbYS0PG1hCPNlqJJ1wtB85HqK41UmSSzxcA1gc3VsV+CLrrFNemtGBKt59khMxn4jmIuYuZxLjpnzCSsoKWAaGz/k/NshRpAGd4/a9pj/i/G3+810Nol0MHfs2oCN3RLpnXZ5Tf/suv1wXsERwKTO0b5e/EAM5/1aoM= 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 171026352869499.21591211612247; Tue, 12 Mar 2024 10:12:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5X2-0004Bx-Ub; Tue, 12 Mar 2024 13:03:17 -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 1rk5UX-0006JN-IO; Tue, 12 Mar 2024 13:00:44 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UT-0008P7-Uh; Tue, 12 Mar 2024 13:00:41 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e6b5432439so29711b3a.1; Tue, 12 Mar 2024 10:00:34 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262833; x=1710867633; 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=pBITymDFeDXiJDgONKwZL8oLgmw8A0Gg/g7pdbBRahU=; b=V+59vRHJxwkgA1EaDCKFw8r/RqI1IF/1hOdqVGMDE2vJcbC33Wk+KVx+vwh+ELYOrv G3njQmkhz0cihQcQ9OWbi1HogpX2quYmaTIRm4B0FeTDpp1m/xGPQYGjbFf1JrydWRZe WshmlBT77nlmDse/HBudbWqNySI0ncu+eSirvUfuXE0qlyefkqF3CSTHIzEbniTfj5oW dPDSp2Dyd2Oik1UR4jKqcwRfVoj7do1hUtf1DGKCHbFhx8Uv2fdOGgmHLwfFSX9SYllc 7rtDSweddrnH0Mqi7nDJy5WkW2iLbqXgYw9zM2NiCJn68cmqwfpjk+JDbYEsTRMwgw44 1NuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262833; x=1710867633; 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=pBITymDFeDXiJDgONKwZL8oLgmw8A0Gg/g7pdbBRahU=; b=LE/nt+JSoY60N+xkodLCQEXxsMKllU5hjFf3ZxIjx0H6B4o8MtMtcDC4hkiymZ1bOL bl1Su8+X+vLIxnY7iuvgrr6/VPF4jMeyZ8mQjSqrIa/baWUvMvM7FHN1jtxzc1FXnPN8 n+KtwLfFT0YISXw17w5fXaelbf1+u7KxD5OLxza4/PJj4A40/5w8UJH0ufLw/ffzzZeV /E288GbS3BEwrepPJ/9Xltj+aSMstzQ9fKKCrImDNcBgAQ9Ck8LKysooroMe9KihNmvO zgcXeXgqXw5k9jo6aDKrFK5uo9mnZOO4eS++1Yoo2UVmj1m8Fkv3cFDK+HN7Rqbvo0hS MIEA== X-Forwarded-Encrypted: i=1; AJvYcCW+qKKT3XrBv0aF4vGeaRDXl8VwbVElIoiLfrNj2EURm9Dzy5qjfLZkABIsqh3uWVa59gPWqbwQkX4cSTZLj9e9Up31 X-Gm-Message-State: AOJu0Yw3Qcxw5Wp6E6yr4sJLM9LwXY+DXebR1oomfpphBzb2WEnfaK6g d3bhjKG3ktPwvZg0DCBdvQ/sUKJVFbMSAYz1lNah/zXy0v2/F4l18A16R7EqYvs= X-Google-Smtp-Source: AGHT+IFT0vRE1D+15HxGvwOVUTyBmL1xSAgU61PIwj17yKZEPoZa83WSAekJ/c9j96PLZKcC0CZJ+g== X-Received: by 2002:a05:6a20:12c2:b0:1a3:2fea:936c with SMTP id v2-20020a056a2012c200b001a32fea936cmr322711pzg.41.1710262833625; Tue, 12 Mar 2024 10:00:33 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 25/38] spapr: nested: register nested-hv api hcalls only for cap-nested-hv Date: Wed, 13 Mar 2024 02:58:36 +1000 Message-ID: <20240312165851.2240242-26-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::431; envelope-from=npiggin@gmail.com; helo=mail-pf1-x431.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: 1710263530620100007 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Since cap-nested-hv is an optional capability, it makes sense to register api specfic hcalls only when respective capability is enabled. This requires to introduce a new API to unregister hypercalls to maintain sanity across guest reboot since caps are re-applied across reboots and re-registeration of hypercalls would hit assert otherwise. Reviewed-by: Nicholas Piggin Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 1 + hw/ppc/spapr_hcall.c | 24 ++++++++++++++++++++++-- hw/ppc/spapr_nested.c | 25 +++++++++++++++++++++++-- include/hw/ppc/spapr.h | 4 ++++ include/hw/ppc/spapr_nested.h | 1 - 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index abd484023a..7321c35174 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1734,6 +1734,7 @@ static void spapr_machine_reset(MachineState *machine= , ShutdownCause reason) =20 pef_kvm_reset(machine->cgs, &error_fatal); spapr_caps_apply(spapr); + spapr_nested_reset(spapr); =20 first_ppc_cpu =3D POWERPC_CPU(first_cpu); if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 75c2d12978..5e1d020e3d 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1525,6 +1525,28 @@ void spapr_register_hypercall(target_ulong opcode, s= papr_hcall_fn fn) *slot =3D fn; } =20 +void spapr_unregister_hypercall(target_ulong opcode) +{ + spapr_hcall_fn *slot; + + if (opcode <=3D MAX_HCALL_OPCODE) { + assert((opcode & 0x3) =3D=3D 0); + + slot =3D &papr_hypercall_table[opcode / 4]; + } else if (opcode >=3D SVM_HCALL_BASE && opcode <=3D SVM_HCALL_MAX) { + /* we only have SVM-related hcall numbers assigned in multiples of= 4 */ + assert((opcode & 0x3) =3D=3D 0); + + slot =3D &svm_hypercall_table[(opcode - SVM_HCALL_BASE) / 4]; + } else { + assert((opcode >=3D KVMPPC_HCALL_BASE) && (opcode <=3D KVMPPC_HCAL= L_MAX)); + + slot =3D &kvmppc_hypercall_table[opcode - KVMPPC_HCALL_BASE]; + } + + *slot =3D NULL; +} + target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode, target_ulong *args) { @@ -1638,8 +1660,6 @@ static void hypercall_register_types(void) spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support); =20 spapr_register_hypercall(KVMPPC_H_UPDATE_DT, h_update_dt); - - spapr_register_nested(); } =20 type_init(hypercall_register_types) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 121aa96ddc..8e0ee0d22f 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -7,6 +7,14 @@ #include "hw/ppc/spapr_cpu_core.h" #include "hw/ppc/spapr_nested.h" =20 +void spapr_nested_reset(SpaprMachineState *spapr) +{ + if (spapr_get_cap(spapr, SPAPR_CAP_NESTED_KVM_HV)) { + spapr_unregister_nested_hv(); + spapr_register_nested_hv(); + } +} + #ifdef CONFIG_TCG #define PRTS_MASK 0x1f =20 @@ -375,20 +383,33 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp) address_space_unmap(CPU(cpu)->as, regs, len, len, true); } =20 -void spapr_register_nested(void) +void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); spapr_register_hypercall(KVMPPC_H_ENTER_NESTED, h_enter_nested); spapr_register_hypercall(KVMPPC_H_TLB_INVALIDATE, h_tlb_invalidate); spapr_register_hypercall(KVMPPC_H_COPY_TOFROM_GUEST, h_copy_tofrom_gue= st); } + +void spapr_unregister_nested_hv(void) +{ + spapr_unregister_hypercall(KVMPPC_H_SET_PARTITION_TABLE); + spapr_unregister_hypercall(KVMPPC_H_ENTER_NESTED); + spapr_unregister_hypercall(KVMPPC_H_TLB_INVALIDATE); + spapr_unregister_hypercall(KVMPPC_H_COPY_TOFROM_GUEST); +} #else void spapr_exit_nested(PowerPCCPU *cpu, int excp) { g_assert_not_reached(); } =20 -void spapr_register_nested(void) +void spapr_register_nested_hv(void) +{ + /* DO NOTHING */ +} + +void spapr_unregister_nested_hv(void) { /* DO NOTHING */ } diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 5b5ba9ef77..78a736297b 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -631,6 +631,7 @@ typedef target_ulong (*spapr_hcall_fn)(PowerPCCPU *cpu,= SpaprMachineState *sm, target_ulong *args); =20 void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn); +void spapr_unregister_hypercall(target_ulong opcode); target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode, target_ulong *args); =20 @@ -1028,5 +1029,8 @@ void spapr_vof_client_dt_finalize(SpaprMachineState *= spapr, void *fdt); =20 /* H_WATCHDOG */ void spapr_watchdog_init(SpaprMachineState *spapr); +void spapr_register_nested_hv(void); +void spapr_unregister_nested_hv(void); +void spapr_nested_reset(SpaprMachineState *spapr); =20 #endif /* HW_SPAPR_H */ diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index d312a5d61d..09d95182b2 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -95,7 +95,6 @@ struct nested_ppc_state { int64_t tb_offset; }; =20 -void spapr_register_nested(void); void spapr_exit_nested(PowerPCCPU *cpu, int excp); =20 #endif /* HW_SPAPR_NESTED_H */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263061; cv=none; d=zohomail.com; s=zohoarc; b=BjFn0djQBaYPmZxDWZht/ESALOy6nvN2e3+yzHvRl/1nmx3zdH0ivYio9MXmrVb0fdz/QFPMxelDoc+h7AhhEx6LjjxQmTNAMcSOSM3HoQ+fnFAxf7fSXOwycf8Vxy2m1q9hHKXa9WB7EE0rKi1JVQKCLin0p9Io0liUNnM9BRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263061; 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=uGGK8C7KiRqAJNCTwSuiIvTju4WLaHuX/qCVDSVsKBE=; b=fN/xLsLEP+jw4cx7/+os2Qp6Rd3S775dtRV5cFf+hVTLIYlk46D9RqHTLvrAAZ4Xkm57VXGUAeTbMKdUEQlidnTxKLPjNL0wzCAtR/bnJE2SmvgZUK3lFaxUGlt9RlUi5FM9XDi45lcZCIgktzJ9agM1Inr0yEmu7Xrm66Fh5xc= 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 1710263061078833.3908805194981; Tue, 12 Mar 2024 10:04:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WU-00016R-Eb; Tue, 12 Mar 2024 13:02:42 -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 1rk5UZ-0006Ll-Ut; Tue, 12 Mar 2024 13:00:48 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0: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 1rk5UW-0008RM-3Q; Tue, 12 Mar 2024 13:00:43 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6e6aa5c5a6fso140188b3a.0; Tue, 12 Mar 2024 10:00:38 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262837; x=1710867637; 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=uGGK8C7KiRqAJNCTwSuiIvTju4WLaHuX/qCVDSVsKBE=; b=DIUoquRR8It3DNhZiysoa1RT8UZAZH9VkL+LCoS2PzhvJFJbc5xDOxZIGv1z2VseaH WmdkKGJEj1uq905h4uJjOsbmlpI8KDEAZZNcBqyi4IlIF31Bnc2196KZGc9mTRp2uPpM EVbd7v3fM0E6riqL+CCCf75csibKu1htiZuYCCx+4lPwsCzTlBTYiXM62gS+vigUqwwF lFQx1euUbEm4i8Kjuw0fxGRrHCfC282bzP0OLEhRTHTdDB20H+4mqwAbbL3Dw/xD2TnR N2MVkIfsRx05EWDNkTRGPBvKsjpZQo5oHtWPZPbkAFfgV/90BdVrmyIYZfO6XOR9ZtQO 0gzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262837; x=1710867637; 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=uGGK8C7KiRqAJNCTwSuiIvTju4WLaHuX/qCVDSVsKBE=; b=a6eUeM5kaYFeXLIc8++926aHDgIh8b9jii8sguFhMDu4qztlr2wlTp3IPENdc+FGwt Q5xeCYOROXKxMGihWg3KBPXNb6UxZcPEbWp1eJbQXiXKuJFvAV6lPpMeq2/9e4WLhxbm RDx0EAwzB7yYQ0BFYANy8QLXKhPKr2i9uRb6RJQTzLwVbrt3jGInJchVZ400vacFDd7J nuAYFlE4qp/t04ynN4zjSJxTVeh3lF6pfrxgzvlwKMb1mveLDHckERuYIOmQFJWpUGiH EGE+RE0/cR3AQzUjIdyD6nQgWb62goVGXBVy7JnMWtMtQk36c9h8bN2DpsTYPDfsNsE8 K7IA== X-Forwarded-Encrypted: i=1; AJvYcCXQkXXApgqTNVbqmu93IifMywhJR36xuXUaRDtaaIJVUySrukzi0FVKvmrZxah4BITfuMbzwO67KkdX46Nv1zYSeDf7 X-Gm-Message-State: AOJu0Ywa09/w/lsyMMDfG8634V2kVRfXBlfNP4x5vPnRlWtoPVOmYUQR aTdQS3NhWH5lBwU7bfrdMnO1OALLy+RpJyACbmr5fm2EJrB1UH3c6DAkDg1V9WA= X-Google-Smtp-Source: AGHT+IHEiM1rcQH28G0DHhxvsQVUa4KMN5aAccVNQHWbOedj2EaqakMWn8GNV90lgM1+j5qE545adg== X-Received: by 2002:a05:6a00:841:b0:6e6:8c49:f2f6 with SMTP id q1-20020a056a00084100b006e68c49f2f6mr35034pfk.24.1710262837166; Tue, 12 Mar 2024 10:00:37 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 26/38] spapr: nested: move nested part of spapr_get_pate into spapr_nested.c Date: Wed, 13 Mar 2024 02:58:37 +1000 Message-ID: <20240312165851.2240242-27-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42a; envelope-from=npiggin@gmail.com; helo=mail-pf1-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, 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: 1710263062400100001 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Most of the nested code has already been moved to spapr_nested.c This logic inside spapr_get_pate is related to nested guests and better suited for spapr_nested.c, hence moving there. Reviewed-by: Nicholas Piggin Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 28 ++------------------------- hw/ppc/spapr_nested.c | 36 +++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr_nested.h | 3 ++- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7321c35174..ff429d0ffe 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1407,7 +1407,6 @@ void spapr_init_all_lpcrs(target_ulong value, target_= ulong mask) } } =20 - static bool spapr_get_pate(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry) { @@ -1420,33 +1419,10 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vh= yp, PowerPCCPU *cpu, /* Copy PATE1:GR into PATE0:HR */ entry->dw0 =3D spapr->patb_entry & PATE0_HR; entry->dw1 =3D spapr->patb_entry; - + return true; } else { - uint64_t patb, pats; - - assert(lpid !=3D 0); - - patb =3D spapr->nested_ptcr & PTCR_PATB; - pats =3D spapr->nested_ptcr & PTCR_PATS; - - /* Check if partition table is properly aligned */ - if (patb & MAKE_64BIT_MASK(0, pats + 12)) { - return false; - } - - /* Calculate number of entries */ - pats =3D 1ull << (pats + 12 - 4); - if (pats <=3D lpid) { - return false; - } - - /* Grab entry */ - patb +=3D 16 * lpid; - entry->dw0 =3D ldq_phys(CPU(cpu)->as, patb); - entry->dw1 =3D ldq_phys(CPU(cpu)->as, patb + 8); + return spapr_get_pate_nested_hv(spapr, cpu, lpid, entry); } - - return true; } =20 #define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2)) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 8e0ee0d22f..f7888ca8bd 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -6,6 +6,7 @@ #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_cpu_core.h" #include "hw/ppc/spapr_nested.h" +#include "mmu-book3s-v3.h" =20 void spapr_nested_reset(SpaprMachineState *spapr) { @@ -16,6 +17,35 @@ void spapr_nested_reset(SpaprMachineState *spapr) } =20 #ifdef CONFIG_TCG + +bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, + target_ulong lpid, ppc_v3_pate_t *entry) +{ + uint64_t patb, pats; + + assert(lpid !=3D 0); + + patb =3D spapr->nested_ptcr & PTCR_PATB; + pats =3D spapr->nested_ptcr & PTCR_PATS; + + /* Check if partition table is properly aligned */ + if (patb & MAKE_64BIT_MASK(0, pats + 12)) { + return false; + } + + /* Calculate number of entries */ + pats =3D 1ull << (pats + 12 - 4); + if (pats <=3D lpid) { + return false; + } + + /* Grab entry */ + patb +=3D 16 * lpid; + entry->dw0 =3D ldq_phys(CPU(cpu)->as, patb); + entry->dw1 =3D ldq_phys(CPU(cpu)->as, patb + 8); + return true; +} + #define PRTS_MASK 0x1f =20 static target_ulong h_set_ptbl(PowerPCCPU *cpu, @@ -413,4 +443,10 @@ void spapr_unregister_nested_hv(void) { /* DO NOTHING */ } + +bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, + target_ulong lpid, ppc_v3_pate_t *entry) +{ + return false; +} #endif diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 09d95182b2..1df1ce14f6 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -96,5 +96,6 @@ struct nested_ppc_state { }; =20 void spapr_exit_nested(PowerPCCPU *cpu, int excp); - +bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, + target_ulong lpid, ppc_v3_pate_t *entry); #endif /* HW_SPAPR_NESTED_H */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710262989; cv=none; d=zohomail.com; s=zohoarc; b=Bvnz9RiFc68zrGHzVytJlRnWeh+/kkLeNVjgX2b+JXv6sxKfpgF+wTBEeMGr0+fW2B/fSMmwYUrgC5SWb7QUjRYIrsaiL++0avJE1R57p5nlBp6BXPr+CbLwszGLlgi4HsVTv/FETM8z+MU97MwUlv+dCgjIn9k01jAvo7A5LgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710262989; 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=F1WSS859ppO453pGVNhu4iKbtEfJ5LrxUVyPjlrAMcE=; b=Rdcrj9e/Hv0FlxPaHZ3Ws4FGDIyJU5vJZ6JfGN1O3Mf/lTjgPvb8PZKTPZPhW+sp3yVcwpsM9p9prYa/nMiXysEI4PTxHp1cO5mNVugCS4uINIfNajOk0lOUvQVvOsdXBeXMb2Xn+38sKjzsmT9NboT8oBRKQbchGE6xOSYcVro= 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 1710262989341730.2819769911738; Tue, 12 Mar 2024 10:03:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5WR-0000su-Oq; Tue, 12 Mar 2024 13:02:39 -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 1rk5Ub-0006Mq-DD; Tue, 12 Mar 2024 13:00:48 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5UZ-0008S0-HW; Tue, 12 Mar 2024 13:00:45 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e55731af5cso3023720b3a.0; Tue, 12 Mar 2024 10:00:42 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262841; x=1710867641; 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=F1WSS859ppO453pGVNhu4iKbtEfJ5LrxUVyPjlrAMcE=; b=P/xoBKkjSDDS+BKAcGAr9JcJEqDvuFDFBlBFb4Mgby5VfBOkBNBQzpi0zx1SQqJfZD HDSQC9oUtyawr3bx4imwTI7HpAdJ0o1sc2DBlpOPjqRvxTbCtVjMf5AKcgmAR4sAnSZq D2G8Z6i6zMiVFib3DJ3wzOPetXKnsnz4+xotfppueqvIRfb0mDZ75YOKWGKo5Xw2a+qV CUwonHrnMaJvtbmTZrrNkMgKxzT4F6hHKK4cDWKJFpU9+vgHT0gUPgb21BevBUYy+DRg P4IuP2x1W7jzh8GtfUEE8gY/+omne09B9k/YKSH9XhUauOcRRObo3sl/aJiqLoC2mG1L cUzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262841; x=1710867641; 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=F1WSS859ppO453pGVNhu4iKbtEfJ5LrxUVyPjlrAMcE=; b=xDxtncNyfme6Y1Y2TQMMb35c61f1NLPE6Q90ewco1LgZY1ctD1PP2/h8+rcRiY3YcB AxODHl9n71+ITQhkMR/CZY1jsL/iKZMq1TywFiPG1ASGUCUbtSt4zenIUkroE7QpCnxb GRdtn6uvPGBcNd8eLR/Xmq/phzYrLQYzhW3bpxIHHQZM+lHYqwjUYHKwirTVmvO6DLOb M1qhETDkfswDbiTvFPkv2meFw3UQY9t0kYmOebaF/YcJOT9cE/zKpOIe9u88GwWgKVFF 0MUSlQfqhD0NvqTRvm/9SNmoZPLToLWLAVoA+rNe8uEN2ZcceX6kHTuxrFI/IDlObSa9 hnGA== X-Forwarded-Encrypted: i=1; AJvYcCUzblY6F6Y9cEnN9+3aq0iBxCjvNd1d0nn+TBD4dDwcNkRuciFqyx08CVOrNgzc8junDIDGwaDfPnAbDGBHxc4t3TGj X-Gm-Message-State: AOJu0Yx8LY+tHzT+7f47wBEPoxbfc6QZXBANB3ZT/ZB/xFo7BEbh6FI8 //9QO30uH27Dgstr4JzW81KuHYusakRV7rZyoujrubSQmnAdvhl7hLOLs9Wfhfc= X-Google-Smtp-Source: AGHT+IFkqRswDGTa2+iWUSxZpSrlPg9KFrz4LA/N0SJaxFFhK//tGMwK+7xHkg1zRKwoLgyXkYtx2g== X-Received: by 2002:a05:6a00:c8b:b0:6e6:a004:aaf1 with SMTP id a11-20020a056a000c8b00b006e6a004aaf1mr38003pfv.1.1710262840870; Tue, 12 Mar 2024 10:00:40 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 27/38] spapr: nested: Introduce SpaprMachineStateNested to store related info. Date: Wed, 13 Mar 2024 02:58:38 +1000 Message-ID: <20240312165851.2240242-28-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.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: 1710262990031100001 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Currently, nested_ptcr is being used by existing nested-hv API to store nested guest related info. This need to be organised to extend support for the nested PAPR API which would need to store additional info related to nested guests in next series of patches. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 8 ++++---- include/hw/ppc/spapr.h | 3 ++- include/hw/ppc/spapr_nested.h | 5 +++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index f7888ca8bd..c2a33fc3a9 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -25,8 +25,8 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, P= owerPCCPU *cpu, =20 assert(lpid !=3D 0); =20 - patb =3D spapr->nested_ptcr & PTCR_PATB; - pats =3D spapr->nested_ptcr & PTCR_PATS; + patb =3D spapr->nested.ptcr & PTCR_PATB; + pats =3D spapr->nested.ptcr & PTCR_PATS; =20 /* Check if partition table is properly aligned */ if (patb & MAKE_64BIT_MASK(0, pats + 12)) { @@ -63,7 +63,7 @@ static target_ulong h_set_ptbl(PowerPCCPU *cpu, return H_PARAMETER; } =20 - spapr->nested_ptcr =3D ptcr; /* Save new partition table */ + spapr->nested.ptcr =3D ptcr; /* Save new partition table */ =20 return H_SUCCESS; } @@ -195,7 +195,7 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu, struct kvmppc_pt_regs *regs; hwaddr len; =20 - if (spapr->nested_ptcr =3D=3D 0) { + if (spapr->nested.ptcr =3D=3D 0) { return H_NOT_AVAILABLE; } =20 diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 78a736297b..0eb01ea6fd 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -12,6 +12,7 @@ #include "hw/ppc/spapr_xive.h" /* For SpaprXive */ #include "hw/ppc/xics.h" /* For ICSState */ #include "hw/ppc/spapr_tpm_proxy.h" +#include "hw/ppc/spapr_nested.h" /* For SpaprMachineStateNested */ =20 struct SpaprVioBus; struct SpaprPhbState; @@ -213,7 +214,7 @@ struct SpaprMachineState { uint32_t vsmt; /* Virtual SMT mode (KVM's "core stride") */ =20 /* Nested HV support (TCG only) */ - uint64_t nested_ptcr; + SpaprMachineStateNested nested; =20 Notifier epow_notifier; QTAILQ_HEAD(, SpaprEventLogEntry) pending_events; diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 1df1ce14f6..2488ea98da 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -3,6 +3,10 @@ =20 #include "target/ppc/cpu.h" =20 +typedef struct SpaprMachineStateNested { + uint64_t ptcr; +} SpaprMachineStateNested; + /* * Register state for entering a nested guest with H_ENTER_NESTED. * New member must be added at the end. @@ -96,6 +100,7 @@ struct nested_ppc_state { }; =20 void spapr_exit_nested(PowerPCCPU *cpu, int excp); +typedef struct SpaprMachineState SpaprMachineState; bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry); #endif /* HW_SPAPR_NESTED_H */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263463; cv=none; d=zohomail.com; s=zohoarc; b=Lkmf2CAy/BFgYqI6unN89FEVfuuxBW7me0I2mFOdwqT0Co0Pa9mFcYy3yrg5TFSxJa0Ttb47+X3JQSP9QuO5gwSzbz6GWlzGjyA2b5xyke6sWC8UlRLRePIQtVkPOxs7XL8UkX9OzmXeKmOU8dvjOBOds6me1uAtrIEDWacGbyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263463; 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=g1D76JqJ2U58FMi1RODuDn/OgN6fCV9pAj01Xlhk49w=; b=F0O+PtENBA9nZ3Y2gNTl+kqG9oN65DaNwbAj+6yV2UsqUSaf2ncIZyP1SBjYOaZEZaUKTVMVq6hMDAoYBX01QUiK0ZAq0MofyMotty8tlOU+YhLQBSc8YC/BtREL/MxXD9fm4RDiEnQsQUZyTMk+fnTgCGA7VqjrMha1QVIR2EQ= 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 1710263463302363.14812057240874; Tue, 12 Mar 2024 10:11:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Xd-0005PU-Vf; Tue, 12 Mar 2024 13:03:55 -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 1rk5Ul-0006Q5-7T; Tue, 12 Mar 2024 13:00:57 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Ud-0008Ss-9T; Tue, 12 Mar 2024 13:00:52 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e55731af5cso3023750b3a.0; Tue, 12 Mar 2024 10:00:45 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262844; x=1710867644; 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=g1D76JqJ2U58FMi1RODuDn/OgN6fCV9pAj01Xlhk49w=; b=XdenP9VJqdJQ1/LmWYmO0Yg+Z53J3ZeF+VPwCeGpQMirngLWm/YMqFxoYE7VyPwe4K KOnr2QdWBLmvp4kNZMKKKCKbPuva3V5+5KCfnqhhLP39PsYKAKMvPckvjkw0jpNYOVbR 6uO6ceMcev5Srx2QIKchMm3t80DsrEchhY9EVGwYmLdxjigbl+/8+G8fGHSG6TVoQv6s XSnItcg6kP9BXUmzKsvGKY+fsbg+VkMBw4fGyhNwCuQ4E5YExuyNLLe2Bc9NvOggnSeF mgq/Ah11vYHFt/vOjp1oDFm+PK5Tkpuuj3ln8fOv8mEijK6hg2z2wn3zqCktUJu8V+9G afrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262844; x=1710867644; 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=g1D76JqJ2U58FMi1RODuDn/OgN6fCV9pAj01Xlhk49w=; b=FggXoP8xaOa4ASdscacZ3POKJmhGJosQxlihPtiMXcmGvhrZNVFqXnp7WobXSKpn0f 1YIycIKcZlHqxnoBzao5zLMFTTq6VLJ9rhO/6QzBtaeX2v/mvG8rIYR7jdvrjB9w82ao y7nnFO1kM1s41Y6/qzMbxZbY8ajDo/aQcuEZ6CQlH2J322NCxKZjcV9vRpX7XN1VwI2n Zhdebw4d1wGrTXuaNWT8cMVE/TtEkOh96kQ1bPJVQqTFxNdibMQFlSNNkDqsmvNfxCKp wKc9Ez9b82nvkhSpv9JB4gqiHEYUnV+Bl/EXH5Rcl+fgnvD8b35Wcq5eQZ7yOIPi7fG3 fleg== X-Forwarded-Encrypted: i=1; AJvYcCW2PH/9OEqoqPjikFOOjQouMLB2bpMT/85XqLrRGTW6iPMwasJqrMC52oufa/v9YWgXLb90YRHJvZHZbZxl0b4VsHDy X-Gm-Message-State: AOJu0YzFxVcMdo8NdlzYS/CC0TkzYhTCaIC9vPKid3ai6XdlsZWIHOcs cFNKlJ3+MYdF6yyAqwvv1VEBDxHmDRj8JFUZSXCGtvCQGoOVasaMmEhFoAxEOKQ= X-Google-Smtp-Source: AGHT+IEiwrhGU/MbOuCWoouRzs2qRHau/Bb2N1QT2z9BIlx+xTLFWoJydDgWSfX9Ghx52uozenN8fw== X-Received: by 2002:a05:6a20:5485:b0:1a1:4d8b:6f2c with SMTP id i5-20020a056a20548500b001a14d8b6f2cmr8696437pzk.2.1710262844392; Tue, 12 Mar 2024 10:00:44 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 28/38] spapr: nested: keep nested-hv related code restricted to its API. Date: Wed, 13 Mar 2024 02:58:39 +1000 Message-ID: <20240312165851.2240242-29-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42f; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42f.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: 1710263464155100001 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora spapr_exit_nested and spapr_get_pate_nested_hv contains code which is specific to nested-hv API. Isolating code flows based on API helps extending it to be used with different API as well. Suggested-by: Nicholas Piggin Reviewed-by: Nicholas Piggin Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 6 +++++- hw/ppc/spapr_nested.c | 25 ++++++++++++++++++++++--- include/hw/ppc/spapr_nested.h | 3 +++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ff429d0ffe..e001ffe06f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1421,7 +1421,11 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhy= p, PowerPCCPU *cpu, entry->dw1 =3D spapr->patb_entry; return true; } else { - return spapr_get_pate_nested_hv(spapr, cpu, lpid, entry); + assert(spapr_nested_api(spapr)); + if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { + return spapr_get_pate_nested_hv(spapr, cpu, lpid, entry); + } + return false; } } =20 diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index c2a33fc3a9..12fdbe2aba 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -11,11 +11,19 @@ void spapr_nested_reset(SpaprMachineState *spapr) { if (spapr_get_cap(spapr, SPAPR_CAP_NESTED_KVM_HV)) { + spapr->nested.api =3D NESTED_API_KVM_HV; spapr_unregister_nested_hv(); spapr_register_nested_hv(); + } else { + spapr->nested.api =3D 0; } } =20 +uint8_t spapr_nested_api(SpaprMachineState *spapr) +{ + return spapr->nested.api; +} + #ifdef CONFIG_TCG =20 bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, @@ -310,7 +318,7 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu, return env->gpr[3]; } =20 -void spapr_exit_nested(PowerPCCPU *cpu, int excp) +static void spapr_exit_nested_hv(PowerPCCPU *cpu, int excp) { CPUPPCState *env =3D &cpu->env; SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); @@ -322,8 +330,6 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp) struct kvmppc_pt_regs *regs; hwaddr len; =20 - assert(spapr_cpu->in_nested); - nested_save_state(&l2_state, cpu); hsrr0 =3D env->spr[SPR_HSRR0]; hsrr1 =3D env->spr[SPR_HSRR1]; @@ -413,6 +419,19 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp) address_space_unmap(CPU(cpu)->as, regs, len, len, true); } =20 +void spapr_exit_nested(PowerPCCPU *cpu, int excp) +{ + SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); + SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); + + assert(spapr_cpu->in_nested); + if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { + spapr_exit_nested_hv(cpu, excp); + } else { + g_assert_not_reached(); + } +} + void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 2488ea98da..bf3a7b8d89 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -5,6 +5,8 @@ =20 typedef struct SpaprMachineStateNested { uint64_t ptcr; + uint8_t api; +#define NESTED_API_KVM_HV 1 } SpaprMachineStateNested; =20 /* @@ -103,4 +105,5 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp); typedef struct SpaprMachineState SpaprMachineState; bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry); +uint8_t spapr_nested_api(SpaprMachineState *spapr); #endif /* HW_SPAPR_NESTED_H */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263207; cv=none; d=zohomail.com; s=zohoarc; b=KHdHEDRs55btjqytRqd439NDkoSpTqjPHy5TZScbN5zNcpfDqDG86SIIuVFH4PtY4RTXHWj/VinbXd78WyUGIACJJT4xN2Q3zx1tf0unG25oTbd3Ls7kRvKsSaRBpHgj2ejz0/FFbAgQPCABFSBX1catRroTqAdryLg76SVi7z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263207; 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=qr9X/khHCq5RJj3YA08mgEJxiJTU11rgfAwzxF4mODk=; b=CFB2eAkWmX6A/w6OypuK/5GPwtgxPat58x0lsZ7HkUPAJM/eHN1ljPwuFmTaHGlJyu3haDBf2+yHPm/6AoibFaxbMP80GElaKyPAHCBXFetMRJQ+kROyID+UvQ0i/1BlFwTBLy7wcWWJ0u6SthvZOPAr/EM5muEPro08C3hHTCE= 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 1710263207835168.92832176850482; Tue, 12 Mar 2024 10:06:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Wb-0002Wc-Te; Tue, 12 Mar 2024 13:02:50 -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 1rk5Uk-0006Q8-M4; Tue, 12 Mar 2024 13:00:57 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Uh-0008Tt-Tp; Tue, 12 Mar 2024 13:00:53 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6e6ac00616cso652559b3a.0; Tue, 12 Mar 2024 10:00:50 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262849; x=1710867649; 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=qr9X/khHCq5RJj3YA08mgEJxiJTU11rgfAwzxF4mODk=; b=RXr2t3Ep3lPUtqd27aDRuMzfnFZ9nWKRs2Srlsullw1xqu2UMAMI8NM1IDbQ5QcAOZ 2Ic0J7htH948rat5JhOj9SEJ8kJJwKbzx5HjbP7lGTIkJObh3OCG9hD+Sm2MZwuGU+iH TDmaaLG4AnCKSvKzAqJecfuLY5i4/+g0XsAV6W+pqIBUyCFg7t6u0S6O69RbFx0napNa 0qYrPIdZmUAmB0A9BsVuV5f1MjSi+n16u/r+LRKUjQN5OPyZS3h6UniLYGUQGuEWyrFu nWV2dt66vOR1yJHQwNDn01etIwperahKruB0bjnXj+vnvgSmVWX5fRa1ZvnOX2jgDgif fWXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262849; x=1710867649; 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=qr9X/khHCq5RJj3YA08mgEJxiJTU11rgfAwzxF4mODk=; b=fDdiH49Qg21cqnFOs3nGBP2J60g89Gn8LfspMW8kPAfj3jQ2RtXePKWfob5Fy3f/W7 sPJli2H9IjM4bsUw3NJbEYScxiLVQihXy2f+yTVhmpy/oRIGdrmsRBehdTmD5aySCrsD Nzzgh/X3jv9OsgsK1I2UaI/oIQqcsLh23YzdFYCMQYHcI8V/0fi7QxYuqn7mO7g6kD6v xzKBuDA4QQg9VjOvcIncCwAYBNoOVlvznzvaUtbNili+s/Dm/tFjE2igj81dgWLeunlo A8j38tCkB01NgDENlSKedC9uj7yvU/SMh6fh6v64XxIBwCGogrUxywr/dK6t+aOTJsMo XyAg== X-Forwarded-Encrypted: i=1; AJvYcCW9nOEe4TofKvnJATDvfTlCwhZYD1xVIQZDLn51PmWtfNXgzi4A2xMk5BuEEuWDF1D25oN7wa10vaMLA0EyXO2Yg+Ir X-Gm-Message-State: AOJu0YydW/WyGMC8tkDCXA6EF3HP/gLXUukGEeXWgvO0SydhKB53zvAQ fPEKaKgiHB/WqCUQyFT4pk1s9C9hR0XCiIiIetW+DumA6aCZvijjR2JWXzKpgzQ= X-Google-Smtp-Source: AGHT+IHemoe2+FCjItln5gMGjhCxQ9LURgsjtF/MnwwPbVx8kfykepSpZEoMHtulyqoVhm12Vjy+HQ== X-Received: by 2002:a05:6a00:8cd:b0:6e2:d162:6315 with SMTP id s13-20020a056a0008cd00b006e2d1626315mr5941pfu.29.1710262848147; Tue, 12 Mar 2024 10:00:48 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 29/38] spapr: nested: Document Nested PAPR API Date: Wed, 13 Mar 2024 02:58:40 +1000 Message-ID: <20240312165851.2240242-30-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::436; envelope-from=npiggin@gmail.com; helo=mail-pf1-x436.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: 1710263208985100001 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Adding initial documentation about Nested PAPR API to describe the set of APIs and its usage. Also talks about the Guest State Buffer elements and it's format which is used between L0/L1 to communicate L2 state. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- docs/devel/nested-papr.txt | 119 +++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 docs/devel/nested-papr.txt diff --git a/docs/devel/nested-papr.txt b/docs/devel/nested-papr.txt new file mode 100644 index 0000000000..90943650db --- /dev/null +++ b/docs/devel/nested-papr.txt @@ -0,0 +1,119 @@ +Nested PAPR API (aka KVM on PowerVM) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This API aims at providing support to enable nested virtualization with +KVM on PowerVM. While the existing support for nested KVM on PowerNV was +introduced with cap-nested-hv option, however, with a slight design change, +to enable this on papr/pseries, a new cap-nested-papr option is added. eg: + + qemu-system-ppc64 -cpu POWER10 -machine pseries,cap-nested-papr=3Dtrue .= .. + +Work by: + Michael Neuling + Vaibhav Jain + Jordan Niethe + Harsh Prateek Bora + Shivaprasad G Bhat + Kautuk Consul + +Below taken from the kernel documentation: + +Introduction +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This document explains how a guest operating system can act as a +hypervisor and run nested guests through the use of hypercalls, if the +hypervisor has implemented them. The terms L0, L1, and L2 are used to +refer to different software entities. L0 is the hypervisor mode entity +that would normally be called the "host" or "hypervisor". L1 is a +guest virtual machine that is directly run under L0 and is initiated +and controlled by L0. L2 is a guest virtual machine that is initiated +and controlled by L1 acting as a hypervisor. A significant design change +wrt existing API is that now the entire L2 state is maintained within L0. + +Existing Nested-HV API +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Linux/KVM has had support for Nesting as an L0 or L1 since 2018 + +The L0 code was added:: + + commit 8e3f5fc1045dc49fd175b978c5457f5f51e7a2ce + Author: Paul Mackerras + Date: Mon Oct 8 16:31:03 2018 +1100 + KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization + +The L1 code was added:: + + commit 360cae313702cdd0b90f82c261a8302fecef030a + Author: Paul Mackerras + Date: Mon Oct 8 16:31:04 2018 +1100 + KVM: PPC: Book3S HV: Nested guest entry via hypercall + +This API works primarily using a signal hcall h_enter_nested(). This +call made by the L1 to tell the L0 to start an L2 vCPU with the given +state. The L0 then starts this L2 and runs until an L2 exit condition +is reached. Once the L2 exits, the state of the L2 is given back to +the L1 by the L0. The full L2 vCPU state is always transferred from +and to L1 when the L2 is run. The L0 doesn't keep any state on the L2 +vCPU (except in the short sequence in the L0 on L1 -> L2 entry and L2 +-> L1 exit). + +The only state kept by the L0 is the partition table. The L1 registers +it's partition table using the h_set_partition_table() hcall. All +other state held by the L0 about the L2s is cached state (such as +shadow page tables). + +The L1 may run any L2 or vCPU without first informing the L0. It +simply starts the vCPU using h_enter_nested(). The creation of L2s and +vCPUs is done implicitly whenever h_enter_nested() is called. + +In this document, we call this existing API the v1 API. + +New PAPR API +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The new PAPR API changes from the v1 API such that the creating L2 and +associated vCPUs is explicit. In this document, we call this the v2 +API. + +h_enter_nested() is replaced with H_GUEST_VCPU_RUN(). Before this can +be called the L1 must explicitly create the L2 using h_guest_create() +and any associated vCPUs() created with h_guest_create_vCPU(). Getting +and setting vCPU state can also be performed using h_guest_{g|s}et +hcall. + +The basic execution flow is for an L1 to create an L2, run it, and +delete it is: + +- L1 and L0 negotiate capabilities with H_GUEST_{G,S}ET_CAPABILITIES() + (normally at L1 boot time). + +- L1 requests the L0 to create an L2 with H_GUEST_CREATE() and receives a = token + +- L1 requests the L0 to create an L2 vCPU with H_GUEST_CREATE_VCPU() + +- L1 and L0 communicate the vCPU state using the H_GUEST_{G,S}ET() hcall + +- L1 requests the L0 to run the vCPU using H_GUEST_RUN_VCPU() hcall + +- L1 deletes L2 with H_GUEST_DELETE() + +For more details, please refer: + +[1] Linux Kernel documentation (upstream documentation commit): + +commit 476652297f94a2e5e5ef29e734b0da37ade94110 +Author: Michael Neuling +Date: Thu Sep 14 13:06:00 2023 +1000 + + docs: powerpc: Document nested KVM on POWER + + Document support for nested KVM on POWER using the existing API as well + as the new PAPR API. This includes the new HCALL interface and how it + used by KVM. + + Signed-off-by: Michael Neuling + Signed-off-by: Jordan Niethe + Signed-off-by: Michael Ellerman + Link: https://msgid.link/20230914030600.16993-12-jniethe5@gmail.com --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263208; cv=none; d=zohomail.com; s=zohoarc; b=KLNkyzRxmshDXpJzQzrH3k85binxo0KNuFXQidQ2LqbH+E5fzKnOkD6V05fwV5agguHk/RUGN8RrmQ3NDNM5tZCFqpvT9Qrn7R0XpIhkAQwvGsWSGPsquX26RxsRdyCsCG3b4o++Nbl5e5zcfF+Lfwva0zDgGf2cQcGaNAk5zVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263208; 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=D823XPpwMiJ34nimbNh5Jem7KoFIgSxF2nxMRNRXUM0=; b=kKqRF7xEiKpdzw1jwpRJmo9YygBXMD5zd0sEFX6GO2nlpEvDDQVwRDVP1P8aCUW24PkKsHlEMUfs3zerpXBtTuMNrVMfK8xzri+hW2FH7kfhNafqeVUaYx7T5rlHLWWziIIaI+ypllZ8Xngs+V4vmi7UlLYxm4ehPx7Ju+VGmtw= 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 1710263208171812.94300263395; Tue, 12 Mar 2024 10:06:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Wa-00020J-2S; Tue, 12 Mar 2024 13:02:48 -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 1rk5Un-0006Ta-8S; Tue, 12 Mar 2024 13:00:59 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Uk-0008UL-QA; Tue, 12 Mar 2024 13:00:56 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e6ab012eb1so791126b3a.3; Tue, 12 Mar 2024 10:00:53 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262852; x=1710867652; 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=D823XPpwMiJ34nimbNh5Jem7KoFIgSxF2nxMRNRXUM0=; b=X3MefoNFDB8j3+WSp9f38md6wuBNqrGvOZ+FRDeq+PU/cKGY/Zf328DKvfgjVyy4LU hLKgkiGLUqgIsepvLoRHs/tcLn8w64Cx/91ns6BR5cHtLZiUK6qAW/u+I1pkm9J0LB/X X+YnvCKSTTYvTXoa5GUGhQGjMnpAUzj56QTXkxM4fjf0lWWdJCUBOHKcK/oZssmjbV7I EXUOgi1NSTrypwXGn00baEynWJl2HIP28LGSHjAtWWxYH/+SuiRGCHlCQ/gpKcCwCzaQ xXZUDGlXxoeehA0tcqyDl4x1Z/IUcnYJPtV9lToXbZ06YwTxrqCAW13NndSg09EHDSD5 AoQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262852; x=1710867652; 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=D823XPpwMiJ34nimbNh5Jem7KoFIgSxF2nxMRNRXUM0=; b=HsSlACGk/Ev+beS25JJWZZjJvmyP/vgp9e2GmO5RwW9xvDFlbybzqn1f+/76PS4WAv Ss+LidzRD5ryzYquuGmqiZ92H/i5M0tgEKMYs7jJbc3YuHGrv18WySjdGFQSwJjQunzm VZPPU3cOCYeEinxiS4bPkf/GBEszqd1htu8O4dtJmJMpUe7iuie0vxc5SrNvMZvR3Usz Uv+G9MyBfE1pb7Apd+OGlaI+mw7EjOaKQ9Y6xl3X7kCfg1iHdwdRLQ2AinMLMSy7pN65 yItYoqnIticzEJF/2AivnJxAKLrpdhzJJrYe0YKxfFMo6llDwLDbvXhtD2ZhZMKPFBZe QrtQ== X-Forwarded-Encrypted: i=1; AJvYcCXn1B/w+RVro71djlB91O9qEWzCfg4NWmHdjjabLn+60LA5w47Bly9wmF6PzKr1gWbiva+absHrRGOLc0FxHn5XUw9j X-Gm-Message-State: AOJu0YxTUFoE+kR2VOqct+COBOs4b1/3Rajy1MjX40FALOEHImH7QB/f qFLsXoI+xFJfeNhb0UpqyqJsAW+CgJ735D3dUnWY9ae/RifJG5YGxISEvi5Sse0= X-Google-Smtp-Source: AGHT+IGmiOiDuQdNm+F5+HoovQ+uw/LYqQR0k3LM1nwb67XW4ps2rTzUdBGljuGpdB/JxYOptTT97Q== X-Received: by 2002:a05:6a00:801:b0:6e6:a3b3:923c with SMTP id m1-20020a056a00080100b006e6a3b3923cmr54942pfk.6.1710262852028; Tue, 12 Mar 2024 10:00:52 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling , Amit Machhiwal Subject: [PULL 30/38] spapr: nested: Introduce H_GUEST_[GET|SET]_CAPABILITIES hcalls. Date: Wed, 13 Mar 2024 02:58:41 +1000 Message-ID: <20240312165851.2240242-31-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::429; envelope-from=npiggin@gmail.com; helo=mail-pf1-x429.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: 1710263209015100002 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Introduce the nested PAPR hcalls: - H_GUEST_GET_CAPABILITIES which is used to query the capabilities of the API and the L2 guests it provides. - H_GUEST_SET_CAPABILITIES which is used to set the Guest API capabilities that the Host Partition supports and may use. [amachhiw: support for p9 compat mode and return register bug fixes] Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Amit Machhiwal Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 115 ++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 7 ++- include/hw/ppc/spapr_nested.h | 12 ++++ 3 files changed, 133 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 12fdbe2aba..c35acee51f 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -7,6 +7,7 @@ #include "hw/ppc/spapr_cpu_core.h" #include "hw/ppc/spapr_nested.h" #include "mmu-book3s-v3.h" +#include "cpu-models.h" =20 void spapr_nested_reset(SpaprMachineState *spapr) { @@ -16,6 +17,7 @@ void spapr_nested_reset(SpaprMachineState *spapr) spapr_register_nested_hv(); } else { spapr->nested.api =3D 0; + spapr->nested.capabilities_set =3D false; } } =20 @@ -432,6 +434,93 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp) } } =20 +static target_ulong h_guest_get_capabilities(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + CPUPPCState *env =3D &cpu->env; + target_ulong flags =3D args[0]; + + if (flags) { /* don't handle any flags capabilities for now */ + return H_PARAMETER; + } + + /* P10 capabilities */ + if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_10, 0, + spapr->max_compat_pvr)) { + env->gpr[4] |=3D H_GUEST_CAPABILITIES_P10_MODE; + } + + /* P9 capabilities */ + if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, + spapr->max_compat_pvr)) { + env->gpr[4] |=3D H_GUEST_CAPABILITIES_P9_MODE; + } + + return H_SUCCESS; +} + +static target_ulong h_guest_set_capabilities(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + CPUPPCState *env =3D &cpu->env; + target_ulong flags =3D args[0]; + target_ulong capabilities =3D args[1]; + env->gpr[4] =3D 0; + + if (flags) { /* don't handle any flags capabilities for now */ + return H_PARAMETER; + } + + if (capabilities & H_GUEST_CAPABILITIES_COPY_MEM) { + env->gpr[4] =3D 1; + return H_P2; /* isn't supported */ + } + + /* + * If there are no capabilities configured, set the R5 to the index of + * the first supported Power Processor Mode + */ + if (!capabilities) { + env->gpr[4] =3D 1; + + /* set R5 to the first supported Power Processor Mode */ + if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_10, 0, + spapr->max_compat_pvr)) { + env->gpr[5] =3D H_GUEST_CAP_P10_MODE_BMAP; + } else if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, + spapr->max_compat_pvr)) { + env->gpr[5] =3D H_GUEST_CAP_P9_MODE_BMAP; + } + + return H_P2; + } + + /* + * If an invalid capability is set, R5 should contain the index of the + * invalid capability bit + */ + if (capabilities & ~H_GUEST_CAP_VALID_MASK) { + env->gpr[4] =3D 1; + + /* Set R5 to the index of the invalid capability */ + env->gpr[5] =3D 63 - ctz64(capabilities); + + return H_P2; + } + + if (!spapr->nested.capabilities_set) { + spapr->nested.capabilities_set =3D true; + spapr->nested.pvr_base =3D env->spr[SPR_PVR]; + return H_SUCCESS; + } else { + return H_STATE; + } +} + void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); @@ -447,6 +536,21 @@ void spapr_unregister_nested_hv(void) spapr_unregister_hypercall(KVMPPC_H_TLB_INVALIDATE); spapr_unregister_hypercall(KVMPPC_H_COPY_TOFROM_GUEST); } + +void spapr_register_nested_papr(void) +{ + spapr_register_hypercall(H_GUEST_GET_CAPABILITIES, + h_guest_get_capabilities); + spapr_register_hypercall(H_GUEST_SET_CAPABILITIES, + h_guest_set_capabilities); +} + +void spapr_unregister_nested_papr(void) +{ + spapr_unregister_hypercall(H_GUEST_GET_CAPABILITIES); + spapr_unregister_hypercall(H_GUEST_SET_CAPABILITIES); +} + #else void spapr_exit_nested(PowerPCCPU *cpu, int excp) { @@ -468,4 +572,15 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr= , PowerPCCPU *cpu, { return false; } + +void spapr_register_nested_papr(void) +{ + /* DO NOTHING */ +} + +void spapr_unregister_nested_papr(void) +{ + /* DO NOTHING */ +} + #endif diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 0eb01ea6fd..2906d59137 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -364,6 +364,7 @@ struct SpaprMachineState { #define H_NOOP -63 #define H_UNSUPPORTED -67 #define H_OVERLAP -68 +#define H_STATE -75 #define H_UNSUPPORTED_FLAG -256 #define H_MULTI_THREADS_ACTIVE -9005 =20 @@ -583,8 +584,10 @@ struct SpaprMachineState { #define H_RPT_INVALIDATE 0x448 #define H_SCM_FLUSH 0x44C #define H_WATCHDOG 0x45C +#define H_GUEST_GET_CAPABILITIES 0x460 +#define H_GUEST_SET_CAPABILITIES 0x464 =20 -#define MAX_HCALL_OPCODE H_WATCHDOG +#define MAX_HCALL_OPCODE H_GUEST_SET_CAPABILITIES =20 /* The hcalls above are standardized in PAPR and implemented by pHyp * as well. @@ -1033,5 +1036,7 @@ void spapr_watchdog_init(SpaprMachineState *spapr); void spapr_register_nested_hv(void); void spapr_unregister_nested_hv(void); void spapr_nested_reset(SpaprMachineState *spapr); +void spapr_register_nested_papr(void); +void spapr_unregister_nested_papr(void); =20 #endif /* HW_SPAPR_H */ diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index bf3a7b8d89..73687e03e4 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -7,8 +7,20 @@ typedef struct SpaprMachineStateNested { uint64_t ptcr; uint8_t api; #define NESTED_API_KVM_HV 1 + bool capabilities_set; + uint32_t pvr_base; } SpaprMachineStateNested; =20 +/* Nested PAPR API related macros */ +#define H_GUEST_CAPABILITIES_COPY_MEM 0x8000000000000000 +#define H_GUEST_CAPABILITIES_P9_MODE 0x4000000000000000 +#define H_GUEST_CAPABILITIES_P10_MODE 0x2000000000000000 +#define H_GUEST_CAP_VALID_MASK (H_GUEST_CAPABILITIES_P10_MODE | \ + H_GUEST_CAPABILITIES_P9_MODE) +#define H_GUEST_CAP_COPY_MEM_BMAP 0 +#define H_GUEST_CAP_P9_MODE_BMAP 1 +#define H_GUEST_CAP_P10_MODE_BMAP 2 + /* * Register state for entering a nested guest with H_ENTER_NESTED. * New member must be added at the end. --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263330; cv=none; d=zohomail.com; s=zohoarc; b=bZuNow65jrUqhlc5xNYi93+R4wd5kUiKyyGEyRJ1Kk0hUBoZCCME4W9wXmoWxqBgsCHpyTfRpEu5alA7L1MRFHe5MIA5M06o5kFJm0N4tTpcpTSNQ9D25u8+ggTIPqYcTi8/YQFUjrU51TsY+FgTj3wD0cjgLdGlFDKWeXeBk/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263330; 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=2rcEzjFiw//Qjpwo4SWUe5/5IQxOZFXiJDgJn5KABlY=; b=aJ7xkKeyJEN97lEHttBsLzSY6fPuvQYYHNEaRuf3xk8QImS8blQWw3XyKH1D/cWLeXigXbUealCe9kk5ozudbUVcdbGw0d9IkpHP+KsvsZuJg/Bkqta9pOzEKNntCL7F6rfXE2myjMl9IJ8ThiVCFKYQz7XbAKeQtymh5g7W2rE= 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 1710263330174646.0527168339125; Tue, 12 Mar 2024 10:08:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5X0-0003so-Mp; Tue, 12 Mar 2024 13:03:14 -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 1rk5Ur-0006ZI-9f; Tue, 12 Mar 2024 13:01:02 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Uo-0008Um-BB; Tue, 12 Mar 2024 13:01:01 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e649a2548cso4019269b3a.3; Tue, 12 Mar 2024 10:00:57 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262856; x=1710867656; 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=2rcEzjFiw//Qjpwo4SWUe5/5IQxOZFXiJDgJn5KABlY=; b=ebMV48tOZyzh3w+ILTvGsZ+k+CX5lU90GaLucmtDErd8DNxYW3EXrpSxnVdaK1dVER KvZ1KECfWtYFvEldjkviTC+ySll1RIa+TsJcF19XsyrJzggib1EAOP2BGIDX27v0Wbvb a2v2eNIBpZ2ey3+u9Q/yPlOmQ8wVKX01pm658TywJCXz8st/gtJNAY3pjMOHUuT10e7A i2lSxXCsz6dlSFA6uAuvYfnn2jFeioPOYqq2rwMdtNpJhZ+b/KK39MA5zcTfzHZi6aGK xUH38nYfcAvTp+rxP1nGJ/puYV1FJYSj85iDnIiDG4J+huKR4r3wngHT2MihVpBzOv6/ 1fyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262856; x=1710867656; 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=2rcEzjFiw//Qjpwo4SWUe5/5IQxOZFXiJDgJn5KABlY=; b=Fca2w32YfHEQ2HB/TGZffHe0N0PJmK69EEvvwnP5WtdWxOmxf/LUv4LbSdy1T1bW26 OQ5IHgx91GiDA0dU0rG2HE6NtXa/N/6M1tMlWzz5zhm+Dd8Yg8I06wd0ScgyMO6ueg5m J8MMYUH3ejL9bA7bxjxj2652VP63qzj+u9bJl8TSHkmiFxhDtQK8p8aYbyY0Uq8g3ckn meuCYWrgLtXy6AgrHJICM/iiBit7fS1N8blaatMd8pRd06CCEAULNoIUt5B1SPO2f7GY U4HiZwFuSdEIkX5n70aP6/IdvjglJZvesNWgsxVDp0nnAzJv5OAfi8U9E7URN8z/oIb9 EuvQ== X-Forwarded-Encrypted: i=1; AJvYcCW7wvGR2Lrs8BdRJS/G+OPv55KEjAyNYkjY7zlmp/MNRGdfs0j0n2fdy7wNPtB8ZAdvXrcdZR61R0G6KfsBaPvKAPE2 X-Gm-Message-State: AOJu0YzkcKgPj9cA6TKfISVVeofh1s0y20ssjgWlSH5w0ACPisPWRtuB l/nrKZIDBPNqzmofinJngErvje/M8dH6+01pMO40wF5ThGDGp/DjLzKguNnd8cc= X-Google-Smtp-Source: AGHT+IEn+h/SnxXCJXoyjUFH13z513+W0Mud8C2VR3i/IzrPuUy2s4QZCmgUAiT64afjE13BEYZxCw== X-Received: by 2002:a05:6a00:b49:b0:6e6:1b89:aef3 with SMTP id p9-20020a056a000b4900b006e61b89aef3mr37867pfo.14.1710262855996; Tue, 12 Mar 2024 10:00:55 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 31/38] spapr: nested: Introduce H_GUEST_[CREATE|DELETE] hcalls. Date: Wed, 13 Mar 2024 02:58:42 +1000 Message-ID: <20240312165851.2240242-32-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.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: 1710263331544100003 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Introduce the nested PAPR hcalls: - H_GUEST_CREATE which is used to create and allocate resources for nested guest being created. - H_GUEST_DELETE which is used to delete and deallocate resources for the nested guest being deleted. It also supports deleting all nested guests at once using a deleteAll flag. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 103 ++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 4 +- include/hw/ppc/spapr_nested.h | 7 +++ 3 files changed, 113 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index c35acee51f..1f6eb68b93 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -521,6 +521,105 @@ static target_ulong h_guest_set_capabilities(PowerPCC= PU *cpu, } } =20 +static void +destroy_guest_helper(gpointer value) +{ + struct SpaprMachineStateNestedGuest *guest =3D value; + g_free(guest); +} + +static target_ulong h_guest_create(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + CPUPPCState *env =3D &cpu->env; + target_ulong flags =3D args[0]; + target_ulong continue_token =3D args[1]; + uint64_t guestid; + int nguests =3D 0; + struct SpaprMachineStateNestedGuest *guest; + + if (flags) { /* don't handle any flags for now */ + return H_UNSUPPORTED_FLAG; + } + + if (continue_token !=3D -1) { + return H_P2; + } + + if (!spapr->nested.capabilities_set) { + return H_STATE; + } + + if (!spapr->nested.guests) { + spapr->nested.guests =3D g_hash_table_new_full(NULL, + NULL, + NULL, + destroy_guest_helper); + } + + nguests =3D g_hash_table_size(spapr->nested.guests); + + if (nguests =3D=3D PAPR_NESTED_GUEST_MAX) { + return H_NO_MEM; + } + + /* Lookup for available guestid */ + for (guestid =3D 1; guestid < PAPR_NESTED_GUEST_MAX; guestid++) { + if (!(g_hash_table_lookup(spapr->nested.guests, + GINT_TO_POINTER(guestid)))) { + break; + } + } + + if (guestid =3D=3D PAPR_NESTED_GUEST_MAX) { + return H_NO_MEM; + } + + guest =3D g_try_new0(struct SpaprMachineStateNestedGuest, 1); + if (!guest) { + return H_NO_MEM; + } + + guest->pvr_logical =3D spapr->nested.pvr_base; + g_hash_table_insert(spapr->nested.guests, GINT_TO_POINTER(guestid), gu= est); + env->gpr[4] =3D guestid; + + return H_SUCCESS; +} + +static target_ulong h_guest_delete(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + target_ulong flags =3D args[0]; + target_ulong guestid =3D args[1]; + struct SpaprMachineStateNestedGuest *guest; + + /* + * handle flag deleteAllGuests, if set: + * guestid is ignored and all guests are deleted + * + */ + if (flags & ~H_GUEST_DELETE_ALL_FLAG) { + return H_UNSUPPORTED_FLAG; /* other flag bits reserved */ + } else if (flags & H_GUEST_DELETE_ALL_FLAG) { + g_hash_table_destroy(spapr->nested.guests); + return H_SUCCESS; + } + + guest =3D g_hash_table_lookup(spapr->nested.guests, GINT_TO_POINTER(gu= estid)); + if (!guest) { + return H_P2; + } + + g_hash_table_remove(spapr->nested.guests, GINT_TO_POINTER(guestid)); + + return H_SUCCESS; +} + void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); @@ -543,12 +642,16 @@ void spapr_register_nested_papr(void) h_guest_get_capabilities); spapr_register_hypercall(H_GUEST_SET_CAPABILITIES, h_guest_set_capabilities); + spapr_register_hypercall(H_GUEST_CREATE, h_guest_create); + spapr_register_hypercall(H_GUEST_DELETE, h_guest_delete); } =20 void spapr_unregister_nested_papr(void) { spapr_unregister_hypercall(H_GUEST_GET_CAPABILITIES); spapr_unregister_hypercall(H_GUEST_SET_CAPABILITIES); + spapr_unregister_hypercall(H_GUEST_CREATE); + spapr_unregister_hypercall(H_GUEST_DELETE); } =20 #else diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 2906d59137..13416fc3d7 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -586,8 +586,10 @@ struct SpaprMachineState { #define H_WATCHDOG 0x45C #define H_GUEST_GET_CAPABILITIES 0x460 #define H_GUEST_SET_CAPABILITIES 0x464 +#define H_GUEST_CREATE 0x470 +#define H_GUEST_DELETE 0x488 =20 -#define MAX_HCALL_OPCODE H_GUEST_SET_CAPABILITIES +#define MAX_HCALL_OPCODE H_GUEST_DELETE =20 /* The hcalls above are standardized in PAPR and implemented by pHyp * as well. diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 73687e03e4..56d43e540b 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -9,8 +9,13 @@ typedef struct SpaprMachineStateNested { #define NESTED_API_KVM_HV 1 bool capabilities_set; uint32_t pvr_base; + GHashTable *guests; } SpaprMachineStateNested; =20 +typedef struct SpaprMachineStateNestedGuest { + uint32_t pvr_logical; +} SpaprMachineStateNestedGuest; + /* Nested PAPR API related macros */ #define H_GUEST_CAPABILITIES_COPY_MEM 0x8000000000000000 #define H_GUEST_CAPABILITIES_P9_MODE 0x4000000000000000 @@ -20,6 +25,8 @@ typedef struct SpaprMachineStateNested { #define H_GUEST_CAP_COPY_MEM_BMAP 0 #define H_GUEST_CAP_P9_MODE_BMAP 1 #define H_GUEST_CAP_P10_MODE_BMAP 2 +#define PAPR_NESTED_GUEST_MAX 4096 +#define H_GUEST_DELETE_ALL_FLAG 0x8000000000000000ULL =20 /* * Register state for entering a nested guest with H_ENTER_NESTED. --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263313; cv=none; d=zohomail.com; s=zohoarc; b=a8XTI7jrjziFDTWBv1GztuIHRPKdrbNz7RWdBV6cgiNEeOqF2F19wVCxn+J5dCSawFdG31BbcEWoV2MRM0su26keI7b44D9t8Ioa2WsJUnm86UuTpI8vTRPOPxeRmEGkctMH4VvqNg8XuLIUPG1eD9WzJ3O7G3UWj1WoMdkq7A8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263313; 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=ZxAZDNkVeicKPAVy4559sSS+y8z567HqIodOKDjwHAw=; b=EhKsM+sY+wBNp+ie+IpFk+uXGV/lnqFrqWeJgIxRuBPGoGGjXlMKuRp8NKIkiISoN+n0kb5vzBmm7YIdgAPtno454/OE1PL9wluTPa1tN7hpWEnJGbhiapfRNAl2e+qEzgqYBzGslVbsk/2aa7hhhmun1VL73JKDOz6WVQ23BCs= 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 1710263313970196.2577481668809; Tue, 12 Mar 2024 10:08:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Wy-0003ij-UJ; Tue, 12 Mar 2024 13:03:13 -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 1rk5Uu-0006e3-JK; Tue, 12 Mar 2024 13:01:10 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Us-0008VD-Qe; Tue, 12 Mar 2024 13:01:04 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e6adc557b6so613744b3a.2; Tue, 12 Mar 2024 10:01:01 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262860; x=1710867660; 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=ZxAZDNkVeicKPAVy4559sSS+y8z567HqIodOKDjwHAw=; b=KJldXMTckeIWiSdjk/wRV0AlkfgIHt8m/Hd5Iu9d1CBnsmBWUAAluwoVms9HZfMLMG 9rt50ap5z176oN+MBw6vpeyzqEGkhQxbI9K9FzZ+GbbSoMHvxtaYqbWKTXKYh9JiXby8 nitGJCTb+A8sAgtonOM3E4l1P1NyfJAKoJrNq2g+bK70pFo/kNu3xqMUItCCFGlbD5kc FI15c85P1VHHfqpxHTnu36AQID+sEDglCv/dbiQrztUrcXH8+01o+TOIOXKRapX14k3f x1S2KUfy3oZv9eP/VZevDkKA2rrAQZGwcLIGFNLavk7B6BWiFvVpCysORTsE/jzLrWeP FjTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262860; x=1710867660; 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=ZxAZDNkVeicKPAVy4559sSS+y8z567HqIodOKDjwHAw=; b=Du/gfOyvvuFFnNz6DuS2c+h0SdDTnJ1jQiZeKmY8RYUi9keBz8HDS4Ol/+WiMsBPpa Ul2rTmuEX9VtX2QMPZ5cM+S0ntRcU6o/PJv4rPvo9HxdJmJvf2kTcjJuFD6xaMFvPPjC ZMhLw2QutcYN2s8aSD9xrMjRX7kj4dPCC/dnAUVoqjK9Lxu0xf9odrZw1l1AhU/cElig RlQBoq61mQv9vRzCxTCvpKDNkK3FqHVioZe2ll4qFx4blTi76zSnvND01Yg7fic6AGNG pZVO5qGlg5QTK7OnyYcHYO3pZpLXno79MtsOg6b/aAi+Ss01+pUjseP4g/Lr7LR8aAsx rSHg== X-Forwarded-Encrypted: i=1; AJvYcCXu68DvBYQQfmzGYWeX61h8Sa0R07PftqIOYEn/7h08gKvWNXoN1Exoxdau/ob+dsipvT7JlwpnmUm8POozHUmw09q0 X-Gm-Message-State: AOJu0YzO/XQsTihlJJrAH6qxPf9P/IgRm/hgAvF96tdvQbo2arfG5E78 8nTAALuhwzXT4EbrTKj+NoPS7N5Ppe6AOW10c42z8z+PsuW8AVqxLKRTWw6q5jU= X-Google-Smtp-Source: AGHT+IF+zd89vHLmB71USiPGNDhEL/5CEgsZvqUEXzI4bt/aHFGlpiXKLwsxG77xG1M0sg2LIoPrag== X-Received: by 2002:a05:6a20:1456:b0:1a3:1246:c43e with SMTP id a22-20020a056a20145600b001a31246c43emr956956pzi.28.1710262859946; Tue, 12 Mar 2024 10:00:59 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 32/38] spapr: nested: Introduce H_GUEST_CREATE_VCPU hcall. Date: Wed, 13 Mar 2024 02:58:43 +1000 Message-ID: <20240312165851.2240242-33-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42c; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42c.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: 1710263315474100003 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Introduce the nested PAPR hcall H_GUEST_CREATE_VCPU which is used to create and initialize the specified VCPU resource for the previously created guest. Each guest can have multiple VCPUs upto max 2048. All VCPUs for a guest gets deallocated on guest delete. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 62 +++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 2 ++ include/hw/ppc/spapr_nested.h | 8 +++++ 3 files changed, 72 insertions(+) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 1f6eb68b93..72bf3dc6d4 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -8,6 +8,7 @@ #include "hw/ppc/spapr_nested.h" #include "mmu-book3s-v3.h" #include "cpu-models.h" +#include "qemu/log.h" =20 void spapr_nested_reset(SpaprMachineState *spapr) { @@ -434,6 +435,16 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp) } } =20 +static +SpaprMachineStateNestedGuest *spapr_get_nested_guest(SpaprMachineState *sp= apr, + target_ulong guestid) +{ + SpaprMachineStateNestedGuest *guest; + + guest =3D g_hash_table_lookup(spapr->nested.guests, GINT_TO_POINTER(gu= estid)); + return guest; +} + static target_ulong h_guest_get_capabilities(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, @@ -525,6 +536,7 @@ static void destroy_guest_helper(gpointer value) { struct SpaprMachineStateNestedGuest *guest =3D value; + g_free(guest->vcpus); g_free(guest); } =20 @@ -620,6 +632,54 @@ static target_ulong h_guest_delete(PowerPCCPU *cpu, return H_SUCCESS; } =20 +static target_ulong h_guest_create_vcpu(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + target_ulong flags =3D args[0]; + target_ulong guestid =3D args[1]; + target_ulong vcpuid =3D args[2]; + SpaprMachineStateNestedGuest *guest; + + if (flags) { /* don't handle any flags for now */ + return H_UNSUPPORTED_FLAG; + } + + guest =3D spapr_get_nested_guest(spapr, guestid); + if (!guest) { + return H_P2; + } + + if (vcpuid < guest->nr_vcpus) { + qemu_log_mask(LOG_UNIMP, "vcpuid " TARGET_FMT_ld " already in use.= ", + vcpuid); + return H_IN_USE; + } + /* linear vcpuid allocation only */ + assert(vcpuid =3D=3D guest->nr_vcpus); + + if (guest->nr_vcpus >=3D PAPR_NESTED_GUEST_VCPU_MAX) { + return H_P3; + } + + SpaprMachineStateNestedGuestVcpu *vcpus, *curr_vcpu; + vcpus =3D g_try_renew(struct SpaprMachineStateNestedGuestVcpu, + guest->vcpus, + guest->nr_vcpus + 1); + if (!vcpus) { + return H_NO_MEM; + } + guest->vcpus =3D vcpus; + curr_vcpu =3D &vcpus[guest->nr_vcpus]; + memset(curr_vcpu, 0, sizeof(SpaprMachineStateNestedGuestVcpu)); + + curr_vcpu->enabled =3D true; + guest->nr_vcpus++; + + return H_SUCCESS; +} + void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); @@ -644,6 +704,7 @@ void spapr_register_nested_papr(void) h_guest_set_capabilities); spapr_register_hypercall(H_GUEST_CREATE, h_guest_create); spapr_register_hypercall(H_GUEST_DELETE, h_guest_delete); + spapr_register_hypercall(H_GUEST_CREATE_VCPU, h_guest_create_vcpu); } =20 void spapr_unregister_nested_papr(void) @@ -652,6 +713,7 @@ void spapr_unregister_nested_papr(void) spapr_unregister_hypercall(H_GUEST_SET_CAPABILITIES); spapr_unregister_hypercall(H_GUEST_CREATE); spapr_unregister_hypercall(H_GUEST_DELETE); + spapr_unregister_hypercall(H_GUEST_CREATE_VCPU); } =20 #else diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 13416fc3d7..070135793a 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -365,6 +365,7 @@ struct SpaprMachineState { #define H_UNSUPPORTED -67 #define H_OVERLAP -68 #define H_STATE -75 +#define H_IN_USE -77 #define H_UNSUPPORTED_FLAG -256 #define H_MULTI_THREADS_ACTIVE -9005 =20 @@ -587,6 +588,7 @@ struct SpaprMachineState { #define H_GUEST_GET_CAPABILITIES 0x460 #define H_GUEST_SET_CAPABILITIES 0x464 #define H_GUEST_CREATE 0x470 +#define H_GUEST_CREATE_VCPU 0x474 #define H_GUEST_DELETE 0x488 =20 #define MAX_HCALL_OPCODE H_GUEST_DELETE diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 56d43e540b..2ac3076fac 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -14,6 +14,8 @@ typedef struct SpaprMachineStateNested { =20 typedef struct SpaprMachineStateNestedGuest { uint32_t pvr_logical; + unsigned long nr_vcpus; + struct SpaprMachineStateNestedGuestVcpu *vcpus; } SpaprMachineStateNestedGuest; =20 /* Nested PAPR API related macros */ @@ -27,6 +29,7 @@ typedef struct SpaprMachineStateNestedGuest { #define H_GUEST_CAP_P10_MODE_BMAP 2 #define PAPR_NESTED_GUEST_MAX 4096 #define H_GUEST_DELETE_ALL_FLAG 0x8000000000000000ULL +#define PAPR_NESTED_GUEST_VCPU_MAX 2048 =20 /* * Register state for entering a nested guest with H_ENTER_NESTED. @@ -120,6 +123,11 @@ struct nested_ppc_state { int64_t tb_offset; }; =20 +typedef struct SpaprMachineStateNestedGuestVcpu { + bool enabled; + struct nested_ppc_state state; +} SpaprMachineStateNestedGuestVcpu; + void spapr_exit_nested(PowerPCCPU *cpu, int excp); typedef struct SpaprMachineState SpaprMachineState; bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263531; cv=none; d=zohomail.com; s=zohoarc; b=DcMCdJIHpr8ZI+OBKlQFfB3wso1rgKz4ZA+NUrU98gE4I3FFgb+UJ1nUBaQVbLqoYVywT5qgFjhAJgttcRvIR/p6kf92fpIVI6SMcLa8kaK9vQFbXHU9DUcv2F4whEmGwmttThWm13fyxhEJ7U1te3pgjI6GHwWL6dByL1MuS6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263531; 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=2CypqX/Zjp70n1FIoUG4M+IW/+WsFwMUoVGMfQIzaMo=; b=HgPm/VXRXwb5SqaRujjpeeK6hBJQefOl0eXmqimW827YxAOQmtQyn4ycLGrGcL9k15zt1vwBHNHLbt8xbjUjgfBYt2pn8Dzo3mbM8G5HQjWUw7EWNPFQir0/GDdR9s38lAQMG8gpjBUuQy4zo+M+ma83TDlDF/LpRIEWfWjsI4Q= 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 1710263531975913.0277614056176; Tue, 12 Mar 2024 10:12:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5X3-0004Mo-Tz; Tue, 12 Mar 2024 13:03:18 -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 1rk5Uz-0006ra-CM; Tue, 12 Mar 2024 13:01:12 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Ux-0008W0-6F; Tue, 12 Mar 2024 13:01:08 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso3547291b3a.2; Tue, 12 Mar 2024 10:01:06 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262865; x=1710867665; 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=2CypqX/Zjp70n1FIoUG4M+IW/+WsFwMUoVGMfQIzaMo=; b=b/REzB6l7pbdOy+KUfM42WvGzdeVHZorqLfVlqv0A9Tky4v7568crIac870EU7+9/f /gQts3H2aaPqnZL8nzPDugaE249fC5SPZNSFQmfLp/IxqSTbdcRbDbR8xwP7R02MaYS3 SSkNiQ29FW1fhZS4TOKKJLu2sPbtFisky6ox8rg6ZgETokNzYbHCDAjr7bTDAOBukVhm UJd6Z6xhgaejNbH63mW52Fp2oxdlNH2OHAy/QMqZ17Jf65DIpk20tcItXlkaIGxdcb0V GayIkg3LxZzwuonp2CZ5kXFGbfKvDWLsIFSVDrZHa8BHLDGI2uc7JvW00HaphuDMSCZv xJeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262865; x=1710867665; 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=2CypqX/Zjp70n1FIoUG4M+IW/+WsFwMUoVGMfQIzaMo=; b=eGy/6gWDYfqZEXsGBmdQhK0mA0feq2ueZZ/i/ekQuDqUbaCdGcjnYkPJ9pV3gqA+aP aMZG9FfzK3vjUiLY3eYpBoCAQLqk99SI9nudI/IO4VagBvAHJe8+KQMRoAFNX3XGGEBg n8l9gkhX5yg5RF7+aL9Cb7bkefV0E4CPQjGwh/uUUvwqhfbN1b4jXR5PHsNSsnn15/U/ Kpk2CxaN7hSh3BLvoJ3EjDCOcELNTLHzXmnXf8YwPFwocFfy90WxoY3OsLOqm72RygXC R6SYMS1qRvFyl8SkQBGQqJpYGhMVnWRvtrGUMVqQLRfTaBNLkfGt/jpW8MZWVNqqiqlx orSw== X-Forwarded-Encrypted: i=1; AJvYcCW5td+a/D5VidgTXIWkjkw323Ij6vtj0bVwGiS6aPa2yGj/lEXXlwmBCa6rIenv9UscbOIW8mliFJLDg+AYxUUVy1dO X-Gm-Message-State: AOJu0YwOLNCGFOSUnN+ApOEYo33VGwMDgR5QAw9jH379tensqUZT8YQp L7LblhBsR3MbTChsmYigU0lqYpniT+MlJudDVz2hPOx2bQf04Baz7AUyDf2D2pI= X-Google-Smtp-Source: AGHT+IFJJxMYg0TP0UEwCYa/y+jNm4u4anAjhlnmR8IMi17UrIjCCksLKesHrMnQtMGV7dKJSm4xHg== X-Received: by 2002:a05:6a20:2443:b0:1a1:1022:45f0 with SMTP id t3-20020a056a20244300b001a1102245f0mr2450932pzc.54.1710262865335; Tue, 12 Mar 2024 10:01:05 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora Subject: [PULL 33/38] spapr: nested: Extend nested_ppc_state for nested PAPR API Date: Wed, 13 Mar 2024 02:58:44 +1000 Message-ID: <20240312165851.2240242-34-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42e; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42e.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: 1710263532461100009 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Currently, nested_ppc_state stores a certain set of registers and works with nested_[load|save]_state() for state transfer as reqd for nested-hv AP= I. Extending these with additional registers state as reqd for nested PAPR API. Acked-by: Nicholas Piggin Suggested-by: Nicholas Piggin Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 106 ++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr_nested.h | 50 ++++++++++++++++ target/ppc/cpu.h | 2 + 3 files changed, 158 insertions(+) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 72bf3dc6d4..6a2ff963c6 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -108,6 +108,7 @@ static target_ulong h_copy_tofrom_guest(PowerPCCPU *cpu, static void nested_save_state(struct nested_ppc_state *save, PowerPCCPU *c= pu) { CPUPPCState *env =3D &cpu->env; + SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 memcpy(save->gpr, env->gpr, sizeof(save->gpr)); =20 @@ -134,6 +135,58 @@ static void nested_save_state(struct nested_ppc_state = *save, PowerPCCPU *cpu) save->pidr =3D env->spr[SPR_BOOKS_PID]; save->ppr =3D env->spr[SPR_PPR]; =20 + if (spapr_nested_api(spapr) =3D=3D NESTED_API_PAPR) { + save->pvr =3D env->spr[SPR_PVR]; + save->amor =3D env->spr[SPR_AMOR]; + save->dawr0 =3D env->spr[SPR_DAWR0]; + save->dawrx0 =3D env->spr[SPR_DAWRX0]; + save->ciabr =3D env->spr[SPR_CIABR]; + save->purr =3D env->spr[SPR_PURR]; + save->spurr =3D env->spr[SPR_SPURR]; + save->ic =3D env->spr[SPR_IC]; + save->vtb =3D env->spr[SPR_VTB]; + save->hdar =3D env->spr[SPR_HDAR]; + save->hdsisr =3D env->spr[SPR_HDSISR]; + save->heir =3D env->spr[SPR_HEIR]; + save->asdr =3D env->spr[SPR_ASDR]; + save->dawr1 =3D env->spr[SPR_DAWR1]; + save->dawrx1 =3D env->spr[SPR_DAWRX1]; + save->dexcr =3D env->spr[SPR_DEXCR]; + save->hdexcr =3D env->spr[SPR_HDEXCR]; + save->hashkeyr =3D env->spr[SPR_HASHKEYR]; + save->hashpkeyr =3D env->spr[SPR_HASHPKEYR]; + memcpy(save->vsr, env->vsr, sizeof(save->vsr)); + save->ebbhr =3D env->spr[SPR_EBBHR]; + save->tar =3D env->spr[SPR_TAR]; + save->ebbrr =3D env->spr[SPR_EBBRR]; + save->bescr =3D env->spr[SPR_BESCR]; + save->iamr =3D env->spr[SPR_IAMR]; + save->amr =3D env->spr[SPR_AMR]; + save->uamor =3D env->spr[SPR_UAMOR]; + save->dscr =3D env->spr[SPR_DSCR]; + save->fscr =3D env->spr[SPR_FSCR]; + save->pspb =3D env->spr[SPR_PSPB]; + save->ctrl =3D env->spr[SPR_CTRL]; + save->vrsave =3D env->spr[SPR_VRSAVE]; + save->dar =3D env->spr[SPR_DAR]; + save->dsisr =3D env->spr[SPR_DSISR]; + save->pmc1 =3D env->spr[SPR_POWER_PMC1]; + save->pmc2 =3D env->spr[SPR_POWER_PMC2]; + save->pmc3 =3D env->spr[SPR_POWER_PMC3]; + save->pmc4 =3D env->spr[SPR_POWER_PMC4]; + save->pmc5 =3D env->spr[SPR_POWER_PMC5]; + save->pmc6 =3D env->spr[SPR_POWER_PMC6]; + save->mmcr0 =3D env->spr[SPR_POWER_MMCR0]; + save->mmcr1 =3D env->spr[SPR_POWER_MMCR1]; + save->mmcr2 =3D env->spr[SPR_POWER_MMCR2]; + save->mmcra =3D env->spr[SPR_POWER_MMCRA]; + save->sdar =3D env->spr[SPR_POWER_SDAR]; + save->siar =3D env->spr[SPR_POWER_SIAR]; + save->sier =3D env->spr[SPR_POWER_SIER]; + save->vscr =3D ppc_get_vscr(env); + save->fpscr =3D env->fpscr; + } + save->tb_offset =3D env->tb_env->tb_offset; } =20 @@ -141,6 +194,7 @@ static void nested_load_state(PowerPCCPU *cpu, struct n= ested_ppc_state *load) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; + SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 memcpy(env->gpr, load->gpr, sizeof(env->gpr)); =20 @@ -167,6 +221,58 @@ static void nested_load_state(PowerPCCPU *cpu, struct = nested_ppc_state *load) env->spr[SPR_BOOKS_PID] =3D load->pidr; env->spr[SPR_PPR] =3D load->ppr; =20 + if (spapr_nested_api(spapr) =3D=3D NESTED_API_PAPR) { + env->spr[SPR_PVR] =3D load->pvr; + env->spr[SPR_AMOR] =3D load->amor; + env->spr[SPR_DAWR0] =3D load->dawr0; + env->spr[SPR_DAWRX0] =3D load->dawrx0; + env->spr[SPR_CIABR] =3D load->ciabr; + env->spr[SPR_PURR] =3D load->purr; + env->spr[SPR_SPURR] =3D load->purr; + env->spr[SPR_IC] =3D load->ic; + env->spr[SPR_VTB] =3D load->vtb; + env->spr[SPR_HDAR] =3D load->hdar; + env->spr[SPR_HDSISR] =3D load->hdsisr; + env->spr[SPR_HEIR] =3D load->heir; + env->spr[SPR_ASDR] =3D load->asdr; + env->spr[SPR_DAWR1] =3D load->dawr1; + env->spr[SPR_DAWRX1] =3D load->dawrx1; + env->spr[SPR_DEXCR] =3D load->dexcr; + env->spr[SPR_HDEXCR] =3D load->hdexcr; + env->spr[SPR_HASHKEYR] =3D load->hashkeyr; + env->spr[SPR_HASHPKEYR] =3D load->hashpkeyr; + memcpy(env->vsr, load->vsr, sizeof(env->vsr)); + env->spr[SPR_EBBHR] =3D load->ebbhr; + env->spr[SPR_TAR] =3D load->tar; + env->spr[SPR_EBBRR] =3D load->ebbrr; + env->spr[SPR_BESCR] =3D load->bescr; + env->spr[SPR_IAMR] =3D load->iamr; + env->spr[SPR_AMR] =3D load->amr; + env->spr[SPR_UAMOR] =3D load->uamor; + env->spr[SPR_DSCR] =3D load->dscr; + env->spr[SPR_FSCR] =3D load->fscr; + env->spr[SPR_PSPB] =3D load->pspb; + env->spr[SPR_CTRL] =3D load->ctrl; + env->spr[SPR_VRSAVE] =3D load->vrsave; + env->spr[SPR_DAR] =3D load->dar; + env->spr[SPR_DSISR] =3D load->dsisr; + env->spr[SPR_POWER_PMC1] =3D load->pmc1; + env->spr[SPR_POWER_PMC2] =3D load->pmc2; + env->spr[SPR_POWER_PMC3] =3D load->pmc3; + env->spr[SPR_POWER_PMC4] =3D load->pmc4; + env->spr[SPR_POWER_PMC5] =3D load->pmc5; + env->spr[SPR_POWER_PMC6] =3D load->pmc6; + env->spr[SPR_POWER_MMCR0] =3D load->mmcr0; + env->spr[SPR_POWER_MMCR1] =3D load->mmcr1; + env->spr[SPR_POWER_MMCR2] =3D load->mmcr2; + env->spr[SPR_POWER_MMCRA] =3D load->mmcra; + env->spr[SPR_POWER_SDAR] =3D load->sdar; + env->spr[SPR_POWER_SIAR] =3D load->siar; + env->spr[SPR_POWER_SIER] =3D load->sier; + ppc_store_vscr(env, load->vscr); + ppc_store_fpscr(env, load->fpscr); + } + env->tb_env->tb_offset =3D load->tb_offset; =20 /* diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 2ac3076fac..d232014ccb 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -7,6 +7,7 @@ typedef struct SpaprMachineStateNested { uint64_t ptcr; uint8_t api; #define NESTED_API_KVM_HV 1 +#define NESTED_API_PAPR 2 bool capabilities_set; uint32_t pvr_base; GHashTable *guests; @@ -121,6 +122,55 @@ struct nested_ppc_state { uint64_t ppr; =20 int64_t tb_offset; + /* Nested PAPR API */ + uint64_t amor; + uint64_t dawr0; + uint64_t dawrx0; + uint64_t ciabr; + uint64_t purr; + uint64_t spurr; + uint64_t ic; + uint64_t vtb; + uint64_t hdar; + uint64_t hdsisr; + uint64_t heir; + uint64_t asdr; + uint64_t dawr1; + uint64_t dawrx1; + uint64_t dexcr; + uint64_t hdexcr; + uint64_t hashkeyr; + uint64_t hashpkeyr; + ppc_vsr_t vsr[64] QEMU_ALIGNED(16); + uint64_t ebbhr; + uint64_t tar; + uint64_t ebbrr; + uint64_t bescr; + uint64_t iamr; + uint64_t amr; + uint64_t uamor; + uint64_t dscr; + uint64_t fscr; + uint64_t pspb; + uint64_t ctrl; + uint64_t vrsave; + uint64_t dar; + uint64_t dsisr; + uint64_t pmc1; + uint64_t pmc2; + uint64_t pmc3; + uint64_t pmc4; + uint64_t pmc5; + uint64_t pmc6; + uint64_t mmcr0; + uint64_t mmcr1; + uint64_t mmcr2; + uint64_t mmcra; + uint64_t sdar; + uint64_t siar; + uint64_t sier; + uint32_t vscr; + uint64_t fpscr; }; =20 typedef struct SpaprMachineStateNestedGuestVcpu { diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 7c48b2eadb..be5f74a7cd 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1755,9 +1755,11 @@ void ppc_compat_add_property(Object *obj, const char= *name, #define SPR_PSPB (0x09F) #define SPR_DPDES (0x0B0) #define SPR_DAWR0 (0x0B4) +#define SPR_DAWR1 (0x0B5) #define SPR_RPR (0x0BA) #define SPR_CIABR (0x0BB) #define SPR_DAWRX0 (0x0BC) +#define SPR_DAWRX1 (0x0BD) #define SPR_HFSCR (0x0BE) #define SPR_VRSAVE (0x100) #define SPR_USPRG0 (0x100) --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263203; cv=none; d=zohomail.com; s=zohoarc; b=DOlEAoe5fVou41D9rteiS54eZL3xKsdrZlHTrOO1WIpBYfZowgCPdvmulznPHm9R76NJ4hRSmyt5NwLUeOUgEN2ns6xPp0oNCpzsFO2Dfl4Ga+9MzhGJgR7a1WkzswlvtBRHwqcAFZL2lYnllsV41Sz5oJhx8QmCjWCcDLcHEpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263203; 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=JNjnT7PPQhPO/nhcsdiRMeMLdPFPJxWh3ZYSy3UHgdU=; b=ZPRv3UtAB3RxgVC07dtHVqsT+5Vsu3bLBb2FOsWy/A4R+AM6jRwX6GkSAGccxNqb0qF1xUI+UOiGitCyzK1Ig5yFO1C6A5xbYoyNE8qaDERJ+Zfry2W9OpEV91UkkW2IdxJlxej7YsdQTiACYD4AdIy96BJNWXX+jKtWyZsQChc= 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 1710263203125747.6024326438312; Tue, 12 Mar 2024 10:06:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5YS-00087w-6v; Tue, 12 Mar 2024 13:04:48 -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 1rk5VD-00078E-77; Tue, 12 Mar 2024 13:01:24 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5V5-000057-Mr; Tue, 12 Mar 2024 13:01:22 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6e5a232fe80so42332b3a.0; Tue, 12 Mar 2024 10:01:12 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262871; x=1710867671; 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=JNjnT7PPQhPO/nhcsdiRMeMLdPFPJxWh3ZYSy3UHgdU=; b=QoCZyf/P3+MBkwtR32Fe1HcmekLOxKv+pJ2qlJBa3GYPAQu20f6NgP81cPc9vUcCtt uni61MC6hYLPOBjlk7Uou3ke9du8AAwuMkB2CHlOoLLG46nFR8/KWJocrrJ1ayLFRvz+ yT6SLxC1OmqyopgiYdcpLe8NzzZP0ZDIFjJxelaAZj9odD0/YxHtBAX13t4QMC/3EOv3 iiGH5W2uX3hYqQW+tHo8AvGbGmATHGwjx/p6Bmb96Rgjyd6Gu2UcCQyBEYPep3UAdOqr 5XHIlkZkVhq/vHWaMrSFGTZKFC8WIHa4nZLsgTqt3dA2FdzdZWFfayq4w8g3RvKIF+o1 GuAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262871; x=1710867671; 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=JNjnT7PPQhPO/nhcsdiRMeMLdPFPJxWh3ZYSy3UHgdU=; b=Txk6zQ9H6eVns7df2+W+iT7TrIWtA3jRnUrW70hoWsW0GfZWc/6ycrACF02mXByANz n+A2RH0NgvmrdeXLVP7BVrbNqomArw5WDoyeKo7Si7XFYe2IurIS4rZ6nv7Ry1/HOFGg EfzwvwZzcplxjEIkH+pEee9DzHCkwDW1ueUegff32o1l0pnLHcww7qgO+Cq5P0z4o1g/ ed1tCk8ZK8ECsXDYf+dN07/0GHbKSl5oM59EUhkMbi+I+fvca3FE22D/OYyFNBkt+uKB B2MtPCn1ygV2A7UyKQqFRlWWfiNAw1CLCB/y1kTGaQVi6Pqt/6WIp+f5h+AbVjRaU+Am JwLw== X-Forwarded-Encrypted: i=1; AJvYcCUIf6w2pRezwD36gMeBttoCOGnG7vrTdm61dMeBBsfS8xMUWqRfGDuRKAmw0K+lBlA1A48Jo+x94OV7FqpSBhTawM51 X-Gm-Message-State: AOJu0YxDp9Od3NIvju3met6WEORGJVTAVKW+HixcU4uRTnzWnwV+Vluc 9Ni2NXVNdZthBhMfl/zw7+bQVeNtJ9c6yqGfaMP4WhPpi5AH8ltKbbXqtULa8D0= X-Google-Smtp-Source: AGHT+IGqLtvZc1SRnAfX4yy6vEc/FLz91vdeGhXJcgg29cx1co0lkKgSxex2r9A89zjNV1X+71nxBw== X-Received: by 2002:a05:6a00:93a1:b0:6e6:a004:aaed with SMTP id ka33-20020a056a0093a100b006e6a004aaedmr26637pfb.5.1710262870592; Tue, 12 Mar 2024 10:01:10 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling , Shivaprasad G Bhat , Amit Machhiwal Subject: [PULL 34/38] spapr: nested: Initialize the GSB elements lookup table. Date: Wed, 13 Mar 2024 02:58:45 +1000 Message-ID: <20240312165851.2240242-35-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42b; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42b.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: 1710263205033100010 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Nested PAPR API provides a standard Guest State Buffer (GSB) format with unique IDs for each guest state element for which get/set state is supported by the API. Some of the elements are read-only and/or guest-wide. Introducing additional required GSB elements and helper routines for state exchange of each of the nested guest state elements for which get/set state should be supported by the API. [amachhiw: set the PCR whenever logical PVR is set] Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Shivaprasad G Bhat Signed-off-by: Amit Machhiwal Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 487 +++++++++++++++++++++++++++++++++- include/hw/ppc/spapr_nested.h | 313 ++++++++++++++++++++++ 2 files changed, 798 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 6a2ff963c6..cd7fa90350 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -19,6 +19,7 @@ void spapr_nested_reset(SpaprMachineState *spapr) } else { spapr->nested.api =3D 0; spapr->nested.capabilities_set =3D false; + spapr_nested_gsb_init(); } } =20 @@ -136,7 +137,6 @@ static void nested_save_state(struct nested_ppc_state *= save, PowerPCCPU *cpu) save->ppr =3D env->spr[SPR_PPR]; =20 if (spapr_nested_api(spapr) =3D=3D NESTED_API_PAPR) { - save->pvr =3D env->spr[SPR_PVR]; save->amor =3D env->spr[SPR_AMOR]; save->dawr0 =3D env->spr[SPR_DAWR0]; save->dawrx0 =3D env->spr[SPR_DAWRX0]; @@ -222,7 +222,6 @@ static void nested_load_state(PowerPCCPU *cpu, struct n= ested_ppc_state *load) env->spr[SPR_PPR] =3D load->ppr; =20 if (spapr_nested_api(spapr) =3D=3D NESTED_API_PAPR) { - env->spr[SPR_PVR] =3D load->pvr; env->spr[SPR_AMOR] =3D load->amor; env->spr[SPR_DAWR0] =3D load->dawr0; env->spr[SPR_DAWRX0] =3D load->dawrx0; @@ -551,6 +550,485 @@ SpaprMachineStateNestedGuest *spapr_get_nested_guest(= SpaprMachineState *spapr, return guest; } =20 +static bool spapr_nested_vcpu_check(SpaprMachineStateNestedGuest *guest, + target_ulong vcpuid, bool inoutbuf) +{ + struct SpaprMachineStateNestedGuestVcpu *vcpu; + /* + * Perform sanity checks for the provided vcpuid of a guest. + * For now, ensure its valid, allocated and enabled for use. + */ + + if (vcpuid >=3D PAPR_NESTED_GUEST_VCPU_MAX) { + return false; + } + + if (!(vcpuid < guest->nr_vcpus)) { + return false; + } + + vcpu =3D &guest->vcpus[vcpuid]; + if (!vcpu->enabled) { + return false; + } + + if (!inoutbuf) { + return true; + } + + /* Check to see if the in/out buffers are registered */ + if (vcpu->runbufin.addr && vcpu->runbufout.addr) { + return true; + } + + return false; +} + +static void *get_vcpu_state_ptr(SpaprMachineStateNestedGuest *guest, + target_ulong vcpuid) +{ + assert(spapr_nested_vcpu_check(guest, vcpuid, false)); + return &guest->vcpus[vcpuid].state; +} + +static void *get_vcpu_ptr(SpaprMachineStateNestedGuest *guest, + target_ulong vcpuid) +{ + assert(spapr_nested_vcpu_check(guest, vcpuid, false)); + return &guest->vcpus[vcpuid]; +} + +static void *get_guest_ptr(SpaprMachineStateNestedGuest *guest, + target_ulong vcpuid) +{ + return guest; /* for GSBE_NESTED */ +} + +/* + * set=3D1 means the L1 is trying to set some state + * set=3D0 means the L1 is trying to get some state + */ +static void copy_state_8to8(void *a, void *b, bool set) +{ + /* set takes from the Big endian element_buf and sets internal buffer = */ + + if (set) { + *(uint64_t *)a =3D be64_to_cpu(*(uint64_t *)b); + } else { + *(uint64_t *)b =3D cpu_to_be64(*(uint64_t *)a); + } +} + +static void copy_state_4to4(void *a, void *b, bool set) +{ + if (set) { + *(uint32_t *)a =3D be32_to_cpu(*(uint32_t *)b); + } else { + *(uint32_t *)b =3D cpu_to_be32(*((uint32_t *)a)); + } +} + +static void copy_state_16to16(void *a, void *b, bool set) +{ + uint64_t *src, *dst; + + if (set) { + src =3D b; + dst =3D a; + + dst[1] =3D be64_to_cpu(src[0]); + dst[0] =3D be64_to_cpu(src[1]); + } else { + src =3D a; + dst =3D b; + + dst[1] =3D cpu_to_be64(src[0]); + dst[0] =3D cpu_to_be64(src[1]); + } +} + +static void copy_state_4to8(void *a, void *b, bool set) +{ + if (set) { + *(uint64_t *)a =3D (uint64_t) be32_to_cpu(*(uint32_t *)b); + } else { + *(uint32_t *)b =3D cpu_to_be32((uint32_t) (*((uint64_t *)a))); + } +} + +static void copy_state_pagetbl(void *a, void *b, bool set) +{ + uint64_t *pagetbl; + uint64_t *buf; /* 3 double words */ + uint64_t rts; + + assert(set); + + pagetbl =3D a; + buf =3D b; + + *pagetbl =3D be64_to_cpu(buf[0]); + /* as per ISA section 6.7.6.1 */ + *pagetbl |=3D PATE0_HR; /* Host Radix bit is 1 */ + + /* RTS */ + rts =3D be64_to_cpu(buf[1]); + assert(rts =3D=3D 52); + rts =3D rts - 31; /* since radix tree size =3D 2^(RTS+31) */ + *pagetbl |=3D ((rts & 0x7) << 5); /* RTS2 is bit 56:58 */ + *pagetbl |=3D (((rts >> 3) & 0x3) << 61); /* RTS1 is bit 1:2 */ + + /* RPDS {Size =3D 2^(RPDS+3) , RPDS >=3D5} */ + *pagetbl |=3D 63 - clz64(be64_to_cpu(buf[2])) - 3; +} + +static void copy_state_proctbl(void *a, void *b, bool set) +{ + uint64_t *proctbl; + uint64_t *buf; /* 2 double words */ + + assert(set); + + proctbl =3D a; + buf =3D b; + /* PRTB: Process Table Base */ + *proctbl =3D be64_to_cpu(buf[0]); + /* PRTS: Process Table Size =3D 2^(12+PRTS) */ + if (be64_to_cpu(buf[1]) =3D=3D (1ULL << 12)) { + *proctbl |=3D 0; + } else if (be64_to_cpu(buf[1]) =3D=3D (1ULL << 24)) { + *proctbl |=3D 12; + } else { + g_assert_not_reached(); + } +} + +static void copy_state_runbuf(void *a, void *b, bool set) +{ + uint64_t *buf; /* 2 double words */ + struct SpaprMachineStateNestedGuestVcpuRunBuf *runbuf; + + assert(set); + + runbuf =3D a; + buf =3D b; + + runbuf->addr =3D be64_to_cpu(buf[0]); + assert(runbuf->addr); + + /* per spec */ + assert(be64_to_cpu(buf[1]) <=3D 16384); + + /* + * This will also hit in the input buffer but should be fine for + * now. If not we can split this function. + */ + assert(be64_to_cpu(buf[1]) >=3D VCPU_OUT_BUF_MIN_SZ); + + runbuf->size =3D be64_to_cpu(buf[1]); +} + +/* tell the L1 how big we want the output vcpu run buffer */ +static void out_buf_min_size(void *a, void *b, bool set) +{ + uint64_t *buf; /* 1 double word */ + + assert(!set); + + buf =3D b; + + buf[0] =3D cpu_to_be64(VCPU_OUT_BUF_MIN_SZ); +} + +static void copy_logical_pvr(void *a, void *b, bool set) +{ + SpaprMachineStateNestedGuest *guest; + uint32_t *buf; /* 1 word */ + uint32_t *pvr_logical_ptr; + uint32_t pvr_logical; + target_ulong pcr =3D 0; + + pvr_logical_ptr =3D a; + buf =3D b; + + if (!set) { + buf[0] =3D cpu_to_be32(*pvr_logical_ptr); + return; + } + + pvr_logical =3D be32_to_cpu(buf[0]); + + *pvr_logical_ptr =3D pvr_logical; + + if (*pvr_logical_ptr) { + switch (*pvr_logical_ptr) { + case CPU_POWERPC_LOGICAL_3_10: + pcr =3D PCR_COMPAT_3_10 | PCR_COMPAT_3_00; + break; + case CPU_POWERPC_LOGICAL_3_00: + pcr =3D PCR_COMPAT_3_00; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, + "Could not set PCR for LPVR=3D0x%08x\n", + *pvr_logical_ptr); + return; + } + } + + guest =3D container_of(pvr_logical_ptr, + struct SpaprMachineStateNestedGuest, + pvr_logical); + for (int i =3D 0; i < guest->nr_vcpus; i++) { + guest->vcpus[i].state.pcr =3D ~pcr | HVMASK_PCR; + } +} + +static void copy_tb_offset(void *a, void *b, bool set) +{ + SpaprMachineStateNestedGuest *guest; + uint64_t *buf; /* 1 double word */ + uint64_t *tb_offset_ptr; + uint64_t tb_offset; + + tb_offset_ptr =3D a; + buf =3D b; + + if (!set) { + buf[0] =3D cpu_to_be64(*tb_offset_ptr); + return; + } + + tb_offset =3D be64_to_cpu(buf[0]); + /* need to copy this to the individual tb_offset for each vcpu */ + guest =3D container_of(tb_offset_ptr, + struct SpaprMachineStateNestedGuest, + tb_offset); + for (int i =3D 0; i < guest->nr_vcpus; i++) { + guest->vcpus[i].tb_offset =3D tb_offset; + } +} + +static void copy_state_hdecr(void *a, void *b, bool set) +{ + uint64_t *buf; /* 1 double word */ + uint64_t *hdecr_expiry_tb; + + hdecr_expiry_tb =3D a; + buf =3D b; + + if (!set) { + buf[0] =3D cpu_to_be64(*hdecr_expiry_tb); + return; + } + + *hdecr_expiry_tb =3D be64_to_cpu(buf[0]); +} + +struct guest_state_element_type guest_state_element_types[] =3D { + GUEST_STATE_ELEMENT_NOP(GSB_HV_VCPU_IGNORED_ID, 0), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR0, gpr[0]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR1, gpr[1]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR2, gpr[2]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR3, gpr[3]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR4, gpr[4]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR5, gpr[5]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR6, gpr[6]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR7, gpr[7]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR8, gpr[8]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR9, gpr[9]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR10, gpr[10]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR11, gpr[11]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR12, gpr[12]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR13, gpr[13]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR14, gpr[14]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR15, gpr[15]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR16, gpr[16]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR17, gpr[17]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR18, gpr[18]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR19, gpr[19]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR20, gpr[20]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR21, gpr[21]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR22, gpr[22]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR23, gpr[23]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR24, gpr[24]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR25, gpr[25]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR26, gpr[26]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR27, gpr[27]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR28, gpr[28]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR29, gpr[29]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR30, gpr[30]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_GPR31, gpr[31]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_NIA, nip), + GSE_ENV_DWM(GSB_VCPU_SPR_MSR, msr, HVMASK_MSR), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_CTR, ctr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_LR, lr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_XER, xer), + GUEST_STATE_ELEMENT_ENV_WW(GSB_VCPU_SPR_CR, cr), + GUEST_STATE_ELEMENT_NOP_DW(GSB_VCPU_SPR_MMCR3), + GUEST_STATE_ELEMENT_NOP_DW(GSB_VCPU_SPR_SIER2), + GUEST_STATE_ELEMENT_NOP_DW(GSB_VCPU_SPR_SIER3), + GUEST_STATE_ELEMENT_NOP_W(GSB_VCPU_SPR_WORT), + GSE_ENV_DWM(GSB_VCPU_SPR_LPCR, lpcr, HVMASK_LPCR), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_AMOR, amor), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_HFSCR, hfscr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_DAWR0, dawr0), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_DAWRX0, dawrx0), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_CIABR, ciabr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_PURR, purr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SPURR, spurr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_IC, ic), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_VTB, vtb), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_HDAR, hdar), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_HDSISR, hdsisr), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_HEIR, heir), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_ASDR, asdr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SRR0, srr0), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SRR1, srr1), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SPRG0, sprg0), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SPRG1, sprg1), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SPRG2, sprg2), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SPRG3, sprg3), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PIDR, pidr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_CFAR, cfar), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_PPR, ppr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_DAWR1, dawr1), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_DAWRX1, dawrx1), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_DEXCR, dexcr), + GSE_ENV_DWM(GSB_VCPU_SPR_HDEXCR, hdexcr, HVMASK_HDEXCR), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_HASHKEYR, hashkeyr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_HASHPKEYR, hashpkeyr), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR0, vsr[0]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR1, vsr[1]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR2, vsr[2]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR3, vsr[3]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR4, vsr[4]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR5, vsr[5]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR6, vsr[6]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR7, vsr[7]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR8, vsr[8]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR9, vsr[9]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR10, vsr[10]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR11, vsr[11]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR12, vsr[12]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR13, vsr[13]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR14, vsr[14]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR15, vsr[15]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR16, vsr[16]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR17, vsr[17]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR18, vsr[18]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR19, vsr[19]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR20, vsr[20]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR21, vsr[21]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR22, vsr[22]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR23, vsr[23]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR24, vsr[24]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR25, vsr[25]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR26, vsr[26]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR27, vsr[27]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR28, vsr[28]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR29, vsr[29]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR30, vsr[30]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR31, vsr[31]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR32, vsr[32]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR33, vsr[33]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR34, vsr[34]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR35, vsr[35]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR36, vsr[36]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR37, vsr[37]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR38, vsr[38]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR39, vsr[39]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR40, vsr[40]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR41, vsr[41]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR42, vsr[42]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR43, vsr[43]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR44, vsr[44]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR45, vsr[45]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR46, vsr[46]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR47, vsr[47]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR48, vsr[48]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR49, vsr[49]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR50, vsr[50]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR51, vsr[51]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR52, vsr[52]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR53, vsr[53]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR54, vsr[54]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR55, vsr[55]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR56, vsr[56]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR57, vsr[57]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR58, vsr[58]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR59, vsr[59]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR60, vsr[60]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR61, vsr[61]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR62, vsr[62]), + GUEST_STATE_ELEMENT_ENV_QW(GSB_VCPU_SPR_VSR63, vsr[63]), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_EBBHR, ebbhr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_TAR, tar), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_EBBRR, ebbrr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_BESCR, bescr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_IAMR, iamr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_AMR, amr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_UAMOR, uamor), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_DSCR, dscr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_FSCR, fscr), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PSPB, pspb), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_CTRL, ctrl), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_VRSAVE, vrsave), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_DAR, dar), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_DSISR, dsisr), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PMC1, pmc1), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PMC2, pmc2), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PMC3, pmc3), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PMC4, pmc4), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PMC5, pmc5), + GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_PMC6, pmc6), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_MMCR0, mmcr0), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_MMCR1, mmcr1), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_MMCR2, mmcr2), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_MMCRA, mmcra), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SDAR , sdar), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SIAR , siar), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_SIER , sier), + GUEST_STATE_ELEMENT_ENV_WW(GSB_VCPU_SPR_VSCR, vscr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_SPR_FPSCR, fpscr), + GUEST_STATE_ELEMENT_ENV_DW(GSB_VCPU_DEC_EXPIRE_TB, dec_expiry_tb), + GSBE_NESTED(GSB_PART_SCOPED_PAGETBL, 0x18, parttbl[0], copy_state_pag= etbl), + GSBE_NESTED(GSB_PROCESS_TBL, 0x10, parttbl[1], copy_state_pro= ctbl), + GSBE_NESTED(GSB_VCPU_LPVR, 0x4, pvr_logical, copy_logical_p= vr), + GSBE_NESTED_MSK(GSB_TB_OFFSET, 0x8, tb_offset, copy_tb_offset, + HVMASK_TB_OFFSET), + GSBE_NESTED_VCPU(GSB_VCPU_IN_BUFFER, 0x10, runbufin, copy_state_run= buf), + GSBE_NESTED_VCPU(GSB_VCPU_OUT_BUFFER, 0x10, runbufout, copy_state_ru= nbuf), + GSBE_NESTED_VCPU(GSB_VCPU_OUT_BUF_MIN_SZ, 0x8, runbufout, out_buf_min_= size), + GSBE_NESTED_VCPU(GSB_VCPU_HDEC_EXPIRY_TB, 0x8, hdecr_expiry_tb, + copy_state_hdecr) +}; + +void spapr_nested_gsb_init(void) +{ + struct guest_state_element_type *type; + + /* Init the guest state elements lookup table, flags for now */ + for (int i =3D 0; i < ARRAY_SIZE(guest_state_element_types); i++) { + type =3D &guest_state_element_types[i]; + + assert(type->id <=3D GSB_LAST); + if (type->id >=3D GSB_VCPU_SPR_HDAR) + /* 0xf000 - 0xf005 Thread + RO */ + type->flags =3D GUEST_STATE_ELEMENT_TYPE_FLAG_READ_ONLY; + else if (type->id >=3D GSB_VCPU_IN_BUFFER) + /* 0x0c00 - 0xf000 Thread + RW */ + type->flags =3D 0; + else if (type->id >=3D GSB_VCPU_LPVR) + /* 0x0003 - 0x0bff Guest + RW */ + type->flags =3D GUEST_STATE_ELEMENT_TYPE_FLAG_GUEST_WIDE; + else if (type->id >=3D GSB_HV_VCPU_STATE_SIZE) + /* 0x0001 - 0x0002 Guest + RO */ + type->flags =3D GUEST_STATE_ELEMENT_TYPE_FLAG_READ_ONLY | + GUEST_STATE_ELEMENT_TYPE_FLAG_GUEST_WIDE; + } +} + static target_ulong h_guest_get_capabilities(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, @@ -854,4 +1332,9 @@ void spapr_unregister_nested_papr(void) /* DO NOTHING */ } =20 +void spapr_nested_gsb_init(void) +{ + /* DO NOTHING */ +} + #endif diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index d232014ccb..3da02df7bb 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -3,6 +3,191 @@ =20 #include "target/ppc/cpu.h" =20 +/* Guest State Buffer Element IDs */ +#define GSB_HV_VCPU_IGNORED_ID 0x0000 /* An element whose value is ignore= d */ +#define GSB_HV_VCPU_STATE_SIZE 0x0001 /* HV internal format VCPU state si= ze */ +#define GSB_VCPU_OUT_BUF_MIN_SZ 0x0002 /* Min size of the Run VCPU o/p buf= fer */ +#define GSB_VCPU_LPVR 0x0003 /* Logical PVR */ +#define GSB_TB_OFFSET 0x0004 /* Timebase Offset */ +#define GSB_PART_SCOPED_PAGETBL 0x0005 /* Partition Scoped Page Table */ +#define GSB_PROCESS_TBL 0x0006 /* Process Table */ + /* RESERVED 0x0007 - 0x0BFF */ +#define GSB_VCPU_IN_BUFFER 0x0C00 /* Run VCPU Input Buffer */ +#define GSB_VCPU_OUT_BUFFER 0x0C01 /* Run VCPU Out Buffer */ +#define GSB_VCPU_VPA 0x0C02 /* HRA to Guest VCPU VPA */ + /* RESERVED 0x0C03 - 0x0FFF */ +#define GSB_VCPU_GPR0 0x1000 +#define GSB_VCPU_GPR1 0x1001 +#define GSB_VCPU_GPR2 0x1002 +#define GSB_VCPU_GPR3 0x1003 +#define GSB_VCPU_GPR4 0x1004 +#define GSB_VCPU_GPR5 0x1005 +#define GSB_VCPU_GPR6 0x1006 +#define GSB_VCPU_GPR7 0x1007 +#define GSB_VCPU_GPR8 0x1008 +#define GSB_VCPU_GPR9 0x1009 +#define GSB_VCPU_GPR10 0x100A +#define GSB_VCPU_GPR11 0x100B +#define GSB_VCPU_GPR12 0x100C +#define GSB_VCPU_GPR13 0x100D +#define GSB_VCPU_GPR14 0x100E +#define GSB_VCPU_GPR15 0x100F +#define GSB_VCPU_GPR16 0x1010 +#define GSB_VCPU_GPR17 0x1011 +#define GSB_VCPU_GPR18 0x1012 +#define GSB_VCPU_GPR19 0x1013 +#define GSB_VCPU_GPR20 0x1014 +#define GSB_VCPU_GPR21 0x1015 +#define GSB_VCPU_GPR22 0x1016 +#define GSB_VCPU_GPR23 0x1017 +#define GSB_VCPU_GPR24 0x1018 +#define GSB_VCPU_GPR25 0x1019 +#define GSB_VCPU_GPR26 0x101A +#define GSB_VCPU_GPR27 0x101B +#define GSB_VCPU_GPR28 0x101C +#define GSB_VCPU_GPR29 0x101D +#define GSB_VCPU_GPR30 0x101E +#define GSB_VCPU_GPR31 0x101F +#define GSB_VCPU_HDEC_EXPIRY_TB 0x1020 +#define GSB_VCPU_SPR_NIA 0x1021 +#define GSB_VCPU_SPR_MSR 0x1022 +#define GSB_VCPU_SPR_LR 0x1023 +#define GSB_VCPU_SPR_XER 0x1024 +#define GSB_VCPU_SPR_CTR 0x1025 +#define GSB_VCPU_SPR_CFAR 0x1026 +#define GSB_VCPU_SPR_SRR0 0x1027 +#define GSB_VCPU_SPR_SRR1 0x1028 +#define GSB_VCPU_SPR_DAR 0x1029 +#define GSB_VCPU_DEC_EXPIRE_TB 0x102A +#define GSB_VCPU_SPR_VTB 0x102B +#define GSB_VCPU_SPR_LPCR 0x102C +#define GSB_VCPU_SPR_HFSCR 0x102D +#define GSB_VCPU_SPR_FSCR 0x102E +#define GSB_VCPU_SPR_FPSCR 0x102F +#define GSB_VCPU_SPR_DAWR0 0x1030 +#define GSB_VCPU_SPR_DAWR1 0x1031 +#define GSB_VCPU_SPR_CIABR 0x1032 +#define GSB_VCPU_SPR_PURR 0x1033 +#define GSB_VCPU_SPR_SPURR 0x1034 +#define GSB_VCPU_SPR_IC 0x1035 +#define GSB_VCPU_SPR_SPRG0 0x1036 +#define GSB_VCPU_SPR_SPRG1 0x1037 +#define GSB_VCPU_SPR_SPRG2 0x1038 +#define GSB_VCPU_SPR_SPRG3 0x1039 +#define GSB_VCPU_SPR_PPR 0x103A +#define GSB_VCPU_SPR_MMCR0 0x103B +#define GSB_VCPU_SPR_MMCR1 0x103C +#define GSB_VCPU_SPR_MMCR2 0x103D +#define GSB_VCPU_SPR_MMCR3 0x103E +#define GSB_VCPU_SPR_MMCRA 0x103F +#define GSB_VCPU_SPR_SIER 0x1040 +#define GSB_VCPU_SPR_SIER2 0x1041 +#define GSB_VCPU_SPR_SIER3 0x1042 +#define GSB_VCPU_SPR_BESCR 0x1043 +#define GSB_VCPU_SPR_EBBHR 0x1044 +#define GSB_VCPU_SPR_EBBRR 0x1045 +#define GSB_VCPU_SPR_AMR 0x1046 +#define GSB_VCPU_SPR_IAMR 0x1047 +#define GSB_VCPU_SPR_AMOR 0x1048 +#define GSB_VCPU_SPR_UAMOR 0x1049 +#define GSB_VCPU_SPR_SDAR 0x104A +#define GSB_VCPU_SPR_SIAR 0x104B +#define GSB_VCPU_SPR_DSCR 0x104C +#define GSB_VCPU_SPR_TAR 0x104D +#define GSB_VCPU_SPR_DEXCR 0x104E +#define GSB_VCPU_SPR_HDEXCR 0x104F +#define GSB_VCPU_SPR_HASHKEYR 0x1050 +#define GSB_VCPU_SPR_HASHPKEYR 0x1051 +#define GSB_VCPU_SPR_CTRL 0x1052 + /* RESERVED 0x1053 - 0x1FFF */ +#define GSB_VCPU_SPR_CR 0x2000 +#define GSB_VCPU_SPR_PIDR 0x2001 +#define GSB_VCPU_SPR_DSISR 0x2002 +#define GSB_VCPU_SPR_VSCR 0x2003 +#define GSB_VCPU_SPR_VRSAVE 0x2004 +#define GSB_VCPU_SPR_DAWRX0 0x2005 +#define GSB_VCPU_SPR_DAWRX1 0x2006 +#define GSB_VCPU_SPR_PMC1 0x2007 +#define GSB_VCPU_SPR_PMC2 0x2008 +#define GSB_VCPU_SPR_PMC3 0x2009 +#define GSB_VCPU_SPR_PMC4 0x200A +#define GSB_VCPU_SPR_PMC5 0x200B +#define GSB_VCPU_SPR_PMC6 0x200C +#define GSB_VCPU_SPR_WORT 0x200D +#define GSB_VCPU_SPR_PSPB 0x200E + /* RESERVED 0x200F - 0x2FFF */ +#define GSB_VCPU_SPR_VSR0 0x3000 +#define GSB_VCPU_SPR_VSR1 0x3001 +#define GSB_VCPU_SPR_VSR2 0x3002 +#define GSB_VCPU_SPR_VSR3 0x3003 +#define GSB_VCPU_SPR_VSR4 0x3004 +#define GSB_VCPU_SPR_VSR5 0x3005 +#define GSB_VCPU_SPR_VSR6 0x3006 +#define GSB_VCPU_SPR_VSR7 0x3007 +#define GSB_VCPU_SPR_VSR8 0x3008 +#define GSB_VCPU_SPR_VSR9 0x3009 +#define GSB_VCPU_SPR_VSR10 0x300A +#define GSB_VCPU_SPR_VSR11 0x300B +#define GSB_VCPU_SPR_VSR12 0x300C +#define GSB_VCPU_SPR_VSR13 0x300D +#define GSB_VCPU_SPR_VSR14 0x300E +#define GSB_VCPU_SPR_VSR15 0x300F +#define GSB_VCPU_SPR_VSR16 0x3010 +#define GSB_VCPU_SPR_VSR17 0x3011 +#define GSB_VCPU_SPR_VSR18 0x3012 +#define GSB_VCPU_SPR_VSR19 0x3013 +#define GSB_VCPU_SPR_VSR20 0x3014 +#define GSB_VCPU_SPR_VSR21 0x3015 +#define GSB_VCPU_SPR_VSR22 0x3016 +#define GSB_VCPU_SPR_VSR23 0x3017 +#define GSB_VCPU_SPR_VSR24 0x3018 +#define GSB_VCPU_SPR_VSR25 0x3019 +#define GSB_VCPU_SPR_VSR26 0x301A +#define GSB_VCPU_SPR_VSR27 0x301B +#define GSB_VCPU_SPR_VSR28 0x301C +#define GSB_VCPU_SPR_VSR29 0x301D +#define GSB_VCPU_SPR_VSR30 0x301E +#define GSB_VCPU_SPR_VSR31 0x301F +#define GSB_VCPU_SPR_VSR32 0x3020 +#define GSB_VCPU_SPR_VSR33 0x3021 +#define GSB_VCPU_SPR_VSR34 0x3022 +#define GSB_VCPU_SPR_VSR35 0x3023 +#define GSB_VCPU_SPR_VSR36 0x3024 +#define GSB_VCPU_SPR_VSR37 0x3025 +#define GSB_VCPU_SPR_VSR38 0x3026 +#define GSB_VCPU_SPR_VSR39 0x3027 +#define GSB_VCPU_SPR_VSR40 0x3028 +#define GSB_VCPU_SPR_VSR41 0x3029 +#define GSB_VCPU_SPR_VSR42 0x302A +#define GSB_VCPU_SPR_VSR43 0x302B +#define GSB_VCPU_SPR_VSR44 0x302C +#define GSB_VCPU_SPR_VSR45 0x302D +#define GSB_VCPU_SPR_VSR46 0x302E +#define GSB_VCPU_SPR_VSR47 0x302F +#define GSB_VCPU_SPR_VSR48 0x3030 +#define GSB_VCPU_SPR_VSR49 0x3031 +#define GSB_VCPU_SPR_VSR50 0x3032 +#define GSB_VCPU_SPR_VSR51 0x3033 +#define GSB_VCPU_SPR_VSR52 0x3034 +#define GSB_VCPU_SPR_VSR53 0x3035 +#define GSB_VCPU_SPR_VSR54 0x3036 +#define GSB_VCPU_SPR_VSR55 0x3037 +#define GSB_VCPU_SPR_VSR56 0x3038 +#define GSB_VCPU_SPR_VSR57 0x3039 +#define GSB_VCPU_SPR_VSR58 0x303A +#define GSB_VCPU_SPR_VSR59 0x303B +#define GSB_VCPU_SPR_VSR60 0x303C +#define GSB_VCPU_SPR_VSR61 0x303D +#define GSB_VCPU_SPR_VSR62 0x303E +#define GSB_VCPU_SPR_VSR63 0x303F + /* RESERVED 0x3040 - 0xEFFF */ +#define GSB_VCPU_SPR_HDAR 0xF000 +#define GSB_VCPU_SPR_HDSISR 0xF001 +#define GSB_VCPU_SPR_HEIR 0xF002 +#define GSB_VCPU_SPR_ASDR 0xF003 +/* End of list of Guest State Buffer Element IDs */ +#define GSB_LAST GSB_VCPU_SPR_ASDR + typedef struct SpaprMachineStateNested { uint64_t ptcr; uint8_t api; @@ -16,6 +201,8 @@ typedef struct SpaprMachineStateNested { typedef struct SpaprMachineStateNestedGuest { uint32_t pvr_logical; unsigned long nr_vcpus; + uint64_t parttbl[2]; + uint64_t tb_offset; struct SpaprMachineStateNestedGuestVcpu *vcpus; } SpaprMachineStateNestedGuest; =20 @@ -31,6 +218,109 @@ typedef struct SpaprMachineStateNestedGuest { #define PAPR_NESTED_GUEST_MAX 4096 #define H_GUEST_DELETE_ALL_FLAG 0x8000000000000000ULL #define PAPR_NESTED_GUEST_VCPU_MAX 2048 +#define VCPU_OUT_BUF_MIN_SZ 0x80ULL +#define HVMASK_DEFAULT 0xffffffffffffffff +#define HVMASK_LPCR 0x0070000003820800 +#define HVMASK_MSR 0xEBFFFFFFFFBFEFFF +#define HVMASK_HDEXCR 0x00000000FFFFFFFF +#define HVMASK_TB_OFFSET 0x000000FFFFFFFFFF + +/* + * As per ISA v3.1B, following bits are reserved: + * 0:2 + * 4:57 (ISA mentions bit 58 as well but it should be used for P10) + * 61:63 (hence, haven't included PCR bits for v2.06 and v2.05 + * in LOW BITS) + */ +#define PCR_LOW_BITS (PCR_COMPAT_3_10 | PCR_COMPAT_3_00) +#define HVMASK_PCR (~PCR_LOW_BITS) + +#define GUEST_STATE_ELEMENT(i, sz, s, f, ptr, c) { \ + .id =3D (i), \ + .size =3D (sz), \ + .location =3D ptr, \ + .offset =3D offsetof(struct s, f), \ + .copy =3D (c) \ +} + +#define GSBE_NESTED(i, sz, f, c) { \ + .id =3D (i), \ + .size =3D (sz), \ + .location =3D get_guest_ptr, \ + .offset =3D offsetof(struct SpaprMachineStateNestedGuest, f),\ + .copy =3D (c), \ + .mask =3D HVMASK_DEFAULT \ +} + +#define GSBE_NESTED_MSK(i, sz, f, c, m) { \ + .id =3D (i), \ + .size =3D (sz), \ + .location =3D get_guest_ptr, \ + .offset =3D offsetof(struct SpaprMachineStateNestedGuest, f),\ + .copy =3D (c), \ + .mask =3D (m) \ +} + +#define GSBE_NESTED_VCPU(i, sz, f, c) { \ + .id =3D (i), \ + .size =3D (sz), \ + .location =3D get_vcpu_ptr, \ + .offset =3D offsetof(struct SpaprMachineStateNestedGuestVcpu, f),\ + .copy =3D (c), \ + .mask =3D HVMASK_DEFAULT \ +} + +#define GUEST_STATE_ELEMENT_NOP(i, sz) { \ + .id =3D (i), \ + .size =3D (sz), \ + .location =3D NULL, \ + .offset =3D 0, \ + .copy =3D NULL, \ + .mask =3D HVMASK_DEFAULT \ +} + +#define GUEST_STATE_ELEMENT_NOP_DW(i) \ + GUEST_STATE_ELEMENT_NOP(i, 8) +#define GUEST_STATE_ELEMENT_NOP_W(i) \ + GUEST_STATE_ELEMENT_NOP(i, 4) + +#define GUEST_STATE_ELEMENT_BASE(i, s, c) { \ + .id =3D (i), \ + .size =3D (s), \ + .location =3D get_vcpu_state_ptr, \ + .offset =3D 0, \ + .copy =3D (c), \ + .mask =3D HVMASK_DEFAULT \ + } + +#define GUEST_STATE_ELEMENT_OFF(i, s, f, c) { \ + .id =3D (i), \ + .size =3D (s), \ + .location =3D get_vcpu_state_ptr, \ + .offset =3D offsetof(struct nested_ppc_state, f), \ + .copy =3D (c), \ + .mask =3D HVMASK_DEFAULT \ + } + +#define GUEST_STATE_ELEMENT_MSK(i, s, f, c, m) { \ + .id =3D (i), \ + .size =3D (s), \ + .location =3D get_vcpu_state_ptr, \ + .offset =3D offsetof(struct nested_ppc_state, f), \ + .copy =3D (c), \ + .mask =3D (m) \ + } + +#define GUEST_STATE_ELEMENT_ENV_QW(i, f) \ + GUEST_STATE_ELEMENT_OFF(i, 16, f, copy_state_16to16) +#define GUEST_STATE_ELEMENT_ENV_DW(i, f) \ + GUEST_STATE_ELEMENT_OFF(i, 8, f, copy_state_8to8) +#define GUEST_STATE_ELEMENT_ENV_W(i, f) \ + GUEST_STATE_ELEMENT_OFF(i, 4, f, copy_state_4to8) +#define GUEST_STATE_ELEMENT_ENV_WW(i, f) \ + GUEST_STATE_ELEMENT_OFF(i, 4, f, copy_state_4to4) +#define GSE_ENV_DWM(i, f, m) \ + GUEST_STATE_ELEMENT_MSK(i, 8, f, copy_state_8to8, m) =20 /* * Register state for entering a nested guest with H_ENTER_NESTED. @@ -171,16 +461,39 @@ struct nested_ppc_state { uint64_t sier; uint32_t vscr; uint64_t fpscr; + int64_t dec_expiry_tb; +}; + +struct SpaprMachineStateNestedGuestVcpuRunBuf { + uint64_t addr; + uint64_t size; }; =20 typedef struct SpaprMachineStateNestedGuestVcpu { bool enabled; struct nested_ppc_state state; + struct SpaprMachineStateNestedGuestVcpuRunBuf runbufin; + struct SpaprMachineStateNestedGuestVcpuRunBuf runbufout; + int64_t tb_offset; + uint64_t hdecr_expiry_tb; } SpaprMachineStateNestedGuestVcpu; =20 +struct guest_state_element_type { + uint16_t id; + int size; +#define GUEST_STATE_ELEMENT_TYPE_FLAG_GUEST_WIDE 0x1 +#define GUEST_STATE_ELEMENT_TYPE_FLAG_READ_ONLY 0x2 + uint16_t flags; + void *(*location)(SpaprMachineStateNestedGuest *, target_ulong); + size_t offset; + void (*copy)(void *, void *, bool); + uint64_t mask; +}; + void spapr_exit_nested(PowerPCCPU *cpu, int excp); typedef struct SpaprMachineState SpaprMachineState; bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry); uint8_t spapr_nested_api(SpaprMachineState *spapr); +void spapr_nested_gsb_init(void); #endif /* HW_SPAPR_NESTED_H */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263488; cv=none; d=zohomail.com; s=zohoarc; b=TYjPOm8PBOHmcQ4fsdH2Z3ufxewfJfdwDAXXSgJyYcgKjciX0vE+cQ3zXUY2/0ml99slCtL6jMjR+upeEajv4qz1yBFHzIyn5nBWcH130ZMNgVJponzpQTqWalui1xc44Qh83N1mUhX75kjQuOhPedwL1mNGSmquBrl3A+ErOKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263488; 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=K2gX2wZRZwnsfISaLROX6zVjfiOGenKvEwzj5dh2eCo=; b=RyzTYvPgb90+5vtw/OlKSZVGm7Lk2o+HUSO7csq+CKirTa01ISBeXZ7gZKMhOYqIdXqRntwK4jLkUxzSCNfR8MTCCM6JMhzAwpfhnfHIM07PFAB9GMv4IeA8daLA2+G0PHbklkLxLiugEjtsfUHKg2vmtCIriyqSpdndiioHeTc= 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 1710263488547622.126041729436; Tue, 12 Mar 2024 10:11:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Y1-0006bE-Jf; Tue, 12 Mar 2024 13:04:17 -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 1rk5VT-0007kn-OL; Tue, 12 Mar 2024 13:01:40 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5VR-000093-4z; Tue, 12 Mar 2024 13:01:39 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6e6adc557b6so614417b3a.2; Tue, 12 Mar 2024 10:01:36 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262895; x=1710867695; 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=K2gX2wZRZwnsfISaLROX6zVjfiOGenKvEwzj5dh2eCo=; b=IDqBT2ERwKIAb1qhUpBEeWed+pwarjp4WrSjCegxYcpP3pL0A/s2bhZ3DqHBo4K+ZQ 105s2WNmz0xV9x7JhEE0JMKIQUWdKAO43dCerenaT1usfrAcVdjYqCAcX8FgdFf7vDSY BmJ7wStDyg0Q6I2V5H7JTsyXpbI2GSEIzVl2cQ2yCNB7ycGZQmHEQAgYClaaftiKaZLE h3siMA6rSjhKeWTJHVJIopG0Vl2bPALzxd31/oYKtXTlrVecBn+tjz7No5y3QzbJo+uJ t2zNVMKHKHCKop9xf0w5GxLNyoURhUOXin9Aggv3ioE7ZO9hx4frR0kKazmsOSMjN2dB QnxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262895; x=1710867695; 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=K2gX2wZRZwnsfISaLROX6zVjfiOGenKvEwzj5dh2eCo=; b=OY7ibA7s3yCw8nSkAXuekRDUilWQTKG3f235/kuNRSP3eB3ax3Q4yo6Nl7QPti00iQ UEqh2J2inrGFM2HLjdFxlQ1tarIR0cxT5zsfenE4mD/CWL2/KG/xAmRmnnpdDp8PZPRG Os3QD2DxY2Mi29jumWLWPhzga1PiaOxw9yVHCalxh7TjIDIwLtkp1Jk4kdoRX9SLtzuq ZpGlre/zjTUIwObwvJNnGxUB/s6UG9PZBD7C5ddGDHNZChd0HNKSIpI7DymR4pAAMwej k85VYNXJcJnfviKKepbI2FnnwGsz83C0SUpQfIYtDFi9F7WTclueYnAblKjGtxU83uHW F+CQ== X-Forwarded-Encrypted: i=1; AJvYcCUSnm85EMZLv4cTKN6qrWvuGc2k8IHGFbmnF7TrV8HJSHoMKQ8pShsWO6gxPPCdqH19ZVQbtgob4PVOXoT3yurtEoDs X-Gm-Message-State: AOJu0YyfXyIieKD0thaSqdz0nLbZ0y2cwLSZ2vVwUjAR/9KCFreS25/S B54zS77YzSj2L6XWRRt7Dyq31N8aBDUDccKI62johSzfasUsqskk2Rudnmfy+bE= X-Google-Smtp-Source: AGHT+IHgAGttvZRLLgvbVASjEVI0G0brtsy9gYPZLrdZvf/T39w3blETB2na+fKfKugV5EKYJavUpA== X-Received: by 2002:a05:6a00:1a89:b0:6e6:2af9:7553 with SMTP id e9-20020a056a001a8900b006e62af97553mr42798pfv.5.1710262894981; Tue, 12 Mar 2024 10:01:34 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 35/38] spapr: nested: Introduce H_GUEST_[GET|SET]_STATE hcalls. Date: Wed, 13 Mar 2024 02:58:46 +1000 Message-ID: <20240312165851.2240242-36-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::42b; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42b.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: 1710263490375100003 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Introduce the nested PAPR hcalls: - H_GUEST_GET_STATE which is used to get state of a nested guest or a guest VCPU. The value field for each element in the request is destination to be updated to reflect current state on success. - H_GUEST_SET_STATE which is used to modify the state of a guest or a guest VCPU. On success, guest (or its VCPU) state shall be updated as per the value field for the requested element(s). Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr_nested.c | 268 ++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 3 + include/hw/ppc/spapr_nested.h | 23 +++ 3 files changed, 294 insertions(+) diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index cd7fa90350..cea282926f 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -1029,6 +1029,140 @@ void spapr_nested_gsb_init(void) } } =20 +static struct guest_state_element *guest_state_element_next( + struct guest_state_element *element, + int64_t *len, + int64_t *num_elements) +{ + uint16_t size; + + /* size is of element->value[] only. Not whole guest_state_element */ + size =3D be16_to_cpu(element->size); + + if (len) { + *len -=3D size + offsetof(struct guest_state_element, value); + } + + if (num_elements) { + *num_elements -=3D 1; + } + + return (struct guest_state_element *)(element->value + size); +} + +static +struct guest_state_element_type *guest_state_element_type_find(uint16_t id) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(guest_state_element_types); i++) + if (id =3D=3D guest_state_element_types[i].id) { + return &guest_state_element_types[i]; + } + + return NULL; +} + +static void log_element(struct guest_state_element *element, + struct guest_state_request *gsr) +{ + qemu_log_mask(LOG_GUEST_ERROR, "h_guest_%s_state id:0x%04x size:0x%04x= ", + gsr->flags & GUEST_STATE_REQUEST_SET ? "set" : "get", + be16_to_cpu(element->id), be16_to_cpu(element->size)); + qemu_log_mask(LOG_GUEST_ERROR, "buf:0x%016"PRIx64" ...\n", + be64_to_cpu(*(uint64_t *)element->value)); +} + +static bool guest_state_request_check(struct guest_state_request *gsr) +{ + int64_t num_elements, len =3D gsr->len; + struct guest_state_buffer *gsb =3D gsr->gsb; + struct guest_state_element *element; + struct guest_state_element_type *type; + uint16_t id, size; + + /* gsb->num_elements =3D 0 =3D=3D 32 bits long */ + assert(len >=3D 4); + + num_elements =3D be32_to_cpu(gsb->num_elements); + element =3D gsb->elements; + len -=3D sizeof(gsb->num_elements); + + /* Walk the buffer to validate the length */ + while (num_elements) { + + id =3D be16_to_cpu(element->id); + size =3D be16_to_cpu(element->size); + + if (false) { + log_element(element, gsr); + } + /* buffer size too small */ + if (len < 0) { + return false; + } + + type =3D guest_state_element_type_find(id); + if (!type) { + qemu_log_mask(LOG_GUEST_ERROR, "Element ID %04x unknown\n", id= ); + log_element(element, gsr); + return false; + } + + if (id =3D=3D GSB_HV_VCPU_IGNORED_ID) { + goto next_element; + } + + if (size !=3D type->size) { + qemu_log_mask(LOG_GUEST_ERROR, "Size mismatch. Element ID:%04x= ." + "Size Exp:%i Got:%i\n", id, type->size, size); + log_element(element, gsr); + return false; + } + + if ((type->flags & GUEST_STATE_ELEMENT_TYPE_FLAG_READ_ONLY) && + (gsr->flags & GUEST_STATE_REQUEST_SET)) { + qemu_log_mask(LOG_GUEST_ERROR, "Trying to set a read-only Elem= ent " + "ID:%04x.\n", id); + return false; + } + + if (type->flags & GUEST_STATE_ELEMENT_TYPE_FLAG_GUEST_WIDE) { + /* guest wide element type */ + if (!(gsr->flags & GUEST_STATE_REQUEST_GUEST_WIDE)) { + qemu_log_mask(LOG_GUEST_ERROR, "trying to set a guest wide= " + "Element ID:%04x.\n", id); + return false; + } + } else { + /* thread wide element type */ + if (gsr->flags & GUEST_STATE_REQUEST_GUEST_WIDE) { + qemu_log_mask(LOG_GUEST_ERROR, "trying to set a thread wid= e " + "Element ID:%04x.\n", id); + return false; + } + } +next_element: + element =3D guest_state_element_next(element, &len, &num_elements); + + } + return true; +} + +static bool is_gsr_invalid(struct guest_state_request *gsr, + struct guest_state_element *element, + struct guest_state_element_type *type) +{ + if ((gsr->flags & GUEST_STATE_REQUEST_SET) && + (*(uint64_t *)(element->value) & ~(type->mask))) { + log_element(element, gsr); + qemu_log_mask(LOG_GUEST_ERROR, "L1 can't set reserved bits " + "(allowed mask: 0x%08"PRIx64")\n", type->mask); + return true; + } + return false; +} + static target_ulong h_guest_get_capabilities(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, @@ -1264,6 +1398,136 @@ static target_ulong h_guest_create_vcpu(PowerPCCPU = *cpu, return H_SUCCESS; } =20 +static target_ulong getset_state(SpaprMachineStateNestedGuest *guest, + uint64_t vcpuid, + struct guest_state_request *gsr) +{ + void *ptr; + uint16_t id; + struct guest_state_element *element; + struct guest_state_element_type *type; + int64_t lenleft, num_elements; + + lenleft =3D gsr->len; + + if (!guest_state_request_check(gsr)) { + return H_P3; + } + + num_elements =3D be32_to_cpu(gsr->gsb->num_elements); + element =3D gsr->gsb->elements; + /* Process the elements */ + while (num_elements) { + type =3D NULL; + /* log_element(element, gsr); */ + + id =3D be16_to_cpu(element->id); + if (id =3D=3D GSB_HV_VCPU_IGNORED_ID) { + goto next_element; + } + + type =3D guest_state_element_type_find(id); + assert(type); + + /* Get pointer to guest data to get/set */ + if (type->location && type->copy) { + ptr =3D type->location(guest, vcpuid); + assert(ptr); + if (!~(type->mask) && is_gsr_invalid(gsr, element, type)) { + return H_INVALID_ELEMENT_VALUE; + } + type->copy(ptr + type->offset, element->value, + gsr->flags & GUEST_STATE_REQUEST_SET ? true : false= ); + } + +next_element: + element =3D guest_state_element_next(element, &lenleft, &num_eleme= nts); + } + + return H_SUCCESS; +} + +static target_ulong map_and_getset_state(PowerPCCPU *cpu, + SpaprMachineStateNestedGuest *gue= st, + uint64_t vcpuid, + struct guest_state_request *gsr) +{ + target_ulong rc; + int64_t len; + bool is_write; + + len =3D gsr->len; + /* only get_state would require write access to the provided buffer */ + is_write =3D (gsr->flags & GUEST_STATE_REQUEST_SET) ? false : true; + gsr->gsb =3D address_space_map(CPU(cpu)->as, gsr->buf, (uint64_t *)&le= n, + is_write, MEMTXATTRS_UNSPECIFIED); + if (!gsr->gsb) { + rc =3D H_P3; + goto out1; + } + + if (len !=3D gsr->len) { + rc =3D H_P3; + goto out1; + } + + rc =3D getset_state(guest, vcpuid, gsr); + +out1: + address_space_unmap(CPU(cpu)->as, gsr->gsb, len, is_write, len); + return rc; +} + +static target_ulong h_guest_getset_state(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong *args, + bool set) +{ + target_ulong flags =3D args[0]; + target_ulong lpid =3D args[1]; + target_ulong vcpuid =3D args[2]; + target_ulong buf =3D args[3]; + target_ulong buflen =3D args[4]; + struct guest_state_request gsr; + SpaprMachineStateNestedGuest *guest; + + guest =3D spapr_get_nested_guest(spapr, lpid); + if (!guest) { + return H_P2; + } + gsr.buf =3D buf; + assert(buflen <=3D GSB_MAX_BUF_SIZE); + gsr.len =3D buflen; + gsr.flags =3D 0; + if (flags & H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) { + gsr.flags |=3D GUEST_STATE_REQUEST_GUEST_WIDE; + } + if (flags & !H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) { + return H_PARAMETER; /* flag not supported yet */ + } + + if (set) { + gsr.flags |=3D GUEST_STATE_REQUEST_SET; + } + return map_and_getset_state(cpu, guest, vcpuid, &gsr); +} + +static target_ulong h_guest_set_state(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + return h_guest_getset_state(cpu, spapr, args, true); +} + +static target_ulong h_guest_get_state(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + return h_guest_getset_state(cpu, spapr, args, false); +} + void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); @@ -1289,6 +1553,8 @@ void spapr_register_nested_papr(void) spapr_register_hypercall(H_GUEST_CREATE, h_guest_create); spapr_register_hypercall(H_GUEST_DELETE, h_guest_delete); spapr_register_hypercall(H_GUEST_CREATE_VCPU, h_guest_create_vcpu); + spapr_register_hypercall(H_GUEST_SET_STATE, h_guest_set_state); + spapr_register_hypercall(H_GUEST_GET_STATE, h_guest_get_state); } =20 void spapr_unregister_nested_papr(void) @@ -1298,6 +1564,8 @@ void spapr_unregister_nested_papr(void) spapr_unregister_hypercall(H_GUEST_CREATE); spapr_unregister_hypercall(H_GUEST_DELETE); spapr_unregister_hypercall(H_GUEST_CREATE_VCPU); + spapr_unregister_hypercall(H_GUEST_SET_STATE); + spapr_unregister_hypercall(H_GUEST_GET_STATE); } =20 #else diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 070135793a..6223873641 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -366,6 +366,7 @@ struct SpaprMachineState { #define H_OVERLAP -68 #define H_STATE -75 #define H_IN_USE -77 +#define H_INVALID_ELEMENT_VALUE -81 #define H_UNSUPPORTED_FLAG -256 #define H_MULTI_THREADS_ACTIVE -9005 =20 @@ -589,6 +590,8 @@ struct SpaprMachineState { #define H_GUEST_SET_CAPABILITIES 0x464 #define H_GUEST_CREATE 0x470 #define H_GUEST_CREATE_VCPU 0x474 +#define H_GUEST_GET_STATE 0x478 +#define H_GUEST_SET_STATE 0x47C #define H_GUEST_DELETE 0x488 =20 #define MAX_HCALL_OPCODE H_GUEST_DELETE diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index 3da02df7bb..bf9b258c29 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -224,6 +224,10 @@ typedef struct SpaprMachineStateNestedGuest { #define HVMASK_MSR 0xEBFFFFFFFFBFEFFF #define HVMASK_HDEXCR 0x00000000FFFFFFFF #define HVMASK_TB_OFFSET 0x000000FFFFFFFFFF +#define GSB_MAX_BUF_SIZE (1024 * 1024) +#define H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE 0x8000000000000000 +#define GUEST_STATE_REQUEST_GUEST_WIDE 0x1 +#define GUEST_STATE_REQUEST_SET 0x2 =20 /* * As per ISA v3.1B, following bits are reserved: @@ -322,6 +326,25 @@ typedef struct SpaprMachineStateNestedGuest { #define GSE_ENV_DWM(i, f, m) \ GUEST_STATE_ELEMENT_MSK(i, 8, f, copy_state_8to8, m) =20 +struct guest_state_element { + uint16_t id; + uint16_t size; + uint8_t value[]; +} QEMU_PACKED; + +struct guest_state_buffer { + uint32_t num_elements; + struct guest_state_element elements[]; +} QEMU_PACKED; + +/* Actual buffer plus some metadata about the request */ +struct guest_state_request { + struct guest_state_buffer *gsb; + int64_t buf; + int64_t len; + uint16_t flags; +}; + /* * Register state for entering a nested guest with H_ENTER_NESTED. * New member must be added at the end. --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263203; cv=none; d=zohomail.com; s=zohoarc; b=MmoQEv92ZU0paPWsBANThsU6DJYC6fdRtc+vbespbrqPGFvYEq3KRHqhW148pLHKCIMManCInVCWtECD2gF3dizsZEKKn1JOxsP73qPbdzMp5I/h/MuSbsker8gLQsjtXaemoTIuFKc/iJON1UF1H9dNPmFmSeQNNzOjuGaLwUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263203; 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=1+p2N2ydmuh4NiUkruo5k6BsdLADhep4spOhwhm1AwI=; b=lr/nxbv996hHG1GZPvnTbtTc8MR30eVumyAWW6bSlzjzGRduvyXAALbJ5rCblo7E95pxb8BC++SgUq1ifo2csmBQyf62cn8jNYfay+wapxfpTlf2IwjVbZ9Xjb09mlyRz2FKnzYTbGEgKIJp0w+qJHO/Cu8jLARH6rmy35IgM0E= 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 1710263203336419.3412654080888; Tue, 12 Mar 2024 10:06:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Yp-0000gn-5C; Tue, 12 Mar 2024 13:05:07 -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 1rk5VX-00083R-Uh; Tue, 12 Mar 2024 13:01:44 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5VW-00009P-2D; Tue, 12 Mar 2024 13:01:43 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6e6ac58fceaso605905b3a.1; Tue, 12 Mar 2024 10:01:41 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262899; x=1710867699; 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=1+p2N2ydmuh4NiUkruo5k6BsdLADhep4spOhwhm1AwI=; b=lzUZcIl5D8zyg/kQNpviQJIq365TZuoVrLRkdaDCH20SJgVXYygqDSC5rlUdpGGMup o10V943ujIIITG0tu6rS4cYt1P8PfsmW3Inorw7nQFYZR88uy3g5K9GwYrMksmYYYtVP Ebh+hptIvjMSBxkg2TbsSBeci2zCFcdxd8ygCeXLbHFHWALLfjTdOmZxbLDts/r8Kng4 xfVCJIJ7rZyCRDftDUXx4ct6lLge89cFYd3Yh1NuHrVXQobkZZT9MAV7tUddX9SgTdaA npFuIm7jCXHYy4xTMN5XOjjP8eSkAVUnVY43ySApFfV5IRa67mI3WU0+16zgAJN4RutC D06w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262899; x=1710867699; 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=1+p2N2ydmuh4NiUkruo5k6BsdLADhep4spOhwhm1AwI=; b=JuwKZUAM56WqG2P0EKkwT2Z1WnA5QWe8fNuTUffF9osi2vjulOq/lQqpTVurp4YLXU +UQr0DVfK8+K6VB9XNr/ACfMXaxRQYT3TlIYZyYwqUVPX+e1RbGxXP7X54MaRAffFjII eJ71ocWet1yeLvFJIM+E/6v8TA2hIVdHHx217nvuFuYeHGV4y5I15ZSPb64cs3PBzzKW /h1rWcaqm8UkH0k9KTLCXKj8R96yxUOxUZ3CZlqsC7j6mxcf3nWu4OIwIFnzRFP4wh1c mM9Aisj61h6X2hrsxw2l28nkwdWXwacvJwaQmpvPBU7uZh9QDu/9C2td0jjYNoBh1TTy jA6Q== X-Forwarded-Encrypted: i=1; AJvYcCW9oU6G7y81yO0rQgROqO0LS5Tbt/IYVnbJa75rA4fFY77c1fN/YCKF3L6RDZd+147e6qomwZZrjw4kpU+Qf9l/+sfd X-Gm-Message-State: AOJu0YwTYc5M734qYqExen8Os7NqBN8veYtIxcW1wyjDz11j09pn7lfg gT7EM+lAIRC2mqd1qtxvj/lxIqdxSYW5frizIjAhdogJgL+t5/VDpVBnHJd1P4Y= X-Google-Smtp-Source: AGHT+IGQj20GoVZOoCvsTVrpTfhh8reWlaOfqq+/qg1Q7DDVCb9QZfbs1k33lbF+OUZTKpOotFJJVw== X-Received: by 2002:a05:6a00:178a:b0:6e6:57c8:6fc3 with SMTP id s10-20020a056a00178a00b006e657c86fc3mr112481pfg.0.1710262898683; Tue, 12 Mar 2024 10:01:38 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 36/38] spapr: nested: Use correct source for parttbl info for nested PAPR API. Date: Wed, 13 Mar 2024 02:58:47 +1000 Message-ID: <20240312165851.2240242-37-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::436; envelope-from=npiggin@gmail.com; helo=mail-pf1-x436.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: 1710263204974100007 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora For nested PAPR API, we use SpaprMachineStateNestedGuest struct to store partition table info, use the same in spapr_get_pate_nested() via helper. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 6 +++-- hw/ppc/spapr_nested.c | 41 ++++++++++++++++++++++++++--------- include/hw/ppc/spapr_nested.h | 2 ++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index e001ffe06f..aaf73781b0 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1421,11 +1421,13 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vh= yp, PowerPCCPU *cpu, entry->dw1 =3D spapr->patb_entry; return true; } else { - assert(spapr_nested_api(spapr)); if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { return spapr_get_pate_nested_hv(spapr, cpu, lpid, entry); + } else if (spapr_nested_api(spapr) =3D=3D NESTED_API_PAPR) { + return spapr_get_pate_nested_papr(spapr, cpu, lpid, entry); + } else { + g_assert_not_reached(); } - return false; } } =20 diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index cea282926f..1a5cb254c9 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -58,6 +58,31 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr, = PowerPCCPU *cpu, return true; } =20 +static +SpaprMachineStateNestedGuest *spapr_get_nested_guest(SpaprMachineState *sp= apr, + target_ulong guestid) +{ + SpaprMachineStateNestedGuest *guest; + + guest =3D g_hash_table_lookup(spapr->nested.guests, GINT_TO_POINTER(gu= estid)); + return guest; +} + +bool spapr_get_pate_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu, + target_ulong lpid, ppc_v3_pate_t *entry) +{ + SpaprMachineStateNestedGuest *guest; + assert(lpid !=3D 0); + guest =3D spapr_get_nested_guest(spapr, lpid); + if (!guest) { + return false; + } + + entry->dw0 =3D guest->parttbl[0]; + entry->dw1 =3D guest->parttbl[1]; + return true; +} + #define PRTS_MASK 0x1f =20 static target_ulong h_set_ptbl(PowerPCCPU *cpu, @@ -540,16 +565,6 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp) } } =20 -static -SpaprMachineStateNestedGuest *spapr_get_nested_guest(SpaprMachineState *sp= apr, - target_ulong guestid) -{ - SpaprMachineStateNestedGuest *guest; - - guest =3D g_hash_table_lookup(spapr->nested.guests, GINT_TO_POINTER(gu= estid)); - return guest; -} - static bool spapr_nested_vcpu_check(SpaprMachineStateNestedGuest *guest, target_ulong vcpuid, bool inoutbuf) { @@ -1590,6 +1605,12 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spa= pr, PowerPCCPU *cpu, return false; } =20 +bool spapr_get_pate_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu, + target_ulong lpid, ppc_v3_pate_t *entry) +{ + return false; +} + void spapr_register_nested_papr(void) { /* DO NOTHING */ diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h index bf9b258c29..93ef14adcc 100644 --- a/include/hw/ppc/spapr_nested.h +++ b/include/hw/ppc/spapr_nested.h @@ -519,4 +519,6 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr,= PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry); uint8_t spapr_nested_api(SpaprMachineState *spapr); void spapr_nested_gsb_init(void); +bool spapr_get_pate_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu, + target_ulong lpid, ppc_v3_pate_t *entry); #endif /* HW_SPAPR_NESTED_H */ --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263204; cv=none; d=zohomail.com; s=zohoarc; b=X2GiSkVW1GKZubWPAgAKjKJU8Dv5EnPIzVr3ZV+QiYcUO/O6KlTQhqn8maXdydeZpJlLeOPhOsW+aFB3mj16bWD+SZkx4vX+rpCr/b7XCjxlshzy8d9RCcCfBWgBzuh1vDUFadkHyEJp6xPJUjuh8eC1vvtR0h1CXsAt+COCe8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263204; 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=14uNUTALNX1MTDADLc8MEdZ/WC5ow0RBSVwfY7sHra0=; b=Qa7nSiuB3wHe9C0qWnzvfFzvAyordDkG1quwshwQhCvxbfmzSh40QY9vR7QZPSH/3An8nyz2Us2mQ8QIrlCId8mNysDQUUK3pACcFRskWr+m4Rzq2svrzmP4yKeObtIbU7p5vfgZYWsF/ZH7kUw2JO2CBqjh8ALOeMSRMXexLHY= 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 1710263204064646.5845794678545; Tue, 12 Mar 2024 10:06:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Y5-0007AH-0Y; Tue, 12 Mar 2024 13:04:22 -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 1rk5Vc-00087W-46; Tue, 12 Mar 2024 13:01:53 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5VZ-00009u-LD; Tue, 12 Mar 2024 13:01:47 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e6ab012eb1so792095b3a.3; Tue, 12 Mar 2024 10:01:44 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262904; x=1710867704; 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=14uNUTALNX1MTDADLc8MEdZ/WC5ow0RBSVwfY7sHra0=; b=Q4mDZpz9FsuwvHleQTyrrAQFIrz/U/IJr3rO5CuRq62ULkotr/0tHALsjvrKzXRhKv GUDvwK6jp5wMLwpAmZfTSTRq3I0N2Kxrbn7L+LqrnsulAbbzLr1DjwX1/Ju3ObRh/de2 NVGXqOxqzJfVyAYAUlDWyE+MUD7Jky3w+l7LzdcZj4IHvsI+z46kQ/mpoXTsx4GX+WOk AEM35DJfCbHZd0Gl33hrC5Po3CdGplKM4eVyNwFBD91Cm0tlo8XBtoGw4a6tVkRFuAMy 8wb5gMGpjoYh4h9O4y+R2Gn7FKyioJo2IaVGYKVEJujIP0ZY0ubCYnjvGN0Xq8teaXle nJ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262904; x=1710867704; 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=14uNUTALNX1MTDADLc8MEdZ/WC5ow0RBSVwfY7sHra0=; b=EP7wuJYK3Nxr7X8OcMJUrWKSlyZ9Q2TlPlVLc2JAOrigq8WB4igReYTZIMHERQYAcX sld4CUkbg9AQHAlhB2Tabc2DqbJJYR94LTrsg1NynFrF40Ey6Hx84UAvwTbIHTcmeWWc YDO/ZdcZ2rJUuHzNzOGXl92qrooT4HdpGk/aEwcMf7R9xHaU+Qniy1TNdJmYZakF1tSN D/p5TpGfgAaz0FWyfZXoIL0oKH19qokemxsOprKNZmwFYdsqArhWlErAYPdwc2YwlxeY EqV0q7NaKIMNrC4q5w8GXfriuNlys+7rIfK3Mh/JFP2QmGaJXW7RvsDP98c3gSvqwz6f ffsg== X-Forwarded-Encrypted: i=1; AJvYcCUfwgmH/aYnhdvItQYWnWxXhzn08DvscDYPHFBUPMtCsyhQFUzCxMaMw7B38CBnegwuo63oc2AFMg9fvbKd5Q+6Anvu X-Gm-Message-State: AOJu0Yx/QC8SCvJ8N7YOeLV+OcplPY2QAi0vdaJimA4jWGfOCO+LblM4 gcwEDg1OEwtusTzAOEugRVyKfTfAWiVF4boGD6ax73/isFu3fyjNiKgNeTne6RU= X-Google-Smtp-Source: AGHT+IExTNSVPr9wH+fuDryFzFNnWsgRQmrAIX9H07z7MpmzD/gv3oGIcpzA7d3KZGIx2ycXwuHKug== X-Received: by 2002:a05:6a20:1449:b0:1a1:679b:7dd7 with SMTP id a9-20020a056a20144900b001a1679b7dd7mr8761946pzi.14.1710262903499; Tue, 12 Mar 2024 10:01:43 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 37/38] spapr: nested: Introduce H_GUEST_RUN_VCPU hcall. Date: Wed, 13 Mar 2024 02:58:48 +1000 Message-ID: <20240312165851.2240242-38-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::434; envelope-from=npiggin@gmail.com; helo=mail-pf1-x434.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: 1710263204983100008 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora The H_GUEST_RUN_VCPU hcall is used to start execution of a Guest VCPU. The Hypervisor will update the state of the Guest VCPU based on the input buffer, restore the saved Guest VCPU state, and start its execution. The Guest VCPU can stop running for numerous reasons including HCALLs, hypervisor exceptions, or an outstanding Host Partition Interrupt. The reason that the Guest VCPU stopped running is communicated through R4 and the output buffer will be filled in with any relevant state. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/ppc.c | 10 ++ hw/ppc/spapr_nested.c | 334 ++++++++++++++++++++++++++++++++++++++---- target/ppc/cpu.h | 2 + 3 files changed, 316 insertions(+), 30 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index fadb8f5239..e6fa5580c0 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -633,6 +633,16 @@ void cpu_ppc_store_atbu (CPUPPCState *env, uint32_t va= lue) ((uint64_t)value << 32) | tb); } =20 +void cpu_ppc_increase_tb_by_offset(CPUPPCState *env, int64_t offset) +{ + env->tb_env->tb_offset +=3D offset; +} + +void cpu_ppc_decrease_tb_by_offset(CPUPPCState *env, int64_t offset) +{ + env->tb_env->tb_offset -=3D offset; +} + uint64_t cpu_ppc_load_vtb(CPUPPCState *env) { ppc_tb_t *tb_env =3D env->tb_env; diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 1a5cb254c9..ce3490bcf2 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -210,14 +210,28 @@ static void nested_save_state(struct nested_ppc_state= *save, PowerPCCPU *cpu) save->sier =3D env->spr[SPR_POWER_SIER]; save->vscr =3D ppc_get_vscr(env); save->fpscr =3D env->fpscr; + } else if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { + save->tb_offset =3D env->tb_env->tb_offset; } +} =20 - save->tb_offset =3D env->tb_env->tb_offset; +static void nested_post_load_state(CPUPPCState *env, CPUState *cs) +{ + /* + * compute hflags and possible interrupts. + */ + hreg_compute_hflags(env); + ppc_maybe_interrupt(env); + /* + * Nested HV does not tag TLB entries between L1 and L2, so must + * flush on transition. + */ + tlb_flush(cs); + env->reserve_addr =3D -1; /* Reset the reservation */ } =20 static void nested_load_state(PowerPCCPU *cpu, struct nested_ppc_state *lo= ad) { - CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 @@ -295,22 +309,9 @@ static void nested_load_state(PowerPCCPU *cpu, struct = nested_ppc_state *load) env->spr[SPR_POWER_SIER] =3D load->sier; ppc_store_vscr(env, load->vscr); ppc_store_fpscr(env, load->fpscr); + } else if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { + env->tb_env->tb_offset =3D load->tb_offset; } - - env->tb_env->tb_offset =3D load->tb_offset; - - /* - * MSR updated, compute hflags and possible interrupts. - */ - hreg_compute_hflags(env); - ppc_maybe_interrupt(env); - - /* - * Nested HV does not tag TLB entries between L1 and L2, so must - * flush on transition. - */ - tlb_flush(cs); - env->reserve_addr =3D -1; /* Reset the reservation */ } =20 /* @@ -325,6 +326,7 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu, { PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); CPUPPCState *env =3D &cpu->env; + CPUState *cs =3D CPU(cpu); SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); struct nested_ppc_state l2_state; target_ulong hv_ptr =3D args[0]; @@ -423,6 +425,7 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu, * Switch to the nested guest environment and start the "hdec" timer. */ nested_load_state(cpu, &l2_state); + nested_post_load_state(env, cs); =20 hdec =3D hv_state.hdec_expiry - now; cpu_ppc_hdecr_init(env); @@ -454,6 +457,7 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu, static void spapr_exit_nested_hv(PowerPCCPU *cpu, int excp) { CPUPPCState *env =3D &cpu->env; + CPUState *cs =3D CPU(cpu); SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); struct nested_ppc_state l2_state; target_ulong hv_ptr =3D spapr_cpu->nested_host_state->gpr[4]; @@ -475,6 +479,7 @@ static void spapr_exit_nested_hv(PowerPCCPU *cpu, int e= xcp) */ assert(env->spr[SPR_LPIDR] !=3D 0); nested_load_state(cpu, spapr_cpu->nested_host_state); + nested_post_load_state(env, cs); env->gpr[3] =3D env->excp_vectors[excp]; /* hcall return value */ =20 cpu_ppc_hdecr_exit(env); @@ -552,19 +557,6 @@ static void spapr_exit_nested_hv(PowerPCCPU *cpu, int = excp) address_space_unmap(CPU(cpu)->as, regs, len, len, true); } =20 -void spapr_exit_nested(PowerPCCPU *cpu, int excp) -{ - SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); - SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); - - assert(spapr_cpu->in_nested); - if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { - spapr_exit_nested_hv(cpu, excp); - } else { - g_assert_not_reached(); - } -} - static bool spapr_nested_vcpu_check(SpaprMachineStateNestedGuest *guest, target_ulong vcpuid, bool inoutbuf) { @@ -1543,6 +1535,286 @@ static target_ulong h_guest_get_state(PowerPCCPU *c= pu, return h_guest_getset_state(cpu, spapr, args, false); } =20 +static void exit_nested_store_l2(PowerPCCPU *cpu, int excp, + SpaprMachineStateNestedGuestVcpu *vcpu) +{ + CPUPPCState *env =3D &cpu->env; + SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); + target_ulong now, hdar, hdsisr, asdr; + + assert(sizeof(env->gpr) =3D=3D sizeof(vcpu->state.gpr)); /* sanity che= ck */ + + now =3D cpu_ppc_load_tbl(env); /* L2 timebase */ + now -=3D vcpu->tb_offset; /* L1 timebase */ + vcpu->state.dec_expiry_tb =3D now - cpu_ppc_load_decr(env); + cpu_ppc_store_decr(env, spapr_cpu->nested_host_state->dec_expiry_tb - = now); + /* backup hdar, hdsisr, asdr if reqd later below */ + hdar =3D vcpu->state.hdar; + hdsisr =3D vcpu->state.hdsisr; + asdr =3D vcpu->state.asdr; + + nested_save_state(&vcpu->state, cpu); + + if (excp =3D=3D POWERPC_EXCP_MCHECK || + excp =3D=3D POWERPC_EXCP_RESET || + excp =3D=3D POWERPC_EXCP_SYSCALL) { + vcpu->state.nip =3D env->spr[SPR_SRR0]; + vcpu->state.msr =3D env->spr[SPR_SRR1] & env->msr_mask; + } else { + vcpu->state.nip =3D env->spr[SPR_HSRR0]; + vcpu->state.msr =3D env->spr[SPR_HSRR1] & env->msr_mask; + } + + /* hdar, hdsisr, asdr should be retained unless certain exceptions */ + if ((excp !=3D POWERPC_EXCP_HDSI) && (excp !=3D POWERPC_EXCP_HISI)) { + vcpu->state.asdr =3D asdr; + } else if (excp !=3D POWERPC_EXCP_HDSI) { + vcpu->state.hdar =3D hdar; + vcpu->state.hdsisr =3D hdsisr; + } +} + +static int get_exit_ids(uint64_t srr0, uint16_t ids[16]) +{ + int nr; + + switch (srr0) { + case 0xc00: + nr =3D 10; + ids[0] =3D GSB_VCPU_GPR3; + ids[1] =3D GSB_VCPU_GPR4; + ids[2] =3D GSB_VCPU_GPR5; + ids[3] =3D GSB_VCPU_GPR6; + ids[4] =3D GSB_VCPU_GPR7; + ids[5] =3D GSB_VCPU_GPR8; + ids[6] =3D GSB_VCPU_GPR9; + ids[7] =3D GSB_VCPU_GPR10; + ids[8] =3D GSB_VCPU_GPR11; + ids[9] =3D GSB_VCPU_GPR12; + break; + case 0xe00: + nr =3D 5; + ids[0] =3D GSB_VCPU_SPR_HDAR; + ids[1] =3D GSB_VCPU_SPR_HDSISR; + ids[2] =3D GSB_VCPU_SPR_ASDR; + ids[3] =3D GSB_VCPU_SPR_NIA; + ids[4] =3D GSB_VCPU_SPR_MSR; + break; + case 0xe20: + nr =3D 4; + ids[0] =3D GSB_VCPU_SPR_HDAR; + ids[1] =3D GSB_VCPU_SPR_ASDR; + ids[2] =3D GSB_VCPU_SPR_NIA; + ids[3] =3D GSB_VCPU_SPR_MSR; + break; + case 0xe40: + nr =3D 3; + ids[0] =3D GSB_VCPU_SPR_HEIR; + ids[1] =3D GSB_VCPU_SPR_NIA; + ids[2] =3D GSB_VCPU_SPR_MSR; + break; + case 0xf80: + nr =3D 3; + ids[0] =3D GSB_VCPU_SPR_HFSCR; + ids[1] =3D GSB_VCPU_SPR_NIA; + ids[2] =3D GSB_VCPU_SPR_MSR; + break; + default: + nr =3D 0; + break; + } + + return nr; +} + +static void exit_process_output_buffer(PowerPCCPU *cpu, + SpaprMachineStateNestedGuest *guest, + target_ulong vcpuid, + target_ulong *r3) +{ + SpaprMachineStateNestedGuestVcpu *vcpu =3D &guest->vcpus[vcpuid]; + struct guest_state_request gsr; + struct guest_state_buffer *gsb; + struct guest_state_element *element; + struct guest_state_element_type *type; + int exit_id_count =3D 0; + uint16_t exit_cause_ids[16]; + hwaddr len; + + len =3D vcpu->runbufout.size; + gsb =3D address_space_map(CPU(cpu)->as, vcpu->runbufout.addr, &len, tr= ue, + MEMTXATTRS_UNSPECIFIED); + if (!gsb || len !=3D vcpu->runbufout.size) { + address_space_unmap(CPU(cpu)->as, gsb, len, true, len); + *r3 =3D H_P2; + return; + } + + exit_id_count =3D get_exit_ids(*r3, exit_cause_ids); + + /* Create a buffer of elements to send back */ + gsb->num_elements =3D cpu_to_be32(exit_id_count); + element =3D gsb->elements; + for (int i =3D 0; i < exit_id_count; i++) { + type =3D guest_state_element_type_find(exit_cause_ids[i]); + assert(type); + element->id =3D cpu_to_be16(exit_cause_ids[i]); + element->size =3D cpu_to_be16(type->size); + element =3D guest_state_element_next(element, NULL, NULL); + } + gsr.gsb =3D gsb; + gsr.len =3D VCPU_OUT_BUF_MIN_SZ; + gsr.flags =3D 0; /* get + never guest wide */ + getset_state(guest, vcpuid, &gsr); + + address_space_unmap(CPU(cpu)->as, gsb, len, true, len); + return; +} + +static +void spapr_exit_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu, int= excp) +{ + CPUPPCState *env =3D &cpu->env; + CPUState *cs =3D CPU(cpu); + SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); + target_ulong r3_return =3D env->excp_vectors[excp]; /* hcall return va= lue */ + target_ulong lpid =3D 0, vcpuid =3D 0; + struct SpaprMachineStateNestedGuestVcpu *vcpu =3D NULL; + struct SpaprMachineStateNestedGuest *guest =3D NULL; + + lpid =3D spapr_cpu->nested_host_state->gpr[5]; + vcpuid =3D spapr_cpu->nested_host_state->gpr[6]; + guest =3D spapr_get_nested_guest(spapr, lpid); + assert(guest); + spapr_nested_vcpu_check(guest, vcpuid, false); + vcpu =3D &guest->vcpus[vcpuid]; + + exit_nested_store_l2(cpu, excp, vcpu); + /* do the output buffer for run_vcpu*/ + exit_process_output_buffer(cpu, guest, vcpuid, &r3_return); + + assert(env->spr[SPR_LPIDR] !=3D 0); + nested_load_state(cpu, spapr_cpu->nested_host_state); + cpu_ppc_decrease_tb_by_offset(env, vcpu->tb_offset); + env->gpr[3] =3D H_SUCCESS; + env->gpr[4] =3D r3_return; + nested_post_load_state(env, cs); + cpu_ppc_hdecr_exit(env); + + spapr_cpu->in_nested =3D false; + g_free(spapr_cpu->nested_host_state); + spapr_cpu->nested_host_state =3D NULL; +} + +void spapr_exit_nested(PowerPCCPU *cpu, int excp) +{ + SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); + SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); + + assert(spapr_cpu->in_nested); + if (spapr_nested_api(spapr) =3D=3D NESTED_API_KVM_HV) { + spapr_exit_nested_hv(cpu, excp); + } else if (spapr_nested_api(spapr) =3D=3D NESTED_API_PAPR) { + spapr_exit_nested_papr(spapr, cpu, excp); + } else { + g_assert_not_reached(); + } +} + +static void nested_papr_load_l2(PowerPCCPU *cpu, + CPUPPCState *env, + SpaprMachineStateNestedGuestVcpu *vcpu, + target_ulong now) +{ + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); + target_ulong lpcr, lpcr_mask, hdec; + lpcr_mask =3D LPCR_DPFD | LPCR_ILE | LPCR_AIL | LPCR_LD | LPCR_MER; + + assert(vcpu); + assert(sizeof(env->gpr) =3D=3D sizeof(vcpu->state.gpr)); + nested_load_state(cpu, &vcpu->state); + lpcr =3D (env->spr[SPR_LPCR] & ~lpcr_mask) | + (vcpu->state.lpcr & lpcr_mask); + lpcr |=3D LPCR_HR | LPCR_UPRT | LPCR_GTSE | LPCR_HVICE | LPCR_HDICE; + lpcr &=3D ~LPCR_LPES0; + env->spr[SPR_LPCR] =3D lpcr & pcc->lpcr_mask; + + hdec =3D vcpu->hdecr_expiry_tb - now; + cpu_ppc_store_decr(env, vcpu->state.dec_expiry_tb - now); + cpu_ppc_hdecr_init(env); + cpu_ppc_store_hdecr(env, hdec); + + cpu_ppc_increase_tb_by_offset(env, vcpu->tb_offset); +} + +static void nested_papr_run_vcpu(PowerPCCPU *cpu, + uint64_t lpid, + SpaprMachineStateNestedGuestVcpu *vcpu) +{ + SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); + CPUPPCState *env =3D &cpu->env; + CPUState *cs =3D CPU(cpu); + SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); + target_ulong now =3D cpu_ppc_load_tbl(env); + + assert(env->spr[SPR_LPIDR] =3D=3D 0); + assert(spapr->nested.api); /* ensure API version is initialized */ + spapr_cpu->nested_host_state =3D g_try_new(struct nested_ppc_state, 1); + assert(spapr_cpu->nested_host_state); + nested_save_state(spapr_cpu->nested_host_state, cpu); + spapr_cpu->nested_host_state->dec_expiry_tb =3D now - cpu_ppc_load_dec= r(env); + nested_papr_load_l2(cpu, env, vcpu, now); + env->spr[SPR_LPIDR] =3D lpid; /* post load l2 */ + + spapr_cpu->in_nested =3D true; + nested_post_load_state(env, cs); +} + +static target_ulong h_guest_run_vcpu(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + CPUPPCState *env =3D &cpu->env; + target_ulong flags =3D args[0]; + target_ulong lpid =3D args[1]; + target_ulong vcpuid =3D args[2]; + struct SpaprMachineStateNestedGuestVcpu *vcpu; + struct guest_state_request gsr; + SpaprMachineStateNestedGuest *guest; + target_ulong rc; + + if (flags) /* don't handle any flags for now */ + return H_PARAMETER; + + guest =3D spapr_get_nested_guest(spapr, lpid); + if (!guest) { + return H_P2; + } + if (!spapr_nested_vcpu_check(guest, vcpuid, true)) { + return H_P3; + } + + if (guest->parttbl[0] =3D=3D 0) { + /* At least need a partition scoped radix tree */ + return H_NOT_AVAILABLE; + } + + vcpu =3D &guest->vcpus[vcpuid]; + + /* Read run_vcpu input buffer to update state */ + gsr.buf =3D vcpu->runbufin.addr; + gsr.len =3D vcpu->runbufin.size; + gsr.flags =3D GUEST_STATE_REQUEST_SET; /* Thread wide + writing */ + rc =3D map_and_getset_state(cpu, guest, vcpuid, &gsr); + if (rc =3D=3D H_SUCCESS) { + nested_papr_run_vcpu(cpu, lpid, vcpu); + } else { + env->gpr[3] =3D rc; + } + return env->gpr[3]; +} + void spapr_register_nested_hv(void) { spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); @@ -1570,6 +1842,7 @@ void spapr_register_nested_papr(void) spapr_register_hypercall(H_GUEST_CREATE_VCPU, h_guest_create_vcpu); spapr_register_hypercall(H_GUEST_SET_STATE, h_guest_set_state); spapr_register_hypercall(H_GUEST_GET_STATE, h_guest_get_state); + spapr_register_hypercall(H_GUEST_RUN_VCPU, h_guest_run_vcpu); } =20 void spapr_unregister_nested_papr(void) @@ -1581,6 +1854,7 @@ void spapr_unregister_nested_papr(void) spapr_unregister_hypercall(H_GUEST_CREATE_VCPU); spapr_unregister_hypercall(H_GUEST_SET_STATE); spapr_unregister_hypercall(H_GUEST_GET_STATE); + spapr_unregister_hypercall(H_GUEST_RUN_VCPU); } =20 #else diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index be5f74a7cd..67e6b2effd 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1584,6 +1584,8 @@ uint64_t cpu_ppc_load_atbl(CPUPPCState *env); uint32_t cpu_ppc_load_atbu(CPUPPCState *env); void cpu_ppc_store_atbl(CPUPPCState *env, uint32_t value); void cpu_ppc_store_atbu(CPUPPCState *env, uint32_t value); +void cpu_ppc_increase_tb_by_offset(CPUPPCState *env, int64_t offset); +void cpu_ppc_decrease_tb_by_offset(CPUPPCState *env, int64_t offset); uint64_t cpu_ppc_load_vtb(CPUPPCState *env); void cpu_ppc_store_vtb(CPUPPCState *env, uint64_t value); bool ppc_decr_clear_on_delivery(CPUPPCState *env); --=20 2.42.0 From nobody Mon May 13 02:29:20 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=1710263537; cv=none; d=zohomail.com; s=zohoarc; b=dr/DZHzOo57YYl/8uYGZ4mLP3jfz7XiSSYwpNLHltn7vpSiUr0XZUZVpwAp9wIoLLVBnY4FtwMqpktIrnuVoKyjpWlGhM6LcEGkYec7m5kaC1zF9p+fhJURbGqHJQIgfl9JSzyIXNxt4cBdX//pcaVDIhXqKOaq0mKVoE4Sf8vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710263537; 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=lX04aDkXFvlRCQh6VqYz9F4OSVcE/Z+9u7GVIjBUl0g=; b=JpnFw0cxTpZICFQt//NG4LGN+YrGqf90biPDwCsmNpBL8W93wvlVP3Kp5UBk8ngg9kknvnfbdnLp5sB8D0QpB2P8CNLDvrwQsWkfD6JHaMS/RkkW85yninlgBRhUn34nzwRgvW8IP7Xlc7BkGOBdFi7QwM8IxBsX/aEUWaONeMI= 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 1710263537173434.59634887041875; Tue, 12 Mar 2024 10:12:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk5Z7-0000xY-9n; Tue, 12 Mar 2024 13:05:28 -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 1rk5Vg-00087z-4C; Tue, 12 Mar 2024 13:01:55 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk5Vd-0000AH-8G; Tue, 12 Mar 2024 13:01:51 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e6ac741ff7so545058b3a.0; Tue, 12 Mar 2024 10:01:48 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id t34-20020a056a0013a200b006e6a684a6ddsm1362330pfg.220.2024.03.12.10.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710262907; x=1710867707; 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=lX04aDkXFvlRCQh6VqYz9F4OSVcE/Z+9u7GVIjBUl0g=; b=d9CIxTmwwwjO0NSWvHtxUV/ZUibzdH3otTp2OFllS5pYGspHy2uVnw+oM/XP7mjiPQ Blsn+cFjJLzh7PM6ZtTPObA0pBzKpj1XMLXKrGe3zvd0zaWPiXYCPBm0gks+Ns8BeGXN 2wGta1rvgNPpYJpBQPRWbh3V3jArsfGO/54YJK1XllS/jes23Gg6ai5A/gqXeUlOywrl hlN8s7IzF+sSxOajwees5zHJkk3UbIWol8E2dA0agZNtWJ/+rjcg3fEwt5VAD//jmNck 8Pc1k6DZi6k34UUQl+uZGOeQCuaTYtdd8bQ+gRuQsKqpDe6rsd0MSLTwXWlZfPYmd8T9 h24g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710262907; x=1710867707; 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=lX04aDkXFvlRCQh6VqYz9F4OSVcE/Z+9u7GVIjBUl0g=; b=tYa0hpIXZ6vuS2vFcMUuMJlP6LYxkThGaD0gpqcs5yJwpBDyJ+GA0TDOmUw978k0oz B0zDxw28Dn+udoZ5F3mHrprk4Tb+OgSqoXnYOXoh9BK9EweUP7zu0NTns7aem0FVEHRw qlWOHPmqpBXV1HVYDfVLiGc7civW7PGzI/JnkQndzMuOYxHAq1hC/bqYhgoKf/4Gc3oN A2fD17VigBwwVZMtvvVR+t4bJTtLjSoa6Ye1hedXtzBkqYcrF5njXA1di9GRcy8GEszr nqTmBVu6J2UQkW1kpEDN0BdoyMoyrp52wt6Dj1d9QluMZHPwbvelxsN5wBD4qC4SHxrP WC0A== X-Forwarded-Encrypted: i=1; AJvYcCXODQAriTn/D1yiYa9RQIXiL1P2Mx05bcx9gm5SjjNWHxeVMAr31qflnt/6maMj4L1GstsHJxYJI+6pDM8oXVwjxK2u X-Gm-Message-State: AOJu0YyIPDpZLNmz3M+HULwepHUrdxvMFWjETiyikghtiKqP4mHZ+kYT 9TIGI6c3EdaF2/RMK5/9KLiVmA/Kxfe9phlWkRYWiwCMM/p9IvYtwxT6EX3uBiE= X-Google-Smtp-Source: AGHT+IHHFobD/lume3I6+6DrjoB1PFYIfOvW3njMOKAlzt47rWA9eZLOMaGcsQ2ht4ZMbybwaI9dcw== X-Received: by 2002:a05:6a20:3d25:b0:1a3:25f9:102b with SMTP id y37-20020a056a203d2500b001a325f9102bmr1014246pzi.12.1710262906960; Tue, 12 Mar 2024 10:01:46 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Harsh Prateek Bora , Michael Neuling Subject: [PULL 38/38] spapr: nested: Introduce cap-nested-papr for Nested PAPR API Date: Wed, 13 Mar 2024 02:58:49 +1000 Message-ID: <20240312165851.2240242-39-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240312165851.2240242-1-npiggin@gmail.com> References: <20240312165851.2240242-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::431; envelope-from=npiggin@gmail.com; helo=mail-pf1-x431.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: 1710263538441100003 Content-Type: text/plain; charset="utf-8" From: Harsh Prateek Bora Introduce a SPAPR capability cap-nested-papr which enables nested PAPR API for nested guests. This new API is to enable support for KVM on PowerVM and the support in Linux kernel has already merged upstream. Reviewed-by: Nicholas Piggin Signed-off-by: Michael Neuling Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 2 ++ hw/ppc/spapr_caps.c | 54 ++++++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr_nested.c | 8 ++++--- include/hw/ppc/spapr.h | 6 ++++- 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index aaf73781b0..99d3fcb185 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2166,6 +2166,7 @@ static const VMStateDescription vmstate_spapr =3D { &vmstate_spapr_cap_fwnmi, &vmstate_spapr_fwnmi, &vmstate_spapr_cap_rpt_invalidate, + &vmstate_spapr_cap_nested_papr, NULL } }; @@ -4732,6 +4733,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) smc->default_caps.caps[SPAPR_CAP_IBS] =3D SPAPR_CAP_WORKAROUND; smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] =3D 16; /* 64kiB */ smc->default_caps.caps[SPAPR_CAP_NESTED_KVM_HV] =3D SPAPR_CAP_OFF; + smc->default_caps.caps[SPAPR_CAP_NESTED_PAPR] =3D SPAPR_CAP_OFF; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] =3D SPAPR_CAP_ON; smc->default_caps.caps[SPAPR_CAP_CCF_ASSIST] =3D SPAPR_CAP_ON; smc->default_caps.caps[SPAPR_CAP_FWNMI] =3D SPAPR_CAP_ON; diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index e889244e52..62abf1ba9d 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -487,6 +487,50 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState = *spapr, error_append_hint(errp, "Try appending -machine cap-nested-hv= =3Doff " "or use threads=3D1 with -smp\n"); } + if (spapr_nested_api(spapr) && + spapr_nested_api(spapr) !=3D NESTED_API_KVM_HV) { + error_setg(errp, "Nested-HV APIs are mutually exclusive"); + error_append_hint(errp, "Please use either cap-nested-hv or " + "cap-nested-papr to proceed.\n"); + return; + } else { + spapr->nested.api =3D NESTED_API_KVM_HV; + } + } +} + +static void cap_nested_papr_apply(SpaprMachineState *spapr, + uint8_t val, Error **errp) +{ + ERRP_GUARD(); + PowerPCCPU *cpu =3D POWERPC_CPU(first_cpu); + CPUPPCState *env =3D &cpu->env; + + if (!val) { + /* capability disabled by default */ + return; + } + + if (tcg_enabled()) { + if (!(env->insns_flags2 & PPC2_ISA300)) { + error_setg(errp, "Nested-PAPR only supported on POWER9 and lat= er"); + error_append_hint(errp, + "Try appending -machine cap-nested-papr=3Dof= f\n"); + return; + } + if (spapr_nested_api(spapr) && + spapr_nested_api(spapr) !=3D NESTED_API_PAPR) { + error_setg(errp, "Nested-HV APIs are mutually exclusive"); + error_append_hint(errp, "Please use either cap-nested-hv or " + "cap-nested-papr to proceed.\n"); + return; + } else { + spapr->nested.api =3D NESTED_API_PAPR; + } + } else if (kvm_enabled()) { + error_setg(errp, "KVM implementation does not support Nested-PAPR"= ); + error_append_hint(errp, + "Try appending -machine cap-nested-papr=3Doff\n"= ); } } =20 @@ -735,6 +779,15 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = =3D { .type =3D "bool", .apply =3D cap_nested_kvm_hv_apply, }, + [SPAPR_CAP_NESTED_PAPR] =3D { + .name =3D "nested-papr", + .description =3D "Allow Nested HV (PAPR API)", + .index =3D SPAPR_CAP_NESTED_PAPR, + .get =3D spapr_cap_get_bool, + .set =3D spapr_cap_set_bool, + .type =3D "bool", + .apply =3D cap_nested_papr_apply, + }, [SPAPR_CAP_LARGE_DECREMENTER] =3D { .name =3D "large-decr", .description =3D "Allow Large Decrementer", @@ -919,6 +972,7 @@ SPAPR_CAP_MIG_STATE(sbbc, SPAPR_CAP_SBBC); SPAPR_CAP_MIG_STATE(ibs, SPAPR_CAP_IBS); SPAPR_CAP_MIG_STATE(hpt_maxpagesize, SPAPR_CAP_HPT_MAXPAGESIZE); SPAPR_CAP_MIG_STATE(nested_kvm_hv, SPAPR_CAP_NESTED_KVM_HV); +SPAPR_CAP_MIG_STATE(nested_papr, SPAPR_CAP_NESTED_PAPR); SPAPR_CAP_MIG_STATE(large_decr, SPAPR_CAP_LARGE_DECREMENTER); SPAPR_CAP_MIG_STATE(ccf_assist, SPAPR_CAP_CCF_ASSIST); SPAPR_CAP_MIG_STATE(fwnmi, SPAPR_CAP_FWNMI); diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index ce3490bcf2..936659b4c0 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -13,13 +13,15 @@ void spapr_nested_reset(SpaprMachineState *spapr) { if (spapr_get_cap(spapr, SPAPR_CAP_NESTED_KVM_HV)) { - spapr->nested.api =3D NESTED_API_KVM_HV; spapr_unregister_nested_hv(); spapr_register_nested_hv(); - } else { - spapr->nested.api =3D 0; + } else if (spapr_get_cap(spapr, SPAPR_CAP_NESTED_PAPR)) { spapr->nested.capabilities_set =3D false; + spapr_unregister_nested_papr(); + spapr_register_nested_papr(); spapr_nested_gsb_init(); + } else { + spapr->nested.api =3D 0; } } =20 diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 6223873641..4aaf23d28f 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -81,8 +81,10 @@ typedef enum { #define SPAPR_CAP_RPT_INVALIDATE 0x0B /* Support for AIL modes */ #define SPAPR_CAP_AIL_MODE_3 0x0C +/* Nested PAPR */ +#define SPAPR_CAP_NESTED_PAPR 0x0D /* Num Caps */ -#define SPAPR_CAP_NUM (SPAPR_CAP_AIL_MODE_3 + 1) +#define SPAPR_CAP_NUM (SPAPR_CAP_NESTED_PAPR + 1) =20 /* * Capability Values @@ -592,6 +594,7 @@ struct SpaprMachineState { #define H_GUEST_CREATE_VCPU 0x474 #define H_GUEST_GET_STATE 0x478 #define H_GUEST_SET_STATE 0x47C +#define H_GUEST_RUN_VCPU 0x480 #define H_GUEST_DELETE 0x488 =20 #define MAX_HCALL_OPCODE H_GUEST_DELETE @@ -996,6 +999,7 @@ extern const VMStateDescription vmstate_spapr_cap_sbbc; extern const VMStateDescription vmstate_spapr_cap_ibs; extern const VMStateDescription vmstate_spapr_cap_hpt_maxpagesize; extern const VMStateDescription vmstate_spapr_cap_nested_kvm_hv; +extern const VMStateDescription vmstate_spapr_cap_nested_papr; extern const VMStateDescription vmstate_spapr_cap_large_decr; extern const VMStateDescription vmstate_spapr_cap_ccf_assist; extern const VMStateDescription vmstate_spapr_cap_fwnmi; --=20 2.42.0