On 18/02/15 13:53, Hanjun Guo wrote:
CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor, but phys_id is used as int in acpi processor driver, so it will lead to some inconsistence for the drivers.
Further more, when ARM64 was introduced into ACPI, CPU hardware ID used by ARM64 is 64 bits, u32 or int is not suitable.
So introduce typedef u32 phys_cpuid_t for x86 and ia64, and introduce a macro CPU_PHYS_ID_INVALID as (u32)(-1), use phys_cpuid_t when phys_id defined in acpi processor driver, and replace CPU_PHYS_ID_INVALID as -1 for phys_id, this will solve the inconsistence in acpi processor driver, and will prepare for the ACPI on ARM64 too.
phys_cpuid_t was suggested by Lorenzo and Catalin, and CPU_PHYS_ID_INVALID was suggested by Rafael.
CC: Rafael J Wysocki rjw@rjwysocki.net Signed-off-by: Hanjun Guo hanjun.guo@linaro.org
arch/ia64/include/asm/acpi.h | 4 ++++ arch/ia64/kernel/acpi.c | 2 +- arch/x86/include/asm/acpi.h | 4 ++++ arch/x86/kernel/acpi/boot.c | 2 +- drivers/acpi/acpi_processor.c | 7 ++++--- drivers/acpi/processor_core.c | 30 +++++++++++++++--------------- include/acpi/processor.h | 6 +++--- include/linux/acpi.h | 2 +- 8 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h index a1d91ab..ca1f0e4 100644 --- a/arch/ia64/include/asm/acpi.h +++ b/arch/ia64/include/asm/acpi.h @@ -34,6 +34,10 @@ #include <linux/numa.h> #include <asm/numa.h>
+typedef u32 phys_cpuid_t;
+#define CPU_PHYS_ID_INVALID (u32)(-1)
- #ifdef CONFIG_ACPI extern int acpi_lapic; #define acpi_disabled 0 /* ACPI always enabled on IA64 */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index e795cb8..368abeb 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -893,7 +893,7 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) }
/* wrapper to silence section mismatch warning */ -int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu) +int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu) { return _acpi_map_lsapic(handle, physid, pcpu); } diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 3a45668..cd788dd 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -32,6 +32,10 @@ #include <asm/mpspec.h> #include <asm/realmode.h>
+typedef u32 phys_cpuid_t;
+#define CPU_PHYS_ID_INVALID (u32)(-1)
- #ifdef CONFIG_ACPI extern int acpi_lapic; extern int acpi_ioapic;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b9e30da..3f78219 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -750,7 +750,7 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) }
/* wrapper to silence section mismatch warning */ -int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu) +int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu) { return _acpi_map_lsapic(handle, physid, pcpu); } diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 1020b1b..e6c7c56 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) acpi_status status; int ret;
- if (pr->phys_id == -1)
- if (pr->phys_id == CPU_PHYS_ID_INVALID) return -ENODEV;
Though I wish to get rid of these checks at multiple sites, I can think of one or the other uses-case(rather corner case) for x86 :(
Since you have picked up patch posted by Catalin, IMO you must have his SoB, but I will leave it to his preference.
Otherwise, the patch looks fine, so Acked-by: Sudeep Holla sudeep.holla@arm.com
Regards, Sudeep