* [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic()
@ 2013-09-02 3:57 Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 1/6] ACPI / processor: Introduce apic_id in struct processor to save parsed APIC id Hanjun Guo
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
v1->v2: Return specific error value instead of just return -1, and
correct some grammar mistake in changelog.
For cpu hot add, evaluate _MAT or parse MADT will did twice to get
APIC id:
acpi_processor_add()
acpi_processor_get_info()
acpi_get_cpuid() will evaluate _MAT or parse MADT;
acpi_processor_hotadd_init()
acpi_map_lsapic() will evaluate _MAT again;
This patch set introduces apic_id in struct processor to save parsed
APIC id, and use it to remove the duplicated _MAT evaluation.
Further more, the new logical cpu number will be generated in
acpi_register_lapic(), this can be returned to remove the cpumask
allocation and operation to simplify _acpi_map_lsapic().
There are also some cleanups for the ACPI processor dirver code.
Hanjun Guo (2):
ACPI / processor: remove unnecessary if (!pr) check
ACPI / processor: Remove outdated comments
Jiang Liu (4):
ACPI / processor: Introduce apic_id in struct processor to save
parsed APIC id
ACPI / processor: use apic_id and remove duplicated _MAT evaluation
x86 / ACPI: simplify _acpi_map_lsapic()
ACPI / processor: remove some dead code in acpi_processor_get_info()
arch/ia64/kernel/acpi.c | 38 ++----------------
arch/x86/include/asm/mpspec.h | 2 +-
arch/x86/kernel/acpi/boot.c | 88 +++++++++--------------------------------
arch/x86/kernel/apic/apic.c | 8 ++--
drivers/acpi/acpi_processor.c | 22 +++--------
drivers/acpi/processor_core.c | 26 +++++++++---
include/acpi/processor.h | 3 ++
include/linux/acpi.h | 2 +-
8 files changed, 60 insertions(+), 129 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/6] ACPI / processor: Introduce apic_id in struct processor to save parsed APIC id
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
@ 2013-09-02 3:57 ` Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 2/6] ACPI / processor: use apic_id and remove duplicated _MAT evaluation Hanjun Guo
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
From: Jiang Liu <jiang.liu@huawei.com>
For cpu hot add, we evaluate _MAT or parse MADT twice to get APIC id,
here is the code logic:
acpi_processor_add()
acpi_processor_get_info()
acpi_get_cpuid() will evaluate _MAT or parse MADT;
acpi_processor_hotadd_init()
acpi_map_lsapic() will evaluate _MAT again;
This can be done more effectively, this patch introduces apic_id in struct
processor to save parsed APIC id, and then we can use it and remove the
duplicated _MAT evaluation.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
drivers/acpi/acpi_processor.c | 4 +++-
drivers/acpi/processor_core.c | 26 +++++++++++++++++++++-----
include/acpi/processor.h | 3 +++
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index f29e06e..f89f914 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -270,7 +270,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
device_declaration = 1;
pr->acpi_id = value;
}
- cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id);
+ pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
+ pr->acpi_id);
+ cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
/* Handle UP system running SMP kernel, with no LAPIC in MADT */
if (!cpu0_initialized && (cpu_index == -1) &&
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index cf34d90..b3171f3 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -162,16 +162,23 @@ exit:
return apic_id;
}
-int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
+int acpi_get_apicid(acpi_handle handle, int type, u32 acpi_id)
{
-#ifdef CONFIG_SMP
- int i;
-#endif
- int apic_id = -1;
+ int apic_id;
apic_id = map_mat_entry(handle, type, acpi_id);
if (apic_id == -1)
apic_id = map_madt_entry(type, acpi_id);
+
+ return apic_id;
+}
+
+int acpi_map_cpuid(int apic_id, u32 acpi_id)
+{
+#ifdef CONFIG_SMP
+ int i;
+#endif
+
if (apic_id == -1) {
/*
* On UP processor, there is no _MAT or MADT table.
@@ -211,6 +218,15 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
#endif
return -1;
}
+
+int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
+{
+ int apic_id;
+
+ apic_id = acpi_get_apicid(handle, type, acpi_id);
+
+ return acpi_map_cpuid(apic_id, acpi_id);
+}
EXPORT_SYMBOL_GPL(acpi_get_cpuid);
static bool __init processor_physically_present(acpi_handle handle)
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 66096d0..7816e45 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -199,6 +199,7 @@ struct acpi_processor_flags {
struct acpi_processor {
acpi_handle handle;
u32 acpi_id;
+ u32 apic_id;
u32 id;
u32 pblk;
int performance_platform_limit;
@@ -314,6 +315,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
/* in processor_core.c */
void acpi_processor_set_pdc(acpi_handle handle);
+int acpi_get_apicid(acpi_handle, int type, u32 acpi_id);
+int acpi_map_cpuid(int apic_id, u32 acpi_id);
int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
/* in processor_throttling.c */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/6] ACPI / processor: use apic_id and remove duplicated _MAT evaluation
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 1/6] ACPI / processor: Introduce apic_id in struct processor to save parsed APIC id Hanjun Guo
@ 2013-09-02 3:57 ` Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 3/6] x86 / ACPI: simplify _acpi_map_lsapic() Hanjun Guo
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
From: Jiang Liu <jiang.liu@huawei.com>
Since APIC id is saved in processor struct, just use it and
remove the duplicated _MAT evaluation.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
arch/ia64/kernel/acpi.c | 38 ++++----------------------------------
arch/x86/kernel/acpi/boot.c | 38 +++-----------------------------------
drivers/acpi/acpi_processor.c | 2 +-
include/linux/acpi.h | 2 +-
4 files changed, 9 insertions(+), 71 deletions(-)
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 5eb71d2..59d52e3 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -882,40 +882,10 @@ __init void prefill_possible_map(void)
set_cpu_possible(i, true);
}
-static int _acpi_map_lsapic(acpi_handle handle, int *pcpu)
+static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
{
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object *obj;
- struct acpi_madt_local_sapic *lsapic;
cpumask_t tmp_map;
- int cpu, physid;
-
- if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
- return -EINVAL;
-
- if (!buffer.length || !buffer.pointer)
- return -EINVAL;
-
- obj = buffer.pointer;
- if (obj->type != ACPI_TYPE_BUFFER)
- {
- kfree(buffer.pointer);
- return -EINVAL;
- }
-
- lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
-
- if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
- (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))) {
- kfree(buffer.pointer);
- return -EINVAL;
- }
-
- physid = ((lsapic->id << 8) | (lsapic->eid));
-
- kfree(buffer.pointer);
- buffer.length = ACPI_ALLOCATE_BUFFER;
- buffer.pointer = NULL;
+ int cpu;
cpumask_complement(&tmp_map, cpu_present_mask);
cpu = cpumask_first(&tmp_map);
@@ -934,9 +904,9 @@ static int _acpi_map_lsapic(acpi_handle handle, int *pcpu)
}
/* wrapper to silence section mismatch warning */
-int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu)
+int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
{
- return _acpi_map_lsapic(handle, pcpu);
+ return _acpi_map_lsapic(handle, physid, pcpu);
}
EXPORT_SYMBOL(acpi_map_lsapic);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 2627a81..3e186d1 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -620,44 +620,12 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
#endif
}
-static int _acpi_map_lsapic(acpi_handle handle, int *pcpu)
+static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
{
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object *obj;
- struct acpi_madt_local_apic *lapic;
cpumask_var_t tmp_map, new_map;
- u8 physid;
int cpu;
int retval = -ENOMEM;
- if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
- return -EINVAL;
-
- if (!buffer.length || !buffer.pointer)
- return -EINVAL;
-
- obj = buffer.pointer;
- if (obj->type != ACPI_TYPE_BUFFER ||
- obj->buffer.length < sizeof(*lapic)) {
- kfree(buffer.pointer);
- return -EINVAL;
- }
-
- lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer;
-
- if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC ||
- !(lapic->lapic_flags & ACPI_MADT_ENABLED)) {
- kfree(buffer.pointer);
- return -EINVAL;
- }
-
- physid = lapic->id;
-
- kfree(buffer.pointer);
- buffer.length = ACPI_ALLOCATE_BUFFER;
- buffer.pointer = NULL;
- lapic = NULL;
-
if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
goto out;
@@ -695,9 +663,9 @@ out:
}
/* wrapper to silence section mismatch warning */
-int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu)
+int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
{
- return _acpi_map_lsapic(handle, pcpu);
+ return _acpi_map_lsapic(handle, physid, pcpu);
}
EXPORT_SYMBOL(acpi_map_lsapic);
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index f89f914..66c9b70 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -181,7 +181,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
cpu_maps_update_begin();
cpu_hotplug_begin();
- ret = acpi_map_lsapic(pr->handle, &pr->id);
+ ret = acpi_map_lsapic(pr->handle, pr->apic_id, &pr->id);
if (ret)
goto out;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a5db4ae..3bc7414 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -116,7 +116,7 @@ void acpi_numa_arch_fixup(void);
#ifdef CONFIG_ACPI_HOTPLUG_CPU
/* Arch dependent functions for cpu hotplug support */
-int acpi_map_lsapic(acpi_handle handle, int *pcpu);
+int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu);
int acpi_unmap_lsapic(int cpu);
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/6] x86 / ACPI: simplify _acpi_map_lsapic()
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 1/6] ACPI / processor: Introduce apic_id in struct processor to save parsed APIC id Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 2/6] ACPI / processor: use apic_id and remove duplicated _MAT evaluation Hanjun Guo
@ 2013-09-02 3:57 ` Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 4/6] ACPI / processor: remove some dead code in acpi_processor_get_info() Hanjun Guo
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
From: Jiang Liu <jiang.liu@huawei.com>
In acpi_register_lapic(), it will generates a new logical cpu
number and maps to the local APIC id, this logical cpu number
can be returned to simplify _acpi_map_lsapic() implementation.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
arch/x86/include/asm/mpspec.h | 2 +-
arch/x86/kernel/acpi/boot.c | 50 +++++++++++++----------------------------
arch/x86/kernel/apic/apic.c | 8 ++++---
3 files changed, 22 insertions(+), 38 deletions(-)
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 626cf70..3142a94 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -94,7 +94,7 @@ static inline void early_reserve_e820_mpc_new(void) { }
#define default_get_smp_config x86_init_uint_noop
#endif
-void generic_processor_info(int apicid, int version);
+int generic_processor_info(int apicid, int version);
#ifdef CONFIG_ACPI
extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 3e186d1..ab89c2b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -195,24 +195,31 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
return 0;
}
-static void acpi_register_lapic(int id, u8 enabled)
+/**
+ * acpi_register_lapic - register a local apic and generates a logic cpu number
+ * @id: local apic id to register
+ * @enabled: this cpu is enabled or not
+ *
+ * Returns the logic cpu number which maps to the local apic
+ */
+static int acpi_register_lapic(int id, u8 enabled)
{
unsigned int ver = 0;
if (id >= (MAX_LOCAL_APIC-1)) {
printk(KERN_INFO PREFIX "skipped apicid that is too big\n");
- return;
+ return -EINVAL;
}
if (!enabled) {
++disabled_cpus;
- return;
+ return -EINVAL;
}
if (boot_cpu_physical_apicid != -1U)
ver = apic_version[boot_cpu_physical_apicid];
- generic_processor_info(id, ver);
+ return generic_processor_info(id, ver);
}
static int __init
@@ -622,44 +629,19 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
{
- cpumask_var_t tmp_map, new_map;
int cpu;
- int retval = -ENOMEM;
-
- if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
- goto out;
- if (!alloc_cpumask_var(&new_map, GFP_KERNEL))
- goto free_tmp_map;
-
- cpumask_copy(tmp_map, cpu_present_mask);
- acpi_register_lapic(physid, ACPI_MADT_ENABLED);
-
- /*
- * If acpi_register_lapic successfully generates a new logical cpu
- * number, then the following will get us exactly what was mapped
- */
- cpumask_andnot(new_map, cpu_present_mask, tmp_map);
- if (cpumask_empty(new_map)) {
- printk ("Unable to map lapic to logical cpu number\n");
- retval = -EINVAL;
- goto free_new_map;
+ cpu = acpi_register_lapic(physid, ACPI_MADT_ENABLED);
+ if (cpu < 0) {
+ pr_info(PREFIX "Unable to map lapic to logical cpu number\n");
+ return cpu;
}
acpi_processor_set_pdc(handle);
-
- cpu = cpumask_first(new_map);
acpi_map_cpu2node(handle, cpu, physid);
*pcpu = cpu;
- retval = 0;
-
-free_new_map:
- free_cpumask_var(new_map);
-free_tmp_map:
- free_cpumask_var(tmp_map);
-out:
- return retval;
+ return 0;
}
/* wrapper to silence section mismatch warning */
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index eca89c5..c98fe31 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2107,7 +2107,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
apic_write(APIC_LVT1, value);
}
-void generic_processor_info(int apicid, int version)
+int generic_processor_info(int apicid, int version)
{
int cpu, max = nr_cpu_ids;
bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
@@ -2127,7 +2127,7 @@ void generic_processor_info(int apicid, int version)
" Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
disabled_cpus++;
- return;
+ return -ENODEV;
}
if (num_processors >= nr_cpu_ids) {
@@ -2138,7 +2138,7 @@ void generic_processor_info(int apicid, int version)
" Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
disabled_cpus++;
- return;
+ return -EINVAL;
}
num_processors++;
@@ -2183,6 +2183,8 @@ void generic_processor_info(int apicid, int version)
#endif
set_cpu_possible(cpu, true);
set_cpu_present(cpu, true);
+
+ return cpu;
}
int hard_smp_processor_id(void)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/6] ACPI / processor: remove some dead code in acpi_processor_get_info()
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
` (2 preceding siblings ...)
2013-09-02 3:57 ` [PATCH v2 3/6] x86 / ACPI: simplify _acpi_map_lsapic() Hanjun Guo
@ 2013-09-02 3:57 ` Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 5/6] ACPI / processor: remove unnecessary if (!pr) check Hanjun Guo
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
From: Jiang Liu <jiang.liu@huawei.com>
errata.smp is used by nowhere, so the variable assignment is meanless,
remove it.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
drivers/acpi/acpi_processor.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 66c9b70..5364d02 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -220,9 +220,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
acpi_status status = AE_OK;
static int cpu0_initialized;
- if (num_online_cpus() > 1)
- errata.smp = TRUE;
-
acpi_processor_errata(pr);
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 5/6] ACPI / processor: remove unnecessary if (!pr) check
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
` (3 preceding siblings ...)
2013-09-02 3:57 ` [PATCH v2 4/6] ACPI / processor: remove some dead code in acpi_processor_get_info() Hanjun Guo
@ 2013-09-02 3:57 ` Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 6/6] ACPI / processor: Remove outdated comments Hanjun Guo
2013-09-02 12:12 ` [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Rafael J. Wysocki
6 siblings, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
acpi_processor_errata() is only called in acpi_processor_get_info(),
and the argument 'pr' passed to acpi_processor_errata() will never be
NULL, so the if (!pr) check is unnecessary and can be removed.
Since the 'pr' argument is not used by acpi_processor_errata() any more,
so change the argument into void too.
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
drivers/acpi/acpi_processor.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 5364d02..7ce0750 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -140,15 +140,11 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
return 0;
}
-static int acpi_processor_errata(struct acpi_processor *pr)
+static int acpi_processor_errata(void)
{
int result = 0;
struct pci_dev *dev = NULL;
-
- if (!pr)
- return -EINVAL;
-
/*
* PIIX4
*/
@@ -220,7 +216,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
acpi_status status = AE_OK;
static int cpu0_initialized;
- acpi_processor_errata(pr);
+ acpi_processor_errata();
/*
* Check to see if we have bus mastering arbitration control. This
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 6/6] ACPI / processor: Remove outdated comments
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
` (4 preceding siblings ...)
2013-09-02 3:57 ` [PATCH v2 5/6] ACPI / processor: remove unnecessary if (!pr) check Hanjun Guo
@ 2013-09-02 3:57 ` Hanjun Guo
2013-09-02 12:12 ` [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Rafael J. Wysocki
6 siblings, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2013-09-02 3:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi, Hanjun Guo
acpi_get_processor_id() can be find nowhere, and the acpi id
is synchronized to APIC id when acpi_get_cpuid() is called, so
the comments can be removed.
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
drivers/acpi/acpi_processor.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 7ce0750..da42892 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -240,11 +240,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
return -ENODEV;
}
- /*
- * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
- * >>> 'acpi_get_processor_id(acpi_id, &id)' in
- * arch/xxx/acpi.c
- */
pr->acpi_id = object.processor.proc_id;
} else {
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic()
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
` (5 preceding siblings ...)
2013-09-02 3:57 ` [PATCH v2 6/6] ACPI / processor: Remove outdated comments Hanjun Guo
@ 2013-09-02 12:12 ` Rafael J. Wysocki
6 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2013-09-02 12:12 UTC (permalink / raw)
To: Hanjun Guo
Cc: Thomas Gleixner, Tony Luck, Ingo Molnar, Jiang Liu, linux-acpi,
x86, linux-ia64, linux-kernel, patches, linaro-kernel,
linaro-acpi
On Monday, September 02, 2013 11:57:33 AM Hanjun Guo wrote:
> v1->v2: Return specific error value instead of just return -1, and
> correct some grammar mistake in changelog.
>
> For cpu hot add, evaluate _MAT or parse MADT will did twice to get
> APIC id:
> acpi_processor_add()
> acpi_processor_get_info()
> acpi_get_cpuid() will evaluate _MAT or parse MADT;
> acpi_processor_hotadd_init()
> acpi_map_lsapic() will evaluate _MAT again;
>
> This patch set introduces apic_id in struct processor to save parsed
> APIC id, and use it to remove the duplicated _MAT evaluation.
>
> Further more, the new logical cpu number will be generated in
> acpi_register_lapic(), this can be returned to remove the cpumask
> allocation and operation to simplify _acpi_map_lsapic().
>
> There are also some cleanups for the ACPI processor dirver code.
I like the series, so I've queued it up for 3.13.
Thanks,
Rafael
> Hanjun Guo (2):
> ACPI / processor: remove unnecessary if (!pr) check
> ACPI / processor: Remove outdated comments
>
> Jiang Liu (4):
> ACPI / processor: Introduce apic_id in struct processor to save
> parsed APIC id
> ACPI / processor: use apic_id and remove duplicated _MAT evaluation
> x86 / ACPI: simplify _acpi_map_lsapic()
> ACPI / processor: remove some dead code in acpi_processor_get_info()
>
> arch/ia64/kernel/acpi.c | 38 ++----------------
> arch/x86/include/asm/mpspec.h | 2 +-
> arch/x86/kernel/acpi/boot.c | 88 +++++++++--------------------------------
> arch/x86/kernel/apic/apic.c | 8 ++--
> drivers/acpi/acpi_processor.c | 22 +++--------
> drivers/acpi/processor_core.c | 26 +++++++++---
> include/acpi/processor.h | 3 ++
> include/linux/acpi.h | 2 +-
> 8 files changed, 60 insertions(+), 129 deletions(-)
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-09-02 12:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-02 3:57 [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 1/6] ACPI / processor: Introduce apic_id in struct processor to save parsed APIC id Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 2/6] ACPI / processor: use apic_id and remove duplicated _MAT evaluation Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 3/6] x86 / ACPI: simplify _acpi_map_lsapic() Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 4/6] ACPI / processor: remove some dead code in acpi_processor_get_info() Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 5/6] ACPI / processor: remove unnecessary if (!pr) check Hanjun Guo
2013-09-02 3:57 ` [PATCH v2 6/6] ACPI / processor: Remove outdated comments Hanjun Guo
2013-09-02 12:12 ` [PATCH v2 0/6] Remove the duplicated _MAT evaluation and simplify _acpi_map_lsapic() Rafael J. Wysocki
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).