diff mbox

[for-4.7,4/5] xen/arm: acpi: Remove uncessary check in acpi_map_gic_cpu_interface

Message ID 1460026796-10899-5-git-send-email-julien.grall@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Julien Grall April 7, 2016, 10:59 a.m. UTC
This part of the code will never be executed when the entry
corresponds to the boot CPU.

Also print an error message rather when arch_cpu_init has failed.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/acpi/boot.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Shannon Zhao April 7, 2016, 12:23 p.m. UTC | #1
On 2016/4/7 18:59, Julien Grall wrote:
> This part of the code will never be executed when the entry
> corresponds to the boot CPU.
> 
> Also print an error message rather when arch_cpu_init has failed.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>  xen/arch/arm/acpi/boot.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
> index fd29bdc..602ab39 100644
> --- a/xen/arch/arm/acpi/boot.c
> +++ b/xen/arch/arm/acpi/boot.c
> @@ -51,6 +51,7 @@ static void __init
>  acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>  {
>      int i;
> +    int rc;
>      u64 mpidr = processor->arm_mpidr & MPIDR_HWID_MASK;
>      bool_t enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>  
> @@ -102,16 +103,16 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>      if ( !acpi_psci_present() )
>          return;
>  
> -    /* CPU 0 was already initialized */
> -    if ( enabled_cpus )
> +    if ( (rc = arch_cpu_init(enabled_cpus, NULL)) < 0 )
>      {
> -        if ( arch_cpu_init(enabled_cpus, NULL) < 0 )
> -            return;
> -
> -        /* map the logical cpu id to cpu MPIDR */
> -        cpu_logical_map(enabled_cpus) = mpidr;
> +        printk("cpu%d: init failed (0x%"PRIx64" MPIDR): %d\n",
> +               enabled_cpus, mpidr, rc);
> +        return;
>      }
>  
> +    /* map the logical cpu id to cpu MPIDR */
> +    cpu_logical_map(enabled_cpus) = mpidr;
> +
>      enabled_cpus++;
>  }
>  
>
Stefano Stabellini April 10, 2016, 8:19 p.m. UTC | #2
On Thu, 7 Apr 2016, Julien Grall wrote:
> This part of the code will never be executed when the entry
> corresponds to the boot CPU.
> 
> Also print an error message rather when arch_cpu_init has failed.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  xen/arch/arm/acpi/boot.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
> index fd29bdc..602ab39 100644
> --- a/xen/arch/arm/acpi/boot.c
> +++ b/xen/arch/arm/acpi/boot.c
> @@ -51,6 +51,7 @@ static void __init
>  acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>  {
>      int i;
> +    int rc;
>      u64 mpidr = processor->arm_mpidr & MPIDR_HWID_MASK;
>      bool_t enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>  
> @@ -102,16 +103,16 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>      if ( !acpi_psci_present() )
>          return;
>  
> -    /* CPU 0 was already initialized */
> -    if ( enabled_cpus )
> +    if ( (rc = arch_cpu_init(enabled_cpus, NULL)) < 0 )
>      {
> -        if ( arch_cpu_init(enabled_cpus, NULL) < 0 )
> -            return;
> -
> -        /* map the logical cpu id to cpu MPIDR */
> -        cpu_logical_map(enabled_cpus) = mpidr;
> +        printk("cpu%d: init failed (0x%"PRIx64" MPIDR): %d\n",
> +               enabled_cpus, mpidr, rc);
> +        return;
>      }
>  
> +    /* map the logical cpu id to cpu MPIDR */
> +    cpu_logical_map(enabled_cpus) = mpidr;
> +
>      enabled_cpus++;
>  }
>  
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index fd29bdc..602ab39 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -51,6 +51,7 @@  static void __init
 acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 {
     int i;
+    int rc;
     u64 mpidr = processor->arm_mpidr & MPIDR_HWID_MASK;
     bool_t enabled = !!(processor->flags & ACPI_MADT_ENABLED);
 
@@ -102,16 +103,16 @@  acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
     if ( !acpi_psci_present() )
         return;
 
-    /* CPU 0 was already initialized */
-    if ( enabled_cpus )
+    if ( (rc = arch_cpu_init(enabled_cpus, NULL)) < 0 )
     {
-        if ( arch_cpu_init(enabled_cpus, NULL) < 0 )
-            return;
-
-        /* map the logical cpu id to cpu MPIDR */
-        cpu_logical_map(enabled_cpus) = mpidr;
+        printk("cpu%d: init failed (0x%"PRIx64" MPIDR): %d\n",
+               enabled_cpus, mpidr, rc);
+        return;
     }
 
+    /* map the logical cpu id to cpu MPIDR */
+    cpu_logical_map(enabled_cpus) = mpidr;
+
     enabled_cpus++;
 }