From: Al Stone ahs3@redhat.com
This series of patches starts with Hanjun's patch to create a kernel config item for CONFIG_ACPI_REDUCED_HARDWARE [0]. Building on that, I then reviewed all of the code that touched any of several fields in the FADT that the OSPM is supposed to ignore when ACPI is in Hardware Reduced mode [1]. Any time there was a use of one of the fields to be ignored, I evaluated whether or not the code was implementing Hardware Reduced mode correctly. Similarly, for each the flags in the FADT flags field that are to be ignored in Hardware Reduced mode, the kernel code was again scanned for proper usage. The remainder of the patches are to fix all of the situations I could find where the kernel would not behave correctly in this ACPI mode.
These are being submitted as an RFC to the linaro-acpi@ list so I can get some other eyes looking at them before sending them to linux-acpi@ where they really need to go. These seem to work just fine on the RTSM model for ARMv7, both with and without ACPI enabled, and with and without ACPI_REDUCED_HARDWARE enabled. However, there's no way I can think of or test all possible scenarios so feedback would be greatly appreciated.
NB: these changes are only applicable to the LEG ACPI working tree. The macros in patch 1/13 will have to change for the linux-acpi tree.
Changes for v3: -- Consistent use of #if (!ACPI_REDUCED_HARDWARE) -- Use of ACPI_HW_DEPENDENT_RETURN_{*} macros -- Simplify wherever possible
Changes for v2: -- Change patch series title -- Add in the FACS global lock patch as further hardware reduced mode cleanup that is needed -- Remove whitespace change that should not have gotten in
[1] Please see the ACPI Specification v5.0 for details on Hardware Reduced mode. [0] List at https://wiki.linaro.org/LEG/Engineering/Kernel/ACPI/AcpiReducedHw#Section_5:...
Al Stone (13): ACPI: introduce CONFIG_ACPI_REDUCED_HARDWARE to enable this ACPI mode ACPI: bus master reload not supported in reduced HW mode ACPI: clean up compiler warning about uninitialized field ACPI: HW reduced mode does not allow use of the FADT sci_interrupt field ACPI: ARM: exclude calls on ARM platforms, not include them on x86 ACPI: ensure several FADT fields are only used in HW reduced mode ACPI: do not reserve memory regions for some FADT entries in HW reduced mode ACPI: in HW reduced mode, getting power latencies from FADT is not allowed ACPI: add clarifying comment about processor throttling in HW reduced mode ACPI: ACPI_FADT_C2_MP_SUPPORTED must be ignored in HW reduced mode ACPI: use of ACPI_FADT_32BIT_TIMER is not allowed in HW reduced mode ACPI: correct #ifdef so compilation without ACPI_REDUCED_HARDWARE works ACPI: ARM/ARM64: ensure the ACPI FACS global_lock is never used in HW reduced mode
arch/arm/include/asm/acpi.h | 3 ++- arch/arm64/include/asm/acpi.h | 3 ++- drivers/acpi/Kconfig | 8 ++++++++ drivers/acpi/acpica/utxface.c | 3 ++- drivers/acpi/bus.c | 7 ++++--- drivers/acpi/osl.c | 28 ++++++++++++++++++++-------- drivers/acpi/pci_link.c | 14 ++++++++------ drivers/acpi/plat/arm/boot.c | 2 ++ drivers/acpi/processor_idle.c | 19 ++++++++++++------- drivers/acpi/processor_throttling.c | 8 ++++++++ drivers/acpi/sleep.c | 2 +- include/acpi/acconfig.h | 2 +- include/acpi/acpixf.h | 6 ++++++ include/acpi/platform/aclinux.h | 6 ++++++ 14 files changed, 82 insertions(+), 29 deletions(-)
From: Al Stone ahs3@redhat.com
To enable the hardware reduced mode of ACPI on some platforms (such as ARM), we need to modify the kernel code and set ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source.
This can be done more resonably by introducing a kernel config item to enable/disable ACPI_REDUCED_HARDWARE. We can then change the kernel config instead of having to modify the kernel source directly to enable the reduced hardware mode of ACPI.
Lv Zheng suggested that this configuration item does not belong in ACPICA, the upstream source for much of the ACPI internals, but rather to the Linux kernel itself. Hence, we introduce this flag so that we can make ACPI_REDUCED_HARDWARE configurable. For the details of the discussion, please refer to: http://www.spinics.net/lists/linux-acpi/msg46369.html
NB: this patch is only usable with the Linaro LEG acpi.git tree. The uptream kernel does this slightly differently and a separate patch will be submitted for that tree in a different patchset.
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/Kconfig | 8 ++++++++ include/acpi/acconfig.h | 2 +- include/acpi/platform/aclinux.h | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 70813fe..099ca81 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -389,6 +389,14 @@ config ACPI_BGRT data from the firmware boot splash. It will appear under /sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE + bool "Hardware-reduced ACPI support" + depends on !(IA64 || X86) + help + This config adds support for Hardware-reduced ACPI. When this option + is selected, will generate a specialized version of ACPICA that ONLY + supports the ACPI "reduced hardware". + source "drivers/acpi/apei/Kconfig"
endif # ACPI diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 1c16f82..58b68ca 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -100,7 +100,7 @@ * ACPI PM timer * FACS table (Waking vectors and Global Lock) */ -#define ACPI_REDUCED_HARDWARE FALSE +#define ACPI_REDUCED_HARDWARE FLAG_ACPI_HW_REDUCED
/****************************************************************************** * diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 68534ef..ff3129a 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -174,6 +174,12 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) lock ? AE_OK : AE_NO_MEMORY; \ })
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE +#define FLAG_ACPI_HW_REDUCED TRUE +#else +#define FLAG_ACPI_HW_REDUCED FALSE +#endif /* CONFIG_ACPI_REDUCED_HARDWARE */ + #endif /* __KERNEL__ */
#endif /* __ACLINUX_H__ */
From: Al Stone ahs3@redhat.com
Remove the saving and restoring of bus master reload registers in suspend/resume when in reduces HW mode; according to the spec, no such registers should exist
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/processor_idle.c | 8 +++++--- include/acpi/acpixf.h | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 587f3cf..0125f54 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -219,15 +219,17 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, #endif
#ifdef CONFIG_PM_SLEEP +#if (!ACPI_REDUCED_HARDWARE) static u32 saved_bm_rld; +#endif
-static int acpi_processor_suspend(void) +ACPI_HW_DEPENDENT_RETURN_INT(int acpi_processor_suspend(void)) { acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); return 0; }
-static void acpi_processor_resume(void) +ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_processor_resume(void)) { u32 resumed_bm_rld;
@@ -617,7 +619,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) case ACPI_STATE_C2: if (!cx->address) break; - cx->valid = 1; + cx->valid = 1; break;
case ACPI_STATE_C3: diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 85bfdbe..3eec2446 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -98,6 +98,9 @@ extern u8 acpi_gbl_disable_ssdt_table_load; #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ prototype;
+#define ACPI_HW_DEPENDENT_RETURN_INT(prototype) \ + prototype; + #else #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} @@ -108,6 +111,9 @@ extern u8 acpi_gbl_disable_ssdt_table_load; #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ static ACPI_INLINE prototype {}
+#define ACPI_HW_DEPENDENT_RETURN_INT(prototype) \ + static ACPI_INLINE prototype {return 0;} + #endif /* !ACPI_REDUCED_HARDWARE */
extern u32 acpi_rsdt_forced;
On 11/09/2013 05:07 PM, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
Remove the saving and restoring of bus master reload registers in suspend/resume when in reduces HW mode; according to the spec, no such registers should exist
Signed-off-by: Al Stone al.stone@linaro.org
drivers/acpi/processor_idle.c | 8 +++++--- include/acpi/acpixf.h | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 587f3cf..0125f54 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -219,15 +219,17 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, #endif
#ifdef CONFIG_PM_SLEEP +#if (!ACPI_REDUCED_HARDWARE) static u32 saved_bm_rld; +#endif
-static int acpi_processor_suspend(void) +ACPI_HW_DEPENDENT_RETURN_INT(int acpi_processor_suspend(void)) { acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); return 0; }
-static void acpi_processor_resume(void) +ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_processor_resume(void)) { u32 resumed_bm_rld;
@@ -617,7 +619,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) case ACPI_STATE_C2: if (!cx->address) break;
cx->valid = 1;
cx->valid = 1; break;
case ACPI_STATE_C3:
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 85bfdbe..3eec2446 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -98,6 +98,9 @@ extern u8 acpi_gbl_disable_ssdt_table_load; #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ prototype;
+#define ACPI_HW_DEPENDENT_RETURN_INT(prototype) \
- prototype;
- #else #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
@@ -108,6 +111,9 @@ extern u8 acpi_gbl_disable_ssdt_table_load; #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ static ACPI_INLINE prototype {}
+#define ACPI_HW_DEPENDENT_RETURN_INT(prototype) \
static ACPI_INLINE prototype {return 0;}
#endif /* !ACPI_REDUCED_HARDWARE */
extern u32 acpi_rsdt_forced;
Hrm. This will not work at all upstream because of the way the macros are presumed to be used. I'll have to redo this back to the prior method. The problem is that the non-HW-reduced macros insist on a ';' in the wrong place; how I got this to compile I'll never know...
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/sleep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 14df305..721e949 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -525,7 +525,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) * generate wakeup events. */ if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) { - acpi_event_status pwr_btn_status; + acpi_event_status pwr_btn_status = ACPI_EVENT_FLAG_DISABLED;
acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status);
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/bus.c | 3 ++- drivers/acpi/osl.c | 10 ++++++---- drivers/acpi/pci_link.c | 14 ++++++++------ 3 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 439c369..7fcbc6a 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -543,7 +543,8 @@ void __init acpi_early_init(void) goto error0; }
-#ifdef CONFIG_X86 +#if (!CONFIG_ACPI_REDUCED_HARDWARE) + /* NB: in HW reduced mode, FADT sci_interrupt has no meaning */ if (!acpi_ioapic) { /* compatible (0) means level (3) */ if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) { diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 34beeba..75da583 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -85,6 +85,7 @@ static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
static acpi_osd_handler acpi_irq_handler; static void *acpi_irq_context; +static u32 acpi_irq_number; static struct workqueue_struct *kacpid_wq; static struct workqueue_struct *kacpi_notify_wq; static struct workqueue_struct *kacpi_hotplug_wq; @@ -841,9 +842,9 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
/* * ACPI interrupts different from the SCI in our copy of the FADT are - * not supported. + * not supported, except in HW reduced mode. */ - if (gsi != acpi_gbl_FADT.sci_interrupt) + if (!acpi_gbl_reduced_hardware && (gsi != acpi_gbl_FADT.sci_interrupt)) return AE_BAD_PARAMETER;
if (acpi_irq_handler) @@ -862,13 +863,14 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, acpi_irq_handler = NULL; return AE_NOT_ACQUIRED; } + acpi_irq_number = irq;
return AE_OK; }
acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) { - if (irq != acpi_gbl_FADT.sci_interrupt) + if (!acpi_gbl_reduced_hardware && (irq != acpi_gbl_FADT.sci_interrupt)) return AE_BAD_PARAMETER;
free_irq(irq, acpi_irq); @@ -1845,7 +1847,7 @@ acpi_status __init acpi_os_initialize1(void) acpi_status acpi_os_terminate(void) { if (acpi_irq_handler) { - acpi_os_remove_interrupt_handler(acpi_gbl_FADT.sci_interrupt, + acpi_os_remove_interrupt_handler(acpi_irq_number, acpi_irq_handler); }
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 2652a61..c0ab28a 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -23,7 +23,7 @@ * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * TBD: + * TBD: * 1. Support more than one IRQ resource entry per link device (index). * 2. Implement start/stop mechanism and use ACPI Bus Driver facilities * for IRQ management (e.g. start()->_SRS). @@ -268,8 +268,8 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) } }
- /* - * Query and parse _CRS to get the current IRQ assignment. + /* + * Query and parse _CRS to get the current IRQ assignment. */
status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS, @@ -415,7 +415,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* * "acpi_irq_balance" (default in APIC mode) enables ACPI to use PIC Interrupt * Link Devices to move the PIRQs around to minimize sharing. - * + * * "acpi_irq_nobalance" (default in PIC mode) tells ACPI not to move any PIC IRQs * that the BIOS has already set to active. This is necessary because * ACPI has no automatic means of knowing what ISA IRQs are used. Note that @@ -433,7 +433,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) * * Note that PCI IRQ routers have a list of possible IRQs, * which may not include the IRQs this table says are available. - * + * * Since this heuristic can't tell the difference between a link * that no device will attach to, vs. a link which may be shared * by multiple active devices -- it is not optimal. @@ -505,7 +505,9 @@ int __init acpi_irq_penalty_init(void) } } /* Add a penalty for the SCI */ - acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING; + if (!acpi_gbl_reduced_hardware) + acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += + PIRQ_PENALTY_PCI_USING; return 0; }
From: Al Stone ahs3@redhat.com
Corrected #ifdef so that DMI is not used on ARM platforms.
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 7fcbc6a..5e55b53 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -512,9 +512,9 @@ void __init acpi_early_init(void)
acpi_gbl_permanent_mmap = 1;
-#ifdef CONFIG_X86 +#if (CONFIG_ARM || CONFIG_ARM64) /* - * NB: ARM does not use DMI; only older Intel products do. + * NB: ARM does not use DMI at present. * * If the machine falls into the DMI check table, * DSDT will be copied to memory
On 11/09/2013 05:07 PM, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
Corrected #ifdef so that DMI is not used on ARM platforms.
Signed-off-by: Al Stone al.stone@linaro.org
drivers/acpi/bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 7fcbc6a..5e55b53 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -512,9 +512,9 @@ void __init acpi_early_init(void)
acpi_gbl_permanent_mmap = 1;
-#ifdef CONFIG_X86 +#if (CONFIG_ARM || CONFIG_ARM64) /*
* NB: ARM does not use DMI; only older Intel products do.
* NB: ARM does not use DMI at present.
- If the machine falls into the DMI check table,
- DSDT will be copied to memory
Whups. The if logic is backwards. And wrong. It should be:
#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64))
From: Al Stone ahs3@redhat.com
In acpi_os_terminate(), it was assumed that several FADT entries were mapped into memory. For HW reduced mode, that will not be the case.
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/osl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 75da583..8f4956d 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1851,10 +1851,12 @@ acpi_status acpi_os_terminate(void) acpi_irq_handler); }
- acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe1_block); - acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe0_block); - acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1b_event_block); - acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1a_event_block); + if (!acpi_gbl_reduced_hardware) { + acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe1_block); + acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe0_block); + acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1b_event_block); + acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1a_event_block); + }
destroy_workqueue(kacpid_wq); destroy_workqueue(kacpi_notify_wq);
From: Al Stone ahs3@redhat.com
Since some of the FADT fields reserved are not to be used by the OSPM, do not map in the memory areas that the FADT fields reference.
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/osl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8f4956d..0912066 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -161,6 +161,9 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported) return supported; }
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE +static int __init acpi_reserve_resources(void) { return 0; } +#else static void __init acpi_request_region (struct acpi_generic_address *gas, unsigned int length, char *desc) { @@ -210,6 +213,7 @@ static int __init acpi_reserve_resources(void)
return 0; } +#endif device_initcall(acpi_reserve_resources);
void acpi_os_printf(const char *fmt, ...) @@ -1821,6 +1825,9 @@ static int __init acpi_no_auto_ssdt_setup(char *s)
__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE +acpi_status __init acpi_os_initialize(void) { return AE_OK; } +#else acpi_status __init acpi_os_initialize(void) { acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block); @@ -1830,6 +1837,7 @@ acpi_status __init acpi_os_initialize(void)
return AE_OK; } +#endif
acpi_status __init acpi_os_initialize1(void) {
From: Al Stone ahs3@redhat.com
Make sure we are not in HW reduced mode when we rely on the the P_LVL2_LAT or P_LVL3_LAT (c2_latency, c3_latency) values from the FADT.
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/processor_idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 0125f54..55788c5 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -652,7 +652,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) memset(pr->power.states, 0, sizeof(pr->power.states));
result = acpi_processor_get_power_info_cst(pr); - if (result == -ENODEV) + if (!acpi_gbl_reduced_hardware && (result == -ENODEV)) result = acpi_processor_get_power_info_fadt(pr);
if (result)
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/processor_throttling.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index e7dd2c1..200738e 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -942,6 +942,10 @@ static int acpi_processor_get_fadt_info(struct acpi_processor *pr) return -EINVAL; }
+ /* + * NB: in HW reduced mode, duty_width is always zero + * so this count may not be what is wanted. + */ pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
/* @@ -991,6 +995,10 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, /* Used to clear all duty_value bits */ duty_mask = pr->throttling.state_count - 1;
+ /* + * NB: in HW reduced mode, duty_offset is always zero + * so this mask may not be what is wanted. + */ duty_mask <<= acpi_gbl_FADT.duty_offset; duty_mask = ~duty_mask; }
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/processor_idle.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 55788c5..6ff9b57 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -298,7 +298,8 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) * Check for P_LVL2_UP flag before entering C2 and above on * an SMP system. */ - if ((num_online_cpus() > 1) && + if (!acpi_gbl_reduced_hardware && + (num_online_cpus() > 1) && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) return -ENODEV; #endif @@ -997,7 +998,8 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, continue;
#ifdef CONFIG_HOTPLUG_CPU - if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && + if (!acpi_gbl_reduced_hardware && + (cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) continue; @@ -1052,7 +1054,8 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) continue;
#ifdef CONFIG_HOTPLUG_CPU - if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && + if (!acpi_gbl_reduced_hardware && + (cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) continue;
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/acpica/utxface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 03a211e..ab55195 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c @@ -186,7 +186,8 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
/* Timer resolution - 24 or 32 bits */
- if (acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) { + if (!acpi_gbl_reduced_hardware && + (acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER)) { info_ptr->timer_resolution = 24; } else { info_ptr->timer_resolution = 32;
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org --- drivers/acpi/bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5e55b53..9215cc6 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -512,7 +512,7 @@ void __init acpi_early_init(void)
acpi_gbl_permanent_mmap = 1;
-#if (CONFIG_ARM || CONFIG_ARM64) +#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) /* * NB: ARM does not use DMI at present. * @@ -543,7 +543,7 @@ void __init acpi_early_init(void) goto error0; }
-#if (!CONFIG_ACPI_REDUCED_HARDWARE) +#if !(defined(CONFIG_ARM) || defined(CONFIG_ARM64)) && (!ACPI_REDUCED_HARDWARE) /* NB: in HW reduced mode, FADT sci_interrupt has no meaning */ if (!acpi_ioapic) { /* compatible (0) means level (3) */
From: Al Stone ahs3@redhat.com
This patch is dependent on the CONFIG_ACPI_REDUCED_HARDWARE patch already being in place.
Signed-off-by: Al Stone al.stone@linaro.org --- arch/arm/include/asm/acpi.h | 3 ++- arch/arm64/include/asm/acpi.h | 3 ++- drivers/acpi/plat/arm/boot.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/acpi.h b/arch/arm/include/asm/acpi.h index ca7efaa..cf67b09 100644 --- a/arch/arm/include/asm/acpi.h +++ b/arch/arm/include/asm/acpi.h @@ -82,6 +82,7 @@ /* Blob handling macros */ #define ACPI_BLOB_HEADER_SIZE 8
+#ifndef CONFIG_ACPI_REDUCED_HARDWARE int __acpi_acquire_global_lock(unsigned int *lock); int __acpi_release_global_lock(unsigned int *lock);
@@ -90,9 +91,9 @@ int __acpi_release_global_lock(unsigned int *lock);
#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ ((Acq) = __acpi_release_global_lock(&facs->global_lock)) +#endif
/* Basic configuration for ACPI */ -/* BOZO: hardware reduced acpi only? */ #ifdef CONFIG_ACPI extern int acpi_disabled; extern int acpi_noirq; diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index a19b73f..bb9411f 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -60,6 +60,7 @@ /* Blob handling macros */ #define ACPI_BLOB_HEADER_SIZE 8
+#ifndef CONFIG_ACPI_REDUCED_HARDWARE int __acpi_acquire_global_lock(unsigned int *lock); int __acpi_release_global_lock(unsigned int *lock);
@@ -68,9 +69,9 @@ int __acpi_release_global_lock(unsigned int *lock);
#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ ((Acq) = __acpi_release_global_lock(&facs->global_lock)) +#endif
/* Basic configuration for ACPI */ -/* BOZO: hardware reduced acpi only? */ #ifdef CONFIG_ACPI extern int acpi_disabled; extern int acpi_noirq; diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index 4fcdd9f..1a6d225 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -786,6 +786,7 @@ static int __init parse_acpi(char *arg) } early_param("acpi", parse_acpi);
+#if (!ACPI_REDUCED_HARDWARE) int __acpi_acquire_global_lock(unsigned int *lock) { unsigned int old, new, val; @@ -807,3 +808,4 @@ int __acpi_release_global_lock(unsigned int *lock) } while (unlikely (val != old)); return old & 0x1; } +#endif
On 11/09/2013 05:08 PM, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
This patch is dependent on the CONFIG_ACPI_REDUCED_HARDWARE patch already being in place.
Signed-off-by: Al Stone al.stone@linaro.org
arch/arm/include/asm/acpi.h | 3 ++- arch/arm64/include/asm/acpi.h | 3 ++- drivers/acpi/plat/arm/boot.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/acpi.h b/arch/arm/include/asm/acpi.h index ca7efaa..cf67b09 100644 --- a/arch/arm/include/asm/acpi.h +++ b/arch/arm/include/asm/acpi.h @@ -82,6 +82,7 @@ /* Blob handling macros */ #define ACPI_BLOB_HEADER_SIZE 8
+#ifndef CONFIG_ACPI_REDUCED_HARDWARE int __acpi_acquire_global_lock(unsigned int *lock); int __acpi_release_global_lock(unsigned int *lock);
@@ -90,9 +91,9 @@ int __acpi_release_global_lock(unsigned int *lock);
#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ ((Acq) = __acpi_release_global_lock(&facs->global_lock)) +#endif
/* Basic configuration for ACPI */ -/* BOZO: hardware reduced acpi only? */ #ifdef CONFIG_ACPI extern int acpi_disabled; extern int acpi_noirq; diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index a19b73f..bb9411f 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -60,6 +60,7 @@ /* Blob handling macros */ #define ACPI_BLOB_HEADER_SIZE 8
+#ifndef CONFIG_ACPI_REDUCED_HARDWARE int __acpi_acquire_global_lock(unsigned int *lock); int __acpi_release_global_lock(unsigned int *lock);
@@ -68,9 +69,9 @@ int __acpi_release_global_lock(unsigned int *lock);
#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ ((Acq) = __acpi_release_global_lock(&facs->global_lock)) +#endif
/* Basic configuration for ACPI */ -/* BOZO: hardware reduced acpi only? */ #ifdef CONFIG_ACPI extern int acpi_disabled; extern int acpi_noirq; diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index 4fcdd9f..1a6d225 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -786,6 +786,7 @@ static int __init parse_acpi(char *arg) } early_param("acpi", parse_acpi);
+#if (!ACPI_REDUCED_HARDWARE) int __acpi_acquire_global_lock(unsigned int *lock) { unsigned int old, new, val; @@ -807,3 +808,4 @@ int __acpi_release_global_lock(unsigned int *lock) } while (unlikely (val != old)); return old & 0x1; } +#endif
Note that this patch is not needed upstream until we get all the ARM ACPI infrastructure submitted also.