mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Arnd Bergmann <arnd@arndb.de>, Marc Zyngier <maz@kernel.org>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v3 2/4] LoongArch: Refactor get_acpi_id_for_cpu() related code
Date: Fri, 12 Apr 2024 17:28:52 +0800	[thread overview]
Message-ID: <45a3ef9b-54f2-cea6-5902-d9681fad6a48@loongson.cn> (raw)
In-Reply-To: <CAAhV-H73d5hVM+anfHhTFHjWDmVtC2TJdxU9hANJvQgm-E3g6w@mail.gmail.com>



On 04/12/2024 12:17 PM, Huacai Chen wrote:
> Hi, Tiezhu,
>
> On Thu, Apr 11, 2024 at 9:05 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>
>> Currently, cpu_logical_map(cpu) is defined as __cpu_logical_map[cpu]
>> in arch/loongarch/include/asm/smp.h and __cpu_logical_map[] is defined
>> in arch/loongarch/kernel/smp.c, that is to say, cpu_logical_map(cpu) is
>> vaild only under CONFIG_SMP, the implementation of get_acpi_id_for_cpu()
>> which calls cpu_logical_map(cpu) is not suitable for the case of non-SMP,
>> so refactor get_acpi_id_for_cpu() related code to make it work well for
>> both SMP and non-SMP.
> But you implement cpu_logical_map(cpu) for non-SMP in the 4th patch, right?

The initial aim is to make get_acpi_id_for_cpu() only related with
acpi stuff and referenced the following riscv code, this patch can
be dropped if you think it is better to only define cpu_logical_map(cpu)
under !CONFIG_SMP, I am not sure whether it needs to keep the changes
in acpi.c at least.

static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, 
const unsigned long end)
{
	struct acpi_madt_rintc *rintc = (struct acpi_madt_rintc *)header;
	int cpuid;

	if (!(rintc->flags & ACPI_MADT_ENABLED))
		return 0;

	cpuid = riscv_hartid_to_cpuid(rintc->hart_id);
	/*
	 * When CONFIG_SMP is disabled, mapping won't be created for
	 * all cpus.
	 * CPUs more than num_possible_cpus, will be ignored.
	 */
	if (cpuid >= 0 && cpuid < num_possible_cpus())
		cpu_madt_rintc[cpuid] = *rintc;

	return 0;
}

struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu)
{
	return &cpu_madt_rintc[cpu];
}

u32 get_acpi_id_for_cpu(int cpu)
{
	return acpi_cpu_get_madt_rintc(cpu)->uid;
}

https://elixir.bootlin.com/linux/v6.9-rc3/source/arch/riscv/kernel/acpi.c#L194

Thanks,
Tiezhu


  reply	other threads:[~2024-04-12  9:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  1:05 [PATCH v3 0/4] Give chance to build under !CONFIG_SMP for LoongArch Tiezhu Yang
2024-04-11  1:05 ` [PATCH v3 1/4] LoongArch: Move CONFIG_HAVE_SETUP_PER_CPU_AREA related code to smp.c Tiezhu Yang
2024-04-12  4:12   ` Huacai Chen
2024-04-12  9:27     ` Tiezhu Yang
2024-04-13  7:20       ` Huacai Chen
2024-04-11  1:05 ` [PATCH v3 2/4] LoongArch: Refactor get_acpi_id_for_cpu() related code Tiezhu Yang
2024-04-12  4:17   ` Huacai Chen
2024-04-12  9:28     ` Tiezhu Yang [this message]
2024-04-11  1:05 ` [PATCH v3 3/4] LoongArch: Save and restore PERCPU_BASE_KS for ACPI S3 state Tiezhu Yang
2024-04-12  4:18   ` Huacai Chen
2024-04-12  9:30     ` Tiezhu Yang
2024-04-13  7:22       ` Huacai Chen
2024-04-11  1:05 ` [PATCH v3 4/4] LoongArch: Give chance to build under !CONFIG_SMP Tiezhu Yang
2024-04-11  4:26 ` [PATCH v3 0/4] Give chance to build under !CONFIG_SMP for LoongArch Huacai Chen
2024-04-11  6:06   ` Arnd Bergmann
2024-04-12  4:00     ` Huacai Chen
2024-04-18 17:44     ` Xi Ruoyao

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=45a3ef9b-54f2-cea6-5902-d9681fad6a48@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=arnd@arndb.de \
    --cc=chenhuacai@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®