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/apic.c                       | 3 +++
 hypervisor/arch/x86/control.c                    | 2 +-
 hypervisor/arch/x86/include/asm/control.h        | 2 ++
 5 files changed, 12 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/apic.c b/hypervisor/arch/x86/apic.c
index f43d8e12..a762569c 100644
--- a/hypervisor/arch/x86/apic.c
+++ b/hypervisor/arch/x86/apic.c
@@ -67,6 +67,9 @@ static struct {
        void (*send_ipi)(u32 apic_id, u32 icr_lo);
 } apic_ops;
 
+void arch_send_event(struct public_per_cpu *target_data)
+       __attribute__((alias("apic_send_nmi_ipi")));
+
 static u32 read_xapic(unsigned int reg)
 {
        return mmio_read32(xapic_page + XAPIC_REG(reg));
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..5ca015d0 100644
--- a/hypervisor/arch/x86/include/asm/control.h
+++ b/hypervisor/arch/x86/include/asm/control.h
@@ -23,3 +23,5 @@ void x86_check_events(void);
 
 void __attribute__((noreturn))
 x86_exception_handler(struct exception_frame *frame);
+
+void arch_send_event(struct public_per_cpu *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