linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hanjun.guo@linaro.org (Hanjun Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC part2 PATCH 2/9] ARM64 / ACPI: Prefill cpu possible/present maps and map logical cpu id to APIC id
Date: Thu, 05 Dec 2013 21:34:00 +0800	[thread overview]
Message-ID: <52A080C8.5080909@linaro.org> (raw)
In-Reply-To: <CAL_JsqKF-_GCRR1d5Hs0F6pCMfLxUYkXAAp9hY7Ywuu1C+aZ0A@mail.gmail.com>

On 2013?12?04? 23:47, Rob Herring wrote:
> On Tue, Dec 3, 2013 at 10:39 AM, Hanjun Guo <hanjun.guo@linaro.org> wrote:
>> When boot the kernel with MADT, the cpu possible and present maps should be
>> prefilled for cpu topology and acpi based cpu hot-plug.
>>
>> The logic cpu id maps to APIC id (GIC id) is also implemented, it is needed
>> for acpi processor drivers.
>>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> ---
>>   arch/arm64/include/asm/acpi.h |   10 ++--
>>   arch/arm64/kernel/setup.c     |    2 +
>>   arch/arm64/kernel/smp.c       |    2 +
>>   drivers/acpi/plat/arm-core.c  |  118 +++++++++++++++++++++++++++++++++++++++++
>>   4 files changed, 129 insertions(+), 3 deletions(-)
> [snip]
>
>> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
>> index a0c2ca6..1428024 100644
>> --- a/arch/arm64/kernel/smp.c
>> +++ b/arch/arm64/kernel/smp.c
>> @@ -420,7 +420,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>>                  if (err)
>>                          continue;
>>
>> +#ifndef CONFIG_ACPI
>>                  set_cpu_present(cpu, true);
>> +#endif
> Should this be moved to DT cpu topology related code?

I didn't see the code in the mainline, Mark Brown is
working on it now?

>>                  max_cpus--;
>>          }
>>   }
>> diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c
>> index 45ff625..8527ecc 100644
>> --- a/drivers/acpi/plat/arm-core.c
>> +++ b/drivers/acpi/plat/arm-core.c
> [snip]
>
>> @@ -221,6 +284,61 @@ static int __init acpi_parse_madt_gic_distributor_entries(void)
>>          return 0;
>>   }
>>
>> +static int setup_possible_cpus __initdata = -1;
>> +static int __init _setup_possible_cpus(char *str)
>> +{
>> +       get_option(&str, &setup_possible_cpus);
>> +       return 0;
>> +}
>> +early_param("possible_cpus", _setup_possible_cpus);
> This does not seem ACPI or ARM specific.
>
>> +
>> +/*
>> + * cpu_possible_mask should be static, it cannot change as cpu's
>> + * are onlined, or offlined. The reason is per-cpu data-structures
>> + * are allocated by some modules at init time, and dont expect to
>> + * do this dynamically on cpu arrival/departure.
>> + * cpu_present_mask on the other hand can change dynamically.
>> + * In case when cpu_hotplug is not compiled, then we resort to current
>> + * behaviour, which is cpu_possible == cpu_present.
>> + * - Ashok Raj
>> + *
>> + * Three ways to find out the number of additional hotplug CPUs:
>> + * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
>> + * - The user can overwrite it with possible_cpus=NUM
>> + * - Otherwise don't reserve additional CPUs.
>> + * We do this because additional CPUs waste a lot of memory.
>> + * -AK
>> + */
>> +void __init prefill_possible_map(void)
>> +{
>> +       int i;
>> +       int possible, disabled_cpus;
>> +
>> +       disabled_cpus = total_cpus - available_cpus;
>> +
>> +       if (setup_possible_cpus == -1) {
>> +               if (disabled_cpus > 0)
>> +                       setup_possible_cpus = disabled_cpus;
>> +               else
>> +                       setup_possible_cpus = 0;
>> +       }
>> +
>> +       possible = available_cpus + setup_possible_cpus;
>> +
>> +       pr_info("SMP: the system is limited to %d CPUs\n", nr_cpu_ids);
>> +
>> +       if (possible > nr_cpu_ids)
>> +               possible = nr_cpu_ids;
>> +
>> +       pr_info("SMP: Allowing %d CPUs, %d hotplug CPUs\n",
>> +               possible, max((possible - available_cpus), 0));
>> +
>> +       for (i = 0; i < possible; i++)
>> +               set_cpu_possible(i, true);
>> +       for (; i < NR_CPUS; i++)
>> +               set_cpu_possible(i, false);
>> +}
> This does not seem ACPI or ARM specific either.

I think possible map here is related to ACPI based CPU hot-plug,
that's why I introduce the code here, if anything I'm wrong, please
correct me.

Thanks
Hanjun

  parent reply	other threads:[~2013-12-05 13:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 16:39 [RFC part2 PATCH 0/9] Using ACPI MADT table to initialise SMP and GIC Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 1/9] ARM64 / ACPI: Implement core functions for parsing MADT table Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 2/9] ARM64 / ACPI: Prefill cpu possible/present maps and map logical cpu id to APIC id Hanjun Guo
2013-12-03 16:57   ` One Thousand Gnomes
2013-12-04 14:21     ` Hanjun Guo
2013-12-04 15:40       ` Rob Herring
2013-12-04 15:47   ` Rob Herring
2013-12-05 13:24     ` Mark Brown
2013-12-05 13:34     ` Hanjun Guo [this message]
2013-12-05 23:09     ` Arnd Bergmann
2013-12-09  8:06       ` Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 3/9] ARM64 / ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 4/9] ARM64 / ACPI: Use Parked Address in GIC structure for spin table SMP initialisation Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 5/9] ACPI: Define ACPI_IRQ_MODEL_GIC needed for arm Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 6/9] Irqchip / gic: Set as default domain so we can access from ACPI Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 7/9] irqdomain: Add a new API irq_create_acpi_mapping() Hanjun Guo
2013-12-03 17:25   ` Rob Herring
2013-12-04 15:38     ` Hanjun Guo
2013-12-10 10:06       ` Linus Walleij
2013-12-03 16:39 ` [RFC part2 PATCH 8/9] ACPI / ARM64: Update acpi_register_gsi to register with the core IRQ subsystem Hanjun Guo
2013-12-05  3:48   ` Arnd Bergmann
2013-12-05 14:01     ` Hanjun Guo
2013-12-03 16:39 ` [RFC part2 PATCH 9/9] ACPI / GIC: Initialize GIC using the information in MADT Hanjun Guo
2013-12-03 17:09   ` Rob Herring
2013-12-04 14:58     ` Hanjun Guo
2013-12-03 17:26   ` Marc Zyngier
2013-12-04 15:32     ` Hanjun Guo
2013-12-04 15:50       ` Marc Zyngier
2013-12-05 13:41         ` Hanjun Guo
2013-12-09 18:54         ` Olof Johansson
     [not found] <1385999094-3152-1-git-send-email-hanjun.guo@linaro.org>
     [not found] ` < 1385999094-3152-3-git-send-email-hanjun.guo@linaro.org>
     [not found]   ` <1385999094-3152-3-git-send-email-hanjun.guo@linaro.org>
2013-12-10 12:53     ` [RFC part2 PATCH 2/9] ARM64 / ACPI: Prefill cpu possible/present maps and map logical cpu id to APIC id Grant Likely
2013-12-10 15:07       ` Hanjun Guo

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=52A080C8.5080909@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).