[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/19] xen/arm: Disable/enable non-boot physical CPUs on suspend/resume


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Fri, 7 Oct 2022 10:32:48 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P67wZi9wRvsTNIiKgd4NqFNYGAuUHcR/ii4CMj9fkQk=; b=Q5Fo1lUabUqeX6lcHX5+UnsbgaW83W/DHpvNoQxvzUqClJ8j4OSVOokuXf/QkVbcmn1510feey6EVjd7fdm07rWNyQVTsjLQ3GqTvk98jWcKFJDSfvYqN7j8OQJ5G5dexHXaIoZyv/wmv34s2c4gGEkoNSOUmbFiq2qJhygm6/zDeadQ1q7S+IpJYoGyIFurWDiw/wScrX7VKnVIr2Dv74qKKZXJ/CkvaA2B5+ZbUfUqaRcXw/RnA3kpPqvZEd1YGzW68taKziM/fT8rSpHTOU0ttPl4GIfuLxHnRNtMvCakW5+DumYRbx4OJGv5ky9+PDUU41knqy4QLClqTTIRuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FOU5Aq74f7Et7kpU/iC+iUbECEoxq1J0mKXp8GRh6pLSp7b1+V9CBPx4JOEOE2iAyuOVenUN97eE2XUb3egMbdSgJhZTZ39xN9pyhzLJ64hFn7K42JN5aQSgvMIC2/PAcvx1OY+IGlehAghxr3VFRxsUEm9usk4Szih+zFjMrMI5ZLpitK/WLV47wCMMQAeqoOr27hxEsphqgiB9FBEE+IdZzL3CuessBDevMA9LHuIV72A/QF6q6MApxdCQZnU4pZXr7iZZAmabFpnFu79Z2Z0ccHImXjOScXfzzLyD1mj8ZQp+EIGP/PLqcucGu8SuMO/JN1zIOcNAD8A6ty5AXQ==
  • Cc: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
  • Delivery-date: Fri, 07 Oct 2022 10:33:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY2jglFRIa/47fQkyi/IjVCOcpsw==
  • Thread-topic: [PATCH 07/19] xen/arm: Disable/enable non-boot physical CPUs on suspend/resume

From: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>

Non-boot CPUs have to be disabled on suspend and enabled on resume
(hotplug-based mechanism). Disabling non-boot CPUs will lead to PSCI
CPU_OFF to be called by each non-boot CPU. Depending on the underlying
platform capabilities, this may lead to the physical powering down of
CPUs. Tested on Xilinx Zynq Ultrascale+ MPSoC (including power down of
each non-boot CPU).

Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
---
 xen/arch/arm/suspend.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c
index 2b94816b63..0784979e4f 100644
--- a/xen/arch/arm/suspend.c
+++ b/xen/arch/arm/suspend.c
@@ -13,6 +13,7 @@
  */
 
 #include <xen/sched.h>
+#include <xen/cpu.h>
 #include <asm/cpufeature.h>
 #include <asm/event.h>
 #include <asm/psci.h>
@@ -135,17 +136,29 @@ void vcpu_resume(struct vcpu *v)
 /* Xen suspend. Note: data is not used (suspend is the suspend to RAM) */
 static long system_suspend(void *data)
 {
+    int status;
+
     BUG_ON(system_state != SYS_STATE_active);
 
     system_state = SYS_STATE_suspend;
     freeze_domains();
 
+    status = disable_nonboot_cpus();
+    if ( status )
+    {
+        system_state = SYS_STATE_resume;
+        goto resume_nonboot_cpus;
+    }
+
     system_state = SYS_STATE_resume;
 
+resume_nonboot_cpus:
+    enable_nonboot_cpus();
     thaw_domains();
     system_state = SYS_STATE_active;
+    dsb(sy);
 
-    return -ENOSYS;
+    return status;
 }
 
 int32_t domain_suspend(register_t epoint, register_t cid)
-- 
2.37.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.