linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface()
@ 2015-03-27 12:14 Hanjun Guo
  2015-03-27 12:14 ` [PATCH 2/2] ARM64 / ACPI: make acpi_map_gic_cpu_interface() as void function Hanjun Guo
  2015-03-30 21:53 ` [Linaro-acpi] [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Al Stone
  0 siblings, 2 replies; 5+ messages in thread
From: Hanjun Guo @ 2015-03-27 12:14 UTC (permalink / raw)
  To: Will Deacon, Catalin Marinas
  Cc: Lorenzo Pieralisi, Mark Rutland, Sudeep Holla, Rafael J. Wysocki,
	linux-acpi, linux-arm-kernel, linux-kernel, linaro-acpi,
	Hanjun Guo

MADT table scannig will stopped once it gets the errors
returned by the handler, which is acpi_map_gic_cpu_interface()
in for ARM64, so Ignore the return error value to search for
all enabled CPUs for SMP init.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 07649e4..c263cba 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -181,7 +181,8 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
-	return acpi_map_gic_cpu_interface(processor);
+	acpi_map_gic_cpu_interface(processor);
+	return 0;
 }
 
 /* Parse GIC cpu interface entries in MADT for SMP init */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM64 / ACPI: make acpi_map_gic_cpu_interface() as void function
  2015-03-27 12:14 [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Hanjun Guo
@ 2015-03-27 12:14 ` Hanjun Guo
  2015-03-30 21:53 ` [Linaro-acpi] [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Al Stone
  1 sibling, 0 replies; 5+ messages in thread
From: Hanjun Guo @ 2015-03-27 12:14 UTC (permalink / raw)
  To: Will Deacon, Catalin Marinas
  Cc: Lorenzo Pieralisi, Mark Rutland, Sudeep Holla, Rafael J. Wysocki,
	linux-acpi, linux-arm-kernel, linux-kernel, linaro-acpi,
	Hanjun Guo

Since the only caller of acpi_parse_gic_cpu_interface() doesn't
need the return value, make it have a void return type to avoid
introducing subtle bugs, and update the comments of the function
accordingly.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/acpi.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index c263cba..8b83955 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -98,12 +98,8 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
 /**
  * acpi_map_gic_cpu_interface - generates a logical cpu number
  * and map to MPIDR represented by GICC structure
- * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
- * @enabled: this cpu is enabled or not
- *
- * Returns the logical cpu number which maps to MPIDR
  */
-static int __init
+static void __init
 acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 {
 	int i;
@@ -112,17 +108,17 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 
 	if (mpidr == INVALID_HWID) {
 		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
-		return -EINVAL;
+		return;
 	}
 
 	total_cpus++;
 	if (!enabled)
-		return -EINVAL;
+		return;
 
 	if (enabled_cpus >=  NR_CPUS) {
 		pr_warn("NR_CPUS limit of %d reached, Processor %d/0x%llx ignored.\n",
 			NR_CPUS, total_cpus, mpidr);
-		return -EINVAL;
+		return;
 	}
 
 	/* Check if GICC structure of boot CPU is available in the MADT */
@@ -130,7 +126,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 		if (bootcpu_valid) {
 			pr_err("Firmware bug, duplicate CPU MPIDR: 0x%llx in MADT\n",
 			       mpidr);
-			return -EINVAL;
+			return;
 		}
 
 		bootcpu_valid = true;
@@ -145,28 +141,27 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 		if (cpu_logical_map(i) == mpidr) {
 			pr_err("Firmware bug, duplicate CPU MPIDR: 0x%llx in MADT\n",
 			       mpidr);
-			return -EINVAL;
+			return;
 		}
 	}
 
 	if (!acpi_psci_present())
-		return -EOPNOTSUPP;
+		return;
 
 	cpu_ops[enabled_cpus] = cpu_get_ops("psci");
 	/* CPU 0 was already initialized */
 	if (enabled_cpus) {
 		if (!cpu_ops[enabled_cpus])
-			return -EINVAL;
+			return;
 
 		if (cpu_ops[enabled_cpus]->cpu_init(NULL, enabled_cpus))
-			return -EOPNOTSUPP;
+			return;
 
 		/* map the logical cpu id to cpu MPIDR */
 		cpu_logical_map(enabled_cpus) = mpidr;
 	}
 
 	enabled_cpus++;
-	return enabled_cpus;
 }
 
 static int __init
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Linaro-acpi] [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface()
  2015-03-27 12:14 [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Hanjun Guo
  2015-03-27 12:14 ` [PATCH 2/2] ARM64 / ACPI: make acpi_map_gic_cpu_interface() as void function Hanjun Guo
@ 2015-03-30 21:53 ` Al Stone
  2015-03-31  1:42   ` Hanjun Guo
  1 sibling, 1 reply; 5+ messages in thread
From: Al Stone @ 2015-03-30 21:53 UTC (permalink / raw)
  To: Hanjun Guo, Will Deacon, Catalin Marinas
  Cc: linaro-acpi, Rafael J. Wysocki, linux-kernel, linux-acpi,
	linux-arm-kernel

On 03/27/2015 06:14 AM, Hanjun Guo wrote:
> MADT table scannig will stopped once it gets the errors
> returned by the handler, which is acpi_map_gic_cpu_interface()
> in for ARM64, so Ignore the return error value to search for
> all enabled CPUs for SMP init.

I think the comment should say something like:

MADT scanning will stop when it gets an error from the handler,
acpi_map_gic_cpu_interface(), on arm64.  However, we need to
find all of the enabled CPUs so that SMP initialization can work
properly.  So, if an error occurs in this case, ignore it for
now so that we can find all of the enabled CPUs.

Is that what you meant, Hanjun?

> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  arch/arm64/kernel/acpi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index 07649e4..c263cba 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -181,7 +181,8 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>  		return -EINVAL;
>  
>  	acpi_table_print_madt_entry(header);
> -	return acpi_map_gic_cpu_interface(processor);
> +	acpi_map_gic_cpu_interface(processor);
> +	return 0;
>  }
>  
>  /* Parse GIC cpu interface entries in MADT for SMP init */
> 


-- 
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Linaro Enterprise Group
al.stone@linaro.org
-----------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linaro-acpi] [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface()
  2015-03-30 21:53 ` [Linaro-acpi] [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Al Stone
@ 2015-03-31  1:42   ` Hanjun Guo
  0 siblings, 0 replies; 5+ messages in thread
From: Hanjun Guo @ 2015-03-31  1:42 UTC (permalink / raw)
  To: Al Stone, Hanjun Guo, Will Deacon, Catalin Marinas
  Cc: linaro-acpi, Rafael J. Wysocki, linux-kernel, linux-acpi,
	linux-arm-kernel

On 2015/3/31 5:53, Al Stone wrote:
> On 03/27/2015 06:14 AM, Hanjun Guo wrote:
>> MADT table scannig will stopped once it gets the errors
>> returned by the handler, which is acpi_map_gic_cpu_interface()
>> in for ARM64, so Ignore the return error value to search for
>> all enabled CPUs for SMP init.
> I think the comment should say something like:
>
> MADT scanning will stop when it gets an error from the handler,
> acpi_map_gic_cpu_interface(), on arm64.  However, we need to
> find all of the enabled CPUs so that SMP initialization can work
> properly.  So, if an error occurs in this case, ignore it for
> now so that we can find all of the enabled CPUs.
>
> Is that what you meant, Hanjun?

That's exactly what I mean, you describe it much clearer :)

Thanks
Hanjun


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface()
  2015-03-27 13:55 [PATCH 0/7] minor cleanups for ACPI processor driver Hanjun Guo
@ 2015-03-27 13:55 ` Hanjun Guo
  0 siblings, 0 replies; 5+ messages in thread
From: Hanjun Guo @ 2015-03-27 13:55 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Will Deacon, Catalin Marinas, Boris Ostrovsky,
	Stefano Stabellini, Lorenzo Pieralisi, Sudeep Holla, linux-acpi,
	linux-kernel, linaro-acpi, Hanjun Guo

MADT table scannig will stopped once it gets the errors
returned by the handler, which is acpi_map_gic_cpu_interface()
in for ARM64, so Ignore the return error value to search for
all enabled CPUs for SMP init.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 07649e4..c263cba 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -181,7 +181,8 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
-	return acpi_map_gic_cpu_interface(processor);
+	acpi_map_gic_cpu_interface(processor);
+	return 0;
 }
 
 /* Parse GIC cpu interface entries in MADT for SMP init */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-31  1:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-27 12:14 [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Hanjun Guo
2015-03-27 12:14 ` [PATCH 2/2] ARM64 / ACPI: make acpi_map_gic_cpu_interface() as void function Hanjun Guo
2015-03-30 21:53 ` [Linaro-acpi] [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Al Stone
2015-03-31  1:42   ` Hanjun Guo
2015-03-27 13:55 [PATCH 0/7] minor cleanups for ACPI processor driver Hanjun Guo
2015-03-27 13:55 ` [PATCH 1/2] ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface() Hanjun Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).