[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240409150536.9933-4-miguel.luis@oracle.com>
Date: Tue, 9 Apr 2024 15:05:32 +0000
From: Miguel Luis <miguel.luis@...cle.com>
To: Jonathan.Cameron@...wei.com, "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: rmk+kernel@...linux.org.uk, miguel.luis@...cle.com
Subject: [RFC PATCH 3/4] ACPI: processor: refactor acpi_processor_get_info: isolate acpi_{map|unmap}_cpu under CONFIG_ACPI_HOTPLUG_CPU
mapping and unmaping a cpu at the stage of extra cpu enumeration is
architecture specific which depends on CONFIG_ACPI_HOTPLUG_CPU so let's
isolate that functionality from architecture independent one.
Signed-off-by: Miguel Luis <miguel.luis@...cle.com>
---
drivers/acpi/acpi_processor.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 9ea58b61d741..c6e2f64a056b 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -194,8 +194,21 @@ static void acpi_processor_hotplug_delay_init(struct acpi_processor *pr)
pr_info("CPU%d has been hot-added\n", pr->id);
pr->flags.need_hotplug_init = 1;
}
+static int acpi_processor_hotplug_map_cpu(struct acpi_processor *pr)
+{
+ return acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
+}
+static void acpi_processor_hotplug_unmap_cpu(struct acpi_processor *pr)
+{
+ acpi_unmap_cpu(pr->id);
+}
#else
static void acpi_processor_hotplug_delay_init(struct acpi_processor *pr) {}
+static int acpi_processor_hotplug_map_cpu(struct acpi_processor *pr)
+{
+ return 0;
+}
+static void acpi_processor_hotplug_unmap_cpu(struct acpi_processor *pr) {}
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
/* Enumerate extra CPUs */
@@ -215,13 +228,13 @@ static int acpi_processor_enumerate_extra(struct acpi_processor *pr)
cpu_maps_update_begin();
cpus_write_lock();
- ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
+ ret = acpi_processor_hotplug_map_cpu(pr);
if (ret)
goto out;
ret = arch_register_cpu(pr->id);
if (ret) {
- acpi_unmap_cpu(pr->id);
+ acpi_processor_hotplug_unmap_cpu(pr);
goto out;
}
--
2.43.0
Powered by blists - more mailing lists