From: hanjun.guo@linaro.org (Hanjun Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
Date: Fri, 27 Mar 2015 03:48:50 +0800 [thread overview]
Message-ID: <551462A2.4070308@linaro.org> (raw)
In-Reply-To: <20150326151510.GI2805@arm.com>
On 2015?03?26? 23:15, Will Deacon wrote:
> On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
>>> +/**
>>> + * 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 acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>
>> So here we have an u8 enabled.
>>
>>> +static int __init
>>> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>> + const unsigned long end)
>>> +{
>>> + struct acpi_madt_generic_interrupt *processor;
>>> +
>>> + processor = (struct acpi_madt_generic_interrupt *)header;
>>> +
>>> + if (BAD_MADT_ENTRY(processor, end))
>>> + return -EINVAL;
>>> +
>>> + acpi_table_print_madt_entry(header);
>>> +
>>> + acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> + processor->flags & ACPI_MADT_ENABLED);
>>
>> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
>> don't lose any information. So either make the enabled above a bool or
>> simply pass the flags with the check in acpi_map_gic_cpu_interface()
>> (personal preference for the latter).
>
> I've applied the following patch on top of the series.
>
> Will
>
> --->8
>
> 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.
> {
> 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
Thanks
Hanjun
next prev parent reply other threads:[~2015-03-26 19:48 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 [this message]
2015-03-26 21:12 ` Will Deacon
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=551462A2.4070308@linaro.org \
--to=hanjun.guo@linaro.org \
--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).