From nobody Sun Feb 8 15:46:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655970298; cv=none; d=zohomail.com; s=zohoarc; b=D4zohoP4pyuuseMQPKQlXkV3MXVWgzZtYWqmRCubgyhoGh5j6uuguMj4Q+vBzAQlaTiQczETw6WZ1DiHOK7qmC/TkQ5FbgfO+t0BECe5llU+zVdB3vX1fA6X7dm5tPRV7/JAKxWUUwo8e7CiMNfqA/R13u9CylGMPSf7Z0O9XtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655970298; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=mwbVZbkGb1mIzAb6cGBQmcbXv0Qp1YQ7XptNOzCcVVU=; b=jmcrsDoO4jpXPuQSvdKOGbRKNf4ojlSB8rYkVajuLsbFPqGoxrdvE/guJWOZP+AqR/dDYEM3JrqfjRho7qMQTUUHczu/aHXK+TBk+tRA1oC5rhbv5y//9i3G5oRV0ctfGBsc6OGjkjoasIZYsHrp1VD0Uqkt8tEXwM3UvV+wcYo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655970298670104.5494647664242; Thu, 23 Jun 2022 00:44:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.354494.581625 (Exim 4.92) (envelope-from ) id 1o4HW1-00039a-8O; Thu, 23 Jun 2022 07:44:37 +0000 Received: by outflank-mailman (output) from mailman id 354494.581625; Thu, 23 Jun 2022 07:44:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o4HW1-00039T-5V; Thu, 23 Jun 2022 07:44:37 +0000 Received: by outflank-mailman (input) for mailman id 354494; Thu, 23 Jun 2022 07:44:36 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o4HW0-000394-2t for xen-devel@lists.xenproject.org; Thu, 23 Jun 2022 07:44:36 +0000 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [2a00:1450:4864:20::132]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 538ea0c9-f2c8-11ec-b725-ed86ccbb4733; Thu, 23 Jun 2022 09:44:35 +0200 (CEST) Received: by mail-lf1-x132.google.com with SMTP id y32so31899391lfa.6 for ; Thu, 23 Jun 2022 00:44:35 -0700 (PDT) Received: from localhost.localdomain ([91.219.254.75]) by smtp.gmail.com with ESMTPSA id w24-20020a194918000000b0047255d21190sm2869071lfa.191.2022.06.23.00.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 00:44:33 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 538ea0c9-f2c8-11ec-b725-ed86ccbb4733 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mwbVZbkGb1mIzAb6cGBQmcbXv0Qp1YQ7XptNOzCcVVU=; b=agdJCNDWKtal+dxhtZ0ntcI1xPHADJTK+qpcTEREiEVTjCMQ8nWc04LwjGNQXfb1Oq 0Gd0Hm9q+eC2xXn1OXmWlc1qNYPmqpRMC0vNfjDSESlZNeG4GG5SHeo8zcKdRStA8B58 qtM1yoD5192Hyr2BD/0nRD79AJZvaqS0WiNQ6NdSmA+AM0M0laYHCiKHs2+CHjFyB5Yp cVR85k04ofgLqDuciqcc6C7RNZUmumtPKRVdMVX2CQWZg5lHMYIrzYbZRw40ydg1uRgk rOuvy9U80p8cOzOpwBCrVL2ET+Ru0D3LXsVKhKqWnFjPvarYrUJlR8ZEqp9q7NaD2WzI bGcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mwbVZbkGb1mIzAb6cGBQmcbXv0Qp1YQ7XptNOzCcVVU=; b=t5FVhtUswOYC3v8Nd5i74M+POBsGPDEU58E2sYHE6QsMH/ZPFQt64ZOxv10k/WpwXA lbX+Ojs/7QZzu3QxHDm498PupG2nZmrt7x5QH9VT2wwAdGQqD7Sop5DqVHY066SvrGbe mVUFiwPyRUHoVzyQvk8XUbrHBYZK1UckKkjWVQP35ugIFbuBlj/g+zWt2TOPfAxn8Bww 1iF5Oh+RCmy3L/QujPLBQF7WihyeGyOFXU+5RU3YNmpjJpcaTlAihhu9ODVy/twY9oSM dvZnoJBd5WCP5cExD+wYfvQTFaa6IiBD71kWBIAuAW1v4lMY/2LPJX4waKEIDI7jVuDz h51A== X-Gm-Message-State: AJIora/S7AVz1IuwSpKIxHbyWeEDlqRsot/fQy3aB7R1vnvuzLSRhcvJ rnywN6Tbpln41Bz1Hn1E3kiqfoceHJs6oA== X-Google-Smtp-Source: AGRyM1tgGEDjTbPw3X1ZM+Cnm2NXts2D69Tzg5f9IP0yHqdEP6loNsINQiZduPQRxoczuewJNo8IWw== X-Received: by 2002:a05:6512:2398:b0:479:24aa:6454 with SMTP id c24-20020a056512239800b0047924aa6454mr4829473lfv.664.1655970274322; Thu, 23 Jun 2022 00:44:34 -0700 (PDT) From: dmitry.semenets@gmail.com To: xen-devel@lists.xenproject.org Cc: Dmytro Semenets , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH] xen: arm: Don't use stop_cpu() in halt_this_cpu() Date: Thu, 23 Jun 2022 10:44:28 +0300 Message-Id: <20220623074428.226719-1-dmitry.semenets@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655970300387100001 Content-Type: text/plain; charset="utf-8" From: Dmytro Semenets When shutting down (or rebooting) the platform, Xen will call stop_cpu() on all the CPUs but one. The last CPU will then request the system to shutdown/restart. On platform using PSCI, stop_cpu() will call PSCI CPU off. Per the spec (section 5.5.2 DEN0022D.b), the call could return DENIED if the Trusted OS is resident on the CPU that is about to be turned off. As Xen doesn't migrate off the trusted OS (which BTW may not be migratable), it would be possible to hit the panic(). In the ideal situation, Xen should migrate the trusted OS or make sure the CPU off is not called. However, when shutting down (or rebooting) the platform, it is pointless to try to turn off all the CPUs (per section 5.10.2, it is only required to put the core in a known state). So solve the problem by open-coding stop_cpu() in halt_this_cpu() and not call PSCI CPU off. Signed-off-by: Dmytro Semenets Acked-by: Julien Grall --- xen/arch/arm/shutdown.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c index 3dc6819d56..a9aea19e8e 100644 --- a/xen/arch/arm/shutdown.c +++ b/xen/arch/arm/shutdown.c @@ -8,7 +8,12 @@ =20 static void noreturn halt_this_cpu(void *arg) { - stop_cpu(); + local_irq_disable(); + /* Make sure the write happens before we sleep forever */ + dsb(sy); + isb(); + while ( 1 ) + wfi(); } =20 void machine_halt(void) --=20 2.25.1