From: Jan Kiszka <jan.kis...@siemens.com>

Now that we no longer need to shut down non-root CPUs directly, we can
get rid of this arch function. On x86, it also allows the removal of
per_cpu::shutdown_cpu and related handling. On ARM, we can drop the
PSCI_CPU_OFF call from arch_reset_self and the irqchip_cell_exit for
non-root cells from arch_shutdown.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 hypervisor/arch/arm/control.c            | 37 +-------------------------------
 hypervisor/arch/x86/control.c            | 13 -----------
 hypervisor/arch/x86/include/asm/percpu.h |  2 --
 hypervisor/include/jailhouse/control.h   | 15 -------------
 4 files changed, 1 insertion(+), 66 deletions(-)

diff --git a/hypervisor/arch/arm/control.c b/hypervisor/arch/arm/control.c
index 50f681c..1eb71eb 100644
--- a/hypervisor/arch/arm/control.c
+++ b/hypervisor/arch/arm/control.c
@@ -112,19 +112,7 @@ void arch_reset_self(struct per_cpu *cpu_data)
         */
        irqchip_eoi_irq(SGI_CPU_OFF, true);
 
-       if (is_shutdown) {
-#ifndef CONFIG_MACH_VEXPRESS
-               if (cell != &root_cell) {
-                       irqchip_cpu_shutdown(cpu_data);
-
-                       smc(PSCI_CPU_OFF, 0, 0, 0);
-                       smc(PSCI_CPU_OFF_V0_1_UBOOT, 0, 0, 0);
-                       panic_printk("FATAL: PSCI_CPU_OFF failed\n");
-                       panic_stop();
-               }
-#endif
-               /* arch_shutdown_self resets the GIC on all remaining CPUs. */
-       } else {
+       if (!is_shutdown) {
                err = irqchip_cpu_reset(cpu_data);
                if (err)
                        printk("IRQ setup failed\n");
@@ -411,32 +399,9 @@ void arch_panic_park(void)
        __builtin_unreachable();
 }
 
-/*
- * This handler is only used for cells, not for the root. The core already
- * issued a cpu_suspend. arch_reset_cpu will cause arch_reset_self to be
- * called on that CPU, which will in turn call arch_shutdown_self.
- */
-void arch_shutdown_cpu(unsigned int cpu_id)
-{
-       struct per_cpu *cpu_data = per_cpu(cpu_id);
-
-       cpu_data->virt_id = cpu_id;
-       cpu_data->shutdown = true;
-
-       if (psci_wait_cpu_stopped(cpu_id))
-               printk("FATAL: unable to stop CPU%d\n", cpu_id);
-
-       arch_reset_cpu(cpu_id);
-}
-
 void arch_shutdown(void)
 {
        unsigned int cpu;
-       struct cell *cell = root_cell.next;
-
-       /* Re-route each SPI to CPU0 */
-       for (; cell != NULL; cell = cell->next)
-               irqchip_cell_exit(cell);
 
        /*
         * Let the exit handler call reset_self to let the core finish its
diff --git a/hypervisor/arch/x86/control.c b/hypervisor/arch/x86/control.c
index c583649..47a5a2f 100644
--- a/hypervisor/arch/x86/control.c
+++ b/hypervisor/arch/x86/control.c
@@ -190,13 +190,6 @@ void arch_park_cpu(unsigned int cpu_id)
        arch_resume_cpu(cpu_id);
 }
 
-void arch_shutdown_cpu(unsigned int cpu_id)
-{
-       arch_suspend_cpu(cpu_id);
-       per_cpu(cpu_id)->shutdown_cpu = true;
-       arch_resume_cpu(cpu_id);
-}
-
 void x86_send_init_sipi(unsigned int cpu_id, enum x86_init_sipi type,
                        int sipi_vector)
 {
@@ -248,12 +241,6 @@ void x86_check_events(void)
                while (cpu_data->suspend_cpu)
                        cpu_relax();
 
-               if (cpu_data->shutdown_cpu) {
-                       apic_clear();
-                       vcpu_exit(cpu_data);
-                       asm volatile("1: hlt; jmp 1b");
-               }
-
                spin_lock(&cpu_data->control_lock);
 
                cpu_data->cpu_suspended = false;
diff --git a/hypervisor/arch/x86/include/asm/percpu.h 
b/hypervisor/arch/x86/include/asm/percpu.h
index ce0e41d..717fd58 100644
--- a/hypervisor/arch/x86/include/asm/percpu.h
+++ b/hypervisor/arch/x86/include/asm/percpu.h
@@ -131,8 +131,6 @@ struct per_cpu {
        bool flush_vcpu_caches;
        /** Set to true for pending cache allocation updates (Intel only). */
        bool update_cat;
-       /** Set to true for instructing the CPU to disable hypervisor mode. */
-       bool shutdown_cpu;
        /** State of the shutdown process. Possible values:
         * @li SHUTDOWN_NONE: no shutdown in progress
         * @li SHUTDOWN_STARTED: shutdown in progress
diff --git a/hypervisor/include/jailhouse/control.h 
b/hypervisor/include/jailhouse/control.h
index c7da909..ffe1d09 100644
--- a/hypervisor/include/jailhouse/control.h
+++ b/hypervisor/include/jailhouse/control.h
@@ -194,21 +194,6 @@ void arch_reset_cpu(unsigned int cpu_id);
 void arch_park_cpu(unsigned int cpu_id);
 
 /**
- * Releases hypervisor control over the target CPU.
- * @param cpu_id       ID of the target CPU.
- *
- * @note This function must not be invoked for the caller's CPU.
- *
- * @note The target CPU need not be suspended before calling the function.
- *
- * @note The caller has to ensure that the target CPU has enough time to reach
- * the shutdown position before destroying the code path it has to take to get
- * there. This can be ensured by bringing the CPU online again under Linux
- * before cleaning up the hypervisor.
- */
-void arch_shutdown_cpu(unsigned int cpu_id);
-
-/**
  * Performs the architecture-specific steps for mapping a memory region into a
  * cell's address space.
  * @param cell         Cell for which the mapping shall be done.
-- 
2.1.4

-- 
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