Skip to content

Commit 64f9111

Browse files
committed
Merge branches 'acpi-ec', 'acpi-apei', 'acpi-soc' and 'acpi-misc'
* acpi-ec: ACPI: EC: trust DSDT GPE for certain HP laptop ACPI: EC: Make more Asus laptops use ECDT _GPE * acpi-apei: ACPI: APEI: fix synchronous external aborts in user-mode ACPI: APEI: Don't warn if ACPI is disabled * acpi-soc: ACPI: LPSS: Use kstrtol() instead of simple_strtol() * acpi-misc: ACPI: NVS: fix doc warnings in nvs.c ACPI: NUMA: fix typo in a comment ACPI: OSL: Use DEFINE_RES_IO_NAMED() to simplify code ACPI: bus: Call kobject_put() in acpi_init() error path ACPI: bus: Remove unneeded assignment ACPI: configfs: Replace ACPI_INFO() with pr_debug() ACPI: ipmi: Remove address space handler in error path ACPI: event: Remove redundant initialization of local variable ACPI: sbshc: Fix fall-through warning for Clang
5 parents 8b457d6 + 4370cbf + ccb5ecd + 8e3ecc6 + 120f4aa commit 64f9111

File tree

12 files changed

+131
-55
lines changed

12 files changed

+131
-55
lines changed

drivers/acpi/acpi_configfs.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#include <linux/acpi.h>
1414
#include <linux/security.h>
1515

16-
#include "acpica/accommon.h"
17-
#include "acpica/actables.h"
18-
1916
static struct config_group *acpi_table_group;
2017

2118
struct acpi_table {
@@ -226,7 +223,7 @@ static void acpi_table_drop_item(struct config_group *group,
226223
{
227224
struct acpi_table *table = container_of(cfg, struct acpi_table, cfg);
228225

229-
ACPI_INFO(("Host-directed Dynamic ACPI Table Unload"));
226+
pr_debug("Host-directed Dynamic ACPI Table Unload\n");
230227
acpi_unload_table(table->index);
231228
config_item_put(cfg);
232229
}

drivers/acpi/acpi_ipmi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,14 @@ static int __init acpi_ipmi_init(void)
597597
pr_warn("Can't register IPMI opregion space handle\n");
598598
return -EINVAL;
599599
}
600+
600601
result = ipmi_smi_watcher_register(&driver_data.bmc_events);
601-
if (result)
602+
if (result) {
603+
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
604+
ACPI_ADR_SPACE_IPMI,
605+
&acpi_ipmi_space_handler);
602606
pr_err("Can't register IPMI system interface watcher\n");
607+
}
603608

604609
return result;
605610
}

drivers/acpi/acpi_lpss.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,12 @@ static void byt_i2c_setup(struct lpss_private_data *pdata)
186186
long uid = 0;
187187

188188
/* Expected to always be true, but better safe then sorry */
189-
if (uid_str)
190-
uid = simple_strtol(uid_str, NULL, 10);
191-
192-
/* Detect I2C bus shared with PUNIT and ignore its d3 status */
193-
status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
194-
if (ACPI_SUCCESS(status) && shared_host && uid)
195-
pmc_atom_d3_mask &= ~(BIT_LPSS2_F1_I2C1 << (uid - 1));
189+
if (uid_str && !kstrtol(uid_str, 10, &uid) && uid) {
190+
/* Detect I2C bus shared with PUNIT and ignore its d3 status */
191+
status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
192+
if (ACPI_SUCCESS(status) && shared_host)
193+
pmc_atom_d3_mask &= ~(BIT_LPSS2_F1_I2C1 << (uid - 1));
194+
}
196195

197196
lpss_deassert_reset(pdata);
198197

drivers/acpi/apei/einj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ static int __init einj_init(void)
673673
struct apei_exec_context ctx;
674674

675675
if (acpi_disabled) {
676-
pr_warn("ACPI disabled.\n");
676+
pr_info("ACPI disabled.\n");
677677
return -ENODEV;
678678
}
679679

drivers/acpi/apei/ghes.c

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -441,43 +441,92 @@ static void ghes_kick_task_work(struct callback_head *head)
441441
gen_pool_free(ghes_estatus_pool, (unsigned long)estatus_node, node_len);
442442
}
443443

444-
static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,
445-
int sev)
444+
static bool ghes_do_memory_failure(u64 physical_addr, int flags)
446445
{
447446
unsigned long pfn;
448-
int flags = -1;
449-
int sec_sev = ghes_severity(gdata->error_severity);
450-
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
451447

452448
if (!IS_ENABLED(CONFIG_ACPI_APEI_MEMORY_FAILURE))
453449
return false;
454450

455-
if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))
456-
return false;
457-
458-
pfn = mem_err->physical_addr >> PAGE_SHIFT;
451+
pfn = PHYS_PFN(physical_addr);
459452
if (!pfn_valid(pfn)) {
460453
pr_warn_ratelimited(FW_WARN GHES_PFX
461454
"Invalid address in generic error data: %#llx\n",
462-
mem_err->physical_addr);
455+
physical_addr);
463456
return false;
464457
}
465458

459+
memory_failure_queue(pfn, flags);
460+
return true;
461+
}
462+
463+
static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,
464+
int sev)
465+
{
466+
int flags = -1;
467+
int sec_sev = ghes_severity(gdata->error_severity);
468+
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
469+
470+
if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))
471+
return false;
472+
466473
/* iff following two events can be handled properly by now */
467474
if (sec_sev == GHES_SEV_CORRECTED &&
468475
(gdata->flags & CPER_SEC_ERROR_THRESHOLD_EXCEEDED))
469476
flags = MF_SOFT_OFFLINE;
470477
if (sev == GHES_SEV_RECOVERABLE && sec_sev == GHES_SEV_RECOVERABLE)
471478
flags = 0;
472479

473-
if (flags != -1) {
474-
memory_failure_queue(pfn, flags);
475-
return true;
476-
}
480+
if (flags != -1)
481+
return ghes_do_memory_failure(mem_err->physical_addr, flags);
477482

478483
return false;
479484
}
480485

486+
static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata, int sev)
487+
{
488+
struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata);
489+
bool queued = false;
490+
int sec_sev, i;
491+
char *p;
492+
493+
log_arm_hw_error(err);
494+
495+
sec_sev = ghes_severity(gdata->error_severity);
496+
if (sev != GHES_SEV_RECOVERABLE || sec_sev != GHES_SEV_RECOVERABLE)
497+
return false;
498+
499+
p = (char *)(err + 1);
500+
for (i = 0; i < err->err_info_num; i++) {
501+
struct cper_arm_err_info *err_info = (struct cper_arm_err_info *)p;
502+
bool is_cache = (err_info->type == CPER_ARM_CACHE_ERROR);
503+
bool has_pa = (err_info->validation_bits & CPER_ARM_INFO_VALID_PHYSICAL_ADDR);
504+
const char *error_type = "unknown error";
505+
506+
/*
507+
* The field (err_info->error_info & BIT(26)) is fixed to set to
508+
* 1 in some old firmware of HiSilicon Kunpeng920. We assume that
509+
* firmware won't mix corrected errors in an uncorrected section,
510+
* and don't filter out 'corrected' error here.
511+
*/
512+
if (is_cache && has_pa) {
513+
queued = ghes_do_memory_failure(err_info->physical_fault_addr, 0);
514+
p += err_info->length;
515+
continue;
516+
}
517+
518+
if (err_info->type < ARRAY_SIZE(cper_proc_error_type_strs))
519+
error_type = cper_proc_error_type_strs[err_info->type];
520+
521+
pr_warn_ratelimited(FW_WARN GHES_PFX
522+
"Unhandled processor error type: %s\n",
523+
error_type);
524+
p += err_info->length;
525+
}
526+
527+
return queued;
528+
}
529+
481530
/*
482531
* PCIe AER errors need to be sent to the AER driver for reporting and
483532
* recovery. The GHES severities map to the following AER severities and
@@ -605,9 +654,7 @@ static bool ghes_do_proc(struct ghes *ghes,
605654
ghes_handle_aer(gdata);
606655
}
607656
else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) {
608-
struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata);
609-
610-
log_arm_hw_error(err);
657+
queued = ghes_handle_arm_hw_error(gdata, sev);
611658
} else {
612659
void *err = acpi_hest_get_payload(gdata);
613660

drivers/acpi/bus.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,14 +1315,13 @@ static int __init acpi_init(void)
13151315
}
13161316

13171317
acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
1318-
if (!acpi_kobj) {
1318+
if (!acpi_kobj)
13191319
pr_debug("%s: kset create error\n", __func__);
1320-
acpi_kobj = NULL;
1321-
}
13221320

13231321
init_prmt();
13241322
result = acpi_bus_init();
13251323
if (result) {
1324+
kobject_put(acpi_kobj);
13261325
disable_acpi();
13271326
return result;
13281327
}

drivers/acpi/ec.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static struct workqueue_struct *ec_query_wq;
183183

184184
static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */
185185
static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setting */
186+
static int EC_FLAGS_TRUST_DSDT_GPE; /* Needs DSDT GPE as correction setting */
186187
static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */
187188

188189
/* --------------------------------------------------------------------------
@@ -1593,7 +1594,8 @@ static int acpi_ec_add(struct acpi_device *device)
15931594
}
15941595

15951596
if (boot_ec && ec->command_addr == boot_ec->command_addr &&
1596-
ec->data_addr == boot_ec->data_addr) {
1597+
ec->data_addr == boot_ec->data_addr &&
1598+
!EC_FLAGS_TRUST_DSDT_GPE) {
15971599
/*
15981600
* Trust PNP0C09 namespace location rather than
15991601
* ECDT ID. But trust ECDT GPE rather than _GPE
@@ -1816,6 +1818,18 @@ static int ec_correct_ecdt(const struct dmi_system_id *id)
18161818
return 0;
18171819
}
18181820

1821+
/*
1822+
* Some ECDTs contain wrong GPE setting, but they share the same port addresses
1823+
* with DSDT EC, don't duplicate the DSDT EC with ECDT EC in this case.
1824+
* https://bugzilla.kernel.org/show_bug.cgi?id=209989
1825+
*/
1826+
static int ec_honor_dsdt_gpe(const struct dmi_system_id *id)
1827+
{
1828+
pr_debug("Detected system needing DSDT GPE setting.\n");
1829+
EC_FLAGS_TRUST_DSDT_GPE = 1;
1830+
return 0;
1831+
}
1832+
18191833
/*
18201834
* Some DSDTs contain wrong GPE setting.
18211835
* Asus FX502VD/VE, GL702VMK, X550VXK, X580VD
@@ -1846,6 +1860,22 @@ static const struct dmi_system_id ec_dmi_table[] __initconst = {
18461860
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
18471861
DMI_MATCH(DMI_PRODUCT_NAME, "GL702VMK"),}, NULL},
18481862
{
1863+
ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BA", {
1864+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1865+
DMI_MATCH(DMI_PRODUCT_NAME, "X505BA"),}, NULL},
1866+
{
1867+
ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BP", {
1868+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1869+
DMI_MATCH(DMI_PRODUCT_NAME, "X505BP"),}, NULL},
1870+
{
1871+
ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BA", {
1872+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1873+
DMI_MATCH(DMI_PRODUCT_NAME, "X542BA"),}, NULL},
1874+
{
1875+
ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BP", {
1876+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1877+
DMI_MATCH(DMI_PRODUCT_NAME, "X542BP"),}, NULL},
1878+
{
18491879
ec_honor_ecdt_gpe, "ASUS X550VXK", {
18501880
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
18511881
DMI_MATCH(DMI_PRODUCT_NAME, "X550VXK"),}, NULL},
@@ -1854,6 +1884,11 @@ static const struct dmi_system_id ec_dmi_table[] __initconst = {
18541884
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
18551885
DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL},
18561886
{
1887+
/* https://bugzilla.kernel.org/show_bug.cgi?id=209989 */
1888+
ec_honor_dsdt_gpe, "HP Pavilion Gaming Laptop 15-cx0xxx", {
1889+
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
1890+
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Gaming Laptop 15-cx0xxx"),}, NULL},
1891+
{
18571892
ec_clear_on_resume, "Samsung hardware", {
18581893
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL},
18591894
{},

drivers/acpi/event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int acpi_event_genetlink_init(void)
167167

168168
static int __init acpi_event_init(void)
169169
{
170-
int error = 0;
170+
int error;
171171

172172
if (acpi_disabled)
173173
return 0;

drivers/acpi/nvs.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ struct nvs_page {
8484
static LIST_HEAD(nvs_list);
8585

8686
/**
87-
* suspend_nvs_register - register platform NVS memory region to save
88-
* @start - physical address of the region
89-
* @size - size of the region
87+
* suspend_nvs_register - register platform NVS memory region to save
88+
* @start: Physical address of the region.
89+
* @size: Size of the region.
9090
*
91-
* The NVS region need not be page-aligned (both ends) and we arrange
92-
* things so that the data from page-aligned addresses in this region will
93-
* be copied into separate RAM pages.
91+
* The NVS region need not be page-aligned (both ends) and we arrange
92+
* things so that the data from page-aligned addresses in this region will
93+
* be copied into separate RAM pages.
9494
*/
9595
static int suspend_nvs_register(unsigned long start, unsigned long size)
9696
{
@@ -125,7 +125,7 @@ static int suspend_nvs_register(unsigned long start, unsigned long size)
125125
}
126126

127127
/**
128-
* suspend_nvs_free - free data pages allocated for saving NVS regions
128+
* suspend_nvs_free - free data pages allocated for saving NVS regions
129129
*/
130130
void suspend_nvs_free(void)
131131
{
@@ -149,7 +149,7 @@ void suspend_nvs_free(void)
149149
}
150150

151151
/**
152-
* suspend_nvs_alloc - allocate memory necessary for saving NVS regions
152+
* suspend_nvs_alloc - allocate memory necessary for saving NVS regions
153153
*/
154154
int suspend_nvs_alloc(void)
155155
{
@@ -166,7 +166,7 @@ int suspend_nvs_alloc(void)
166166
}
167167

168168
/**
169-
* suspend_nvs_save - save NVS memory regions
169+
* suspend_nvs_save - save NVS memory regions
170170
*/
171171
int suspend_nvs_save(void)
172172
{
@@ -195,10 +195,10 @@ int suspend_nvs_save(void)
195195
}
196196

197197
/**
198-
* suspend_nvs_restore - restore NVS memory regions
198+
* suspend_nvs_restore - restore NVS memory regions
199199
*
200-
* This function is going to be called with interrupts disabled, so it
201-
* cannot iounmap the virtual addresses used to access the NVS region.
200+
* This function is going to be called with interrupts disabled, so it
201+
* cannot iounmap the virtual addresses used to access the NVS region.
202202
*/
203203
void suspend_nvs_restore(void)
204204
{

drivers/acpi/osl.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,12 +1487,7 @@ EXPORT_SYMBOL(acpi_check_resource_conflict);
14871487
int acpi_check_region(resource_size_t start, resource_size_t n,
14881488
const char *name)
14891489
{
1490-
struct resource res = {
1491-
.start = start,
1492-
.end = start + n - 1,
1493-
.name = name,
1494-
.flags = IORESOURCE_IO,
1495-
};
1490+
struct resource res = DEFINE_RES_IO_NAMED(start, n, name);
14961491

14971492
return acpi_check_resource_conflict(&res);
14981493
}

0 commit comments

Comments
 (0)