Skip to content

Commit

Permalink
Merge tag 'acpi-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "These fix a frequency limit issue in the ACPI processor performance
  library code, fix a few issues in the ACPICA code, improve Crystal
  Cove support in the ACPI PMIC driver, fix string handling in the ACPI
  battery driver, add IRQ override quirks for a few machines more, fix
  other assorted problems and clean up code and documentation.

  Specifics:

   - Drop port I/O validation for some regions to avoid AML failures due
     to rejections of legitimate port I/O writes (Mario Limonciello)

   - Constify acpi_get_handle() pathname argument to allow its callers
     to pass const pathnames to it (Sakari Ailus)

   - Prevent acpi_ns_simple_repair() from crashing in some cases when
     AE_AML_NO_RETURN_VALUE should be returned (Daniil Tatianin)

   - Fix typo in CDAT DSMAS struct definition (Lukas Wunner)

   - Drop an unnecessary (void *) conversion from the ACPI processor
     driver (Zhou jie)

   - Modify the ACPI processor performance library code to use the "no
     limit" frequency QoS as appropriate and adjust the intel_pstate
     driver accordingly (Rafael Wysocki)

   - Add support for NBFT to the ACPI table parser (Stuart Hayes)

   - Introduce list of known non-PNP devices to avoid enumerating some
     of them as PNP devices (Rafael Wysocki)

   - Add x86 ACPI paths to the ACPI entry in MAINTAINERS to allow
     scripts to report the actual maintainers information (Rafael
     Wysocki)

   - Add two more entries to the ACPI IRQ override quirk list (Adam
     Niederer, Werner Sembach)

   - Add a pmic_i2c_address entry for Intel Bay Trail Crystal Cove to
     allow intel_soc_pmic_exec_mipi_pmic_seq_element() to be used with
     the Bay Trail Crystal Cove PMIC OpRegion driver (Hans de Goede)

   - Add comments with DSDT power OpRegion field names to the ACPI PMIC
     driver (Hans de Goede)

   - Fix string termination handling in the ACPI battery driver (Armin
     Wolf)

   - Limit error type to 32-bit width in the ACPI APEI error injection
     code (Shuai Xue)

   - Fix Lenovo Ideapad Z570 DMI match in the ACPI backlight driver
     (Hans de Goede)

   - Silence missing prototype warnings in some places in the
     ACPI-related code (Ammar Faizi)

   - Make kobj_type structures used in the ACPI code constant (Thomas
     Weißschuh)

   - Correct spelling in firmware-guide/ACPI (Randy Dunlap)

   - Clarify the meaning of Explicit and Implicit in the _DSD GPIO
     properties documentation (Andy Shevchenko)

   - Fix some kernel-doc comments in the ACPI CPPC library code (Yang
     Li)"

* tag 'acpi-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (25 commits)
  ACPI: make kobj_type structures constant
  Documentation: firmware-guide: gpio-properties: Clarify Explicit and Implicit
  ACPICA: Fix typo in CDAT DSMAS struct definition
  ACPI: resource: Do IRQ override on all TongFang GMxRGxx
  ACPI: resource: Add IRQ overrides for MAINGEAR Vector Pro 2 models
  ACPI: CPPC: Fix some kernel-doc comments
  ACPI: video: Fix Lenovo Ideapad Z570 DMI match
  Documentation: firmware-guide/ACPI: correct spelling
  ACPI: PMIC: Add comments with DSDT power opregion field names
  ACPI: battery: Increase maximum string length
  ACPI: battery: Fix buffer overread if not NUL-terminated
  ACPI: APEI: EINJ: Limit error type to 32-bit width
  MAINTAINERS: Add x86 ACPI paths to the ACPI entry
  ACPI: battery: Fix missing NUL-termination with large strings
  ACPI: PNP: Introduce list of known non-PNP devices
  ACPICA: nsrepair: handle cases without a return value correctly
  ACPI: Silence missing prototype warnings
  cpufreq: intel_pstate: Drop ACPI _PSS states table patching
  ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily
  ACPI: processor: perflib: Use the "no limit" frequency QoS
  ...
  • Loading branch information
Linus Torvalds committed Feb 21, 2023
2 parents 2504ba8 + f32309c commit 88af9b1
Show file tree
Hide file tree
Showing 25 changed files with 163 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Documentation/firmware-guide/acpi/acpi-lid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ state upon the last _LID evaluation. There won't be difference when the
_LID control method is evaluated during the runtime, the problem is its
initial returning value. When the AML tables implement this control method
with cached value, the initial returning value is likely not reliable.
There are platforms always retun "closed" as initial lid state.
There are platforms always return "closed" as initial lid state.

Restrictions of the lid state change notifications
==================================================
Expand Down
35 changes: 24 additions & 11 deletions Documentation/firmware-guide/acpi/gpio-properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,30 @@ state of the output pin which driver should use during its initialization.
Linux tries to use common sense here and derives the state from the bias
and polarity settings. The table below shows the expectations:

========= ============= ==============
Pull Bias Polarity Requested...
========= ============= ==============
Implicit x AS IS (assumed firmware configured for us)
Explicit x (no _DSD) as Pull Bias (Up == High, Down == Low),
assuming non-active (Polarity = !Pull Bias)
Down Low as low, assuming active
Down High as low, assuming non-active
Up Low as high, assuming non-active
Up High as high, assuming active
========= ============= ==============
+-------------+-------------+-----------------------------------------------+
| Pull Bias | Polarity | Requested... |
+=============+=============+===============================================+
| Implicit |
+-------------+-------------+-----------------------------------------------+
| **Default** | x | AS IS (assumed firmware configured it for us) |
+-------------+-------------+-----------------------------------------------+
| Explicit |
+-------------+-------------+-----------------------------------------------+
| **None** | x | AS IS (assumed firmware configured it for us) |
| | | with no Pull Bias |
+-------------+-------------+-----------------------------------------------+
| **Up** | x (no _DSD) | |
| +-------------+ as high, assuming non-active |
| | Low | |
| +-------------+-----------------------------------------------+
| | High | as high, assuming active |
+-------------+-------------+-----------------------------------------------+
| **Down** | x (no _DSD) | |
| +-------------+ as low, assuming non-active |
| | High | |
| +-------------+-----------------------------------------------+
| | Low | as low, assuming active |
+-------------+-------------+-----------------------------------------------+

That said, for our above example the both GPIOs, since the bias setting
is explicit and _DSD is present, will be treated as active with a high
Expand Down
2 changes: 1 addition & 1 deletion Documentation/firmware-guide/acpi/namespace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Description Table). The XSDT always points to the FADT (Fixed ACPI
Description Table) using its first entry, the data within the FADT
includes various fixed-length entries that describe fixed ACPI features
of the hardware. The FADT contains a pointer to the DSDT
(Differentiated System Descripition Table). The XSDT also contains
(Differentiated System Description Table). The XSDT also contains
entries pointing to possibly multiple SSDTs (Secondary System
Description Table).

Expand Down
5 changes: 4 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
F: Documentation/ABI/testing/configfs-acpi
F: Documentation/ABI/testing/sysfs-bus-acpi
F: Documentation/firmware-guide/acpi/
F: arch/x86/kernel/acpi/
F: arch/x86/pci/acpi.c
F: drivers/acpi/
F: drivers/pci/*/*acpi*
F: drivers/pci/*acpi*
Expand Down Expand Up @@ -19918,7 +19920,8 @@ L: linux-pm@vger.kernel.org
S: Supported
B: https://bugzilla.kernel.org
F: Documentation/power/
F: arch/x86/kernel/acpi/
F: arch/x86/kernel/acpi/sleep*
F: arch/x86/kernel/acpi/wakeup*
F: drivers/base/power/
F: include/linux/freezer.h
F: include/linux/pm.h
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/acpi_lpit.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/acpi.h>
#include <asm/msr.h>
#include <asm/tsc.h>
#include "internal.h"

struct lpit_residency_info {
struct acpi_generic_address gaddr;
Expand Down
14 changes: 13 additions & 1 deletion drivers/acpi/acpi_pnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,22 @@ static bool acpi_pnp_match(const char *idstr, const struct acpi_device_id **matc
return false;
}

/*
* If one of the device IDs below is present in the list of device IDs of a
* given ACPI device object, the PNP scan handler will not attach to that
* object, because there is a proper non-PNP driver in the kernel for the
* device represented by it.
*/
static const struct acpi_device_id acpi_nonpnp_device_ids[] = {
{"INTC1080"},
{"INTC1081"},
{""},
};

static int acpi_pnp_attach(struct acpi_device *adev,
const struct acpi_device_id *id)
{
return 1;
return !!acpi_match_device_ids(adev, acpi_nonpnp_device_ids);
}

static struct acpi_scan_handler acpi_pnp_handler = {
Expand Down
7 changes: 4 additions & 3 deletions drivers/acpi/acpica/hwvalid.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width);
*
* The table is used to implement the Microsoft port access rules that
* first appeared in Windows XP. Some ports are always illegal, and some
* ports are only illegal if the BIOS calls _OSI with a win_XP string or
* later (meaning that the BIOS itelf is post-XP.)
* ports are only illegal if the BIOS calls _OSI with nothing newer than
* the specific _OSI strings.
*
* This provides ACPICA with the desired port protections and
* Microsoft compatibility.
Expand Down Expand Up @@ -145,7 +145,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)

/* Port illegality may depend on the _OSI calls made by the BIOS */

if (acpi_gbl_osi_data >= port_info->osi_dependency) {
if (port_info->osi_dependency == ACPI_ALWAYS_ILLEGAL ||
acpi_gbl_osi_data == port_info->osi_dependency) {
ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
"Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n",
ACPI_FORMAT_UINT64(address),
Expand Down
12 changes: 7 additions & 5 deletions drivers/acpi/acpica/nsrepair.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ acpi_ns_simple_repair(struct acpi_evaluate_info *info,
* Try to fix if there was no return object. Warning if failed to fix.
*/
if (!return_object) {
if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) {
if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
if (expected_btypes) {
if (!(expected_btypes & ACPI_RTYPE_NONE) &&
package_index != ACPI_NOT_PACKAGE_ELEMENT) {
ACPI_WARN_PREDEFINED((AE_INFO,
info->full_pathname,
ACPI_WARN_ALWAYS,
Expand All @@ -196,14 +197,15 @@ acpi_ns_simple_repair(struct acpi_evaluate_info *info,
if (ACPI_SUCCESS(status)) {
return (AE_OK); /* Repair was successful */
}
} else {
}

if (expected_btypes != ACPI_RTYPE_NONE) {
ACPI_WARN_PREDEFINED((AE_INFO,
info->full_pathname,
ACPI_WARN_ALWAYS,
"Missing expected return value"));
return (AE_AML_NO_RETURN_VALUE);
}

return (AE_AML_NO_RETURN_VALUE);
}
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/nsxfname.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,

acpi_status
acpi_get_handle(acpi_handle parent,
acpi_string pathname, acpi_handle *ret_handle)
const char *pathname, acpi_handle *ret_handle)
{
acpi_status status;
struct acpi_namespace_node *node = NULL;
Expand Down
4 changes: 4 additions & 0 deletions drivers/acpi/apei/einj.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ static int error_type_set(void *data, u64 val)
u32 available_error_type = 0;
u32 tval, vendor;

/* Only low 32 bits for error type are valid */
if (val & GENMASK_ULL(63, 32))
return -EINVAL;

/*
* Vendor defined types have 0x80000000 bit set, and
* are not enumerated by ACPI_EINJ_GET_ERROR_TYPE
Expand Down
35 changes: 23 additions & 12 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#define ACPI_BATTERY_STATE_CHARGING 0x2
#define ACPI_BATTERY_STATE_CRITICAL 0x4

#define MAX_STRING_LENGTH 64

MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
MODULE_DESCRIPTION("ACPI Battery Driver");
Expand Down Expand Up @@ -118,10 +120,10 @@ struct acpi_battery {
int capacity_granularity_1;
int capacity_granularity_2;
int alarm;
char model_number[32];
char serial_number[32];
char type[32];
char oem_info[32];
char model_number[MAX_STRING_LENGTH];
char serial_number[MAX_STRING_LENGTH];
char type[MAX_STRING_LENGTH];
char oem_info[MAX_STRING_LENGTH];
int state;
int power_unit;
unsigned long flags;
Expand Down Expand Up @@ -437,16 +439,25 @@ static int extract_package(struct acpi_battery *battery,
element = &package->package.elements[i];
if (offsets[i].mode) {
u8 *ptr = (u8 *)battery + offsets[i].offset;
u32 len = MAX_STRING_LENGTH;

switch (element->type) {
case ACPI_TYPE_BUFFER:
if (len > element->buffer.length + 1)
len = element->buffer.length + 1;

fallthrough;
case ACPI_TYPE_STRING:
strscpy(ptr, element->string.pointer, len);

if (element->type == ACPI_TYPE_STRING ||
element->type == ACPI_TYPE_BUFFER)
strncpy(ptr, element->string.pointer, 32);
else if (element->type == ACPI_TYPE_INTEGER) {
strncpy(ptr, (u8 *)&element->integer.value,
sizeof(u64));
ptr[sizeof(u64)] = 0;
} else
break;
case ACPI_TYPE_INTEGER:
strscpy(ptr, (u8 *)&element->integer.value, sizeof(u64) + 1);

break;
default:
*ptr = 0; /* don't have value */
}
} else {
int *x = (int *)((u8 *)battery + offsets[i].offset);
*x = (element->type == ACPI_TYPE_INTEGER) ?
Expand Down
4 changes: 3 additions & 1 deletion drivers/acpi/cppc_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static struct attribute *cppc_attrs[] = {
};
ATTRIBUTE_GROUPS(cppc);

static struct kobj_type cppc_ktype = {
static const struct kobj_type cppc_ktype = {
.sysfs_ops = &kobj_sysfs_ops,
.default_groups = cppc_groups,
};
Expand Down Expand Up @@ -595,6 +595,7 @@ bool __weak cpc_supported_by_cpu(void)

/**
* pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace
* @pcc_ss_id: PCC Subspace index as in the PCC client ACPI package.
*
* Check and allocate the cppc_pcc_data memory.
* In some processor configurations it is possible that same subspace
Expand Down Expand Up @@ -1603,6 +1604,7 @@ EXPORT_SYMBOL_GPL(cppc_set_perf);

/**
* cppc_get_transition_latency - returns frequency transition latency in ns
* @cpu_num: CPU number for per_cpu().
*
* ACPI CPPC does not explicitly specify how a platform can specify the
* transition latency for performance change requests. The closest we have
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/device_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void acpi_data_node_release(struct kobject *kobj)
complete(&dn->kobj_done);
}

static struct kobj_type acpi_data_node_ktype = {
static const struct kobj_type acpi_data_node_ktype = {
.sysfs_ops = &acpi_data_node_sysfs_ops,
.default_groups = acpi_data_node_default_groups,
.release = acpi_data_node_release,
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/ioapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/acpi.h>
#include <linux/pci.h>
#include <acpi/acpi.h>
#include "internal.h"

struct acpi_pci_ioapic {
acpi_handle root_handle;
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/pmic/intel_pmic_bytcrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
.power_table_count= ARRAY_SIZE(power_table),
.thermal_table = thermal_table,
.thermal_table_count = ARRAY_SIZE(thermal_table),
.pmic_i2c_address = 0x6e,
};

static int intel_crc_pmic_opregion_probe(struct platform_device *pdev)
Expand Down
26 changes: 13 additions & 13 deletions drivers/acpi/pmic/intel_pmic_chtdc_ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
#define CHTDC_TI_GPADC 0x5a

static struct pmic_table chtdc_ti_power_table[] = {
{ .address = 0x00, .reg = 0x41 },
{ .address = 0x04, .reg = 0x42 },
{ .address = 0x08, .reg = 0x43 },
{ .address = 0x0c, .reg = 0x45 },
{ .address = 0x10, .reg = 0x46 },
{ .address = 0x14, .reg = 0x47 },
{ .address = 0x18, .reg = 0x48 },
{ .address = 0x1c, .reg = 0x49 },
{ .address = 0x20, .reg = 0x4a },
{ .address = 0x24, .reg = 0x4b },
{ .address = 0x28, .reg = 0x4c },
{ .address = 0x2c, .reg = 0x4d },
{ .address = 0x30, .reg = 0x4e },
{ .address = 0x00, .reg = 0x41 }, /* LDO1 */
{ .address = 0x04, .reg = 0x42 }, /* LDO2 */
{ .address = 0x08, .reg = 0x43 }, /* LDO3 */
{ .address = 0x0c, .reg = 0x45 }, /* LDO5 */
{ .address = 0x10, .reg = 0x46 }, /* LDO6 */
{ .address = 0x14, .reg = 0x47 }, /* LDO7 */
{ .address = 0x18, .reg = 0x48 }, /* LDO8 */
{ .address = 0x1c, .reg = 0x49 }, /* LDO9 */
{ .address = 0x20, .reg = 0x4a }, /* LD10 */
{ .address = 0x24, .reg = 0x4b }, /* LD11 */
{ .address = 0x28, .reg = 0x4c }, /* LD12 */
{ .address = 0x2c, .reg = 0x4d }, /* LD13 */
{ .address = 0x30, .reg = 0x4e }, /* LD14 */
};

static struct pmic_table chtdc_ti_thermal_table[] = {
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr,

static void __lapic_timer_propagate_broadcast(void *arg)
{
struct acpi_processor *pr = (struct acpi_processor *) arg;
struct acpi_processor *pr = arg;

if (pr->power.timer_broadcast_on_state < INT_MAX)
tick_broadcast_enable();
Expand Down
38 changes: 30 additions & 8 deletions drivers/acpi/processor_perflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
{
acpi_status status = 0;
unsigned long long ppc = 0;
s32 qos_value;
int index;
int ret;

if (!pr)
Expand All @@ -72,17 +74,30 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
}
}

index = ppc;

if (pr->performance_platform_limit == index ||
ppc >= pr->performance->state_count)
return 0;

pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
(int)ppc, ppc ? "" : "not");
index, index ? "is" : "is not");

pr->performance_platform_limit = (int)ppc;
pr->performance_platform_limit = index;

if (ppc >= pr->performance->state_count ||
unlikely(!freq_qos_request_active(&pr->perflib_req)))
if (unlikely(!freq_qos_request_active(&pr->perflib_req)))
return 0;

ret = freq_qos_update_request(&pr->perflib_req,
pr->performance->states[ppc].core_frequency * 1000);
/*
* If _PPC returns 0, it means that all of the available states can be
* used ("no limit").
*/
if (index == 0)
qos_value = FREQ_QOS_MAX_DEFAULT_VALUE;
else
qos_value = pr->performance->states[index].core_frequency * 1000;

ret = freq_qos_update_request(&pr->perflib_req, qos_value);
if (ret < 0) {
pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n",
pr->id, ret);
Expand Down Expand Up @@ -166,9 +181,16 @@ void acpi_processor_ppc_init(struct cpufreq_policy *policy)
if (!pr)
continue;

/*
* Reset performance_platform_limit in case there is a stale
* value in it, so as to make it match the "no limit" QoS value
* below.
*/
pr->performance_platform_limit = 0;

ret = freq_qos_add_request(&policy->constraints,
&pr->perflib_req,
FREQ_QOS_MAX, INT_MAX);
&pr->perflib_req, FREQ_QOS_MAX,
FREQ_QOS_MAX_DEFAULT_VALUE);
if (ret < 0)
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret);
Expand Down
Loading

0 comments on commit 88af9b1

Please sign in to comment.