From: Al Stone ahs3@redhat.com
These patches are a bit of all over the place. Each of them cleans up or removes BOZO comments that have been in the ACPI ARM port from the very early days of the port (I inserted the BOZO comments when it was not clear what needed to be done but I could temporarily hack around a problem). Removing each of those had all sorts of different changes needed, from the simplest (the comment turns out to be wrong in hindsight), to stubbing out or even removing functions that make no sense on an ARMv7/v8 platform.
The only file in the ARM ACPI code that still has a "BOZO" comment in it should be drivers/acpi/plat/arm/sleep.c; this has been left alone since there are discussions about removing the file completely (which is probably a good idea).
Al Stone (7): ACPI: ARM: make use of an ACPI blob address in FDT /chosen configurable. ACPI: ARM: Clean up a leftover comment that is no longer pertinent. ACPI: ARM: remove x86 acpi_wakeup_address usage when running on ARM ACPI: ARM: remove unnecessary comments ACPI: ARM: cleanup comments and isolate out x86-specific PAD code ACPI: ARM: stub out PCI configuration call for non-PCI systems ACPI: ARM: stub out processor idle routines for use on non-x86 platforms
arch/arm/Kconfig.debug | 11 ++++++ arch/arm/include/asm/acpi.h | 7 ---- arch/arm/include/asm/io.h | 6 +--- arch/arm/include/asm/processor.h | 6 ---- arch/arm64/Kconfig.debug | 11 ++++++ arch/arm64/include/asm/acpi.h | 7 ---- arch/arm64/include/asm/processor.h | 6 ---- drivers/acpi/acpi_pad.c | 15 +++----- drivers/acpi/osl.c | 42 ++++++++++++---------- drivers/acpi/processor_idle.c | 74 +++++++++++++++++++------------------- drivers/acpi/sleep.c | 2 ++ 11 files changed, 91 insertions(+), 96 deletions(-)
From: Al Stone ahs3@redhat.com
Since this is really only a option to be used during kernel development, add the kernel config item ACPI_USE_CHOSEN_NODE to allow a developer access to this when working on a non-UEFI system or if needed to experiment with ACPI table content during driver development.
Signed-off-by: Al Stone al.stone@linaro.org --- arch/arm/Kconfig.debug | 11 +++++++++++ arch/arm64/Kconfig.debug | 11 +++++++++++ drivers/acpi/osl.c | 10 ++++++---- 3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 0e23bb6..6ef3d7c 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -1132,4 +1132,15 @@ config PID_IN_CONTEXTIDR additional instructions during context switch. Say Y here only if you are planning to use hardware trace tools with this kernel.
+config ACPI_USE_CHOSEN_NODE + bool "Pass ACPI blob address through /chosen node" + depends on ARM || ARM64 + help + Enabling this allows one to experiment with ACPI tables during + development on non-UEFI systems. If this is enabled, ACPI will + expect to find /chosen/linux,acpi-start in an FDT passed into + the kernel and use the contents of that node as the physical + address of the RSDP in an ACPI table blob. + + endmenu diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index 835c559..483dcce 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug @@ -23,4 +23,15 @@ config PID_IN_CONTEXTIDR instructions during context switch. Say Y here only if you are planning to use hardware trace tools with this kernel.
+config ACPI_USE_CHOSEN_NODE + bool "Pass ACPI blob address through /chosen node" + depends on ARM || ARM64 + help + Enabling this allows one to experiment with ACPI tables during + development on non-UEFI systems. If this is enabled, ACPI will + expect to find /chosen/linux,acpi-start in an FDT passed into + the kernel and use the contents of that node as the physical + address of the RSDP in an ACPI table blob. + + endmenu diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 0912066..a9b5b11 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -251,13 +251,15 @@ static int __init setup_acpi_rsdp(char *arg) early_param("acpi_rsdp", setup_acpi_rsdp); #endif
-#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) +#ifdef CONFIG_ACPI_USE_CHOSEN_NODE #include <asm/acpi.h> #include <acpi/actbl.h>
void acpi_find_arm_root_pointer(acpi_physical_address *pa) { - /* BOZO: temporarily clunky. + /* This function is for development use only, or in extreme + * cases where UEFI is not yet available for the platform. + * * What we do is, while using u-boot still, is use the values * that have already been retrieved from the FDT node * (/chosen/linux,acpi-start and /chosen/linux,acpi-len) which @@ -307,7 +309,7 @@ void acpi_find_arm_root_pointer(acpi_physical_address *pa)
return; } -#endif +#endif /* CONFIG_ACPI_USE_CHOSEN_NODE */
acpi_physical_address __init acpi_os_get_root_pointer(void) { @@ -329,7 +331,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) } else { acpi_physical_address pa = 0;
-#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) +#ifdef CONFIG_ACPI_USE_CHOSEN_NODE acpi_find_arm_root_pointer(&pa); #else acpi_find_root_pointer(&pa);
From: Al Stone ahs3@redhat.com
The comment questioned whether the header file had a typo when it in fact does not.
Signed-off-by: Al Stone al.stone@linaro.org --- arch/arm/include/asm/io.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index b0f3334..467abad 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -328,11 +328,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t); */ #define ioremap(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE) #define ioremap_nocache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE) -/* - * BOZO: is this just mis-named as ioremap_cached()? - * renaming it to ioremap_cache() to find out for now. - #define ioremap_cached(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED) - */ +#define ioremap_cached(cookie, size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED) #define ioremap_cache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED) #define ioremap_wc(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC) #define iounmap __arm_iounmap
From: Al Stone ahs3@redhat.com
This code will be handled in a different manner (either PSCI or other kernel code) so is not needed for ARMv7/v8 systems.
Signed-off-by: Al Stone al.stone@linaro.org --- arch/arm/include/asm/acpi.h | 7 ------- arch/arm64/include/asm/acpi.h | 7 ------- drivers/acpi/sleep.c | 2 ++ 3 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/acpi.h b/arch/arm/include/asm/acpi.h index a6989d8..7907c81 100644 --- a/arch/arm/include/asm/acpi.h +++ b/arch/arm/include/asm/acpi.h @@ -118,13 +118,6 @@ extern int acpi_suspend_lowlevel(void);
extern void prefill_possible_map(void);
-/* Physical address to resume after wakeup */ -/* BOZO: was... -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -*/ -#define acpi_wakeup_address (0) - - static inline void disable_acpi(void) { acpi_disabled = 1; diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c1dc30d..0409796 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -96,13 +96,6 @@ extern int acpi_suspend_lowlevel(void);
extern void prefill_possible_map(void);
-/* Physical address to resume after wakeup */ -/* BOZO: was... -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -*/ -#define acpi_wakeup_address (0) - - static inline void disable_acpi(void) { acpi_disabled = 1; diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 721e949..0847fd6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -58,6 +58,7 @@ static struct notifier_block tts_notifier = {
static int acpi_sleep_prepare(u32 acpi_state) { +#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) #ifdef CONFIG_ACPI_SLEEP /* do we have a wakeup address for S2 and S3? */ if (acpi_state == ACPI_STATE_S3) { @@ -68,6 +69,7 @@ static int acpi_sleep_prepare(u32 acpi_state) } ACPI_FLUSH_CPU_CACHE(); #endif +#endif printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n", acpi_state); acpi_enable_wakeup_devices(acpi_state);
On Sun, Nov 17, 2013 at 04:17:55PM -0700, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
This code will be handled in a different manner (either PSCI or other kernel code) so is not needed for ARMv7/v8 systems.
Signed-off-by: Al Stone al.stone@linaro.org
arch/arm/include/asm/acpi.h | 7 ------- arch/arm64/include/asm/acpi.h | 7 ------- drivers/acpi/sleep.c | 2 ++ 3 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/acpi.h b/arch/arm/include/asm/acpi.h index a6989d8..7907c81 100644 --- a/arch/arm/include/asm/acpi.h +++ b/arch/arm/include/asm/acpi.h @@ -118,13 +118,6 @@ extern int acpi_suspend_lowlevel(void); extern void prefill_possible_map(void); -/* Physical address to resume after wakeup */ -/* BOZO: was... -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -*/ -#define acpi_wakeup_address (0)
static inline void disable_acpi(void) { acpi_disabled = 1; diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c1dc30d..0409796 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -96,13 +96,6 @@ extern int acpi_suspend_lowlevel(void); extern void prefill_possible_map(void); -/* Physical address to resume after wakeup */ -/* BOZO: was... -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -*/ -#define acpi_wakeup_address (0)
static inline void disable_acpi(void) { acpi_disabled = 1; diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 721e949..0847fd6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -58,6 +58,7 @@ static struct notifier_block tts_notifier = { static int acpi_sleep_prepare(u32 acpi_state) { +#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) #ifdef CONFIG_ACPI_SLEEP /* do we have a wakeup address for S2 and S3? */ if (acpi_state == ACPI_STATE_S3) { @@ -68,6 +69,7 @@ static int acpi_sleep_prepare(u32 acpi_state) } ACPI_FLUSH_CPU_CACHE(); #endif +#endif
Im not sure this is needed, all this ends up doing is setting
acpi_gbl_FACS->firmware_waking_vector
to the address passed. I think we can probably just use a dummy value here on arm to save the clumsy #if defined() stuff.
It is only used in arch/x86/kernel/tboot.c so should not affect arm at all.
Graeme
On 11/17/2013 05:04 PM, Graeme Gregory wrote:
On Sun, Nov 17, 2013 at 04:17:55PM -0700, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
This code will be handled in a different manner (either PSCI or other kernel code) so is not needed for ARMv7/v8 systems.
Signed-off-by: Al Stone al.stone@linaro.org
arch/arm/include/asm/acpi.h | 7 ------- arch/arm64/include/asm/acpi.h | 7 ------- drivers/acpi/sleep.c | 2 ++ 3 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/acpi.h b/arch/arm/include/asm/acpi.h index a6989d8..7907c81 100644 --- a/arch/arm/include/asm/acpi.h +++ b/arch/arm/include/asm/acpi.h @@ -118,13 +118,6 @@ extern int acpi_suspend_lowlevel(void);
extern void prefill_possible_map(void);
-/* Physical address to resume after wakeup */ -/* BOZO: was... -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -*/ -#define acpi_wakeup_address (0)
- static inline void disable_acpi(void) { acpi_disabled = 1;
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c1dc30d..0409796 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -96,13 +96,6 @@ extern int acpi_suspend_lowlevel(void);
extern void prefill_possible_map(void);
-/* Physical address to resume after wakeup */ -/* BOZO: was... -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -*/ -#define acpi_wakeup_address (0)
- static inline void disable_acpi(void) { acpi_disabled = 1;
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 721e949..0847fd6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -58,6 +58,7 @@ static struct notifier_block tts_notifier = {
static int acpi_sleep_prepare(u32 acpi_state) { +#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) #ifdef CONFIG_ACPI_SLEEP /* do we have a wakeup address for S2 and S3? */ if (acpi_state == ACPI_STATE_S3) { @@ -68,6 +69,7 @@ static int acpi_sleep_prepare(u32 acpi_state) } ACPI_FLUSH_CPU_CACHE(); #endif +#endif
Im not sure this is needed, all this ends up doing is setting
acpi_gbl_FACS->firmware_waking_vector
to the address passed. I think we can probably just use a dummy value here on arm to save the clumsy #if defined() stuff.
It is only used in arch/x86/kernel/tboot.c so should not affect arm at all.
Graeme
Hrm. Yeah, good idea. I'll simplify for the next version.
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- arch/arm/include/asm/processor.h | 6 ------ arch/arm64/include/asm/processor.h | 6 ------ 2 files changed, 12 deletions(-)
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index abff94a..250cc11 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h @@ -108,10 +108,6 @@ static inline void prefetch(const void *ptr) #define ARCH_HAS_SPINLOCK_PREFETCH #define spin_lock_prefetch(x) do { } while (0)
-/* - * Not all ARM devices have ACPI, but some do - * BOZO: is this correct? - */ #ifdef CONFIG_ACPI enum idle_boot_override { IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, IDLE_POLL, IDLE_FORCE_MWAIT }; @@ -119,8 +115,6 @@ enum idle_boot_override { IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, extern unsigned long boot_option_idle_override; #endif
-/* end BOZO */ - #endif
#define HAVE_ARCH_PICK_MMAP_LAYOUT diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 53326fd..550e052 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -155,10 +155,6 @@ static inline void spin_lock_prefetch(const void *x) prefetchw(x); }
-/* - * Not all ARM devices have ACPI, but some do - * BOZO: is this correct? - */ #ifdef CONFIG_ACPI enum idle_boot_override { IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, IDLE_POLL, IDLE_FORCE_MWAIT }; @@ -166,8 +162,6 @@ enum idle_boot_override { IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, extern unsigned long boot_option_idle_override; #endif
-/* end BOZO */ - #define HAVE_ARCH_PICK_MMAP_LAYOUT
#endif
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/acpi_pad.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 36d993c..bec32e0 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -31,7 +31,6 @@ #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> #ifdef CONFIG_X86 - /* BOZO: abstract out? */ #include <asm/mwait.h> #endif
@@ -48,10 +47,9 @@ static unsigned char tsc_marked_unstable; static unsigned char lapic_detected_unstable; static unsigned char lapic_marked_unstable;
+#ifdef CONFIG_X86 static void power_saving_mwait_init(void) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ unsigned int eax, ebx, ecx, edx; unsigned int highest_cstate = 0; unsigned int highest_subcstate = 0; @@ -77,9 +75,7 @@ static void power_saving_mwait_init(void) } power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | (highest_subcstate - 1); -#endif
-#if defined(CONFIG_X86) switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: case X86_VENDOR_INTEL: @@ -97,8 +93,10 @@ static void power_saving_mwait_init(void) tsc_detected_unstable = 1; lapic_detected_unstable = 1; } -#endif } +#else +static void power_saving_mwait_init(void) { return; } +#endif
static unsigned long cpu_weight[NR_CPUS]; static int tsk_in_cpu[NR_CPUS] = {[0 ... NR_CPUS-1] = -1}; @@ -180,7 +178,6 @@ static int power_saving_thread(void *data) while (!need_resched()) { if (tsc_detected_unstable && !tsc_marked_unstable) { #ifdef CONFIG_X86 - /* BOZO: abstract out? */ /* TSC could halt in idle, so notify users */ mark_tsc_unstable("TSC halts in idle"); #endif @@ -203,12 +200,8 @@ static int power_saving_thread(void *data) stop_critical_timings();
#ifdef CONFIG_X86 - /* BOZO: abstract out? */ __monitor((void *)¤t_thread_info()->flags, 0, 0); -#endif smp_mb(); -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ if (!need_resched()) __mwait(power_saving_mwait_eax, 1); #endif
On 2013-11-18 7:17, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org
drivers/acpi/acpi_pad.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
Processor Aggregator Device is intended to be only x86 used now, so I think let us just keep *no* touch to this file and change the Kconfig for Processor Aggregator Device:
config ACPI_PROCESSOR_AGGREGATOR tristate "Processor Aggregator" depends on ACPI_PROCESSOR - depends on X86 || ARM || ARM64 + depends on X86
when we want to use Processor Aggregator Device for ARM one day (maybe never), then modify the driver at that time, is this make sense to you?
Thanks Hanjun
index 36d993c..bec32e0 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -31,7 +31,6 @@ #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> #ifdef CONFIG_X86
- /* BOZO: abstract out? */
#include <asm/mwait.h> #endif @@ -48,10 +47,9 @@ static unsigned char tsc_marked_unstable; static unsigned char lapic_detected_unstable; static unsigned char lapic_marked_unstable; +#ifdef CONFIG_X86 static void power_saving_mwait_init(void) { -#ifdef CONFIG_X86
- /* BOZO: abstract out? */ unsigned int eax, ebx, ecx, edx; unsigned int highest_cstate = 0; unsigned int highest_subcstate = 0;
@@ -77,9 +75,7 @@ static void power_saving_mwait_init(void) } power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | (highest_subcstate - 1); -#endif -#if defined(CONFIG_X86) switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: case X86_VENDOR_INTEL: @@ -97,8 +93,10 @@ static void power_saving_mwait_init(void) tsc_detected_unstable = 1; lapic_detected_unstable = 1; } -#endif } +#else +static void power_saving_mwait_init(void) { return; } +#endif static unsigned long cpu_weight[NR_CPUS]; static int tsk_in_cpu[NR_CPUS] = {[0 ... NR_CPUS-1] = -1}; @@ -180,7 +178,6 @@ static int power_saving_thread(void *data) while (!need_resched()) { if (tsc_detected_unstable && !tsc_marked_unstable) { #ifdef CONFIG_X86
/* BOZO: abstract out? */ /* TSC could halt in idle, so notify users */ mark_tsc_unstable("TSC halts in idle");
#endif @@ -203,12 +200,8 @@ static int power_saving_thread(void *data) stop_critical_timings(); #ifdef CONFIG_X86
- /* BOZO: abstract out? */ __monitor((void *)¤t_thread_info()->flags, 0, 0);
-#endif smp_mb(); -#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (!need_resched()) __mwait(power_saving_mwait_eax, 1);
#endif
On Thu, Nov 21, 2013 at 04:54:27PM +0800, Hanjun Guo wrote:
On 2013-11-18 7:17, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org
drivers/acpi/acpi_pad.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
Processor Aggregator Device is intended to be only x86 used now, so I think let us just keep *no* touch to this file and change the Kconfig for Processor Aggregator Device:
config ACPI_PROCESSOR_AGGREGATOR tristate "Processor Aggregator" depends on ACPI_PROCESSOR
depends on X86 || ARM || ARM64
- depends on X86
when we want to use Processor Aggregator Device for ARM one day (maybe never), then modify the driver at that time, is this make sense to you?
I agree Hanjun.
Graeme
Thanks Hanjun
index 36d993c..bec32e0 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -31,7 +31,6 @@ #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> #ifdef CONFIG_X86
- /* BOZO: abstract out? */
#include <asm/mwait.h> #endif @@ -48,10 +47,9 @@ static unsigned char tsc_marked_unstable; static unsigned char lapic_detected_unstable; static unsigned char lapic_marked_unstable; +#ifdef CONFIG_X86 static void power_saving_mwait_init(void) { -#ifdef CONFIG_X86
- /* BOZO: abstract out? */ unsigned int eax, ebx, ecx, edx; unsigned int highest_cstate = 0; unsigned int highest_subcstate = 0;
@@ -77,9 +75,7 @@ static void power_saving_mwait_init(void) } power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | (highest_subcstate - 1); -#endif -#if defined(CONFIG_X86) switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: case X86_VENDOR_INTEL: @@ -97,8 +93,10 @@ static void power_saving_mwait_init(void) tsc_detected_unstable = 1; lapic_detected_unstable = 1; } -#endif } +#else +static void power_saving_mwait_init(void) { return; } +#endif static unsigned long cpu_weight[NR_CPUS]; static int tsk_in_cpu[NR_CPUS] = {[0 ... NR_CPUS-1] = -1}; @@ -180,7 +178,6 @@ static int power_saving_thread(void *data) while (!need_resched()) { if (tsc_detected_unstable && !tsc_marked_unstable) { #ifdef CONFIG_X86
/* BOZO: abstract out? */ /* TSC could halt in idle, so notify users */ mark_tsc_unstable("TSC halts in idle");
#endif @@ -203,12 +200,8 @@ static int power_saving_thread(void *data) stop_critical_timings(); #ifdef CONFIG_X86
- /* BOZO: abstract out? */ __monitor((void *)¤t_thread_info()->flags, 0, 0);
-#endif smp_mb(); -#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (!need_resched()) __mwait(power_saving_mwait_eax, 1);
#endif
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
On 11/21/2013 04:58 AM, Graeme Gregory wrote:
On Thu, Nov 21, 2013 at 04:54:27PM +0800, Hanjun Guo wrote:
On 2013-11-18 7:17, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org
drivers/acpi/acpi_pad.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
Processor Aggregator Device is intended to be only x86 used now, so I think let us just keep *no* touch to this file and change the Kconfig for Processor Aggregator Device:
config ACPI_PROCESSOR_AGGREGATOR tristate "Processor Aggregator" depends on ACPI_PROCESSOR
depends on X86 || ARM || ARM64
- depends on X86
when we want to use Processor Aggregator Device for ARM one day (maybe never), then modify the driver at that time, is this make sense to you?
I agree Hanjun.
Ack. Much simpler change. Thanks.
Graeme
Thanks Hanjun
index 36d993c..bec32e0 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -31,7 +31,6 @@ #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> #ifdef CONFIG_X86
- /* BOZO: abstract out? */ #include <asm/mwait.h> #endif
@@ -48,10 +47,9 @@ static unsigned char tsc_marked_unstable; static unsigned char lapic_detected_unstable; static unsigned char lapic_marked_unstable;
+#ifdef CONFIG_X86 static void power_saving_mwait_init(void) { -#ifdef CONFIG_X86
- /* BOZO: abstract out? */ unsigned int eax, ebx, ecx, edx; unsigned int highest_cstate = 0; unsigned int highest_subcstate = 0;
@@ -77,9 +75,7 @@ static void power_saving_mwait_init(void) } power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | (highest_subcstate - 1); -#endif
-#if defined(CONFIG_X86) switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: case X86_VENDOR_INTEL: @@ -97,8 +93,10 @@ static void power_saving_mwait_init(void) tsc_detected_unstable = 1; lapic_detected_unstable = 1; } -#endif } +#else +static void power_saving_mwait_init(void) { return; } +#endif
static unsigned long cpu_weight[NR_CPUS]; static int tsk_in_cpu[NR_CPUS] = {[0 ... NR_CPUS-1] = -1}; @@ -180,7 +178,6 @@ static int power_saving_thread(void *data) while (!need_resched()) { if (tsc_detected_unstable && !tsc_marked_unstable) { #ifdef CONFIG_X86
#endif/* BOZO: abstract out? */ /* TSC could halt in idle, so notify users */ mark_tsc_unstable("TSC halts in idle");
@@ -203,12 +200,8 @@ static int power_saving_thread(void *data) stop_critical_timings();
#ifdef CONFIG_X86
- /* BOZO: abstract out? */ __monitor((void *)¤t_thread_info()->flags, 0, 0);
-#endif smp_mb(); -#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (!need_resched()) __mwait(power_saving_mwait_eax, 1); #endif
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/osl.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index a9b5b11..0088b98 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1075,6 +1075,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width) return AE_OK; }
+#ifdef CONFIG_PCI acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, u64 *value, u32 width) @@ -1099,23 +1100,23 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, return AE_ERROR; }
-#ifdef CONFIG_X86 - /* - * BOZO: probably should not call this function at all - * if there is no PCI... - */ result = raw_pci_read(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, &value32); -#else - result = 0; - value32 = 0; -#endif *value = value32;
return (result ? AE_ERROR : AE_OK); } +#else +acpi_status +acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, + u64 *value, u32 width) +{ + return AE_ERROR; +} +#endif
+#ifdef CONFIG_PCI acpi_status acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, u64 value, u32 width) @@ -1136,17 +1137,20 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, return AE_ERROR; }
-#ifdef CONFIG_X86 - /* BOZO: how do we handle not having PCI? */ result = raw_pci_write(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, value); -#else - result = 0; -#endif
return (result ? AE_ERROR : AE_OK); } +#else +acpi_status +acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, + u64 value, u32 width) +{ + return AE_ERROR; +} +#endif
static void acpi_os_execute_deferred(struct work_struct *work) {
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/processor_idle.c | 74 ++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6ff9b57..3404f95 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -76,6 +76,7 @@ static int disabled_by_idle_boot_param(void) boot_option_idle_override == IDLE_HALT; }
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) /* * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. * For now disable this. Probably a bug somewhere else. @@ -95,7 +96,9 @@ static int set_max_cstate(const struct dmi_system_id *id)
return 0; } +#endif
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) static struct dmi_system_id processor_power_dmi_table[] = { { set_max_cstate, "Clevo 5600D", { DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), @@ -111,35 +114,32 @@ static struct dmi_system_id processor_power_dmi_table[] = { (void *)1}, {}, }; +#endif
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) /* * Callers should disable interrupts before the call and enable * interrupts after return. */ static void acpi_safe_halt(void) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ current_thread_info()->status &= ~TS_POLLING; -#endif + /* * TS_POLLING-cleared state must be visible before we * test NEED_RESCHED: */ smp_mb(); if (!need_resched()) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ safe_halt(); -#endif local_irq_disable(); } -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ current_thread_info()->status |= TS_POLLING; -#endif } +#else +static void acpi_safe_halt(void) { return; } +#endif
#ifdef ARCH_APICTIMER_STOPS_ON_C3
@@ -678,6 +678,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) return 0; }
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) /** * acpi_idle_bm_check - checks if bus master activity was detected */ @@ -703,6 +704,7 @@ static int acpi_idle_bm_check(void) } return bm_status; } +#endif
/** * acpi_idle_do_entry - a helper function that does C2 and C3 type entry @@ -758,6 +760,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, }
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) /** * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining) * @dev: the target CPU @@ -771,8 +774,6 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
while (1) {
-#ifdef CONFIG_X86 - /* BOZO: abstract out? */ if (cx->entry_method == ACPI_CSTATE_HALT) safe_halt(); else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { @@ -780,14 +781,20 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) /* See comment in acpi_idle_do_entry() */ inl(acpi_gbl_FADT.xpm_timer_block.address); } else -#endif return -ENODEV; }
/* Never reached */ return 0; } +#else +static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) +{ + return -ENODEV; +} +#endif
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) /** * acpi_idle_enter_simple - enters an ACPI state without BM handling * @dev: the target CPU @@ -806,10 +813,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, return -EINVAL;
if (cx->entry_method != ACPI_CSTATE_FFH) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ current_thread_info()->status &= ~TS_POLLING; -#endif /* * TS_POLLING-cleared state must be visible before we test * NEED_RESCHED: @@ -817,10 +821,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, smp_mb();
if (unlikely(need_resched())) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ current_thread_info()->status |= TS_POLLING; -#endif return -EINVAL; } } @@ -840,16 +841,21 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
sched_clock_idle_wakeup_event(0);
-#ifdef CONFIG_X86 - /* BOZO: abstract out? */ if (cx->entry_method != ACPI_CSTATE_FFH) current_thread_info()->status |= TS_POLLING; -#endif
lapic_timer_state_broadcast(pr, cx, 0); return index; } +#else +static int acpi_idle_enter_simple(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + return -EINVAL; +} +#endif
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) static int c3_cpu_count; static DEFINE_RAW_SPINLOCK(c3_lock);
@@ -883,10 +889,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, }
if (cx->entry_method != ACPI_CSTATE_FFH) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ current_thread_info()->status &= ~TS_POLLING; -#endif /* * TS_POLLING-cleared state must be visible before we test * NEED_RESCHED: @@ -894,18 +897,12 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, smp_mb();
if (unlikely(need_resched())) { -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ current_thread_info()->status |= TS_POLLING; -#endif return -EINVAL; } }
-#ifdef CONFIG_X86 - /* BOZO: abstract out? */ acpi_unlazy_tlb(smp_processor_id()); -#endif
/* Tell the scheduler that we are going deep-idle: */ sched_clock_idle_sleep_event(); @@ -948,15 +945,19 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
sched_clock_idle_wakeup_event(0);
-#ifdef CONFIG_X86 - /* BOZO: abstract out? */ if (cx->entry_method != ACPI_CSTATE_FFH) current_thread_info()->status |= TS_POLLING; -#endif
lapic_timer_state_broadcast(pr, cx, 0); return index; } +#else +static int acpi_idle_enter_bm(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + return -EINVAL; +} +#endif
struct cpuidle_driver acpi_idle_driver = { .name = "acpi_idle", @@ -1201,6 +1202,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
static int acpi_processor_registered;
+#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) int acpi_processor_power_init(struct acpi_processor *pr) { acpi_status status = 0; @@ -1213,10 +1215,7 @@ int acpi_processor_power_init(struct acpi_processor *pr)
if (!first_run) { dmi_check_system(processor_power_dmi_table); -#ifdef CONFIG_X86 - /* BOZO: abstract out? */ max_cstate = acpi_processor_cstate_check(max_cstate); -#endif if (max_cstate < ACPI_C_STATES_MAX) printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", @@ -1275,6 +1274,9 @@ int acpi_processor_power_init(struct acpi_processor *pr) } return 0; } +#else +int acpi_processor_power_init(struct acpi_processor *pr) { return 0; } +#endif
int acpi_processor_power_exit(struct acpi_processor *pr) {