All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mykyta Poturai <Mykyta_Poturai@epam.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Mirela Simonovic <mirela.simonovic@aggios.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Saeed Nowshadi <saeed.nowshadi@xilinx.com>
Subject: [PATCH 10/19] xen/arm: Suspend/resume GIC on system suspend/resume
Date: Fri, 7 Oct 2022 10:32:49 +0000	[thread overview]
Message-ID: <99a4fc0ff6732482152389a0813769fcfbdb379c.1665137247.git.mykyta_poturai@epam.com> (raw)
In-Reply-To: <cover.1665137247.git.mykyta_poturai@epam.com>

From: Mirela Simonovic <mirela.simonovic@aggios.com>

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@aggios.com>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
---
 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


  parent reply	other threads:[~2022-10-07 10:33 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1665137247.git.mykyta_poturai@epam.com>
2022-10-07 10:32 ` [PATCH 01/19] xen/arm: Implement PSCI system suspend Mykyta Poturai
2022-10-07 10:59   ` Julien Grall
2022-10-08 22:00   ` Volodymyr Babchuk
2022-10-09  9:30     ` Julien Grall
2022-10-07 10:32 ` [PATCH 02/19] watchdog: Introduce a separate struct for watchdog timers Mykyta Poturai
2022-10-07 10:32 ` [PATCH 03/19] xen/arm: While a domain is suspended put its watchdogs on pause Mykyta Poturai
2022-10-07 10:32 ` [PATCH 04/19] xen/arm: Trigger Xen suspend when Dom0 completes suspend Mykyta Poturai
2022-10-07 10:32 ` [PATCH 05/19] xen/x86: Move freeze/thaw_domains into common files Mykyta Poturai
2022-12-06 20:36   ` Julien Grall
2022-10-07 10:32 ` [PATCH 09/19] xen/arm: Implement GIC suspend/resume functions (gicv2 only) Mykyta Poturai
2022-12-06 21:18   ` Julien Grall
2022-10-07 10:32 ` [PATCH 08/19] xen/arm: Add rcu_barrier() before enabling non-boot CPUs on resume Mykyta Poturai
2022-10-07 10:32 ` [PATCH 06/19] xen/arm: Freeze domains on suspend and thaw them " Mykyta Poturai
2022-12-06 20:47   ` Julien Grall
2022-10-07 10:32 ` [PATCH 07/19] xen/arm: Disable/enable non-boot physical CPUs on suspend/resume Mykyta Poturai
2022-12-06 21:00   ` Julien Grall
2022-10-07 10:32 ` Mykyta Poturai [this message]
2022-12-06 21:20   ` [PATCH 10/19] xen/arm: Suspend/resume GIC on system suspend/resume Julien Grall
2022-10-07 10:32 ` [PATCH 12/19] xen/arm: Implement PSCI SYSTEM_SUSPEND call (physical interface) Mykyta Poturai
2022-12-06 21:34   ` Julien Grall
2022-10-07 10:32 ` [PATCH 11/19] xen/arm: Suspend/resume timer interrupt generation Mykyta Poturai
2022-12-06 21:29   ` Julien Grall
2022-10-07 10:32 ` [PATCH 15/19] xen/arm: Resume Dom0 after Xen resumes Mykyta Poturai
2022-10-07 10:32 ` [PATCH 13/19] xen/arm: Resume memory management on Xen resume Mykyta Poturai
2022-12-06 21:52   ` Julien Grall
2022-10-07 10:32 ` [PATCH 16/19] xen/arm: Suspend/resume console on Xen suspend/resume Mykyta Poturai
2022-12-06 22:12   ` Julien Grall
2022-12-06 22:14     ` Julien Grall
2022-10-07 10:32 ` [PATCH 14/19] xen/arm: Save/restore context on suspend/resume Mykyta Poturai
2022-12-06 22:09   ` Julien Grall
2022-10-07 10:32 ` [PATCH 17/19] xen: don't free percpu areas during suspend Mykyta Poturai
2022-10-07 11:17   ` Juergen Gross
2022-10-21  9:46     ` Dario Faggioli
2022-10-07 10:32 ` [PATCH 19/19] Fix misleading indentation gcc warning Mykyta Poturai
2022-12-06 22:17   ` Julien Grall
2022-10-07 10:32 ` [PATCH 18/19] timers: Don't migrate timers during suspend Mykyta Poturai
2022-12-06 22:19   ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99a4fc0ff6732482152389a0813769fcfbdb379c.1665137247.git.mykyta_poturai@epam.com \
    --to=mykyta_poturai@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=mirela.simonovic@aggios.com \
    --cc=saeed.nowshadi@xilinx.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.