From nobody Sat Nov 23 22:24:17 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=1730679950; cv=none; d=zohomail.com; s=zohoarc; b=L6u40qPAmlanfzBkrSX4xPxQFn8LDqDnvMMEf7McvibMpvH7pdGw6Pt1IpOXTl3aGOZc/MITPA4tmu6A0Wv8n9Yl2DFxBUK1kDIcVTBC9oFHDef+7x9dmcgBNskZzYWdj9Km6i/+UELu2FMKegxo0GyWneWVZ+6BAkeXU0LgiNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730679950; 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=bKJeZuECGCGYQRCE/Wz2aptnEpkzwWv0a7kXALVVYP8=; b=RMPlNJTgZC/DhUng+dGnxRX8Jjt/7xsTFiPaVefo5E6ecVF1G4NZUbbmp/HrfUnfgNLsTutKyrMnLULLywy2jqnWe3+5B7y9nxhxhU5s0A0Z1zpgot9quYKS5LyB4d2zazn/8CplL4ZVkyRLu3s9K6JJ9sQI2IqTTczGuPoCffQ= 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 1730679950261248.11087310089317; Sun, 3 Nov 2024 16:25:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7krr-000879-5N; Sun, 03 Nov 2024 19:22:51 -0500 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 1t7krm-0007cu-VC; Sun, 03 Nov 2024 19:22:47 -0500 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 1t7krl-0002oi-8l; Sun, 03 Nov 2024 19:22:46 -0500 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-720d14c8dbfso2326207b3a.0; Sun, 03 Nov 2024 16:22:44 -0800 (PST) Received: from wheely.local0.net (124-171-217-17.tpgi.com.au. [124.171.217.17]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a0081esm5900648a12.59.2024.11.03.16.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 16:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730679763; x=1731284563; 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=bKJeZuECGCGYQRCE/Wz2aptnEpkzwWv0a7kXALVVYP8=; b=H4O4WLtx+QnA4byWd8SIocZZ8LpBKxCcy2eSIzD0UWtBsuBmsHniETIlR8sAj98TI3 HRneZsHHw//e7ntb39nkcaRinrmSqnYw1cbCNUKIsm3HAdcUdeQMnvpQ/Ry3c3pSCKoi F8egmM2+t684qS+Tk393KmLjkoybdEQf7+JIe6YEYntvtt+GLT2o+1ZyLjNBycZZI+IN YpnHuPpJxLCVzkeJCHHaDsTxu24K6fr9fw1xrLX6pbfrIURrLoiSiv/rk4lxsXRABiA9 Cby/Sq6ROOyfl2O5MDoRDT1hgTa0KK6PltL7Jtm/L6IUkNXf0LgwpWwBzB9OftArIhA9 66fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730679763; x=1731284563; 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=bKJeZuECGCGYQRCE/Wz2aptnEpkzwWv0a7kXALVVYP8=; b=nPpMs6tovlu65fuNCxPwBSNKJndGLIH/jBySdONRMHvU6x69Zm1it+URYo80HpAHrf P8T2uCAYRh9MIk4TrNRWWnTsdgkbzSm6kV+AgGtqoSf9ezOY8nn/zvNB4k/4SvhqcN67 N6KQm8iknGEoOrl1boHz2jUIOh2wAEBj7NU0jLnCtp5FG9EQLFLx09ZfGXBqqxC+lmjT zO9AU++Q8F4u1k3EIEneuBkDhoF7LS40wB9Cx488oTAZRfS4EcUFTHcE68iW5eh7+9hw WoT6HPDGiK9OAV10tC2LaY8Zwh7BnQR7XYYmY8BIewc3H9X9U7MVQkZsWk3tMVIJ6pQz 75Qw== X-Forwarded-Encrypted: i=1; AJvYcCW81B0ptl+FDz9oA+bcwOIUbMEiiR9vm16JWPzfhf9Fjm9okszhRQGa1YMVbkLL+EDtg5H7OaOj3Q==@nongnu.org X-Gm-Message-State: AOJu0YzbNNVGwklpEBEyKu8y6jEONqlop3xcVYn9JKpWxyFydvHB7YtB nQYAFtkYcmjuUQsP0b+CSjw4HPTtt8SxaIdu0oSUyC7K2VNUaUb0uw/e9Q== X-Google-Smtp-Source: AGHT+IH8WTOaxPIx8AOQS8yZLRGGkYNd23+mHjiZsjacKdsC5+S/GCkrHz8LysRomM4VnF1nCp0L+Q== X-Received: by 2002:a05:6a20:d498:b0:1d9:1823:83bf with SMTP id adf61e73a8af0-1db91d516d0mr19815344637.8.1730679763291; Sun, 03 Nov 2024 16:22:43 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Glenn Miles , Glenn Miles , Michael Kowal , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 59/67] pnv/xive: Update PIPR when updating CPPR Date: Mon, 4 Nov 2024 10:18:48 +1000 Message-ID: <20241104001900.682660-60-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241104001900.682660-1-npiggin@gmail.com> References: <20241104001900.682660-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: 1730679952014116600 From: Glenn Miles Current code was updating the PIPR inside the xive_tctx_accept() function instead of the xive_tctx_set_cppr function, which is where the HW would have it updated. Moved the update to the xive_tctx_set_cppr function which required additional support for pool interrupts. Fixes: cdd4de68edb6 ("ppc/xive: notify the CPU when the interrupt priority = is more privileged") Signed-off-by: Glenn Miles Signed-off-by: Michael Kowal Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- hw/intc/xive.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index baad7129ca..8460bd622a 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -89,7 +89,6 @@ static uint64_t xive_tctx_accept(XiveTCTX *tctx, uint8_t = ring) =20 /* Reset the pending buffer bit */ alt_regs[TM_IPB] &=3D ~xive_priority_to_ipb(cppr); - regs[TM_PIPR] =3D ipb_to_pipr(alt_regs[TM_IPB]); =20 /* Drop Exception bit */ regs[TM_NSR] &=3D ~mask; @@ -143,6 +142,8 @@ void xive_tctx_reset_signal(XiveTCTX *tctx, uint8_t rin= g) static void xive_tctx_set_cppr(XiveTCTX *tctx, uint8_t ring, uint8_t cppr) { uint8_t *regs =3D &tctx->regs[ring]; + uint8_t pipr_min; + uint8_t ring_min; =20 trace_xive_tctx_set_cppr(tctx->cs->cpu_index, ring, regs[TM_IPB], regs[TM_PIPR], @@ -154,8 +155,37 @@ static void xive_tctx_set_cppr(XiveTCTX *tctx, uint8_t= ring, uint8_t cppr) =20 tctx->regs[ring + TM_CPPR] =3D cppr; =20 + /* + * Recompute the PIPR based on local pending interrupts. The PHYS + * ring must take the minimum of both the PHYS and POOL PIPR values. + */ + pipr_min =3D ipb_to_pipr(regs[TM_IPB]); + ring_min =3D ring; + + /* PHYS updates also depend on POOL values */ + if (ring =3D=3D TM_QW3_HV_PHYS) { + uint8_t *pool_regs =3D &tctx->regs[TM_QW2_HV_POOL]; + + /* POOL values only matter if POOL ctx is valid */ + if (pool_regs[TM_WORD2] & 0x80) { + + uint8_t pool_pipr =3D ipb_to_pipr(pool_regs[TM_IPB]); + + /* + * Determine highest priority interrupt and + * remember which ring has it. + */ + if (pool_pipr < pipr_min) { + pipr_min =3D pool_pipr; + ring_min =3D TM_QW2_HV_POOL; + } + } + } + + regs[TM_PIPR] =3D pipr_min; + /* CPPR has changed, check if we need to raise a pending exception */ - xive_tctx_notify(tctx, ring); + xive_tctx_notify(tctx, ring_min); } =20 void xive_tctx_ipb_update(XiveTCTX *tctx, uint8_t ring, uint8_t ipb) --=20 2.45.2