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

[PATCH 10/19] xen/arm: Suspend/resume GIC on system suspend/resume


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Fri, 7 Oct 2022 10:32:49 +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=y7tfKwxlMC2rm0Z//gUzhgGJuWbgTzwYs5gBCllkoFo=; b=DA0qZW1wyE6ceESPJhferFrl+e2K/cKcLyDZaDqR4iHUhgIV9UnMl/b7HOV4iUTMJkntDVPIYkypqFxcHBHfqdgNMqQbSfZCmBCPonvKGvVNo7hpjnvT0v7DGE411gDuDYAr8EhzjIZZhTJ296KlkZFE7qOc3D5M3Unbk+IC66ILKICAtmCpobj/7IsYkfT9hMpb0JCgCa/GNAFfbV8Id+Kq+K27NDesHsOGIlcs+ttijFACGRROckS8m/DjP+tryaI8n6ZlMA49hwfJ/nSWs8Te4mTitbCvhUANK7nkPtVQtBZ4vptFjhnSNoAqMl5JDE/Z6JkqSqybUDN8/7sv7Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cyYO3xNfKXtQyyQ1hvtNWy40UigXKe4W15LmWYbkYoX8gpY7QYsSLB62+jBKBcmeagqizavkwv/egBUcywxL1ofB537iZ1n5+skS1K/YG0g5nbO0RMuH9eoppdrAeZPzEFka3nhvfsI/TylULeukMmcfcJOwsgJX0Jy7FtQ0crAm12Pd7cCJjQkUU06wO6ZqeEpSaAy1gq63avk6tQ5QR8T1i0Khb1WWKxR5iCujfqGT9iQ/mPF4ijmJZY8avPgswLrwZUwZ41xHShav/zMC9w+2jFyg6jIwM9bX5T6hXAXH2AV9Er1ivWlUbOQ186bgv68pgDm7TlaRASVNaX0wuA==
  • 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:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY2jglc8rj8DiR5UCRaZVxNHMwnQ==
  • Thread-topic: [PATCH 10/19] xen/arm: Suspend/resume GIC on system suspend/resume

From: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>

GIC state is saved on system suspend by calling gic_suspend
(this function does not change current state of the GIC but only
saves the values of configuration registers).
The state of GIC has to be restored by calling gic_resume, but only
if the gic_suspend has succeeded. If gic_suspend fails, we'll just
restore interrupts configuration and abort suspend.

Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
---
 xen/arch/arm/gic.c     |  4 +---
 xen/arch/arm/suspend.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index e9feb1fd3b..ef90664929 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -476,9 +476,7 @@ int gic_suspend(void)
     if ( !gic_hw_ops->suspend || !gic_hw_ops->resume )
         return -ENOSYS;
 
-    gic_hw_ops->suspend();
-
-    return 0;
+    return gic_hw_ops->suspend();
 }
 
 void gic_resume(void)
diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c
index 0c16cfc750..b94a6df86d 100644
--- a/xen/arch/arm/suspend.c
+++ b/xen/arch/arm/suspend.c
@@ -137,6 +137,7 @@ void vcpu_resume(struct vcpu *v)
 static long system_suspend(void *data)
 {
     int status;
+    unsigned long flags;
 
     BUG_ON(system_state != SYS_STATE_active);
 
@@ -150,8 +151,21 @@ static long system_suspend(void *data)
         goto resume_nonboot_cpus;
     }
 
+    local_irq_save(flags);
+    status = gic_suspend();
+    if ( status )
+    {
+        system_state = SYS_STATE_resume;
+        goto resume_irqs;
+    }
+
     system_state = SYS_STATE_resume;
 
+    gic_resume();
+
+resume_irqs:
+    local_irq_restore(flags);
+
 resume_nonboot_cpus:
     rcu_barrier();
     enable_nonboot_cpus();
-- 
2.37.1



 


Rackspace

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