From nobody Sun Nov 24 11:53:30 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=1722950150; cv=none; d=zohomail.com; s=zohoarc; b=ft3W1tjaL+shG+T4CWHU0Irg8shWBfTEtkGtQ7jIJudEW6wfcWEsAHLaDOrV5xaXmaNESU38jfmtlyKyoDBLH3obR/heRPelwdz4MvPQzw/hINMA0BUx06dVSKVj2+5FHh8obvo8nZL2sIKttn6qrlZ1b2n0NYo+bEjBH3thRvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950150; 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=4PqO+DYgcTMKO0xB3vRM0Tk2cvFGgi0Ib7F149Q/avM=; b=FEYIy+uiHe9DMnwrREeV5eEACFp7GOOFhy6DzN4uZWH/x5y8tW/DcW+YBZSo3OlKWW2yYsJW76IKbQvXnhr5L5fxwKT9YKJMFUAZcbXOwaBF5poNmq5UZ6Reb5OkcX9LZ35pIBn4nSeoJdpHsQeOEpC1UMZt6bv27expVr34fe0= 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 1722950150051219.44028058822607; Tue, 6 Aug 2024 06:15:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK0Q-0002ys-6H; Tue, 06 Aug 2024 09:13:38 -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 1sbK0O-0002qr-4v; Tue, 06 Aug 2024 09:13:36 -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 1sbK0M-0003UO-4T; Tue, 06 Aug 2024 09:13:35 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-70d25b5b6b0so435476b3a.2; Tue, 06 Aug 2024 06:13:33 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950012; x=1723554812; 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=4PqO+DYgcTMKO0xB3vRM0Tk2cvFGgi0Ib7F149Q/avM=; b=MdItoTWo+dFsTRmFh982apISat2VHEmy7di8hkF96GNZKAldtqErLhzl3iwfHWZ2jJ Z/dHZh8wzkEAwYE9LaD/jHY9v80gKTfGgABGTnpaMT0/gzDoH455fDBsdfGT3cLsUx7F /pZOsEW1c0go35XFojlyrXdJ2InvuvqO13yHFvJm9IBR+WW+eL1lhySoFilRO+Zhz/tG p0qqo/T0VnvYcP7DGhvJpczwldU9AdpfF+fQnAcHenmcDEBomQSflcebHMpEuUpA1Pfy G7capfrSULaJC+9Qo2txg66Jii8bq+WUoQMTpS31zu7kRZJ6DTkdoJsipq1JwjVFbG2P XqTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950012; x=1723554812; 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=4PqO+DYgcTMKO0xB3vRM0Tk2cvFGgi0Ib7F149Q/avM=; b=bbc7NRQU52cElRJBzUKRIK8J2XNaMwqD1DyKjweWLlcbeHuqRe9MQ6tgAXVclWvb6s nYFjG8Few5eTV3wuH62kL+IdHjv4SY55CIYvmtsTfsjeW4Hu9kZeKSDKmRjLMrlBtFxk rIDpH0XqsBKoV0FAQUDxaa+EPHgtMT3pZKuPTTvLyhAgp6CGOsgxjS1GiT+wEfJc5OV3 J06s3ZR8RF6yTabMzkCTOXYvVVFxX0RtDGhmqcMVAoCzaFNgF8fJom9Cm5yBvvlrgXCh HB+TGNuFHstnQJuzG0JqViw294aCVPB4ShET2OF7p4m+2FVg9Rg4U5YydfjV/tjdItYi 7VDA== X-Forwarded-Encrypted: i=1; AJvYcCW85hD+EmQZe+dbIXmYD6qVZ58bM9m5qw3b/AqClrMIr3VienfRxOBQnzHP7aWwEqbSJ2kaupqmkjv5IXUb+pWNyd7+Nxk= X-Gm-Message-State: AOJu0Yzgme2zyNE+pI3hivMAMMChIHlg4mm/5LNNFBagMJIEAHh5eVaz e+ykT9mkidumSOGH5bkmrEwjJY3/+AQZK3QN1rTPv2n82vGvvH3nspnOwdiA X-Google-Smtp-Source: AGHT+IFsQW/iPHB3uw4u00GlHe8SeLFDoGaKDsVCT9IyjeLOoS4tpkCEIbQC4k4KZb7fzVak9tDFzw== X-Received: by 2002:a17:902:e749:b0:1fb:cffb:cfc1 with SMTP id d9443c01a7336-1ff5727c5bbmr165610895ad.4.1722950011794; Tue, 06 Aug 2024 06:13:31 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH 1/7] ppc/pnv: Fix LPC serirq routing calculation Date: Tue, 6 Aug 2024 23:13:11 +1000 Message-ID: <20240806131318.275109-2-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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 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: 1722950152201116600 The serirq routing table is split over two registers, the calculation for the high irqs in the second register did not subtract the irq offset. This was spotted by Coverity as a shift-by-negative. Fix this and change the open-coded shifting and masking to use extract32() function so it's less error-prone. This went unnoticed because irqs >=3D 14 are not used in a standard QEMU/OPAL boot, changing the first QEMU serial-isa irq to 14 to test does demonstrate serial irqs aren't received, and that this change fixes that. Reported-by: C=C3=A9dric Le Goater Resolves: Coverity CID 1558829 (partially) Signed-off-by: Nicholas Piggin Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson --- target/ppc/cpu.h | 1 + hw/ppc/pnv_lpc.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 321ed2da75..bd32a1a5f8 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -40,6 +40,7 @@ =20 #define PPC_BIT_NR(bit) (63 - (bit)) #define PPC_BIT(bit) (0x8000000000000000ULL >> (bit)) +#define PPC_BIT32_NR(bit) (31 - (bit)) #define PPC_BIT32(bit) (0x80000000 >> (bit)) #define PPC_BIT8(bit) (0x80 >> (bit)) #define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs)) diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c index f8aad955b5..80b79dfbbc 100644 --- a/hw/ppc/pnv_lpc.c +++ b/hw/ppc/pnv_lpc.c @@ -435,13 +435,19 @@ static void pnv_lpc_eval_serirq_routes(PnvLpcControll= er *lpc) return; } =20 + /* + * Each of the ISA irqs is routed to one of the 4 SERIRQ irqs with 2 + * bits, split across 2 OPB registers. + */ for (irq =3D 0; irq <=3D 13; irq++) { - int serirq =3D (lpc->opb_irq_route1 >> (31 - 5 - (irq * 2))) & 0x3; + int serirq =3D extract32(lpc->opb_irq_route1, + PPC_BIT32_NR(5 + irq * 2), 2); lpc->irq_to_serirq_route[irq] =3D serirq; } =20 for (irq =3D 14; irq < ISA_NUM_IRQS; irq++) { - int serirq =3D (lpc->opb_irq_route0 >> (31 - 9 - (irq * 2))) & 0x3; + int serirq =3D extract32(lpc->opb_irq_route0, + PPC_BIT32_NR(9 + (irq - 14) * 2), 2); lpc->irq_to_serirq_route[irq] =3D serirq; } } --=20 2.45.2 From nobody Sun Nov 24 11:53:30 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=1722950085; cv=none; d=zohomail.com; s=zohoarc; b=ehIXRR3qhg4+ZFuGzZb+5XO7k1TsAgmMTo1LqB/1bAKS8aSX56jqsSN8zZulAI/7kB3JVdYd/oRLtDklq3afhARsGjqAXf8rlGYIifPZYPvxNIqfkDP7L1occz0xYCl1a3HzE5OK3uNFvmwCy8pcMNEm/pHayE2lREmAnD1Dhwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950085; 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=mnebB2MqX6EetROF6uhcR3JDthmIaqX5oq8YhYJ9rA4=; b=Q7m4poBNTS0Lw06KlhBmmqb94n1WWVmz5peNW6e0kRVvHbZhYWKStws8xtK3IJPBQn/v0eV/0lUH/uy6eBLGe5+1D2Vaw+61GI+x/OlyGZkS2IUEiRMYgzfZL+0LZKHB8puc/l145tR4K3cQfdxCSsg2i0N/Ue3RHdlrWaY/I7Y= 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 1722950085981117.23164144645875; Tue, 6 Aug 2024 06:14:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK0U-0003Hh-Uq; Tue, 06 Aug 2024 09:13:43 -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 1sbK0S-00037O-9M; Tue, 06 Aug 2024 09:13:40 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbK0Q-0003VM-Hw; Tue, 06 Aug 2024 09:13:39 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fc65329979so4977545ad.0; Tue, 06 Aug 2024 06:13:37 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950016; x=1723554816; 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=mnebB2MqX6EetROF6uhcR3JDthmIaqX5oq8YhYJ9rA4=; b=VUhGPm2B59ELmnRYSjEMJ3gmgfWhOYcZ3rWizkXnmf89ltc8E5N7EkD2bcsjbtkslZ pTykFnZuPry1qI6tQDWc9r3eXiS/JATpdg/v5GkzX/tTs6ZsHCUt9A/HYxRmqr0AYVQV gnrsIh5J/elq2blxpraLk2BZwsYEWmyr5Xs2xMRGiKV3HtiZAIIIoJkL7TCIk1hoNMLS hOOC5jO7iXiUqNGcHsztLjmsNvgbFqdix/vaUJeuVnzji1zKYdFqn5mR37UJZUq0WgrI odqm8bxX26rs/ESk//+AtfLRSzQnV/ZJSTkWHGtdyIEj1vb28zM50Ws/oyI4hixz86js 6kxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950016; x=1723554816; 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=mnebB2MqX6EetROF6uhcR3JDthmIaqX5oq8YhYJ9rA4=; b=od/vdHg66ngfBsy23MhEtIRfSI9dj3Bn5af0q1n5TC60dMl2mVZ9EzCkPRyZvPmyWG 9ToOhsu3SztyhxuNidW1tDic8k2e5iyld760VtpznGhulmkSW6lZB2uzkstKwqECYck4 U5ke+Fx68H5xeI5zHClj+Wa0hLMIZcq6Po/IVtLbyDHMx2fiPrIwidM/69p5yPqYKjHL 3WT1fzdtmgY3NSV3lpkX6lBKxgP3oEMOco3Qq4uUwMvDhnkdE74Tmxwk0A7/SkMVSCTU gwfHOHog46+ZKpGjFSctXk0E5S9nNEYRrpu214+ozfnWn0o2qKzjIu2LSFugUtSVZ1/3 Shtg== X-Forwarded-Encrypted: i=1; AJvYcCXFw2nYB+0HDFHNuSd1FrM97KXqqVgsBbhmmvS2XvnbBG2cPeK5zera6EkVVJCq6rqLOh2D2KmMfapWg5RT0ABga+NMKis= X-Gm-Message-State: AOJu0YzagGRKfXwdUr7bDnBlzQZlhioGZ2t/uzE36PYnKebVq0AYg9Qg Z74jpASLvFuaX9A3aXvXBlu38JY/J8mradqloeMsQ6CsnplA2fR19dZOM00d X-Google-Smtp-Source: AGHT+IHc+zac+YHMwx3ht7IXL+rjtWbA7Ny23MxRqjxjqH5H3NM6TWrgEM2VI0DEvnY3dAE5h3WzuQ== X-Received: by 2002:a17:902:f54b:b0:1fb:6151:f62f with SMTP id d9443c01a7336-1ff572957c5mr188262655ad.28.1722950016200; Tue, 06 Aug 2024 06:13:36 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH 2/7] ppc/pnv: Fix LPC POWER8 register sanity check Date: Tue, 6 Aug 2024 23:13:12 +1000 Message-ID: <20240806131318.275109-3-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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::62a; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1722950087745116601 POWER8 does not have the ISA IRQ -> SERIRQ routing system of later CPUs, instead all ISA IRQs are sent to the CPU via a single PSI interrupt. There is a sanity check in the POWER8 case to ensure the routing bits have not been set, because that would indicate a programming error. Those bits were incorrectly specified because of ppc bit numbering fun. Coverity detected this as an always-zero expression. Reported-by: C=C3=A9dric Le Goater Resolves: Coverity CID 1558829 (partially) Signed-off-by: Nicholas Piggin Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson --- hw/ppc/pnv_lpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c index 80b79dfbbc..8c203d2059 100644 --- a/hw/ppc/pnv_lpc.c +++ b/hw/ppc/pnv_lpc.c @@ -427,8 +427,8 @@ static void pnv_lpc_eval_serirq_routes(PnvLpcController= *lpc) int irq; =20 if (!lpc->psi_has_serirq) { - if ((lpc->opb_irq_route0 & PPC_BITMASK(8, 13)) || - (lpc->opb_irq_route1 & PPC_BITMASK(4, 31))) { + if ((lpc->opb_irq_route0 & PPC_BITMASK32(8, 13)) || + (lpc->opb_irq_route1 & PPC_BITMASK32(4, 31))) { qemu_log_mask(LOG_GUEST_ERROR, "OPB: setting serirq routing on POWER8 system, ignoring.\n= "); } --=20 2.45.2 From nobody Sun Nov 24 11:53:30 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=1722950086; cv=none; d=zohomail.com; s=zohoarc; b=Po8CxHsMfU9WucL8OhUz9EPHILDNJg3szAAK0pBE+55PF9lBCkjf6dXa8I2LoXeHnRu1eNbaK7ZWtnrAS7qv+kEKjReukitrRI9xCZWhIUz+Thu33Idl3JVjtfUOXaB4/LHfP6XKPnFeFMfpOjwSgOQF5vEQNSDl0q4RHNUomqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950086; 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=n3vOJHdBSCS5r7re3EDV7tdNgSsbH1n37vePYDuNuvo=; b=d0S+vz+EJMOD3rAz7VR7bSAJ2nTxnkUphCVZjw93Z57BLPzT9KVh/TwpukRYFwWegj+INAtHWas2D2rHa61aZM/fd5f47/UT4SM3Lo2xreSJcJinYX2rElTrhKEmwmy+jsXuyjxMBsbnQA9yvQQHuIEKlIJ2Ix+AUWDcXKD+4LA= 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 1722950086130967.6527062206897; Tue, 6 Aug 2024 06:14:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK0k-0004Gx-S4; Tue, 06 Aug 2024 09:14:01 -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 1sbK0a-0003dO-4W; Tue, 06 Aug 2024 09:13:48 -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 1sbK0X-0003Vi-9S; Tue, 06 Aug 2024 09:13:47 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7a18ba4143bso348334a12.2; Tue, 06 Aug 2024 06:13:42 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950020; x=1723554820; 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=n3vOJHdBSCS5r7re3EDV7tdNgSsbH1n37vePYDuNuvo=; b=is+m2jKqj1iM9YGg0pFY857XIbdg5GnnR1vHCN/QTz193adeTrwJy3VKjYFkT0J8nr UAG4zJJF33/r8gTBdUdabCLYgKPGfgxvZ+nIGHgHwnRUcqOD4XhbA6SfpquAinLSbOps 6SW/MEmGwmSE06JGmdCXwf9mHhpWSmVqbzhRfy1h0KW4OaIklnnVWDwQM1woNMSnf+LV N4ZvsyIz29+SYp/ZcTFpHLdNFSguouNa0oUiBDaZgUwDX15vR9nDSMLwnoJKRyzq7PjM sWDMSwaZdcVD5bGeKi/vCQUPxBSlg5N44A/GsL9+m2qZkpE16w/6WDP2mduotLmNZn3W cQBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950020; x=1723554820; 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=n3vOJHdBSCS5r7re3EDV7tdNgSsbH1n37vePYDuNuvo=; b=mv45OdlO+e0yjUfWXa345V9P7keze+yb9wZFbNNhWKOBMFIwbNDFr5PTTT8ZHrUbQI HdPaK8f7wkh4XiR7BW+SLzyFm30J/JoMXHG1wgYSn5IJhk+i7YVNLemenefT58XXXxwR s7Ld8wUKHJzinbUXmkMkR/wTg6vfbZz/yR1FHgfuSxDAzc6l1MFmr/JXR6q7Jx+iC+LK z3R4G0ffU5A09fNAdx0hyvnHhFLvrzVOXtOuhMlK1t9F0wpVCX4PPhD4Blr4iU2r5vMK W2Mwvz3HeOsy+OGPoImbNKrR59zHZIzRwesvoE3+65pTUoE8gnqbgsg6GFQOYASKfZoM I5Cg== X-Forwarded-Encrypted: i=1; AJvYcCUvJRYR4FEKAT7TmJ1fkXWkjFCJHALxuxbh0EWD4U1CtAdMKi5cbqjQnyk+WM4dK5jygLDdxFnG/WLuNsRiUB9L1pe0BP4= X-Gm-Message-State: AOJu0Yy17Ibt/9JG5KFSEKThmDK5+JUBQIHZdyiYycgr0F1dTFTgjNVh o1sv4FvSllO7jNMt04VwhHaA77iyNTSNPd/ujGPL0PHsZfVBSYePEVm9VfD5 X-Google-Smtp-Source: AGHT+IGW5IBw63fnL89t7pHof4im9YaPlCM4KPYrf2wAncSb1N1oJYXR7tea7mLnB6tNmQJqekXJwQ== X-Received: by 2002:a17:902:ce82:b0:1fd:a942:154d with SMTP id d9443c01a7336-1ff572c488dmr122962095ad.22.1722950020008; Tue, 06 Aug 2024 06:13:40 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org Subject: [PATCH 3/7] target/ppc: Fix mtDPDES targeting SMT siblings Date: Tue, 6 Aug 2024 23:13:13 +1000 Message-ID: <20240806131318.275109-4-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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::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 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: 1722950087745116600 Content-Type: text/plain; charset="utf-8" A typo in the loop over SMT threads to set irq level for doorbells when storing to DPDES meant everything was aimed at the CPU executing the instruction. Signed-off-by: Nicholas Piggin Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/ppc/misc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c index 1b83971375..f0ca80153b 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -288,7 +288,7 @@ void helper_store_dpdes(CPUPPCState *env, target_ulong = val) PowerPCCPU *ccpu =3D POWERPC_CPU(ccs); uint32_t thread_id =3D ppc_cpu_tir(ccpu); =20 - ppc_set_irq(cpu, PPC_INTERRUPT_DOORBELL, val & (0x1 << thread_id)); + ppc_set_irq(ccpu, PPC_INTERRUPT_DOORBELL, val & (0x1 << thread_id)= ); } bql_unlock(); } --=20 2.45.2 From nobody Sun Nov 24 11:53:30 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=1722950086; cv=none; d=zohomail.com; s=zohoarc; b=QbQ6mC1iLy8vz5kbXSobdR4ol2B34q4OAsd/5zLeibAWcp4yu+MS8nGb++N2WpDuGhSl2EKGZS7fUJOxYnyzPkXIw2y9JxoGyqZ3et+lru7XwdCR0WGCeqKi2BEWsTlI8iAO86t6ea3AjqP1ibuOZKWq1vvqZ8HtET/LePk5+GU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950086; 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=KIbYNlJMBEsCqBxxwTzqQf1JhWU8VE32ZNkapVqS6C8=; b=YJcehMhhyKroDnXhAiP3TyuKT+CmUqiIqLSuivUdqy9ajC+YzGqODT2FMFAWi7wLIXgLUks+q9trEvTbDV7nmbHe1k14i3PVXk4Msl4fjZgn8GvgkH9Z25PEhxNIYT0pPrFSPLuL0tZSNKBpXVcjoO+jdkNyesLIZnJ2a7SDayA= 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 1722950086506599.1946635503664; Tue, 6 Aug 2024 06:14:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK14-0005d3-Gt; Tue, 06 Aug 2024 09:14: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 1sbK0c-0003mM-Dp; Tue, 06 Aug 2024 09:13:53 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbK0Z-0003Vz-MJ; Tue, 06 Aug 2024 09:13:49 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1ff67158052so4288115ad.0; Tue, 06 Aug 2024 06:13:44 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950023; x=1723554823; 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=KIbYNlJMBEsCqBxxwTzqQf1JhWU8VE32ZNkapVqS6C8=; b=TG0Ak+TFPK95pY1TGuao6kTrQZBVYdxngiItFJSN9P/vW4dUCfFwduHkmWv2SbgWp1 jdXvk0BH6iDr8XmJlhpZ65ppMZbIajCpCplAC1c77epjzWUsZCZMWI7L5/x4R1qt3RUw yRKraRvO/IjTXqhxtoxDW+Eq+l5Osqq1Y0oWBDldB8qwjmjg1rq2Q/5V1OmTeIOPZEcF sqQYDuWPXOgjLEwICzis/6hbLZCBMHVSSWrjjzcHZ3sHudTm0XlFXXtCsqVvdzBwTIc+ Eh5SoMQVp3DGNOz5mvPH8ZsXB7xWk4ZryVxFxVQbjPFjtaMOBd6z2AcgiE3XT3y+43Ln VkfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950023; x=1723554823; 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=KIbYNlJMBEsCqBxxwTzqQf1JhWU8VE32ZNkapVqS6C8=; b=Wpw1cbAAdu7Y9RTkwXTPtgulDMkTNyvU3Xurbjgf/9SXqj9BWcQ8yDdLuaH5jnhSm+ jlwRhaQCwEu3gpNEAf5AP0A7mS6BTxm2SGNAu1dStK+pFJf32gEbv0J36ORxwWmvWxYp ENcoSwXKBReuJUIdCmFvrWnXYNRKag/BubRfW2VBSQFWevgeXOFG/fJwVQOI4JmTyXdi UKnb6l6aR7auFsO5ImzLVauAd+fPEMyJxxuYWcevZN5AA7IPCmg2jAFycFQN0O4bjwUd dHxvYXcgwoYwq7jjMPGb3pmD8gTMibZSHJaRF8n9ltPnZAsE9beCwAqA+30yo53gC0CW bUug== X-Forwarded-Encrypted: i=1; AJvYcCUgHPj+oDtFGAD03fCvjiTnCa528V5TuBRuqnzMgtAD8VxGVyTs2l5JjeARgKbA0wMxPYhF332vPeiTxGue3IQpHFYctcc= X-Gm-Message-State: AOJu0YwnuHBO95NlLMuknh373uql1dp2SBKfzStctgXjxslZdmC06S/s iZsEUHt/rXVlZKegLQ1XvxFomHc53mNAPcd/R2a4XRn9VqH45L/TtZw4RCvl X-Google-Smtp-Source: AGHT+IE/Wm7PJAZf+CMGRmjGZndGLRL+exg55KjpuAvnXHRI1c1l4AVKIwxy63x1NWJH+DgwRbecCQ== X-Received: by 2002:a17:902:b192:b0:1fb:5574:7554 with SMTP id d9443c01a7336-1ff572b97cfmr110012275ad.28.1722950022804; Tue, 06 Aug 2024 06:13:42 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org Subject: [PATCH 4/7] target/ppc: PMIs are level triggered Date: Tue, 6 Aug 2024 23:13:14 +1000 Message-ID: <20240806131318.275109-5-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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::62c; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1722950087753116600 Content-Type: text/plain; charset="utf-8" In Book-S / Power processors, the performance monitor interrupts are driven by the MMCR0[PMAO] bit, which is level triggered and not cleared by the interrupt. Others may have different performance monitor architecture, but none of those are implemented by QEMU. Signed-off-by: Nicholas Piggin Reviewed-by: Richard Henderson --- target/ppc/excp_helper.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index f33fc36db2..701abe1b6d 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2187,7 +2187,6 @@ static void p7_deliver_interrupt(CPUPPCState *env, in= t interrupt) powerpc_excp(cpu, POWERPC_EXCP_DECR); break; case PPC_INTERRUPT_PERFM: - env->pending_interrupts &=3D ~PPC_INTERRUPT_PERFM; powerpc_excp(cpu, POWERPC_EXCP_PERFM); break; case 0: @@ -2250,7 +2249,6 @@ static void p8_deliver_interrupt(CPUPPCState *env, in= t interrupt) powerpc_excp(cpu, POWERPC_EXCP_SDOOR_HV); break; case PPC_INTERRUPT_PERFM: - env->pending_interrupts &=3D ~PPC_INTERRUPT_PERFM; powerpc_excp(cpu, POWERPC_EXCP_PERFM); break; case PPC_INTERRUPT_EBB: /* EBB exception */ @@ -2330,7 +2328,6 @@ static void p9_deliver_interrupt(CPUPPCState *env, in= t interrupt) powerpc_excp(cpu, POWERPC_EXCP_SDOOR_HV); break; case PPC_INTERRUPT_PERFM: - env->pending_interrupts &=3D ~PPC_INTERRUPT_PERFM; powerpc_excp(cpu, POWERPC_EXCP_PERFM); break; case PPC_INTERRUPT_EBB: /* EBB exception */ @@ -2444,7 +2441,6 @@ static void ppc_deliver_interrupt(CPUPPCState *env, i= nt interrupt) powerpc_excp(cpu, POWERPC_EXCP_SDOOR_HV); break; case PPC_INTERRUPT_PERFM: - env->pending_interrupts &=3D ~PPC_INTERRUPT_PERFM; powerpc_excp(cpu, POWERPC_EXCP_PERFM); break; case PPC_INTERRUPT_THERM: /* Thermal interrupt */ --=20 2.45.2 From nobody Sun Nov 24 11:53:30 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=1722950086; cv=none; d=zohomail.com; s=zohoarc; b=CTUr8gDvHSXbQtoSR82oVvtedSJlGfTlC4PlRR+biro5Z/lOYntIN0X/c20neNe9dwQcLXeDu5xDlXS+42ZM1fxfZ7p+x3RWpzivFxkwsW3hjpFEhP94YuDOUSuQkrzMpuXfEnhMJdCjrjlilinLFxJML/xGVDx/FL9Nr0FF1q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950086; 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=VgU6iYZFKP//e6ctrVy6nGUeFbSjKaYt4cFTsJDS7Pk=; b=lUAhpsI6Rao0F6w/PmFtuYDIukAyCccLzCkXXLR7ONi0SKTcCgeBwofYIYfJmGmX6FDlCDPJpPiwBBXWqwe7o06L0Rs8il9ISPW3oQKMe2RQFq8AgKYbwbeMpAT6D3/mYyy7I6GR2Lj44XLE4Dm6ZItEFty4bfy3pByPL0C9zYY= 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 1722950086117993.0871828908065; Tue, 6 Aug 2024 06:14:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK15-0005lO-O7; Tue, 06 Aug 2024 09:14:19 -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 1sbK0f-0003xY-CF; Tue, 06 Aug 2024 09:13:56 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbK0c-0003WJ-OG; Tue, 06 Aug 2024 09:13:52 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1ff1cd07f56so4580175ad.2; Tue, 06 Aug 2024 06:13:49 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950027; x=1723554827; 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=VgU6iYZFKP//e6ctrVy6nGUeFbSjKaYt4cFTsJDS7Pk=; b=FyHCiPNnja+NxFlaUOeKYN7nSG6dow1PJa1Ea2FuAMCwtW4cv5pnJ1FSmcEhU6v3sa SQFsItugNC9G/DNaCKlu+jR0idZy2lTS24XyGUzaWC0OS3QloHIzJ1vHfkDmgcfUoIxe MietkRSSVDL+p6BkaKjk5QSn/I1XvIpXjQ2mJvxRicu+BE42rqbDWNgmXY840/iDMCYJ w2clRyW/3JsDKIw9MarnZVCJiXDgrg/GTUiGwXEtGXkqrhOCI0z6x29nlIyWOHjPfukI PUmYbzhu7o2tktTMVmtLbMyAdhTa/8HjyV697dLKYVqmf1iP+xydnsfhG8w9YAB64Zyg fmCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950027; x=1723554827; 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=VgU6iYZFKP//e6ctrVy6nGUeFbSjKaYt4cFTsJDS7Pk=; b=g5zX7nM32dHULLBT3AEmT4PZvsB7GQRvMlQ9G/VGMdsfNCdwdeG6tbom8scaQL4smD QinPe4+ZHxNSwTcG/gVt/CijsFePf8T0qV4l181ByM1wfw5mltw1xXV/lVRpw9s+6E8h jbmixSiWNmq/NplebWBsOjqC0r/CZSM6tG1ZHvF2Gowq8WP79CUpcmoPU0IZLBIx5N3B Okze60yHD0rzb01tu5fF3/xEyIGUBZlbkLREsmy3iPLvb/4Th7/sEbq/HalSkahg4iKD 86h+Kwzwu8aZQveHV0+r1YJ7CrsucqUbnBwmqs9SXr4dTrwJr6+C0ynOeKlQRJ6yDPJx LHOg== X-Forwarded-Encrypted: i=1; AJvYcCUbTlEg1tVtACvkP8I1Z7WGliuKIRsFUIvfTozIu0ZHQlFMYQf3FsVGP0suz6pMQ8MoHg1Y/LrHmWGDhbxp3oFw6zdiqbI= X-Gm-Message-State: AOJu0YxJD1e3GZQxlwFZ7X8tLKpozIlEWjZPczos6DSLTMzFucQFgLFP Ry0COZAPNeUGpfGYAV8j2wAsdXFWUtJjNuaTBI9BFL3Tl0LWI83Y+59cIWXR X-Google-Smtp-Source: AGHT+IFyCslNNQAAnyRF6xqwhi48lWAoBkiYAnZdvs7xgmOQvYGMOR9NCFGJ0uOaUhwTxi5NXh5h3g== X-Received: by 2002:a17:902:d505:b0:1fa:8f64:8b0d with SMTP id d9443c01a7336-1ff5722e795mr213538905ad.4.1722950027271; Tue, 06 Aug 2024 06:13:47 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org Subject: [PATCH 5/7] target/ppc: Fix doorbell delivery to threads in powersave Date: Tue, 6 Aug 2024 23:13:15 +1000 Message-ID: <20240806131318.275109-6-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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::62a; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1722950087743116600 Content-Type: text/plain; charset="utf-8" Doorbell exceptions are not not cleared when they cause a wake from powersave state, only when they take the corresponding interrupt. The sreset-on-wake logic must avoid clearing the interrupt in this case. Signed-off-by: Nicholas Piggin Reviewed-by: Richard Henderson --- target/ppc/excp_helper.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 701abe1b6d..b619a6adde 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2237,7 +2237,9 @@ static void p8_deliver_interrupt(CPUPPCState *env, in= t interrupt) powerpc_excp(cpu, POWERPC_EXCP_DECR); break; case PPC_INTERRUPT_DOORBELL: - env->pending_interrupts &=3D ~PPC_INTERRUPT_DOORBELL; + if (!env->resume_as_sreset) { + env->pending_interrupts &=3D ~PPC_INTERRUPT_DOORBELL; + } if (is_book3s_arch2x(env)) { powerpc_excp(cpu, POWERPC_EXCP_SDOOR); } else { @@ -2245,7 +2247,9 @@ static void p8_deliver_interrupt(CPUPPCState *env, in= t interrupt) } break; case PPC_INTERRUPT_HDOORBELL: - env->pending_interrupts &=3D ~PPC_INTERRUPT_HDOORBELL; + if (!env->resume_as_sreset) { + env->pending_interrupts &=3D ~PPC_INTERRUPT_HDOORBELL; + } powerpc_excp(cpu, POWERPC_EXCP_SDOOR_HV); break; case PPC_INTERRUPT_PERFM: @@ -2301,6 +2305,7 @@ static void p9_deliver_interrupt(CPUPPCState *env, in= t interrupt) =20 case PPC_INTERRUPT_HDECR: /* Hypervisor decrementer exception */ /* HDEC clears on delivery */ + /* XXX: should not see an HDEC if resume_as_sreset. assert? */ env->pending_interrupts &=3D ~PPC_INTERRUPT_HDECR; powerpc_excp(cpu, POWERPC_EXCP_HDECR); break; @@ -2320,11 +2325,15 @@ static void p9_deliver_interrupt(CPUPPCState *env, = int interrupt) powerpc_excp(cpu, POWERPC_EXCP_DECR); break; case PPC_INTERRUPT_DOORBELL: - env->pending_interrupts &=3D ~PPC_INTERRUPT_DOORBELL; + if (!env->resume_as_sreset) { + env->pending_interrupts &=3D ~PPC_INTERRUPT_DOORBELL; + } powerpc_excp(cpu, POWERPC_EXCP_SDOOR); break; case PPC_INTERRUPT_HDOORBELL: - env->pending_interrupts &=3D ~PPC_INTERRUPT_HDOORBELL; + if (!env->resume_as_sreset) { + env->pending_interrupts &=3D ~PPC_INTERRUPT_HDOORBELL; + } powerpc_excp(cpu, POWERPC_EXCP_SDOOR_HV); break; case PPC_INTERRUPT_PERFM: --=20 2.45.2 From nobody Sun Nov 24 11:53:30 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=1722950119; cv=none; d=zohomail.com; s=zohoarc; b=U9IVM+UFVFd+WIAg4PU9+deaGSZoQVVpCvuK53MDFsIl9oaTxGqZoM0Vt8oxe1M+G0V29FbGNAVtbAUUrcTBH89C4FiOWJXV/XcpaAE9ZQIpPA50q6BCMPFhFyl7X0l77gmebg4rAGjW6OueqXl2k5BfI/UYA1fbfCaSfPmUZCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950119; 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=6XYyJCLzvnn8wO2a9+7AscKvhpo1XrKV7Sx5tGxYTLM=; b=UsDTZoVu2YdtUoGMrv5jHQs7PridC8S4XwO4APpoYh1TQoXsHraF6g0Wq/84GlWUEO1fak2nhEOYFa+ZlW9mlA5DiuqYZWi5zk9ePSDcMz/zW0KAOe0ZZKE7a8lGygbVtze86o5r7qHrWVi5BgJS/iWDWX3CZqNexuLatI6tEE0= 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 1722950119784256.04474946900393; Tue, 6 Aug 2024 06:15:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK15-0005gx-1o; Tue, 06 Aug 2024 09:14:19 -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 1sbK0j-0004E0-Ge; Tue, 06 Aug 2024 09:13:58 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbK0f-0003Ws-TF; Tue, 06 Aug 2024 09:13:56 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1fd9e70b592so5886315ad.3; Tue, 06 Aug 2024 06:13:52 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950030; x=1723554830; 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=6XYyJCLzvnn8wO2a9+7AscKvhpo1XrKV7Sx5tGxYTLM=; b=EpS8697Nwudjvl0eIj1OD+SsMSbRFRYLSUmPnweSxc+3x10UGTlQUYGmVVaZFxW1bu iO1cCtXgScLNVfW07trCZ1RWtubraa+F1d7wKxQj9+AWhqV6PQ9HxicNEaPybNWpv9fJ aE+sPwXvedq/m0bqSIPqYL8i46KBez/xTnKv+PSh5FQEfpkK0q7HuPBIQIO211WxnnxL rbnF8K6I+rCUVnulG5TOeoSyFJ89R9t0CE42vY5cIUSteC3KA0HZMB58SgX4AYqoDibz GIuvRXDuYBsxL/tJCxmrow5lZB+m+yzapVY/gC5g9ODsn7en5GFhp9RULeD8FUsSvTaZ w9OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950030; x=1723554830; 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=6XYyJCLzvnn8wO2a9+7AscKvhpo1XrKV7Sx5tGxYTLM=; b=k/cBk2UFEsHm87ABueY1Ls9WRreh5ObBi9XPzmj1qKssOr5fJF1BlTtA7twH6EKWIj tPrFztKciBBcXqB0xI/gB8R0wPxG0h6ODfIUq93DYBCIHuyV7o50KIBxUkyHFQqLL5P2 vWcTxr007Y0FjOQgiBqcRgSkOHNpGWKMemp35tfKmXBl583+2wNQY6sAIGk840RFyKH+ 9qBtUlCiPE0sRuZnK1clWAw3lwi6ERVIAZD/La+ThWd3RNDgZd8O0VaKWPlm0bu8FZfe 6URMMHNKg4qJTbTocnWBXz4uVq6I9Q0+1D1PSXITPv2uWx2ux5Ku7yUTnGpdjJCbeG1M c+XA== X-Forwarded-Encrypted: i=1; AJvYcCXCe3ctG7pqpn6U02sgx6hs8tNRGiJx/ck1Y6sL1Xnx6nEoUO1nhdN4bteF2K13sRbKeo5HVcYNrxwLVMxRxYFISObDUY0= X-Gm-Message-State: AOJu0YwXxgGsOx3LUGyvu8cSZ7mLNJynYYMR1RsCpox9vrgV0TGlDLwM GpmWuz6zozJ1YsNOJ8u1TuQkbxiwrT2POwTzDq0N3BMMh0b+2NCtz/DzVdd4 X-Google-Smtp-Source: AGHT+IFVTUR2zNJzggAN83mRWimea12aZp2Q4ejiZxQJ7ffEe/QORbo0/RtebXbwUR/u4Mxnr/Ub1Q== X-Received: by 2002:a17:902:db04:b0:200:7d10:b7c9 with SMTP id d9443c01a7336-2007d10b8e1mr9796865ad.28.1722950030218; Tue, 06 Aug 2024 06:13:50 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org Subject: [PATCH 6/7] target/ppc: Fix HFSCR facility checks Date: Tue, 6 Aug 2024 23:13:16 +1000 Message-ID: <20240806131318.275109-7-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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::630; envelope-from=npiggin@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1722950121919116600 Content-Type: text/plain; charset="utf-8" The HFSCR defines were being encoded as bit masks, but the users expect (and analogous FSCR defines are) bit numbers. Signed-off-by: Nicholas Piggin Reviewed-by: Richard Henderson --- target/ppc/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index bd32a1a5f8..f7a2da2bbe 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -635,8 +635,8 @@ FIELD(MSR, LE, MSR_LE, 1) #define PSSCR_EC PPC_BIT(43) /* Exit Criterion */ =20 /* HFSCR bits */ -#define HFSCR_MSGP PPC_BIT(53) /* Privileged Message Send Facilities */ -#define HFSCR_BHRB PPC_BIT(59) /* BHRB Instructions */ +#define HFSCR_MSGP PPC_BIT_NR(53) /* Privileged Message Send Facilitie= s */ +#define HFSCR_BHRB PPC_BIT_NR(59) /* BHRB Instructions */ #define HFSCR_IC_MSGP 0xA =20 #define DBCR0_ICMP (1 << 27) --=20 2.45.2 From nobody Sun Nov 24 11:53:30 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=1722950112; cv=none; d=zohomail.com; s=zohoarc; b=JkLHV0pLynkvgB4gQXBo4BtsE+OUceasw1cviPbmpclIUd/8vl0qVmIPWv2Hy7yohsigOj+UC57JXtwVSz0/zTEG92TAYZBb49f124/AB+/hLZ0DpYziuUp2vvxYEtefuxeWDgNPMPn5qMasFPN92j2JIQ49uVdZZ1BJp+HJVz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722950112; 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=hYtQ+iWLl5Zd5RwOL72P9POMBpC2vDPbojh7D+T2lE0=; b=lfZR+lgnsMauLECwoPYcuLkhZeACDu+jHrExcwt18z5s60/pUNU94UW2KBsliqfVRs+g4MWmplCN0swY1b2wAWGzB0I6qpJbdA9lp7x5F8+CfzWM7hYhHZyLuy8VBh+lCkA4/Lqbzcgl28NSwBSP8iZ7CpebxkZgNrtnEtEYRCQ= 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 1722950112248365.66165143718683; Tue, 6 Aug 2024 06:15:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbK14-0005bA-0B; Tue, 06 Aug 2024 09:14: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 1sbK0l-0004Lj-Gp; Tue, 06 Aug 2024 09:14:01 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbK0i-0003XD-Nb; Tue, 06 Aug 2024 09:13:58 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1fd65aaac27so46087765ad.1; Tue, 06 Aug 2024 06:13:55 -0700 (PDT) Received: from wheely.local0.net ([1.145.149.136]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm87403425ad.173.2024.08.06.06.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 06:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722950034; x=1723554834; 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=hYtQ+iWLl5Zd5RwOL72P9POMBpC2vDPbojh7D+T2lE0=; b=SeKMSWmzG2LpTGWFRaAV83QZrq6upBXg90Yi9Cn0W3zykX40J9XgP3mOKEcFbGVCFg vIvRCNkvSIk0yaa5LP9dS0qqAsRS4w69GWghqv+FC6TPkSzXReKJKFqCW+z+bDOuDssq qENoFvpFFyVwf51e34uw4A7M+l9ErTRGj7QnLgFeuOM2n8BCW83GTUQlwUN4sqkB2MuU bafdOi/WJlwgs4bDVxoxY6lfaJTFMiSEoHe/sG6fQl9h1cHCVMyP1uJpr0w2RvPo49SU yo7+IatZnWcKnA4Pa05o1CB43vJHRdzOW8t7lAf5oswTzPbMIiGEOKXj9yR9TcqQlGUz kKoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722950034; x=1723554834; 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=hYtQ+iWLl5Zd5RwOL72P9POMBpC2vDPbojh7D+T2lE0=; b=wJaBRs1qTggphz/xKhsdW+vtX+lxtFr9+rkCc3IGdb4ifP6IneggwIntv1tiAFyAH9 fsMEU4raLu5lJKZqKP8cpGnUcyYGnz3J+sjyqk5SabXZIAYajTNFIcHN4VwZctuzYOkk w8QDBSpjABaZACHcf4JakFK+aCkJM30HRSovIqwV96gr5zTPG5EX0XwAb4NY7amORvZA 3ihpwuNDtoJZbHq4AfDD09neEinbwW5aJkfsFZj0GCRoE5f480poVlSAKVuPdB1ol9uR bgtbKsOroJKOXObn8gFzI+Vrw7Y+yJwZjq9C/9cTVIyneXPdw/OkoYtq7gcuhfixWVRn mkgg== X-Forwarded-Encrypted: i=1; AJvYcCXGlqFV4g/z7s57M5OsCe/DgghI4vQtNjxtQWUGAQxMkvJd7QfpW6rmerCyaY7YsxqpdWMz+ZKlqlnWnV/0b3Th9nmcXXU= X-Gm-Message-State: AOJu0YxRgDXHJs1wEt0PpHv+m8aZuass86QPHxRO5XKgZ3CxN45Kyqof Wuz2Ebh+9+E9CwlqIyPsz3KCdQndnZSaPmQvrvSMiQjEwxdEDzdd0cuMl3mp X-Google-Smtp-Source: AGHT+IFXwEEbAbqNJy2gwj2saeY3w8iWaRaOmOAMT8/USpcib0DdzlQ5uKTM26+6H/t+BlxSvijbRw== X-Received: by 2002:a17:903:1209:b0:1f4:a04e:8713 with SMTP id d9443c01a7336-1ff57f062b9mr270064675ad.28.1722950033738; Tue, 06 Aug 2024 06:13:53 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , qemu-devel@nongnu.org Subject: [PATCH 7/7] target/ppc: Fix VRMA to not check virtual page class key protection Date: Tue, 6 Aug 2024 23:13:17 +1000 Message-ID: <20240806131318.275109-8-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806131318.275109-1-npiggin@gmail.com> References: <20240806131318.275109-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::636; envelope-from=npiggin@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1722950113924116600 Content-Type: text/plain; charset="utf-8" Hash virtual real mode addressing is defined by the architecture to not perform virtual page class key protection checks. Signed-off-by: Nicholas Piggin Reviewed-by: Richard Henderson --- target/ppc/mmu-hash64.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 5e1983e334..c8c2f8910a 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -993,6 +993,7 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, MMU= AccessType access_type, int exec_prot, pp_prot, amr_prot, prot; int need_prot; hwaddr raddr; + bool vrma =3D false; =20 /* * Note on LPCR usage: 970 uses HID4, but our special variant of @@ -1022,6 +1023,7 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, M= MUAccessType access_type, } } else if (ppc_hash64_use_vrma(env)) { /* Emulated VRMA mode */ + vrma =3D true; slb =3D &vrma_slbe; if (build_vrma_slbe(cpu, slb) !=3D 0) { /* Invalid VRMA setup, machine check */ @@ -1136,7 +1138,12 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, = MMUAccessType access_type, =20 exec_prot =3D ppc_hash64_pte_noexec_guard(cpu, pte); pp_prot =3D ppc_hash64_pte_prot(mmu_idx, slb, pte); - amr_prot =3D ppc_hash64_amr_prot(cpu, pte); + if (vrma) { + /* VRMA does not check keys */ + amr_prot =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; + } else { + amr_prot =3D ppc_hash64_amr_prot(cpu, pte); + } prot =3D exec_prot & pp_prot & amr_prot; =20 need_prot =3D check_prot_access_type(PAGE_RWX, access_type); --=20 2.45.2