From: Jan Kiszka <[email protected]>

Only the GICv3 actually returns a non-zero value, and that only if the
reset was called before the irqchip was fully initialized, i.e. as part
of an error rollback triggered via irqchip_cpu_shutdown. Therefore,
remove the error return code and only avoid the v3's cpu_reset handler
does anything in case it was not yet initialized.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/arm/control.c             | 7 ++-----
 hypervisor/arch/arm/gic-v2.c              | 4 +---
 hypervisor/arch/arm/gic-v3.c              | 8 +++-----
 hypervisor/arch/arm/include/asm/irqchip.h | 4 ++--
 hypervisor/arch/arm/irqchip.c             | 4 ++--
 5 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/hypervisor/arch/arm/control.c b/hypervisor/arch/arm/control.c
index 1eb71eb..477f450 100644
--- a/hypervisor/arch/arm/control.c
+++ b/hypervisor/arch/arm/control.c
@@ -112,11 +112,8 @@ void arch_reset_self(struct per_cpu *cpu_data)
         */
        irqchip_eoi_irq(SGI_CPU_OFF, true);
 
-       if (!is_shutdown) {
-               err = irqchip_cpu_reset(cpu_data);
-               if (err)
-                       printk("IRQ setup failed\n");
-       }
+       if (!is_shutdown)
+               irqchip_cpu_reset(cpu_data);
 
        /* Wait for the driver to call cpu_up */
        if (cell == &root_cell || is_shutdown)
diff --git a/hypervisor/arch/arm/gic-v2.c b/hypervisor/arch/arm/gic-v2.c
index a4ca99c..3b0cbb0 100644
--- a/hypervisor/arch/arm/gic-v2.c
+++ b/hypervisor/arch/arm/gic-v2.c
@@ -59,7 +59,7 @@ static void gic_clear_pending_irqs(void)
        mmio_write32(gich_base + GICH_APR, 0);
 }
 
-static int gic_cpu_reset(struct per_cpu *cpu_data, bool is_shutdown)
+static void gic_cpu_reset(struct per_cpu *cpu_data, bool is_shutdown)
 {
        unsigned int i;
        bool root_shutdown = is_shutdown && (cpu_data->cell == &root_cell);
@@ -108,8 +108,6 @@ static int gic_cpu_reset(struct per_cpu *cpu_data, bool 
is_shutdown)
                gich_vmcr = 0;
        }
        mmio_write32(gich_base + GICH_VMCR, gich_vmcr);
-
-       return 0;
 }
 
 static int gic_cpu_init(struct per_cpu *cpu_data)
diff --git a/hypervisor/arch/arm/gic-v3.c b/hypervisor/arch/arm/gic-v3.c
index 25e560d..43c021f 100644
--- a/hypervisor/arch/arm/gic-v3.c
+++ b/hypervisor/arch/arm/gic-v3.c
@@ -71,7 +71,7 @@ static void gic_clear_pending_irqs(void)
        }
 }
 
-static int gic_cpu_reset(struct per_cpu *cpu_data, bool is_shutdown)
+static void gic_cpu_reset(struct per_cpu *cpu_data, bool is_shutdown)
 {
        unsigned int i;
        void *gicr = cpu_data->gicr_base;
@@ -79,8 +79,8 @@ static int gic_cpu_reset(struct per_cpu *cpu_data, bool 
is_shutdown)
        bool root_shutdown = is_shutdown && (cpu_data->cell == &root_cell);
        u32 ich_vmcr;
 
-       if (gicr == 0)
-               return -ENODEV;
+       if (!gicr)
+               return;
 
        gic_clear_pending_irqs();
 
@@ -120,8 +120,6 @@ static int gic_cpu_reset(struct per_cpu *cpu_data, bool 
is_shutdown)
        }
 
        arm_write_sysreg(ICH_VMCR_EL2, 0);
-
-       return 0;
 }
 
 static int gic_cpu_init(struct per_cpu *cpu_data)
diff --git a/hypervisor/arch/arm/include/asm/irqchip.h 
b/hypervisor/arch/arm/include/asm/irqchip.h
index eb4c25e..2e9b1da 100644
--- a/hypervisor/arch/arm/include/asm/irqchip.h
+++ b/hypervisor/arch/arm/include/asm/irqchip.h
@@ -44,7 +44,7 @@ struct irqchip_ops {
        int     (*cpu_init)(struct per_cpu *cpu_data);
        int     (*cell_init)(struct cell *cell);
        void    (*cell_exit)(struct cell *cell);
-       int     (*cpu_reset)(struct per_cpu *cpu_data, bool is_shutdown);
+       void    (*cpu_reset)(struct per_cpu *cpu_data, bool is_shutdown);
        void    (*adjust_irq_target)(struct cell *cell, u16 irq_id);
 
        int     (*send_sgi)(struct sgi *sgi);
@@ -60,7 +60,7 @@ unsigned int irqchip_mmio_count_regions(struct cell *cell);
 
 int irqchip_init(void);
 int irqchip_cpu_init(struct per_cpu *cpu_data);
-int irqchip_cpu_reset(struct per_cpu *cpu_data);
+void irqchip_cpu_reset(struct per_cpu *cpu_data);
 void irqchip_cpu_shutdown(struct per_cpu *cpu_data);
 
 int irqchip_cell_init(struct cell *cell);
diff --git a/hypervisor/arch/arm/irqchip.c b/hypervisor/arch/arm/irqchip.c
index a6fce01..5f72cdb 100644
--- a/hypervisor/arch/arm/irqchip.c
+++ b/hypervisor/arch/arm/irqchip.c
@@ -132,11 +132,11 @@ int irqchip_cpu_init(struct per_cpu *cpu_data)
        return irqchip.cpu_init(cpu_data);
 }
 
-int irqchip_cpu_reset(struct per_cpu *cpu_data)
+void irqchip_cpu_reset(struct per_cpu *cpu_data)
 {
        cpu_data->pending_irqs_head = cpu_data->pending_irqs_tail = 0;
 
-       return irqchip.cpu_reset(cpu_data, false);
+       irqchip.cpu_reset(cpu_data, false);
 }
 
 void irqchip_cpu_shutdown(struct per_cpu *cpu_data)
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to