Prepares consolidation of arch_cpu_resume/suspend. With this, we have
the same path on all architectures for suspending CPUs. This allows us
to consolidate code in the next step.

Signed-off-by: Ralf Ramsauer <ralf.ramsa...@oth-regensburg.de>
---
 hypervisor/arch/arm-common/control.c             | 2 +-
 hypervisor/arch/arm-common/include/asm/control.h | 5 +++++
 hypervisor/arch/x86/control.c                    | 2 +-
 hypervisor/arch/x86/include/asm/control.h        | 6 ++++++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/hypervisor/arch/arm-common/control.c 
b/hypervisor/arch/arm-common/control.c
index 9aab822b..22101e83 100644
--- a/hypervisor/arch/arm-common/control.c
+++ b/hypervisor/arch/arm-common/control.c
@@ -65,7 +65,7 @@ void arch_suspend_cpu(unsigned int cpu_id)
                 * The target CPU, in turn, will leave the guest and handle the
                 * request in the event loop.
                 */
-               arm_cpu_kick(cpu_id);
+               arch_send_event(target_data);
 
                while (!target_data->cpu_suspended)
                        cpu_relax();
diff --git a/hypervisor/arch/arm-common/include/asm/control.h 
b/hypervisor/arch/arm-common/include/asm/control.h
index bafef2c8..a1771302 100644
--- a/hypervisor/arch/arm-common/include/asm/control.h
+++ b/hypervisor/arch/arm-common/include/asm/control.h
@@ -33,6 +33,11 @@ void arm_cpu_reset(unsigned long pc);
 void arm_cpu_park(void);
 void arm_cpu_kick(unsigned int cpu_id);
 
+static inline void arch_send_event(struct public_per_cpu *target_data)
+{
+       arm_cpu_kick(target_data->cpu_id);
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* !_JAILHOUSE_ASM_CONTROL_H */
diff --git a/hypervisor/arch/x86/control.c b/hypervisor/arch/x86/control.c
index 7f171838..6b39eb9d 100644
--- a/hypervisor/arch/x86/control.c
+++ b/hypervisor/arch/x86/control.c
@@ -138,7 +138,7 @@ void arch_suspend_cpu(unsigned int cpu_id)
                 * The target CPU, in turn, will leave the guest and handle the
                 * request in the event loop.
                 */
-               apic_send_nmi_ipi(target_data);
+               arch_send_event(target_data);
 
                while (!target_data->cpu_suspended)
                        cpu_relax();
diff --git a/hypervisor/arch/x86/include/asm/control.h 
b/hypervisor/arch/x86/include/asm/control.h
index 2566e115..0fcdd812 100644
--- a/hypervisor/arch/x86/include/asm/control.h
+++ b/hypervisor/arch/x86/include/asm/control.h
@@ -11,6 +11,7 @@
  */
 
 #include <jailhouse/percpu.h>
+#include <asm/apic.h>
 
 struct exception_frame;
 
@@ -23,3 +24,8 @@ void x86_check_events(void);
 
 void __attribute__((noreturn))
 x86_exception_handler(struct exception_frame *frame);
+
+static inline void arch_send_event(struct public_per_cpu *target_data)
+{
+       apic_send_nmi_ipi(target_data);
+}
-- 
2.18.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to