Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'acpi-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
"The most significant change here is replacing msleep() in
acpi_os_sleep() with usleep_range() to reduce spurious sleep time due
to timer inaccuracy which may spectacularly reduce the duration of
system suspend and resume transitions on some systems.

All of the other changes fall into the fixes and cleanups category
this time.

Specifics:

- Use usleep_range() instead of msleep() in acpi_os_sleep() to reduce
excessive delays due to timer inaccuracy, mostly affecting system
suspend and resume (Rafael Wysocki)

- Use str_enabled_disabled() string helpers in the ACPI tables
parsing code to make it easier to follow (Sunil V L)

- Update device properties parsing on systems using ACPI so that data
firmware nodes resulting from _DSD evaluation are treated as
available in firmware nodes walks (Sakari Ailus)

- Fix missing guid_t declaration in linux/prmt.h (Robert Richter)

- Update the GHES handling code to follow the global panic= policy
instead of overriding it by force-rebooting the system after a
fatal HW error has been reported (Borislav Petkov)

- Update messages printed by the ACPI battery driver to always refer
to driver extensions as "hooks" to avoid confusion with similar
functionality in the power supply subsystem in the future (Thomas
Weißschuh)

- Fix .probe() error path cleanup in the ACPI fan driver to avoid
memory leaks (Joe Hattori)

- Constify 'struct bin_attribute' in some places in the ACPI
subsystem and mark it as __ro_after_init in one place to prevent
binary blob attributes from being updated (Thomas Weißschuh)

- Add empty stubs for several ACPI-related symbols so that they can
be used when CONFIG_ACPI is unset and use them for removing
unnecessary conditional compilation from the ipu-bridge driver
(Ricardo Ribalda)"

* tag 'acpi-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
APEI: GHES: Have GHES honor the panic= setting
ACPI: PRM: Fix missing guid_t declaration in linux/prmt.h
ACPI: tables: Use string choice helpers
ACPI: property: Consider data nodes as being available
media: ipu-bridge: Remove unneeded conditional compilations
ACPI: bus: implement acpi_device_hid when !ACPI
ACPI: bus: implement for_each_acpi_consumer_dev when !ACPI
ACPI: header: implement acpi_device_handle when !ACPI
ACPI: bus: implement acpi_get_physical_device_location when !ACPI
ACPI: bus: implement for_each_acpi_dev_match when !ACPI
ACPI: bus: change the prototype for acpi_get_physical_device_location
ACPI: fan: cleanup resources in the error path of .probe()
ACPI: battery: Rename extensions to hook in messages
ACPI: OSL: Use usleep_range() in acpi_os_sleep()
ACPI: sysfs: Constify 'struct bin_attribute'
ACPI: BGRT: Constify 'struct bin_attribute'
ACPI: BGRT: Mark bin_attribute as __ro_after_init

+93 -71
+5 -5
drivers/acpi/apei/ghes.c
··· 173 173 static struct ghes_estatus_cache __rcu *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE]; 174 174 static atomic_t ghes_estatus_cache_alloced; 175 175 176 - static int ghes_panic_timeout __read_mostly = 30; 177 - 178 176 static void __iomem *ghes_map(u64 pfn, enum fixed_addresses fixmap_idx) 179 177 { 180 178 phys_addr_t paddr; ··· 981 983 struct acpi_hest_generic_status *estatus, 982 984 u64 buf_paddr, enum fixed_addresses fixmap_idx) 983 985 { 986 + const char *msg = GHES_PFX "Fatal hardware error"; 987 + 984 988 __ghes_print_estatus(KERN_EMERG, ghes->generic, estatus); 985 989 986 990 ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); 987 991 988 - /* reboot to log the error! */ 989 992 if (!panic_timeout) 990 - panic_timeout = ghes_panic_timeout; 991 - panic("Fatal hardware error!"); 993 + pr_emerg("%s but panic disabled\n", msg); 994 + 995 + panic(msg); 992 996 } 993 997 994 998 static int ghes_proc(struct ghes *ghes)
+7 -7
drivers/acpi/battery.c
··· 717 717 } 718 718 list_del_init(&hook->list); 719 719 720 - pr_info("extension unregistered: %s\n", hook->name); 720 + pr_info("hook unregistered: %s\n", hook->name); 721 721 } 722 722 723 723 void battery_hook_unregister(struct acpi_battery_hook *hook) ··· 751 751 if (hook->add_battery(battery->bat, hook)) { 752 752 /* 753 753 * If a add-battery returns non-zero, 754 - * the registration of the extension has failed, 754 + * the registration of the hook has failed, 755 755 * and we will not add it to the list of loaded 756 756 * hooks. 757 757 */ 758 - pr_err("extension failed to load: %s", hook->name); 758 + pr_err("hook failed to load: %s", hook->name); 759 759 battery_hook_unregister_unlocked(hook); 760 760 goto end; 761 761 } 762 762 763 763 power_supply_changed(battery->bat); 764 764 } 765 - pr_info("new extension: %s\n", hook->name); 765 + pr_info("new hook: %s\n", hook->name); 766 766 end: 767 767 mutex_unlock(&hook_mutex); 768 768 } ··· 805 805 list_for_each_entry_safe(hook_node, tmp, &battery_hook_list, list) { 806 806 if (hook_node->add_battery(battery->bat, hook_node)) { 807 807 /* 808 - * The notification of the extensions has failed, to 809 - * prevent further errors we will unload the extension. 808 + * The notification of the hook has failed, to 809 + * prevent further errors we will unload the hook. 810 810 */ 811 - pr_err("error in extension, unloading: %s", 811 + pr_err("error in hook, unloading: %s", 812 812 hook_node->name); 813 813 battery_hook_unregister_unlocked(hook_node); 814 814 }
+3 -3
drivers/acpi/bgrt.c
··· 29 29 BGRT_SHOW(xoffset, image_offset_x); 30 30 BGRT_SHOW(yoffset, image_offset_y); 31 31 32 - static BIN_ATTR_SIMPLE_RO(image); 32 + static __ro_after_init BIN_ATTR_SIMPLE_RO(image); 33 33 34 34 static struct attribute *bgrt_attributes[] = { 35 35 &bgrt_attr_version.attr, ··· 40 40 NULL, 41 41 }; 42 42 43 - static struct bin_attribute *bgrt_bin_attributes[] = { 43 + static const struct bin_attribute *const bgrt_bin_attributes[] = { 44 44 &bin_attr_image, 45 45 NULL, 46 46 }; 47 47 48 48 static const struct attribute_group bgrt_attribute_group = { 49 49 .attrs = bgrt_attributes, 50 - .bin_attrs = bgrt_bin_attributes, 50 + .bin_attrs_new = bgrt_bin_attributes, 51 51 }; 52 52 53 53 int __init acpi_parse_bgrt(struct acpi_table_header *table)
+8 -2
drivers/acpi/fan_core.c
··· 371 371 result = sysfs_create_link(&pdev->dev.kobj, 372 372 &cdev->device.kobj, 373 373 "thermal_cooling"); 374 - if (result) 374 + if (result) { 375 375 dev_err(&pdev->dev, "Failed to create sysfs link 'thermal_cooling'\n"); 376 + goto err_unregister; 377 + } 376 378 377 379 result = sysfs_create_link(&cdev->device.kobj, 378 380 &pdev->dev.kobj, 379 381 "device"); 380 382 if (result) { 381 383 dev_err(&pdev->dev, "Failed to create sysfs link 'device'\n"); 382 - goto err_end; 384 + goto err_remove_link; 383 385 } 384 386 385 387 return 0; 386 388 389 + err_remove_link: 390 + sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling"); 391 + err_unregister: 392 + thermal_cooling_device_unregister(cdev); 387 393 err_end: 388 394 if (fan->acpi4) 389 395 acpi_fan_delete_attributes(device);
+1 -2
drivers/acpi/mipi-disco-img.c
··· 624 624 if (!fwnode_property_present(adev_fwnode, "rotation")) { 625 625 struct acpi_pld_info *pld; 626 626 627 - status = acpi_get_physical_device_location(handle, &pld); 628 - if (ACPI_SUCCESS(status)) { 627 + if (acpi_get_physical_device_location(handle, &pld)) { 629 628 swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] = 630 629 PROPERTY_ENTRY_U32("rotation", 631 630 pld->rotation * 45U);
+21 -1
drivers/acpi/osl.c
··· 607 607 608 608 void acpi_os_sleep(u64 ms) 609 609 { 610 - msleep(ms); 610 + u64 usec = ms * USEC_PER_MSEC, delta_us = 50; 611 + 612 + /* 613 + * Use a hrtimer because the timer wheel timers are optimized for 614 + * cancelation before they expire and this timer is not going to be 615 + * canceled. 616 + * 617 + * Set the delta between the requested sleep time and the effective 618 + * deadline to at least 50 us in case there is an opportunity for timer 619 + * coalescing. 620 + * 621 + * Moreover, longer sleeps can be assumed to need somewhat less timer 622 + * precision, so sacrifice some of it for making the timer a more likely 623 + * candidate for coalescing by setting the delta to 1% of the sleep time 624 + * if it is above 5 ms (this value is chosen so that the delta is a 625 + * continuous function of the sleep time). 626 + */ 627 + if (ms > 5) 628 + delta_us = (USEC_PER_MSEC / 100) * ms; 629 + 630 + usleep_range(usec, usec + delta_us); 611 631 } 612 632 613 633 void acpi_os_stall(u32 us)
+1 -1
drivers/acpi/property.c
··· 1492 1492 static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode) 1493 1493 { 1494 1494 if (!is_acpi_device_node(fwnode)) 1495 - return false; 1495 + return true; 1496 1496 1497 1497 return acpi_device_is_present(to_acpi_device_node(fwnode)); 1498 1498 }
+1 -3
drivers/acpi/scan.c
··· 723 723 static void acpi_store_pld_crc(struct acpi_device *adev) 724 724 { 725 725 struct acpi_pld_info *pld; 726 - acpi_status status; 727 726 728 - status = acpi_get_physical_device_location(adev->handle, &pld); 729 - if (ACPI_FAILURE(status)) 727 + if (!acpi_get_physical_device_location(adev->handle, &pld)) 730 728 return; 731 729 732 730 adev->pld_crc = crc32(~0, pld, sizeof(*pld));
+4 -4
drivers/acpi/sysfs.c
··· 319 319 }; 320 320 321 321 static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj, 322 - struct bin_attribute *bin_attr, char *buf, 322 + const struct bin_attribute *bin_attr, char *buf, 323 323 loff_t offset, size_t count) 324 324 { 325 325 struct acpi_table_attr *table_attr = ··· 372 372 } 373 373 374 374 table_attr->attr.size = table_header->length; 375 - table_attr->attr.read = acpi_table_show; 375 + table_attr->attr.read_new = acpi_table_show; 376 376 table_attr->attr.attr.name = table_attr->filename; 377 377 table_attr->attr.attr.mode = 0400; 378 378 ··· 412 412 } 413 413 414 414 static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj, 415 - struct bin_attribute *bin_attr, char *buf, 415 + const struct bin_attribute *bin_attr, char *buf, 416 416 loff_t offset, size_t count) 417 417 { 418 418 struct acpi_data_attr *data_attr; ··· 495 495 if (!data_attr) 496 496 return -ENOMEM; 497 497 sysfs_attr_init(&data_attr->attr.attr); 498 - data_attr->attr.read = acpi_data_show; 498 + data_attr->attr.read_new = acpi_data_show; 499 499 data_attr->attr.attr.mode = 0400; 500 500 return acpi_data_objs[i].fn(th, data_attr); 501 501 }
+6 -6
drivers/acpi/tables.c
··· 56 56 (struct acpi_madt_local_apic *)header; 57 57 pr_debug("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", 58 58 p->processor_id, p->id, 59 - (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); 59 + str_enabled_disabled(p->lapic_flags & ACPI_MADT_ENABLED)); 60 60 } 61 61 break; 62 62 ··· 66 66 (struct acpi_madt_local_x2apic *)header; 67 67 pr_debug("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n", 68 68 p->local_apic_id, p->uid, 69 - (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); 69 + str_enabled_disabled(p->lapic_flags & ACPI_MADT_ENABLED)); 70 70 } 71 71 break; 72 72 ··· 160 160 (struct acpi_madt_local_sapic *)header; 161 161 pr_debug("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", 162 162 p->processor_id, p->id, p->eid, 163 - (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); 163 + str_enabled_disabled(p->lapic_flags & ACPI_MADT_ENABLED)); 164 164 } 165 165 break; 166 166 ··· 183 183 pr_debug("GICC (acpi_id[0x%04x] address[%llx] MPIDR[0x%llx] %s)\n", 184 184 p->uid, p->base_address, 185 185 p->arm_mpidr, 186 - (p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); 186 + str_enabled_disabled(p->flags & ACPI_MADT_ENABLED)); 187 187 188 188 } 189 189 break; ··· 218 218 219 219 pr_debug("CORE PIC (processor_id[0x%02x] core_id[0x%02x] %s)\n", 220 220 p->processor_id, p->core_id, 221 - (p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); 221 + str_enabled_disabled(p->flags & ACPI_MADT_ENABLED)); 222 222 } 223 223 break; 224 224 ··· 228 228 229 229 pr_debug("RISC-V INTC (acpi_uid[0x%04x] hart_id[0x%llx] %s)\n", 230 230 p->uid, p->hart_id, 231 - (p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); 231 + str_enabled_disabled(p->flags & ACPI_MADT_ENABLED)); 232 232 } 233 233 break; 234 234
+3 -4
drivers/acpi/utils.c
··· 494 494 } 495 495 EXPORT_SYMBOL_GPL(acpi_device_dep); 496 496 497 - acpi_status 497 + bool 498 498 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) 499 499 { 500 500 acpi_status status; ··· 502 502 union acpi_object *output; 503 503 504 504 status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer); 505 - 506 505 if (ACPI_FAILURE(status)) 507 - return status; 506 + return false; 508 507 509 508 output = buffer.pointer; 510 509 ··· 522 523 523 524 out: 524 525 kfree(buffer.pointer); 525 - return status; 526 + return ACPI_SUCCESS(status); 526 527 } 527 528 EXPORT_SYMBOL(acpi_get_physical_device_location); 528 529
+1 -3
drivers/base/physical_location.c
··· 13 13 bool dev_add_physical_location(struct device *dev) 14 14 { 15 15 struct acpi_pld_info *pld; 16 - acpi_status status; 17 16 18 17 if (!has_acpi_companion(dev)) 19 18 return false; 20 19 21 - status = acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld); 22 - if (ACPI_FAILURE(status)) 20 + if (!acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld)) 23 21 return false; 24 22 25 23 dev->physical_location =
+4 -25
drivers/media/pci/intel/ipu-bridge.c
··· 2 2 /* Author: Dan Scally <djrscally@gmail.com> */ 3 3 4 4 #include <linux/acpi.h> 5 + #include <acpi/acpi_bus.h> 5 6 #include <linux/cleanup.h> 6 7 #include <linux/device.h> 7 8 #include <linux/i2c.h> ··· 108 107 "lc898212axb", 109 108 }; 110 109 111 - #if IS_ENABLED(CONFIG_ACPI) 112 110 /* 113 111 * Used to figure out IVSC acpi device by ipu_bridge_get_ivsc_acpi_dev() 114 112 * instead of device and driver match to probe IVSC device. ··· 127 127 const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i]; 128 128 struct acpi_device *consumer, *ivsc_adev; 129 129 130 - acpi_handle handle = acpi_device_handle(adev); 130 + acpi_handle handle = acpi_device_handle(ACPI_PTR(adev)); 131 131 for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1) 132 132 /* camera sensor depends on IVSC in DSDT if exist */ 133 133 for_each_acpi_consumer_dev(ivsc_adev, consumer) 134 - if (consumer->handle == handle) { 134 + if (ACPI_PTR(consumer->handle) == handle) { 135 135 acpi_dev_put(consumer); 136 136 return ivsc_adev; 137 137 } ··· 139 139 140 140 return NULL; 141 141 } 142 - #else 143 - static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev) 144 - { 145 - return NULL; 146 - } 147 - #endif 148 142 149 143 static int ipu_bridge_match_ivsc_dev(struct device *dev, const void *adev) 150 144 { ··· 253 259 { 254 260 enum v4l2_fwnode_orientation orientation; 255 261 struct acpi_pld_info *pld = NULL; 256 - acpi_status status = AE_ERROR; 257 262 258 - #if IS_ENABLED(CONFIG_ACPI) 259 - status = acpi_get_physical_device_location(adev->handle, &pld); 260 - #endif 261 - if (ACPI_FAILURE(status)) { 263 + if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) { 262 264 dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n"); 263 265 return V4L2_FWNODE_ORIENTATION_EXTERNAL; 264 266 } ··· 488 498 if (sensor->csi_dev) { 489 499 const char *device_hid = ""; 490 500 491 - #if IS_ENABLED(CONFIG_ACPI) 492 501 device_hid = acpi_device_hid(sensor->ivsc_adev); 493 - #endif 494 502 495 503 snprintf(sensor->ivsc_name, sizeof(sensor->ivsc_name), "%s-%u", 496 504 device_hid, sensor->link); ··· 659 671 struct acpi_device *adev = NULL; 660 672 int ret; 661 673 662 - #if IS_ENABLED(CONFIG_ACPI) 663 674 for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) { 664 - #else 665 - while (true) { 666 - #endif 667 675 if (!ACPI_PTR(adev->status.enabled)) 668 676 continue; 669 677 ··· 752 768 unsigned int i; 753 769 754 770 for (i = 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) { 755 - #if IS_ENABLED(CONFIG_ACPI) 756 771 const struct ipu_sensor_config *cfg = 757 772 &ipu_supported_sensors[i]; 758 773 759 774 for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) { 760 - #else 761 - while (true) { 762 - sensor_adev = NULL; 763 - #endif 764 775 if (!ACPI_PTR(sensor_adev->status.enabled)) 765 776 continue; 766 777
+1 -2
drivers/usb/core/usb-acpi.c
··· 213 213 * no connectable, the port would be not used. 214 214 */ 215 215 216 - status = acpi_get_physical_device_location(handle, &pld); 217 - if (ACPI_SUCCESS(status) && pld) 216 + if (acpi_get_physical_device_location(handle, &pld) && pld) 218 217 port_dev->location = USB_ACPI_LOCATION_VALID | 219 218 pld->group_token << 8 | pld->group_position; 220 219
+20 -3
include/acpi/acpi_bus.h
··· 43 43 acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, 44 44 struct acpi_buffer *status_buf); 45 45 46 - acpi_status 47 - acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); 48 - 49 46 bool acpi_has_method(acpi_handle handle, char *name); 50 47 acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, 51 48 u64 arg); ··· 57 60 union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, 58 61 u64 rev, u64 func, union acpi_object *argv4); 59 62 #ifdef CONFIG_ACPI 63 + bool 64 + acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); 65 + 60 66 static inline union acpi_object * 61 67 acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev, 62 68 u64 func, union acpi_object *argv4, ··· 1002 1002 static inline int unregister_acpi_bus_type(void *bus) { return 0; } 1003 1003 1004 1004 static inline int acpi_wait_for_acpi_ipmi(void) { return 0; } 1005 + 1006 + static inline const char *acpi_device_hid(struct acpi_device *device) 1007 + { 1008 + return ""; 1009 + } 1010 + 1011 + static inline bool 1012 + acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) 1013 + { 1014 + return false; 1015 + } 1016 + 1017 + #define for_each_acpi_consumer_dev(supplier, consumer) \ 1018 + for (consumer = NULL; false && (supplier);) 1019 + 1020 + #define for_each_acpi_dev_match(adev, hid, uid, hrv) \ 1021 + for (adev = NULL; false && (hid) && (uid) && (hrv); ) 1005 1022 1006 1023 #endif /* CONFIG_ACPI */ 1007 1024
+5
include/linux/acpi.h
··· 854 854 return NULL; 855 855 } 856 856 857 + static inline acpi_handle acpi_device_handle(struct acpi_device *adev) 858 + { 859 + return NULL; 860 + } 861 + 857 862 static inline bool has_acpi_companion(struct device *dev) 858 863 { 859 864 return false;
+2
include/linux/prmt.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 3 + #include <linux/uuid.h> 4 + 3 5 #ifdef CONFIG_ACPI_PRMT 4 6 void init_prmt(void); 5 7 int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);