Skip to content

Commit 817d237

Browse files
committed
Merge branches 'acpi-x86', 'acpi-video', 'acpi-apei' and 'acpi-misc'
Merge x86-specific ACPI changes, an ACPI backlight driver change, ACPI APEI change and miscellaneous ACPI-related changes for 6.9-rc1: - Add DELL0501 handling to acpi_quirk_skip_serdev_enumeration() and make that function generic (Hans de Goede). - Make the ACPI backlight code handle fetching EDID that is longer than 256 bytes (Mario Limonciello). - Skip initialization of GHES_ASSIST structures for Machine Check Architecture in APEI (Avadhut Naik). - Convert several plaform drivers in the ACPI subsystem to using a remove callback that returns void (Uwe Kleine-König). - Drop the long-deprecated custom_method debugfs interface that is problematic from the security standpoint (Rafael Wysocki). - Use %pe in a couple of places in the ACPI code for easier error decoding (Onkarnath). * acpi-x86: ACPI: x86: Add DELL0501 handling to acpi_quirk_skip_serdev_enumeration() ACPI: x86: Move acpi_quirk_skip_serdev_enumeration() out of CONFIG_X86_ANDROID_TABLETS * acpi-video: ACPI: video: Handle fetching EDID that is longer than 256 bytes * acpi-apei: ACPI: APEI: Skip initialization of GHES_ASSIST structures for Machine Check Architecture ACPI: APEI: GHES: Convert to platform remove callback returning void * acpi-misc: ACPI: pfr_update: Convert to platform remove callback returning void ACPI: pfr_telemetry: Convert to platform remove callback returning void ACPI: fan: Convert to platform remove callback returning void ACPI: GED: Convert to platform remove callback returning void ACPI: DPTF: Convert to platform remove callback returning void ACPI: AGDI: Convert to platform remove callback returning void ACPI: TAD: Convert to platform remove callback returning void ACPI: Drop the custom_method debugfs interface ACPI: use %pe for better readability of errors while printing
5 parents d55cc9f + 99b572e + 5d389af + 8ec7071 + 74550b0 commit 817d237

File tree

21 files changed

+134
-276
lines changed

21 files changed

+134
-276
lines changed

Documentation/firmware-guide/acpi/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ ACPI Support
1414
dsd/phy
1515
enumeration
1616
osi
17-
method-customizing
1817
method-tracing
1918
DSD-properties-rules
2019
debug

Documentation/firmware-guide/acpi/method-customizing.rst

Lines changed: 0 additions & 89 deletions
This file was deleted.

drivers/acpi/Kconfig

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,20 +449,6 @@ config ACPI_HED
449449
which is used to report some hardware errors notified via
450450
SCI, mainly the corrected errors.
451451

452-
config ACPI_CUSTOM_METHOD
453-
tristate "Allow ACPI methods to be inserted/replaced at run time"
454-
depends on DEBUG_FS
455-
help
456-
This debug facility allows ACPI AML methods to be inserted and/or
457-
replaced without rebooting the system. For details refer to:
458-
Documentation/firmware-guide/acpi/method-customizing.rst.
459-
460-
NOTE: This option is security sensitive, because it allows arbitrary
461-
kernel memory to be written to by root (uid=0) users, allowing them
462-
to bypass certain security measures (e.g. if root is not allowed to
463-
load additional kernel modules after boot, this feature may be used
464-
to override that restriction).
465-
466452
config ACPI_BGRT
467453
bool "Boottime Graphics Resource Table support"
468454
depends on EFI && (X86 || ARM64)

drivers/acpi/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ obj-$(CONFIG_ACPI_SBS) += sbshc.o
101101
obj-$(CONFIG_ACPI_SBS) += sbs.o
102102
obj-$(CONFIG_ACPI_HED) += hed.o
103103
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
104-
obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
105104
obj-$(CONFIG_ACPI_BGRT) += bgrt.o
106105
obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o
107106
obj-$(CONFIG_ACPI_SPCR_TABLE) += spcr.o

drivers/acpi/acpi_processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void cpufreq_add_device(const char *name)
161161

162162
pdev = platform_device_register_simple(name, PLATFORM_DEVID_NONE, NULL, 0);
163163
if (IS_ERR(pdev))
164-
pr_info("%s device creation failed: %ld\n", name, PTR_ERR(pdev));
164+
pr_info("%s device creation failed: %pe\n", name, pdev);
165165
}
166166

167167
#ifdef CONFIG_X86

drivers/acpi/acpi_tad.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static int acpi_tad_disable_timer(struct device *dev, u32 timer_id)
554554
return acpi_tad_wake_set(dev, "_STV", timer_id, ACPI_TAD_WAKE_DISABLED);
555555
}
556556

557-
static int acpi_tad_remove(struct platform_device *pdev)
557+
static void acpi_tad_remove(struct platform_device *pdev)
558558
{
559559
struct device *dev = &pdev->dev;
560560
acpi_handle handle = ACPI_HANDLE(dev);
@@ -579,7 +579,6 @@ static int acpi_tad_remove(struct platform_device *pdev)
579579
pm_runtime_put_sync(dev);
580580
pm_runtime_disable(dev);
581581
acpi_remove_cmos_rtc_space_handler(handle);
582-
return 0;
583582
}
584583

585584
static int acpi_tad_probe(struct platform_device *pdev)
@@ -684,7 +683,7 @@ static struct platform_driver acpi_tad_driver = {
684683
.acpi_match_table = acpi_tad_ids,
685684
},
686685
.probe = acpi_tad_probe,
687-
.remove = acpi_tad_remove,
686+
.remove_new = acpi_tad_remove,
688687
};
689688
MODULE_DEVICE_TABLE(acpi, acpi_tad_ids);
690689

drivers/acpi/acpi_video.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
612612

613613
static int
614614
acpi_video_device_EDID(struct acpi_video_device *device,
615-
union acpi_object **edid, ssize_t length)
615+
union acpi_object **edid, int length)
616616
{
617617
int status;
618618
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -625,13 +625,11 @@ acpi_video_device_EDID(struct acpi_video_device *device,
625625

626626
if (!device)
627627
return -ENODEV;
628-
if (length == 128)
629-
arg0.integer.value = 1;
630-
else if (length == 256)
631-
arg0.integer.value = 2;
632-
else
628+
if (!length || (length % 128))
633629
return -EINVAL;
634630

631+
arg0.integer.value = length / 128;
632+
635633
status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
636634
if (ACPI_FAILURE(status))
637635
return -ENODEV;
@@ -641,7 +639,8 @@ acpi_video_device_EDID(struct acpi_video_device *device,
641639
if (obj && obj->type == ACPI_TYPE_BUFFER)
642640
*edid = obj;
643641
else {
644-
acpi_handle_info(device->dev->handle, "Invalid _DDC data\n");
642+
acpi_handle_debug(device->dev->handle,
643+
"Invalid _DDC data for length %d\n", length);
645644
status = -EFAULT;
646645
kfree(obj);
647646
}
@@ -1447,7 +1446,6 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
14471446

14481447
for (i = 0; i < video->attached_count; i++) {
14491448
video_device = video->attached_array[i].bind_info;
1450-
length = 256;
14511449

14521450
if (!video_device)
14531451
continue;
@@ -1478,18 +1476,14 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
14781476
continue;
14791477
}
14801478

1481-
status = acpi_video_device_EDID(video_device, &buffer, length);
1482-
1483-
if (ACPI_FAILURE(status) || !buffer ||
1484-
buffer->type != ACPI_TYPE_BUFFER) {
1485-
length = 128;
1479+
for (length = 512; length > 0; length -= 128) {
14861480
status = acpi_video_device_EDID(video_device, &buffer,
14871481
length);
1488-
if (ACPI_FAILURE(status) || !buffer ||
1489-
buffer->type != ACPI_TYPE_BUFFER) {
1490-
continue;
1491-
}
1482+
if (ACPI_SUCCESS(status))
1483+
break;
14921484
}
1485+
if (!length)
1486+
continue;
14931487

14941488
*edid = buffer->buffer.pointer;
14951489
return length;

drivers/acpi/acpi_watchdog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void __init acpi_watchdog_init(void)
179179
pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE,
180180
resources, nresources);
181181
if (IS_ERR(pdev))
182-
pr_err("Device creation failed: %ld\n", PTR_ERR(pdev));
182+
pr_err("Device creation failed: %pe\n", pdev);
183183

184184
kfree(resources);
185185

drivers/acpi/apei/ghes.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ static int ghes_probe(struct platform_device *ghes_dev)
14551455
return rc;
14561456
}
14571457

1458-
static int ghes_remove(struct platform_device *ghes_dev)
1458+
static void ghes_remove(struct platform_device *ghes_dev)
14591459
{
14601460
int rc;
14611461
struct ghes *ghes;
@@ -1492,8 +1492,15 @@ static int ghes_remove(struct platform_device *ghes_dev)
14921492
break;
14931493
case ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED:
14941494
rc = apei_sdei_unregister_ghes(ghes);
1495-
if (rc)
1496-
return rc;
1495+
if (rc) {
1496+
/*
1497+
* Returning early results in a resource leak, but we're
1498+
* only here if stopping the hardware failed.
1499+
*/
1500+
dev_err(&ghes_dev->dev, "Failed to unregister ghes (%pe)\n",
1501+
ERR_PTR(rc));
1502+
return;
1503+
}
14971504
break;
14981505
default:
14991506
BUG();
@@ -1507,16 +1514,14 @@ static int ghes_remove(struct platform_device *ghes_dev)
15071514
mutex_unlock(&ghes_devs_mutex);
15081515

15091516
kfree(ghes);
1510-
1511-
return 0;
15121517
}
15131518

15141519
static struct platform_driver ghes_platform_driver = {
15151520
.driver = {
15161521
.name = "GHES",
15171522
},
15181523
.probe = ghes_probe,
1519-
.remove = ghes_remove,
1524+
.remove_new = ghes_remove,
15201525
};
15211526

15221527
void __init acpi_ghes_init(void)

drivers/acpi/apei/hest.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ EXPORT_SYMBOL_GPL(hest_disable);
3737

3838
static struct acpi_table_hest *__read_mostly hest_tab;
3939

40+
/*
41+
* Since GHES_ASSIST is not supported, skip initialization of GHES_ASSIST
42+
* structures for MCA.
43+
* During HEST parsing, detected MCA error sources are cached from early
44+
* table entries so that the Flags and Source Id fields from these cached
45+
* values are then referred to in later table entries to determine if the
46+
* encountered GHES_ASSIST structure should be initialized.
47+
*/
48+
static struct {
49+
struct acpi_hest_ia_corrected *cmc;
50+
struct acpi_hest_ia_machine_check *mc;
51+
struct acpi_hest_ia_deferred_check *dmc;
52+
} mces;
53+
4054
static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
4155
[ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */
4256
[ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1,
@@ -70,22 +84,54 @@ static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
7084
cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
7185
len = sizeof(*cmc) + cmc->num_hardware_banks *
7286
sizeof(struct acpi_hest_ia_error_bank);
87+
mces.cmc = cmc;
7388
} else if (hest_type == ACPI_HEST_TYPE_IA32_CHECK) {
7489
struct acpi_hest_ia_machine_check *mc;
7590
mc = (struct acpi_hest_ia_machine_check *)hest_hdr;
7691
len = sizeof(*mc) + mc->num_hardware_banks *
7792
sizeof(struct acpi_hest_ia_error_bank);
93+
mces.mc = mc;
7894
} else if (hest_type == ACPI_HEST_TYPE_IA32_DEFERRED_CHECK) {
7995
struct acpi_hest_ia_deferred_check *mc;
8096
mc = (struct acpi_hest_ia_deferred_check *)hest_hdr;
8197
len = sizeof(*mc) + mc->num_hardware_banks *
8298
sizeof(struct acpi_hest_ia_error_bank);
99+
mces.dmc = mc;
83100
}
84101
BUG_ON(len == -1);
85102

86103
return len;
87104
};
88105

106+
/*
107+
* GHES and GHESv2 structures share the same format, starting from
108+
* Source Id and ending in Error Status Block Length (inclusive).
109+
*/
110+
static bool is_ghes_assist_struct(struct acpi_hest_header *hest_hdr)
111+
{
112+
struct acpi_hest_generic *ghes;
113+
u16 related_source_id;
114+
115+
if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR &&
116+
hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR_V2)
117+
return false;
118+
119+
ghes = (struct acpi_hest_generic *)hest_hdr;
120+
related_source_id = ghes->related_source_id;
121+
122+
if (mces.cmc && mces.cmc->flags & ACPI_HEST_GHES_ASSIST &&
123+
related_source_id == mces.cmc->header.source_id)
124+
return true;
125+
if (mces.mc && mces.mc->flags & ACPI_HEST_GHES_ASSIST &&
126+
related_source_id == mces.mc->header.source_id)
127+
return true;
128+
if (mces.dmc && mces.dmc->flags & ACPI_HEST_GHES_ASSIST &&
129+
related_source_id == mces.dmc->header.source_id)
130+
return true;
131+
132+
return false;
133+
}
134+
89135
typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
90136

91137
static int apei_hest_parse(apei_hest_func_t func, void *data)
@@ -114,6 +160,11 @@ static int apei_hest_parse(apei_hest_func_t func, void *data)
114160
return -EINVAL;
115161
}
116162

163+
if (is_ghes_assist_struct(hest_hdr)) {
164+
hest_hdr = (void *)hest_hdr + len;
165+
continue;
166+
}
167+
117168
rc = func(hest_hdr, data);
118169
if (rc)
119170
return rc;

0 commit comments

Comments
 (0)