linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
Date: Thu, 26 Mar 2015 21:12:42 +0000	[thread overview]
Message-ID: <20150326211239.GA23660@arm.com> (raw)
In-Reply-To: <551462A2.4070308@linaro.org>

On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
> On 2015?03?26? 23:15, Will Deacon wrote:
> > commit 8ef320319592693f4a6286d80df210fd47b3e356
> > Author: Will Deacon <will.deacon@arm.com>
> > Date:   Thu Mar 26 15:09:20 2015 +0000
> >
> >      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
> >
> >      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
> >      passing a 32-bit value in the u8 enabled parameter and then subsequently
> >      ignoring its return value.
> >
> >      Sort it out.
> >
> >      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> >      Signed-off-by: Will Deacon <will.deacon@arm.com>
> >
> > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> > index cd60329da8c4..07649e413244 100644
> > --- a/arch/arm64/kernel/acpi.c
> > +++ b/arch/arm64/kernel/acpi.c
> > @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
> >    *
> >    * Returns the logical cpu number which maps to MPIDR
> >    */
> > -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> > +static int __init
> > +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
> 
> How about just replace u8 with u32? This function has its purpose to
> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
> ACPI handle, then pass it to the arch specific mapping function
> to map the physcal cpu ID with logical cpu ID for the new added
> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
> need to go back to that solution.

If/when that happens, we can change things then. Right now, this is a static
function with one caller. One step at a time, please.

> >   {
> >   	int i;
> > +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> > +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
> >
> >   	if (mpidr == INVALID_HWID) {
> >   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> > @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> >   		return -EINVAL;
> >
> >   	acpi_table_print_madt_entry(header);
> > -
> > -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > -		processor->flags & ACPI_MADT_ENABLED);
> > -
> > -	return 0;
> > +	return acpi_map_gic_cpu_interface(processor);
> 
> I don't think we need to return the error value here, in ACPI
> core, it will stop the MADT scanning once it returned the error
> value, but actually we can skip some disabled GICC (cpu) entries
> and find all the enabled ones in MADT, for example,
> 
> cpu0 entry, with flag enabled
> cpu1 entry, disabled  - if we return the error value, table scanning
>                          will stop
> cpu2 entry, enabled   - and this cpu will be ignored

Then send me a patch making acpi_map_gic_cpu_interface have a void return
type. Ignoring the return type is usually a good way to introduce subtle
bugs.

Will

  reply	other threads:[~2015-03-26 21:12 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 14:02 [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1 Hanjun Guo
2015-03-24 14:02 ` [patch v11 01/23] ACPI / table: Use pr_debug() instead of pr_info() for MADT table scanning Hanjun Guo
2015-03-24 14:02 ` [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap Hanjun Guo
2015-03-25 16:43   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 03/23] ARM64: allow late use of early_ioremap Hanjun Guo
2015-03-25 16:43   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 04/23] ARM64 / ACPI: Get RSDP and ACPI boot-time tables Hanjun Guo
2015-03-25 16:44   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64 Hanjun Guo
2015-03-25 16:50   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 06/23] ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT Hanjun Guo
2015-03-24 14:02 ` [patch v11 07/23] ARM64 / ACPI: Introduce PCI stub functions for ACPI Hanjun Guo
2015-03-25 16:50   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 08/23] ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI Hanjun Guo
2015-03-25 16:57   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT Hanjun Guo
2015-03-25 17:00   ` Catalin Marinas
2015-03-26 10:57     ` Lorenzo Pieralisi
2015-03-24 14:02 ` [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init Hanjun Guo
2015-03-25 17:01   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 11/23] ACPI / table: Print GIC information when MADT is parsed Hanjun Guo
2015-03-24 14:02 ` [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization Hanjun Guo
2015-03-25 17:17   ` Catalin Marinas
2015-03-26 15:15     ` Will Deacon
2015-03-26 19:48       ` Hanjun Guo
2015-03-26 21:12         ` Will Deacon [this message]
2015-03-26 23:01           ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID Hanjun Guo
2015-03-25 17:21   ` Catalin Marinas
2015-03-26  3:49     ` Hanjun Guo
2015-03-26 15:13       ` Will Deacon
2015-03-27 13:40       ` Hanjun Guo
2015-03-30 13:58         ` Catalin Marinas
2015-03-31  1:49           ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 14/23] ACPI / processor: Make it possible to get CPU hardware ID via GICC Hanjun Guo
2015-03-25 17:25   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 15/23] ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi Hanjun Guo
2015-03-24 14:02 ` [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support Hanjun Guo
2015-03-25 17:27   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 17/23] clocksource / arch_timer: Parse GTDT to initialize arch timer Hanjun Guo
2015-03-25 17:28   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 18/23] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64 Hanjun Guo
2015-03-25 17:29   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86 Hanjun Guo
2015-03-24 15:30   ` Boris Ostrovsky
2015-03-24 17:24     ` Stefano Stabellini
2015-03-25 11:51       ` Will Deacon
2015-03-25 15:38         ` Stefano Stabellini
2015-03-24 14:02 ` [patch v11 20/23] ARM64 / ACPI: Enable ARM64 in Kconfig Hanjun Guo
2015-03-25 17:29   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 21/23] Documentation: ACPI for ARM64 Hanjun Guo
2015-03-25 17:30   ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 22/23] ARM64 / ACPI: additions of ACPI documentation for arm64 Hanjun Guo
2015-03-24 14:02 ` [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed Hanjun Guo
2015-03-25 17:31   ` Catalin Marinas
2015-03-24 23:04 ` [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1 Rafael J. Wysocki
2015-03-25 12:55   ` Hanjun Guo
2015-03-25  3:53 ` Ming Lei
2015-03-30 16:49 ` Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150326211239.GA23660@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).