diff mbox series

[16/19] xen/arm: Suspend/resume console on Xen suspend/resume

Message ID a3dc2fe24f8f474a3976f4b307a693e359e910d5.1665137247.git.mykyta_poturai@epam.com (mailing list archive)
State New, archived
Headers show
Series [01/19] xen/arm: Implement PSCI system suspend | expand

Commit Message

Mykyta Poturai Oct. 7, 2022, 10:32 a.m. UTC
From: Mirela Simonovic <mirela.simonovic@aggios.com>

This is done using generic console_suspend/resume functions that cause
uart driver specific suspend/resume handlers to be called for each
initialized port (if the port has suspend/resume driver handlers
implemented).

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

Comments

Julien Grall Dec. 6, 2022, 10:12 p.m. UTC | #1
Hi,

On 07/10/2022 11:32, Mykyta Poturai wrote:
> From: Mirela Simonovic <mirela.simonovic@aggios.com>
> 
> This is done using generic console_suspend/resume functions that cause
> uart driver specific suspend/resume handlers to be called for each
> initialized port (if the port has suspend/resume driver handlers
> implemented).

Looking at the UART driver for Arm, most of them (if not all) implement 
suspend/resume with BUG(). So don't you need to properly implement them?

> 
> Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
> Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>

Your signed-off-by is missing.

> ---
>   xen/arch/arm/suspend.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c
> index 4a690eac3b..cf3aab0099 100644
> --- a/xen/arch/arm/suspend.c
> +++ b/xen/arch/arm/suspend.c
> @@ -14,6 +14,7 @@
>   
>   #include <xen/sched.h>
>   #include <xen/cpu.h>
> +#include <xen/console.h>
>   #include <asm/cpufeature.h>
>   #include <asm/event.h>
>   #include <asm/psci.h>
> @@ -166,6 +167,15 @@ static long system_suspend(void *data)
>           goto resume_irqs;
>       }
>   
> +    dprintk(XENLOG_DEBUG, "Suspend\n");
> +    status = console_suspend();
> +    if ( status )
> +    {
> +        dprintk(XENLOG_ERR, "Failed to suspend the console, err=%d\n", status);
> +        system_state = SYS_STATE_resume;
> +        goto resume_console;
> +    }
> +
>       if ( hyp_suspend(&cpu_context) )
>       {
>           status = call_psci_system_suspend();
> @@ -192,6 +202,10 @@ static long system_suspend(void *data)
>        */
>       mmu_init_secondary_cpu();
>   
> +resume_console:
> +    console_resume();
> +    dprintk(XENLOG_DEBUG, "Resume\n");
> +
>       gic_resume();
>   
>   resume_irqs:

Cheers,
Julien Grall Dec. 6, 2022, 10:14 p.m. UTC | #2
On 06/12/2022 22:12, Julien Grall wrote:
> Hi,
> 
> On 07/10/2022 11:32, Mykyta Poturai wrote:
>> From: Mirela Simonovic <mirela.simonovic@aggios.com>
>>
>> This is done using generic console_suspend/resume functions that cause
>> uart driver specific suspend/resume handlers to be called for each
>> initialized port (if the port has suspend/resume driver handlers
>> implemented).
> 
> Looking at the UART driver for Arm, most of them (if not all) implement 
> suspend/resume with BUG(). So don't you need to properly implement them?

I forgot to clarify. No need to implement for every driver. I am just 
puzzled how this was actually tested. What UART are you using on your 
platform?

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c
index 4a690eac3b..cf3aab0099 100644
--- a/xen/arch/arm/suspend.c
+++ b/xen/arch/arm/suspend.c
@@ -14,6 +14,7 @@ 
 
 #include <xen/sched.h>
 #include <xen/cpu.h>
+#include <xen/console.h>
 #include <asm/cpufeature.h>
 #include <asm/event.h>
 #include <asm/psci.h>
@@ -166,6 +167,15 @@  static long system_suspend(void *data)
         goto resume_irqs;
     }
 
+    dprintk(XENLOG_DEBUG, "Suspend\n");
+    status = console_suspend();
+    if ( status )
+    {
+        dprintk(XENLOG_ERR, "Failed to suspend the console, err=%d\n", status);
+        system_state = SYS_STATE_resume;
+        goto resume_console;
+    }
+
     if ( hyp_suspend(&cpu_context) )
     {
         status = call_psci_system_suspend();
@@ -192,6 +202,10 @@  static long system_suspend(void *data)
      */
     mmu_init_secondary_cpu();
 
+resume_console:
+    console_resume();
+    dprintk(XENLOG_DEBUG, "Resume\n");
+
     gic_resume();
 
 resume_irqs: