Skip to content

Commit

Permalink
Merge tag 'acpi-6.9-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 modify the ACPI device events and processor enumeration code to
  take the 'enabled' _STA bit into account as mandated by the ACPI
  specification, convert several platform drivers to using a remove
  callback that returns void, add some new quirks for ACPI IRQ override
  and other things, address assorted issues and clean up code.

  Specifics:

   - Rearrange Device Check and Bus Check notification handling in the
     ACPI device hotplug code to make it get the "enabled" _STA bit into
     account (Rafael Wysocki)

   - Modify acpi_processor_add() to skip processors with the "enabled"
     _STA bit clear, as per the specification (Rafael Wysocki)

   - Stop failing Device Check notification handling without a valid
     reason (Rafael Wysocki)

   - Defer enumeration of devices that depend on a device with an ACPI
     device ID equalt to INTC10CF to address probe ordering issues on
     some platforms (Wentong Wu)

   - Constify acpi_bus_type (Ricardo Marliere)

   - Make the ACPI-specific suspend-to-idle code take the Low-Power S0
     Idle MSFT UUID into account on non-AMD systems (Rafael Wysocki)

   - Add ACPI IRQ override quirks for some new platforms (Sergey
     Kalinichev, Maxim Kudinov, Alexey Froloff, Sviatoslav Harasymchuk,
     Nicolas Haye)

   - Make the NFIT parsing code use acpi_evaluate_dsm_typed() (Andy
     Shevchenko)

   - Fix a memory leak in acpi_processor_power_exit() (Armin Wolf)

   - Make it possible to quirk the CSI-2 and MIPI DisCo for Imaging
     properties parsing and add a quirk for Dell XPS 9315 (Sakari Ailus)

   - Prevent false-positive static checker warnings from triggering by
     intializing some variables in the ACPI thermal code to zero (Colin
     Ian King)

   - 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)

   - Fix register width information handling during system memory
     accesses in the ACPI CPPC library (Jarred White)

   - Add AMD CPPC V2 support for family 17h processors to the ACPI CPPC
     library (Perry Yuan)"

* tag 'acpi-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (35 commits)
  ACPI: resource: Use IRQ override on Maibenben X565
  ACPI: CPPC: Use access_width over bit_width for system memory accesses
  ACPI: CPPC: enable AMD CPPC V2 support for family 17h processors
  ACPI: APEI: Skip initialization of GHES_ASSIST structures for Machine Check Architecture
  ACPI: scan: Consolidate Device Check and Bus Check notification handling
  ACPI: scan: Rework Device Check and Bus Check notification handling
  ACPI: scan: Make acpi_processor_add() check the device enabled bit
  ACPI: scan: Relocate acpi_bus_trim_one()
  ACPI: scan: Fix device check notification handling
  ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override
  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: APEI: GHES: Convert to platform remove callback returning void
  ACPI: property: Polish ignoring bad data nodes
  ACPI: thermal_lib: Initialize temp_decik to zero
  ...
  • Loading branch information
Linus Torvalds committed Mar 13, 2024
2 parents 07abb19 + 817d237 commit 9434467
Show file tree
Hide file tree
Showing 35 changed files with 414 additions and 381 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.

2 changes: 1 addition & 1 deletion arch/x86/kernel/acpi/cppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bool cpc_supported_by_cpu(void)
(boot_cpu_data.x86_model >= 0x20 && boot_cpu_data.x86_model <= 0x2f)))
return true;
else if (boot_cpu_data.x86 == 0x17 &&
boot_cpu_data.x86_model >= 0x70 && boot_cpu_data.x86_model <= 0x7f)
boot_cpu_data.x86_model >= 0x30 && boot_cpu_data.x86_model <= 0x7f)
return true;
return boot_cpu_has(X86_FEATURE_CPPC);
}
Expand Down
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
5 changes: 4 additions & 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 Expand Up @@ -381,6 +381,9 @@ static int acpi_processor_add(struct acpi_device *device,
struct device *dev;
int result = 0;

if (!acpi_device_is_enabled(device))
return -ENODEV;

pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
if (!pr)
return -ENOMEM;
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 9434467

Please sign in to comment.