From patchwork Thu Oct 26 03:24:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Lynch via B4 Relay X-Patchwork-Id: 1855593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mwNWNkZF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SGBC83jJtz23jh for ; Thu, 26 Oct 2023 14:30:44 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mwNWNkZF; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4SGBC82VKrz3cM7 for ; Thu, 26 Oct 2023 14:30:44 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mwNWNkZF; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4601:e00::1; helo=ams.source.kernel.org; envelope-from=devnull+nathanl.linux.ibm.com@kernel.org; receiver=lists.ozlabs.org) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4SGB4H0hnqz2xdd for ; Thu, 26 Oct 2023 14:24:46 +1100 (AEDT) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 1C675B8340D; Thu, 26 Oct 2023 03:24:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 51DAAC433CB; Thu, 26 Oct 2023 03:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698290682; bh=GhEfx64H+DHGKbSx4LQE6BDWp+kP/ryK8Ga6FTHR3sE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=mwNWNkZFxclyWI/SdXc7Y1vjY+ruas1QynAJzfW2VUEkaIaB5gNZOFLKVFQVSLPZa 5wwhrtkbFD3hGK88SIzj9zs9XSf3KbOc4jwq+BpB2LMM9iWe3U3i82rgleH3B6FnMt 4dEeV8iU88K7yTYHIjtSYBo4zzy0WqjPBeTHfWGEML/BtteWInx6r+DFNcnZTTbK2t ug+69ufDWrRBZpzBVzGZbCfFy28j+aCV2pjVeJ9Bv1tVBaHzhhA9isSWG7201H+YUa Z5EdEaWz0DyeAkRV0lEU4yKcCpgfCbhUqEhlA/GNuDhKhcfb+0fwR2dbJDEwxyNUAC hjMiI0GoJ9OZg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39E02C25B70; Thu, 26 Oct 2023 03:24:42 +0000 (UTC) From: Nathan Lynch via B4 Relay Date: Wed, 25 Oct 2023 22:24:17 -0500 Subject: [PATCH v3 03/10] powerpc/rtas: Serialize firmware activation sequences MIME-Version: 1.0 Message-Id: <20231025-papr-sys_rtas-vs-lockdown-v3-3-5eb04559e7d8@linux.ibm.com> References: <20231025-papr-sys_rtas-vs-lockdown-v3-0-5eb04559e7d8@linux.ibm.com> In-Reply-To: <20231025-papr-sys_rtas-vs-lockdown-v3-0-5eb04559e7d8@linux.ibm.com> To: Michael Ellerman , Nicholas Piggin X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698290680; l=988; i=nathanl@linux.ibm.com; s=20230817; h=from:subject:message-id; bh=7xgBvR+vP8RQ93qdtkMXLJQvwa7cT0CKUnx4Yr3c24Y=; b=jvzk2ArQzFP9qxVZoPPMYocBR+9ND91SzbIt8Y4j9LX2vFvUVXK66H7EPWL7HRS4F7Y1QlSSN jxU4y4iFBumDErPpUG/At6ZUrvEsG0HfXTQt2FpB2231nT2OhjmnpJY X-Developer-Key: i=nathanl@linux.ibm.com; a=ed25519; pk=jPDF44RvT+9DGFOH3NGoIu1xN9dF+82pjdpnKjXfoJ0= X-Endpoint-Received: by B4 Relay for nathanl@linux.ibm.com/20230817 with auth_id=78 X-Original-From: Nathan Lynch X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: nathanl@linux.ibm.com Cc: Nathan Lynch , tyreld@linux.ibm.com, =?utf-8?q?Mi?= =?utf-8?q?chal_Such=C3=A1nek?= , linuxppc-dev@lists.ozlabs.org, gcwilson@linux.ibm.com Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Nathan Lynch Use the function lock API to prevent interleaving call sequences of the ibm,activate-firmware RTAS function, which typically requires multiple calls to complete the update. While the spec does not specifically prohibit interleaved sequences, there's almost certainly no advantage to allowing them. Signed-off-by: Nathan Lynch --- arch/powerpc/kernel/rtas.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 579a2c475bb6..864d140e7247 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -1738,10 +1738,14 @@ void rtas_activate_firmware(void) return; } + rtas_function_lock(RTAS_FN_IBM_ACTIVATE_FIRMWARE); + do { fwrc = rtas_call(token, 0, 1, NULL); } while (rtas_busy_delay(fwrc)); + rtas_function_unlock(RTAS_FN_IBM_ACTIVATE_FIRMWARE); + if (fwrc) pr_err("ibm,activate-firmware failed (%i)\n", fwrc); }