Skip to content

Commit

Permalink
Merge branches 'acpi-x86', 'acpi-video', 'acpi-apei' and 'acpi-misc'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Rafael J. Wysocki committed Mar 11, 2024
5 parents d55cc9f + 99b572e + 5d389af + 8ec7071 + 74550b0 commit 817d237
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 276 deletions.
1 change: 0 additions & 1 deletion Documentation/firmware-guide/acpi/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ACPI Support
dsd/phy
enumeration
osi
method-customizing
method-tracing
DSD-properties-rules
debug
Expand Down
89 changes: 0 additions & 89 deletions Documentation/firmware-guide/acpi/method-customizing.rst

This file was deleted.

14 changes: 0 additions & 14 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -449,20 +449,6 @@ config ACPI_HED
which is used to report some hardware errors notified via
SCI, mainly the corrected errors.

config ACPI_CUSTOM_METHOD
tristate "Allow ACPI methods to be inserted/replaced at run time"
depends on DEBUG_FS
help
This debug facility allows ACPI AML methods to be inserted and/or
replaced without rebooting the system. For details refer to:
Documentation/firmware-guide/acpi/method-customizing.rst.

NOTE: This option is security sensitive, because it allows arbitrary
kernel memory to be written to by root (uid=0) users, allowing them
to bypass certain security measures (e.g. if root is not allowed to
load additional kernel modules after boot, this feature may be used
to override that restriction).

config ACPI_BGRT
bool "Boottime Graphics Resource Table support"
depends on EFI && (X86 || ARM64)
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ obj-$(CONFIG_ACPI_SBS) += sbshc.o
obj-$(CONFIG_ACPI_SBS) += sbs.o
obj-$(CONFIG_ACPI_HED) += hed.o
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
obj-$(CONFIG_ACPI_BGRT) += bgrt.o
obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o
obj-$(CONFIG_ACPI_SPCR_TABLE) += spcr.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpi_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void cpufreq_add_device(const char *name)

pdev = platform_device_register_simple(name, PLATFORM_DEVID_NONE, NULL, 0);
if (IS_ERR(pdev))
pr_info("%s device creation failed: %ld\n", name, PTR_ERR(pdev));
pr_info("%s device creation failed: %pe\n", name, pdev);
}

#ifdef CONFIG_X86
Expand Down
5 changes: 2 additions & 3 deletions drivers/acpi/acpi_tad.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ static int acpi_tad_disable_timer(struct device *dev, u32 timer_id)
return acpi_tad_wake_set(dev, "_STV", timer_id, ACPI_TAD_WAKE_DISABLED);
}

static int acpi_tad_remove(struct platform_device *pdev)
static void acpi_tad_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
acpi_handle handle = ACPI_HANDLE(dev);
Expand All @@ -579,7 +579,6 @@ static int acpi_tad_remove(struct platform_device *pdev)
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
acpi_remove_cmos_rtc_space_handler(handle);
return 0;
}

static int acpi_tad_probe(struct platform_device *pdev)
Expand Down Expand Up @@ -684,7 +683,7 @@ static struct platform_driver acpi_tad_driver = {
.acpi_match_table = acpi_tad_ids,
},
.probe = acpi_tad_probe,
.remove = acpi_tad_remove,
.remove_new = acpi_tad_remove,
};
MODULE_DEVICE_TABLE(acpi, acpi_tad_ids);

Expand Down
28 changes: 11 additions & 17 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,

static int
acpi_video_device_EDID(struct acpi_video_device *device,
union acpi_object **edid, ssize_t length)
union acpi_object **edid, int length)
{
int status;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
Expand All @@ -625,13 +625,11 @@ acpi_video_device_EDID(struct acpi_video_device *device,

if (!device)
return -ENODEV;
if (length == 128)
arg0.integer.value = 1;
else if (length == 256)
arg0.integer.value = 2;
else
if (!length || (length % 128))
return -EINVAL;

arg0.integer.value = length / 128;

status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
if (ACPI_FAILURE(status))
return -ENODEV;
Expand All @@ -641,7 +639,8 @@ acpi_video_device_EDID(struct acpi_video_device *device,
if (obj && obj->type == ACPI_TYPE_BUFFER)
*edid = obj;
else {
acpi_handle_info(device->dev->handle, "Invalid _DDC data\n");
acpi_handle_debug(device->dev->handle,
"Invalid _DDC data for length %d\n", length);
status = -EFAULT;
kfree(obj);
}
Expand Down Expand Up @@ -1447,7 +1446,6 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,

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

if (!video_device)
continue;
Expand Down Expand Up @@ -1478,18 +1476,14 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
continue;
}

status = acpi_video_device_EDID(video_device, &buffer, length);

if (ACPI_FAILURE(status) || !buffer ||
buffer->type != ACPI_TYPE_BUFFER) {
length = 128;
for (length = 512; length > 0; length -= 128) {
status = acpi_video_device_EDID(video_device, &buffer,
length);
if (ACPI_FAILURE(status) || !buffer ||
buffer->type != ACPI_TYPE_BUFFER) {
continue;
}
if (ACPI_SUCCESS(status))
break;
}
if (!length)
continue;

*edid = buffer->buffer.pointer;
return length;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpi_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void __init acpi_watchdog_init(void)
pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE,
resources, nresources);
if (IS_ERR(pdev))
pr_err("Device creation failed: %ld\n", PTR_ERR(pdev));
pr_err("Device creation failed: %pe\n", pdev);

kfree(resources);

Expand Down
17 changes: 11 additions & 6 deletions drivers/acpi/apei/ghes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ static int ghes_probe(struct platform_device *ghes_dev)
return rc;
}

static int ghes_remove(struct platform_device *ghes_dev)
static void ghes_remove(struct platform_device *ghes_dev)
{
int rc;
struct ghes *ghes;
Expand Down Expand Up @@ -1492,8 +1492,15 @@ static int ghes_remove(struct platform_device *ghes_dev)
break;
case ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED:
rc = apei_sdei_unregister_ghes(ghes);
if (rc)
return rc;
if (rc) {
/*
* Returning early results in a resource leak, but we're
* only here if stopping the hardware failed.
*/
dev_err(&ghes_dev->dev, "Failed to unregister ghes (%pe)\n",
ERR_PTR(rc));
return;
}
break;
default:
BUG();
Expand All @@ -1507,16 +1514,14 @@ static int ghes_remove(struct platform_device *ghes_dev)
mutex_unlock(&ghes_devs_mutex);

kfree(ghes);

return 0;
}

static struct platform_driver ghes_platform_driver = {
.driver = {
.name = "GHES",
},
.probe = ghes_probe,
.remove = ghes_remove,
.remove_new = ghes_remove,
};

void __init acpi_ghes_init(void)
Expand Down
51 changes: 51 additions & 0 deletions drivers/acpi/apei/hest.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ EXPORT_SYMBOL_GPL(hest_disable);

static struct acpi_table_hest *__read_mostly hest_tab;

/*
* Since GHES_ASSIST is not supported, skip initialization of GHES_ASSIST
* structures for MCA.
* During HEST parsing, detected MCA error sources are cached from early
* table entries so that the Flags and Source Id fields from these cached
* values are then referred to in later table entries to determine if the
* encountered GHES_ASSIST structure should be initialized.
*/
static struct {
struct acpi_hest_ia_corrected *cmc;
struct acpi_hest_ia_machine_check *mc;
struct acpi_hest_ia_deferred_check *dmc;
} mces;

static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
[ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */
[ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1,
Expand Down Expand Up @@ -70,22 +84,54 @@ static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
len = sizeof(*cmc) + cmc->num_hardware_banks *
sizeof(struct acpi_hest_ia_error_bank);
mces.cmc = cmc;
} else if (hest_type == ACPI_HEST_TYPE_IA32_CHECK) {
struct acpi_hest_ia_machine_check *mc;
mc = (struct acpi_hest_ia_machine_check *)hest_hdr;
len = sizeof(*mc) + mc->num_hardware_banks *
sizeof(struct acpi_hest_ia_error_bank);
mces.mc = mc;
} else if (hest_type == ACPI_HEST_TYPE_IA32_DEFERRED_CHECK) {
struct acpi_hest_ia_deferred_check *mc;
mc = (struct acpi_hest_ia_deferred_check *)hest_hdr;
len = sizeof(*mc) + mc->num_hardware_banks *
sizeof(struct acpi_hest_ia_error_bank);
mces.dmc = mc;
}
BUG_ON(len == -1);

return len;
};

/*
* GHES and GHESv2 structures share the same format, starting from
* Source Id and ending in Error Status Block Length (inclusive).
*/
static bool is_ghes_assist_struct(struct acpi_hest_header *hest_hdr)
{
struct acpi_hest_generic *ghes;
u16 related_source_id;

if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR &&
hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR_V2)
return false;

ghes = (struct acpi_hest_generic *)hest_hdr;
related_source_id = ghes->related_source_id;

if (mces.cmc && mces.cmc->flags & ACPI_HEST_GHES_ASSIST &&
related_source_id == mces.cmc->header.source_id)
return true;
if (mces.mc && mces.mc->flags & ACPI_HEST_GHES_ASSIST &&
related_source_id == mces.mc->header.source_id)
return true;
if (mces.dmc && mces.dmc->flags & ACPI_HEST_GHES_ASSIST &&
related_source_id == mces.dmc->header.source_id)
return true;

return false;
}

typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);

static int apei_hest_parse(apei_hest_func_t func, void *data)
Expand Down Expand Up @@ -114,6 +160,11 @@ static int apei_hest_parse(apei_hest_func_t func, void *data)
return -EINVAL;
}

if (is_ghes_assist_struct(hest_hdr)) {
hest_hdr = (void *)hest_hdr + len;
continue;
}

rc = func(hest_hdr, data);
if (rc)
return rc;
Expand Down
Loading

0 comments on commit 817d237

Please sign in to comment.