Commit b7fe6bf7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm+acpi-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management fixes from Rafael Wysocki:

 - Fix for a recent regression in the Tegra cpufreq driver causing
   excess error messages to be printed from Stephen Warren

 - ACPI-based device hotplug fix to prevent conflicting notify handlers
   from being installed for PCI host bridge objects.  From Toshi Kani

 - ACPICA update to upstream version 20131115.  This contains bug fixes
   mostly (loop termination fix for the get AML length function, fixes
   related to namespace node removal and debug output).  From Bob Moore,
   Tomasz Nowicki and Lv Zheng

 - Removal of incorrect inclusions of internal ACPICA header files by
   non-ACPICA code from Lv Zheng

 - Fixes for the ACPI sysfs interface exposing tables to user space from
   Daisuke Hatayama and Jeremy Compostella

 - Assorted ACPI and cpufreq cleanups from Sachin Kamat and Al Stone

 - cpupower tool fix and man page from Thomas Renninger

* tag 'pm+acpi-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: Clean up incorrect inclusions of ACPICA headers
  tools: cpupower: fix wrong err msg not supported vs not available
  tools: cpupower: Add cpupower-idle-set(1) manpage
  ACPI / sysfs: Fix incorrect ACPI tables walk in acpi_tables_sysfs_init()
  ACPI / sysfs: Set file size for each exposed ACPI table
  ACPICA: Update version to 20131115.
  ACPICA: Add support to delete all objects attached to the root namespace node.
  ACPICA: Delete all attached data objects during namespace node deletion.
  ACPICA: Resources: Fix loop termination for the get AML length function.
  ACPICA: Tests: Add CHECKSUM_ABORT protection for test utilities.
  ACPICA: Debug output: Do not emit function nesting level for kernel build.
  ACPI / sleep: clean up compiler warning about uninitialized field
  cpufreq: exynos: Remove unwanted EXPORT_SYMBOL
  cpufreq: tegra: don't error target() when suspended
  ACPI / hotplug: Fix conflicted PCI bridge notify handlers
parents 96d5d9d9 b90f7b8a
......@@ -184,7 +184,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
struct acpi_buffer *output_buffer);
acpi_status
acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
struct acpi_buffer *output_buffer);
acpi_status
......@@ -227,8 +227,8 @@ acpi_rs_get_list_length(u8 * aml_buffer,
u32 aml_buffer_length, acpi_size * size_needed);
acpi_status
acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
acpi_size * size_needed);
acpi_rs_get_aml_length(struct acpi_resource *resource_list,
acpi_size resource_list_size, acpi_size * size_needed);
acpi_status
acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
......
......@@ -106,6 +106,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
void acpi_ns_delete_node(struct acpi_namespace_node *node)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *next_desc;
ACPI_FUNCTION_NAME(ns_delete_node);
......@@ -114,12 +115,13 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
acpi_ns_detach_object(node);
/*
* Delete an attached data object if present (an object that was created
* and attached via acpi_attach_data). Note: After any normal object is
* detached above, the only possible remaining object is a data object.
* Delete an attached data object list if present (objects that were
* attached via acpi_attach_data). Note: After any normal object is
* detached above, the only possible remaining object(s) are data
* objects, in a linked list.
*/
obj_desc = node->object;
if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
while (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
/* Invoke the attached data deletion handler if present */
......@@ -127,7 +129,15 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
obj_desc->data.handler(node, obj_desc->data.pointer);
}
next_desc = obj_desc->common.next_object;
acpi_ut_remove_reference(obj_desc);
obj_desc = next_desc;
}
/* Special case for the statically allocated root node */
if (node == acpi_gbl_root_node) {
return;
}
/* Now we can delete the node */
......
......@@ -593,24 +593,26 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
void acpi_ns_terminate(void)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE(ns_terminate);
/*
* 1) Free the entire namespace -- all nodes and objects
*
* Delete all object descriptors attached to namepsace nodes
* Free the entire namespace -- all nodes and all objects
* attached to the nodes
*/
acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
/* Detach any objects attached to the root */
/* Delete any objects attached to the root node */
obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
if (obj_desc) {
acpi_ns_detach_object(acpi_gbl_root_node);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_VOID;
}
acpi_ns_delete_node(acpi_gbl_root_node);
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
return_VOID;
}
......
......@@ -174,6 +174,7 @@ acpi_rs_stream_option_length(u32 resource_length,
* FUNCTION: acpi_rs_get_aml_length
*
* PARAMETERS: resource - Pointer to the resource linked list
* resource_list_size - Size of the resource linked list
* size_needed - Where the required size is returned
*
* RETURN: Status
......@@ -185,16 +186,20 @@ acpi_rs_stream_option_length(u32 resource_length,
******************************************************************************/
acpi_status
acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
acpi_rs_get_aml_length(struct acpi_resource *resource,
acpi_size resource_list_size, acpi_size * size_needed)
{
acpi_size aml_size_needed = 0;
struct acpi_resource *resource_end;
acpi_rs_length total_size;
ACPI_FUNCTION_TRACE(rs_get_aml_length);
/* Traverse entire list of internal resource descriptors */
while (resource) {
resource_end =
ACPI_ADD_PTR(struct acpi_resource, resource, resource_list_size);
while (resource < resource_end) {
/* Validate the descriptor type */
......
......@@ -418,22 +418,21 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
*
* FUNCTION: acpi_rs_create_aml_resources
*
* PARAMETERS: linked_list_buffer - Pointer to the resource linked list
* output_buffer - Pointer to the user's buffer
* PARAMETERS: resource_list - Pointer to the resource list buffer
* output_buffer - Where the AML buffer is returned
*
* RETURN: Status AE_OK if okay, else a valid acpi_status code.
* If the output_buffer is too small, the error will be
* AE_BUFFER_OVERFLOW and output_buffer->Length will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the linked list of device resources and
* creates a bytestream to be used as input for the
* _SRS control method.
* DESCRIPTION: Converts a list of device resources to an AML bytestream
* to be used as input for the _SRS control method.
*
******************************************************************************/
acpi_status
acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
struct acpi_buffer *output_buffer)
{
acpi_status status;
......@@ -441,16 +440,16 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
ACPI_FUNCTION_TRACE(rs_create_aml_resources);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
linked_list_buffer));
/* Params already validated, no need to re-validate here */
/*
* Params already validated, so we don't re-validate here
*
* Pass the linked_list_buffer into a module that calculates
* the buffer size needed for the byte stream.
*/
status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ResourceList Buffer = %p\n",
resource_list->pointer));
/* Get the buffer size needed for the AML byte stream */
status = acpi_rs_get_aml_length(resource_list->pointer,
resource_list->length,
&aml_size_needed);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
(u32)aml_size_needed, acpi_format_exception(status)));
......@@ -467,8 +466,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
/* Do the conversion */
status =
acpi_rs_convert_resources_to_aml(linked_list_buffer,
status = acpi_rs_convert_resources_to_aml(resource_list->pointer,
aml_size_needed,
output_buffer->pointer);
if (ACPI_FAILURE(status)) {
......
......@@ -753,7 +753,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
* Convert the linked list into a byte stream
*/
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer);
status = acpi_rs_create_aml_resources(in_buffer, &buffer);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
......
......@@ -185,6 +185,7 @@ acpi_debug_print(u32 requested_debug_level,
}
acpi_gbl_prev_thread_id = thread_id;
acpi_gbl_nesting_level = 0;
}
/*
......@@ -193,13 +194,21 @@ acpi_debug_print(u32 requested_debug_level,
*/
acpi_os_printf("%9s-%04ld ", module_name, line_number);
#ifdef ACPI_EXEC_APP
/*
* For acpi_exec only, emit the thread ID and nesting level.
* Note: nesting level is really only useful during a single-thread
* execution. Otherwise, multiple threads will keep resetting the
* level.
*/
if (ACPI_LV_THREADS & acpi_dbg_level) {
acpi_os_printf("[%u] ", (u32)thread_id);
}
acpi_os_printf("[%02ld] %-22.22s: ",
acpi_gbl_nesting_level,
acpi_ut_trim_function_name(function_name));
acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level);
#endif
acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
va_start(args, format);
acpi_os_vprintf(format, args);
......@@ -420,7 +429,9 @@ acpi_ut_exit(u32 line_number,
component_id, "%s\n", acpi_gbl_fn_exit_str);
}
if (acpi_gbl_nesting_level) {
acpi_gbl_nesting_level--;
}
}
ACPI_EXPORT_SYMBOL(acpi_ut_exit)
......@@ -467,7 +478,9 @@ acpi_ut_status_exit(u32 line_number,
}
}
if (acpi_gbl_nesting_level) {
acpi_gbl_nesting_level--;
}
}
ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
......@@ -504,7 +517,9 @@ acpi_ut_value_exit(u32 line_number,
ACPI_FORMAT_UINT64(value));
}
if (acpi_gbl_nesting_level) {
acpi_gbl_nesting_level--;
}
}
ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
......@@ -540,7 +555,9 @@ acpi_ut_ptr_exit(u32 line_number,
ptr);
}
if (acpi_gbl_nesting_level) {
acpi_gbl_nesting_level--;
}
}
#endif
......@@ -13,7 +13,6 @@
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/acpi_io.h>
#include <acpi/acpiosxf.h>
/* ACPI NVS regions, APEI may use it */
......
......@@ -65,6 +65,9 @@ static struct acpi_scan_handler pci_root_handler = {
.ids = root_device_ids,
.attach = acpi_pci_root_add,
.detach = acpi_pci_root_remove,
.hotplug = {
.ignore = true,
},
};
static DEFINE_MUTEX(osc_lock);
......
......@@ -1772,7 +1772,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
*/
list_for_each_entry(hwid, &pnp.ids, list) {
handler = acpi_scan_match_handler(hwid->id, NULL);
if (handler) {
if (handler && !handler->hotplug.ignore) {
acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
acpi_hotplug_notify_cb, handler);
break;
......
......@@ -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);
......
......@@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
table_attr->instance);
table_attr->attr.size = 0;
table_attr->attr.size = table_header->length;
table_attr->attr.read = acpi_table_show;
table_attr->attr.attr.name = table_attr->name;
table_attr->attr.attr.mode = 0400;
......@@ -354,8 +354,9 @@ static int acpi_tables_sysfs_init(void)
{
struct acpi_table_attr *table_attr;
struct acpi_table_header *table_header = NULL;
int table_index = 0;
int result;
int table_index;
acpi_status status;
int ret;
tables_kobj = kobject_create_and_add("tables", acpi_kobj);
if (!tables_kobj)
......@@ -365,33 +366,34 @@ static int acpi_tables_sysfs_init(void)
if (!dynamic_tables_kobj)
goto err_dynamic_tables;
do {
result = acpi_get_table_by_index(table_index, &table_header);
if (!result) {
table_index++;
for (table_index = 0;; table_index++) {
status = acpi_get_table_by_index(table_index, &table_header);
if (status == AE_BAD_PARAMETER)
break;
if (ACPI_FAILURE(status))
continue;
table_attr = NULL;
table_attr =
kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
if (!table_attr)
return -ENOMEM;
acpi_table_attr_init(table_attr, table_header);
result =
sysfs_create_bin_file(tables_kobj,
&table_attr->attr);
if (result) {
ret = sysfs_create_bin_file(tables_kobj, &table_attr->attr);
if (ret) {
kfree(table_attr);
return result;
} else
list_add_tail(&table_attr->node,
&acpi_table_attr_list);
return ret;
}
list_add_tail(&table_attr->node, &acpi_table_attr_list);
}
} while (!result);
kobject_uevent(tables_kobj, KOBJ_ADD);
kobject_uevent(dynamic_tables_kobj, KOBJ_ADD);
result = acpi_install_table_handler(acpi_sysfs_table_handler, NULL);
status = acpi_install_table_handler(acpi_sysfs_table_handler, NULL);
return result == AE_OK ? 0 : -EINVAL;
return ACPI_FAILURE(status) ? -EINVAL : 0;
err_dynamic_tables:
kobject_put(tables_kobj);
err:
......
......@@ -157,4 +157,3 @@ int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
pr_debug("%s: failed initialization\n", __func__);
return -EINVAL;
}
EXPORT_SYMBOL(exynos4210_cpufreq_init);
......@@ -211,4 +211,3 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
pr_debug("%s: failed initialization\n", __func__);
return -EINVAL;
}
EXPORT_SYMBOL(exynos4x12_cpufreq_init);
......@@ -236,4 +236,3 @@ int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
pr_err("%s: failed initialization\n", __func__);
return -EINVAL;
}
EXPORT_SYMBOL(exynos5250_cpufreq_init);
......@@ -142,10 +142,8 @@ static int tegra_target(struct cpufreq_policy *policy, unsigned int index)
mutex_lock(&tegra_cpu_lock);
if (is_suspended) {
ret = -EBUSY;
if (is_suspended)
goto out;
}
freq = freq_table[index].frequency;
......
......@@ -18,7 +18,6 @@
#include <linux/err.h>
#include <acpi/acpi.h>
#include <acpi/acpixf.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_bus.h>
......
......@@ -83,7 +83,9 @@
* Should the subsystem abort the loading of an ACPI table if the
* table checksum is incorrect?
*/
#ifndef ACPI_CHECKSUM_ABORT
#define ACPI_CHECKSUM_ABORT FALSE
#endif
/*
* Generate a version of ACPICA that only supports "reduced hardware"
......
......@@ -100,6 +100,7 @@ enum acpi_hotplug_mode {
struct acpi_hotplug_profile {
struct kobject kobj;
bool enabled:1;
bool ignore:1;
enum acpi_hotplug_mode mode;
};
......
......@@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20130927
#define ACPI_CA_VERSION 0x20131115
#include <acpi/acconfig.h>
#include <acpi/actypes.h>
......
......@@ -87,4 +87,5 @@ Thomas Renninger <trenn@suse.de>
.fi
.SH "SEE ALSO"
.LP
cpupower(1), cpupower\-monitor(1), cpupower\-info(1), cpupower\-set(1)
cpupower(1), cpupower\-monitor(1), cpupower\-info(1), cpupower\-set(1),
cpupower\-idle\-set(1)
.TH "CPUPOWER-IDLE-SET" "1" "0.1" "" "cpupower Manual"
.SH "NAME"
.LP
cpupower idle\-set \- Utility to set cpu idle state specific kernel options
.SH "SYNTAX"
.LP
cpupower [ \-c cpulist ] idle\-info [\fIoptions\fP]
.SH "DESCRIPTION"
.LP
The cpupower idle\-set subcommand allows to set cpu idle, also called cpu
sleep state, specific options offered by the kernel. One example is disabling
sleep states. This can be handy for power vs performance tuning.
.SH "OPTIONS"
.LP
.TP
\fB\-d\fR \fB\-\-disable\fR
Disable a specific processor sleep state.
.TP
\fB\-e\fR \fB\-\-enable\fR
Enable a specific processor sleep state.
.SH "REMARKS"
.LP
Cpuidle Governors Policy on Disabling Sleep States
.RS 4
Depending on the used cpuidle governor, implementing the kernel policy
how to choose sleep states, subsequent sleep states on this core, might get
disabled as well.
There are two cpuidle governors ladder and menu. While the ladder
governor is always available, if CONFIG_CPU_IDLE is selected, the
menu governor additionally requires CONFIG_NO_HZ.
The behavior and the effect of the disable variable depends on the
implementation of a particular governor. In the ladder governor, for
example, it is not coherent, i.e. if one is disabling a light state,
then all deeper states are disabled as well. Likewise, if one enables a
deep state but a lighter state still is disabled, then this has no effect.
.RE
.LP
Disabling the Lightest Sleep State may not have any Affect
.RS 4
If criteria are not met to enter deeper sleep states and the lightest sleep
state is chosen when idle, the kernel may still enter this sleep state,
irrespective of whether it is disabled or not. This is also reflected in
the usage count of the disabled sleep state when using the cpupower idle-info
command.
.RE
.LP
Selecting specific CPU Cores
.RS 4
By default processor sleep states of all CPU cores are set. Please refer
to the cpupower(1) manpage in the \-\-cpu option section how to disable
C-states of specific cores.
.RE
.SH "FILES"
.nf
\fI/sys/devices/system/cpu/cpu*/cpuidle/state*\fP
\fI/sys/devices/system/cpu/cpuidle/*\fP
.fi
.SH "AUTHORS"
.nf
Thomas Renninger <trenn@suse.de>
.fi
.SH "SEE ALSO"
.LP
cpupower(1), cpupower\-monitor(1), cpupower\-info(1), cpupower\-set(1),
cpupower\-idle\-info(1)
......@@ -278,7 +278,7 @@ static char *sysfs_idlestate_get_one_string(unsigned int cpu,
int sysfs_is_idlestate_disabled(unsigned int cpu,
unsigned int idlestate)
{
if (sysfs_get_idlestate_count(cpu) < idlestate)
if (sysfs_get_idlestate_count(cpu) <= idlestate)
return -1;
if (!sysfs_idlestate_file_exists(cpu, idlestate,
......@@ -303,7 +303,7 @@ int sysfs_idlestate_disable(unsigned int cpu,
char value[SYSFS_PATH_MAX];
int bytes_written;
if (sysfs_get_idlestate_count(cpu) < idlestate)
if (sysfs_get_idlestate_count(cpu) <= idlestate)
return -1;
if (!sysfs_idlestate_file_exists(cpu, idlestate,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment