History

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

Pull ACPI updates from Rafael Wysocki: "These eliminate significant AML processing overhead related to using operation regions in system memory, update the ACPICA code in the kernel to upstream revision 20200717 (including a fix to prevent operation region reference counts from overflowing in some cases), remove the last bits of the (long deprecated) ACPI procfs interface and do some assorted cleanups. Specifics: - Eliminate significant AML processing overhead related to using operation regions in system memory by reworking the management of memory mappings in the ACPI code to defer unmap operations (to do them outside of the ACPICA locks, among other things) and making the memory operation reagion handler avoid releasing memory mappings created by it too early (Rafael Wysocki). - Update the ACPICA code in the kernel to upstream revision 20200717: * Prevent operation region reference counts from overflowing in some cases (Erik Kaneda). * Replace one-element array with flexible-array (Gustavo A. R. Silva). - Fix ACPI PCI hotplug reference counting (Rafael Wysocki). - Drop last bits of the ACPI procfs interface (Thomas Renninger). - Drop some redundant checks from the code parsing ACPI tables related to NUMA (Hanjun Guo). - Avoid redundant object evaluation in the ACPI device properties handling code (Heikki Krogerus). - Avoid unecessary memory overhead related to storing the signatures of the ACPI tables recognized by the kernel (Ard Biesheuvel). - Add missing newline characters when printing module parameter values in some places (Xiongfeng Wang). - Update the link to the ACPI specifications in some places (Tiezhu Yang). - Use the fallthrough pseudo-keyword in the ACPI code (Gustavo A. R. Silva). - Drop redundant variable initialization from the APEI code (Colin Ian King). - Drop uninitialized_var() from the ACPI PAD driver (Jason Yan). - Replace HTTP links with HTTPS ones in the ACPI code (Alexander A. Klimov)" * tag 'acpi-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (22 commits) ACPI: APEI: remove redundant assignment to variable rc ACPI: NUMA: Remove the useless 'node >= MAX_NUMNODES' check ACPI: NUMA: Remove the useless sub table pointer check ACPI: tables: Remove the duplicated checks for acpi_parse_entries_array() ACPICA: Update version to 20200717 ACPICA: Do not increment operation_region reference counts for field units ACPICA: Replace one-element array with flexible-array ACPI: Replace HTTP links with HTTPS ones ACPI: Use valid link to the ACPI specification ACPI: OSL: Clean up the removal of unused memory mappings ACPI: OSL: Use deferred unmapping in acpi_os_unmap_iomem() ACPI: OSL: Use deferred unmapping in acpi_os_unmap_generic_address() ACPICA: Preserve memory opregion mappings ACPI: OSL: Implement deferred unmapping of ACPI memory ACPI: Use fallthrough pseudo-keyword PCI: hotplug: ACPI: Fix context refcounting in acpiphp_grab_context() ACPI: tables: avoid relocations for table signature array ACPI: PAD: Eliminate usage of uninitialized_var() macro ACPI: sysfs: add newlines when printing module parameters ACPI: EC: add newline when printing 'ec_event_clearing' module parameter ...

Linus Torvalds committed 6 years ago

Commit 2baa85d2 parents 0408497 db1da2f38 files · +167 −620Browse files

Unified · Split

38 files
  1. Documentation/firmware-guide/acpi/DSD-properties-rules.rst +2 −2
  2. Documentation/firmware-guide/acpi/dsd/data-node-references.rst +2 −2
  3. Documentation/firmware-guide/acpi/dsd/graph.rst +5 −5
  4. Documentation/firmware-guide/acpi/dsd/leds.rst +3 −3
  5. Documentation/firmware-guide/acpi/lpit.rst +1 −1
  6. Documentation/hwmon/acpi_power_meter.rst +1 −1
  7. drivers/acpi/Kconfig +2 −20
  8. drivers/acpi/Makefile +0 −1
  9. drivers/acpi/ac.c +1 −107
  10. drivers/acpi/acpi_pad.c +1 −1
  11. drivers/acpi/acpi_processor.c +1 −1
  12. drivers/acpi/acpica/evrgnini.c +8 −6
  13. drivers/acpi/acpica/exprep.c +0 −4
  14. drivers/acpi/acpica/exregion.c +46 −18
  15. drivers/acpi/acpica/utdelete.c +1 −5
  16. drivers/acpi/acpica/utids.c +1 −2
  17. drivers/acpi/apei/hest.c +1 −1
  18. drivers/acpi/battery.c +0 −255
  19. drivers/acpi/button.c +1 −1
  20. drivers/acpi/cm_sbs.c +0 −87
  21. drivers/acpi/dock.c +1 −1
  22. drivers/acpi/ec.c +4 −4
  23. drivers/acpi/evged.c +1 −1
  24. drivers/acpi/nfit/nfit.h +1 −1
  25. drivers/acpi/numa/srat.c +1 −9
  26. drivers/acpi/osl.c +36 −27
  27. drivers/acpi/processor_idle.c +1 −2
  28. drivers/acpi/property.c +2 −12
  29. drivers/acpi/resource.c +1 −1
  30. drivers/acpi/spcr.c +2 −2
  31. drivers/acpi/sysfs.c +6 −6
  32. drivers/acpi/tables.c +7 −18
  33. drivers/pci/hotplug/acpiphp_glue.c +11 −3
  34. drivers/pci/pci-acpi.c +3 −3
  35. include/acpi/acpixf.h +1 −1
  36. include/acpi/actypes.h +10 −4
  37. include/linux/tboot.h +1 −1
  38. tools/power/cpupower/man/cpupower-idle-info.1 +1 −1
Documentation/firmware-guide/acpi/DSD-properties-rules.rst+2−2
@@ -96,5 +96,5 @@ contents. · 95 unmodified lines
9696 References
9797 ==========
9898
99−.. [1] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
100−.. [2] http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf
99+.. [1] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
100+.. [2] https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf
Documentation/firmware-guide/acpi/dsd/data-node-references.rst+2−2
@@ -85,9 +85,9 @@ References · 84 unmodified lines
8585 ==========
8686
8787 [1] Hierarchical Data Extension UUID For _DSD.
88−<http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
88+<https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
8989 referenced 2018-07-17.
9090
9191 [2] Device Properties UUID For _DSD.
92−<http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
92+<https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
9393 referenced 2016-10-04.
Documentation/firmware-guide/acpi/dsd/graph.rst+5−5
@@ -154,23 +154,23 @@ References · 153 unmodified lines
154154 ==========
155155
156156 [1] _DSD (Device Specific Data) Implementation Guide.
157− http://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm,
157+ https://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm,
158158 referenced 2016-10-03.
159159
160−[2] Devicetree. http://www.devicetree.org, referenced 2016-10-03.
160+[2] Devicetree. https://www.devicetree.org, referenced 2016-10-03.
161161
162162 [3] Documentation/devicetree/bindings/graph.txt
163163
164164 [4] Device Properties UUID For _DSD.
165− http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf,
165+ https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf,
166166 referenced 2016-10-04.
167167
168168 [5] Hierarchical Data Extension UUID For _DSD.
169− http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf,
169+ https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf,
170170 referenced 2016-10-04.
171171
172172 [6] Advanced Configuration and Power Interface Specification.
173− http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf,
173+ https://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf,
174174 referenced 2016-10-04.
175175
176176 [7] _DSD Device Properties Usage Rules.
Documentation/firmware-guide/acpi/dsd/leds.rst+3−3
@@ -90,7 +90,7 @@ where · 89 unmodified lines
9090 References
9191 ==========
9292
93−[1] Device tree. <URL:http://www.devicetree.org>, referenced 2019-02-21.
93+[1] Device tree. <URL:https://www.devicetree.org>, referenced 2019-02-21.
9494
9595 [2] Advanced Configuration and Power Interface Specification.
9696 <URL:https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf>,
@@ -101,11 +101,11 @@ References · 4 unmodified lines
101101 [4] Documentation/devicetree/bindings/media/video-interfaces.txt
102102
103103 [5] Device Properties UUID For _DSD.
104− <URL:http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
104+ <URL:https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
105105 referenced 2019-02-21.
106106
107107 [6] Hierarchical Data Extension UUID For _DSD.
108− <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
108+ <URL:https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
109109 referenced 2019-02-21.
110110
111111 [7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
Documentation/firmware-guide/acpi/lpit.rst+1−1
@@ -7,7 +7,7 @@ Low Power Idle Table (LPIT) · 6 unmodified lines
77 To enumerate platform Low Power Idle states, Intel platforms are using
88 “Low Power Idle Table” (LPIT). More details about this table can be
99 downloaded from:
10−http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf
10+https://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf
1111
1212 Residencies for each low power state can be read via FFH
1313 (Function fixed hardware) or a memory mapped interface.
Documentation/hwmon/acpi_power_meter.rst+1−1
@@ -9,7 +9,7 @@ Supported systems: · 8 unmodified lines
99
1010 Prefix: 'power_meter'
1111
12− Datasheet: http://acpi.info/, section 10.4.
12+ Datasheet: https://uefi.org/specifications, section 10.4.
1313
1414 Author: Darrick J. Wong
1515
drivers/acpi/Kconfig+2−20
@@ -32,7 +32,7 @@ menuconfig ACPI · 31 unmodified lines
3232 Linux support for ACPI is based on Intel Corporation's ACPI
3333 Component Architecture (ACPI CA). For more information on the
3434 ACPI CA, see:
35− <http://acpica.org/>
35+ <https://acpica.org/>
3636
3737 ACPI is an open industry specification originally co-developed by
3838 Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. Currently,
@@ -40,8 +40,7 @@ menuconfig ACPI · 1 unmodified line
4040 the UEFI Forum and any UEFI member can join the ASWG and contribute
4141 to the ACPI specification.
4242 The specification is available at:
43− <http://www.acpi.info>
44− <http://www.uefi.org/acpi/specs>
43+ <https://uefi.org/specifications>
4544
4645 if ACPI
4746
@@ -99,23 +98,6 @@ config ACPI_SLEEP · 51 unmodified lines
9998 depends on ACPI_SYSTEM_POWER_STATES_SUPPORT
10099 default y
101100
102−config ACPI_PROCFS_POWER
103− bool "Deprecated power /proc/acpi directories"
104− depends on X86 && PROC_FS
105− help
106− For backwards compatibility, this option allows
107− deprecated power /proc/acpi/ directories to exist, even when
108− they have been replaced by functions in /sys.
109− The deprecated directories (and their replacements) include:
110− /proc/acpi/battery/* (/sys/class/power_supply/*) and
111− /proc/acpi/ac_adapter/* (sys/class/power_supply/*).
112− This option has no effect on /proc/acpi/ directories
113− and functions which do not yet exist in /sys.
114− This option, together with the proc directories, will be
115− deleted in the future.
116−
117− Say N to delete power /proc/acpi/ directories that have moved to /sys.
118−
119101 config ACPI_REV_OVERRIDE_POSSIBLE
120102 bool "Allow supported ACPI revision to be overridden"
121103 depends on X86
drivers/acpi/Makefile+0−1
@@ -55,7 +55,6 @@ acpi-$(CONFIG_X86) += acpi_cmos_rtc.o · 54 unmodified lines
5555 acpi-$(CONFIG_X86) += x86/apple.o
5656 acpi-$(CONFIG_X86) += x86/utils.o
5757 acpi-$(CONFIG_DEBUG_FS) += debugfs.o
58−acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
5958 acpi-y += acpi_lpat.o
6059 acpi-$(CONFIG_ACPI_LPIT) += acpi_lpit.o
6160 acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
drivers/acpi/ac.c+1−107
@@ -13,10 +13,6 @@ · 12 unmodified lines
1313 #include <linux/types.h>
1414 #include <linux/dmi.h>
1515 #include <linux/delay.h>
16−#ifdef CONFIG_ACPI_PROCFS_POWER
17−#include <linux/proc_fs.h>
18−#include <linux/seq_file.h>
19−#endif
2016 #include <linux/platform_device.h>
2117 #include <linux/power_supply.h>
2218 #include <linux/acpi.h>
@@ -66,12 +62,6 @@ static int acpi_ac_resume(struct device *dev); · 43 unmodified lines
6662 #endif
6763 static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
6864
69−#ifdef CONFIG_ACPI_PROCFS_POWER
70−extern struct proc_dir_entry *acpi_lock_ac_dir(void);
71−extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
72−#endif
73−
74−
7565 static int ac_sleep_before_get_state_ms;
7666 static int ac_check_pmic = 1;
7767
@@ -150,77 +140,6 @@ static enum power_supply_property ac_props[] = { · 72 unmodified lines
150140 POWER_SUPPLY_PROP_ONLINE,
151141 };
152142
153−#ifdef CONFIG_ACPI_PROCFS_POWER
154−/* --------------------------------------------------------------------------
155− FS Interface (/proc)
156− -------------------------------------------------------------------------- */
157−
158−static struct proc_dir_entry *acpi_ac_dir;
159−
160−static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
161−{
162− struct acpi_ac *ac = seq->private;
163−
164−
165− if (!ac)
166− return 0;
167−
168− if (acpi_ac_get_state(ac)) {
169− seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
170− return 0;
171− }
172−
173− seq_puts(seq, "state: ");
174− switch (ac->state) {
175− case ACPI_AC_STATUS_OFFLINE:
176− seq_puts(seq, "off-line\n");
177− break;
178− case ACPI_AC_STATUS_ONLINE:
179− seq_puts(seq, "on-line\n");
180− break;
181− default:
182− seq_puts(seq, "unknown\n");
183− break;
184− }
185−
186− return 0;
187−}
188−
189−static int acpi_ac_add_fs(struct acpi_ac *ac)
190−{
191− struct proc_dir_entry *entry = NULL;
192−
193− printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded,"
194− " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
195− if (!acpi_device_dir(ac->device)) {
196− acpi_device_dir(ac->device) =
197− proc_mkdir(acpi_device_bid(ac->device), acpi_ac_dir);
198− if (!acpi_device_dir(ac->device))
199− return -ENODEV;
200− }
201−
202− /* 'state' [R] */
203− entry = proc_create_single_data(ACPI_AC_FILE_STATE, S_IRUGO,
204− acpi_device_dir(ac->device), acpi_ac_seq_show, ac);
205− if (!entry)
206− return -ENODEV;
207− return 0;
208−}
209−
210−static int acpi_ac_remove_fs(struct acpi_ac *ac)
211−{
212−
213− if (acpi_device_dir(ac->device)) {
214− remove_proc_entry(ACPI_AC_FILE_STATE,
215− acpi_device_dir(ac->device));
216− remove_proc_entry(acpi_device_bid(ac->device), acpi_ac_dir);
217− acpi_device_dir(ac->device) = NULL;
218− }
219−
220− return 0;
221−}
222−#endif
223−
224143 /* --------------------------------------------------------------------------
225144 Driver Model
226145 -------------------------------------------------------------------------- */
@@ -236,7 +155,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) · 9 unmodified lines
236155 default:
237156 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
238157 "Unsupported event [0x%x]\n", event));
239− /* fall through */
158+ fallthrough;
240159 case ACPI_AC_NOTIFY_STATUS:
241160 case ACPI_NOTIFY_BUS_CHECK:
242161 case ACPI_NOTIFY_DEVICE_CHECK:
@@ -348,11 +267,6 @@ static int acpi_ac_add(struct acpi_device *device) · 105 unmodified lines
348267 psy_cfg.drv_data = ac;
349268
350269 ac->charger_desc.name = acpi_device_bid(device);
351−#ifdef CONFIG_ACPI_PROCFS_POWER
352− result = acpi_ac_add_fs(ac);
353− if (result)
354− goto end;
355−#endif
356270 ac->charger_desc.type = POWER_SUPPLY_TYPE_MAINS;
357271 ac->charger_desc.properties = ac_props;
358272 ac->charger_desc.num_properties = ARRAY_SIZE(ac_props);
@@ -372,9 +286,6 @@ static int acpi_ac_add(struct acpi_device *device) · 13 unmodified lines
372286 register_acpi_notifier(&ac->battery_nb);
373287 end:
374288 if (result) {
375−#ifdef CONFIG_ACPI_PROCFS_POWER
376− acpi_ac_remove_fs(ac);
377−#endif
378289 kfree(ac);
379290 }
380291
@@ -418,10 +329,6 @@ static int acpi_ac_remove(struct acpi_device *device) · 37 unmodified lines
418329 power_supply_unregister(ac->charger);
419330 unregister_acpi_notifier(&ac->battery_nb);
420331
421−#ifdef CONFIG_ACPI_PROCFS_POWER
422− acpi_ac_remove_fs(ac);
423−#endif
424−
425332 kfree(ac);
426333
427334 return 0;
@@ -447,18 +354,8 @@ static int __init acpi_ac_init(void) · 19 unmodified lines
447354 }
448355 }
449356
450−#ifdef CONFIG_ACPI_PROCFS_POWER
451− acpi_ac_dir = acpi_lock_ac_dir();
452− if (!acpi_ac_dir)
453− return -ENODEV;
454−#endif
455−
456−
457357 result = acpi_bus_register_driver(&acpi_ac_driver);
458358 if (result < 0) {
459−#ifdef CONFIG_ACPI_PROCFS_POWER
460− acpi_unlock_ac_dir(acpi_ac_dir);
461−#endif
462359 return -ENODEV;
463360 }
464361
@@ -468,9 +365,6 @@ static int __init acpi_ac_init(void) · 3 unmodified lines
468365 static void __exit acpi_ac_exit(void)
469366 {
470367 acpi_bus_unregister_driver(&acpi_ac_driver);
471−#ifdef CONFIG_ACPI_PROCFS_POWER
472− acpi_unlock_ac_dir(acpi_ac_dir);
473−#endif
474368 }
475369 module_init(acpi_ac_init);
476370 module_exit(acpi_ac_exit);
drivers/acpi/acpi_pad.c+1−1
@@ -88,7 +88,7 @@ static void round_robin_cpu(unsigned int tsk_index) · 87 unmodified lines
8888 cpumask_var_t tmp;
8989 int cpu;
9090 unsigned long min_weight = -1;
91− unsigned long uninitialized_var(preferred_cpu);
91+ unsigned long preferred_cpu;
9292
9393 if (!alloc_cpumask_var(&tmp, GFP_KERNEL))
9494 return;
drivers/acpi/acpi_processor.c+1−1
@@ -79,7 +79,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) · 78 unmodified lines
7979 * PIIX4 models.
8080 */
8181 errata.piix4.throttle = 1;
82− /* fall through*/
82+ fallthrough;
8383
8484 case 2: /* PIIX4E */
8585 case 3: /* PIIX4M */
drivers/acpi/acpica/evrgnini.c+8−6
@@ -38,6 +38,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, · 37 unmodified lines
3838 union acpi_operand_object *region_desc =
3939 (union acpi_operand_object *)handle;
4040 struct acpi_mem_space_context *local_region_context;
41+ struct acpi_mem_mapping *mm;
4142
4243 ACPI_FUNCTION_TRACE(ev_system_memory_region_setup);
4344
@@ -46,13 +47,14 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, · 2 unmodified lines
4647 local_region_context =
4748 (struct acpi_mem_space_context *)*region_context;
4849
49− /* Delete a cached mapping if present */
50+ /* Delete memory mappings if present */
5051
51− if (local_region_context->mapped_length) {
52− acpi_os_unmap_memory(local_region_context->
53− mapped_logical_address,
54− local_region_context->
55− mapped_length);
52+ while (local_region_context->first_mm) {
53+ mm = local_region_context->first_mm;
54+ local_region_context->first_mm = mm->next_mm;
55+ acpi_os_unmap_memory(mm->logical_address,
56+ mm->length);
57+ ACPI_FREE(mm);
5658 }
5759 ACPI_FREE(local_region_context);
5860 *region_context = NULL;
drivers/acpi/acpica/exprep.c+0−4
@@ -473,10 +473,6 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) · 472 unmodified lines
473473 (u8)access_byte_width;
474474 }
475475 }
476− /* An additional reference for the container */
477−
478− acpi_ut_add_reference(obj_desc->field.region_obj);
479−
480476 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
481477 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
482478 obj_desc->field.start_field_bit_offset,
drivers/acpi/acpica/exregion.c+46−18
@@ -41,6 +41,7 @@ acpi_ex_system_memory_space_handler(u32 function, · 40 unmodified lines
4141 acpi_status status = AE_OK;
4242 void *logical_addr_ptr = NULL;
4343 struct acpi_mem_space_context *mem_info = region_context;
44+ struct acpi_mem_mapping *mm = mem_info->cur_mm;
4445 u32 length;
4546 acpi_size map_length;
4647 acpi_size page_boundary_map_length;
@@ -96,20 +97,37 @@ acpi_ex_system_memory_space_handler(u32 function, · 49 unmodified lines
9697 * Is 1) Address below the current mapping? OR
9798 * 2) Address beyond the current mapping?
9899 */
99− if ((address < mem_info->mapped_physical_address) ||
100− (((u64) address + length) > ((u64)
101− mem_info->mapped_physical_address +
102− mem_info->mapped_length))) {
100+ if (!mm || (address < mm->physical_address) ||
101+ ((u64) address + length > (u64) mm->physical_address + mm->length)) {
103102 /*
104− * The request cannot be resolved by the current memory mapping;
105− * Delete the existing mapping and create a new one.
103+ * The request cannot be resolved by the current memory mapping.
104+ *
105+ * Look for an existing saved mapping covering the address range
106+ * at hand. If found, save it as the current one and carry out
107+ * the access.
106108 */
107− if (mem_info->mapped_length) {
109+ for (mm = mem_info->first_mm; mm; mm = mm->next_mm) {
110+ if (mm == mem_info->cur_mm)
111+ continue;
112+
113+ if (address < mm->physical_address)
114+ continue;
108115
109− /* Valid mapping, delete it */
116+ if ((u64) address + length >
117+ (u64) mm->physical_address + mm->length)
118+ continue;
110119
111− acpi_os_unmap_memory(mem_info->mapped_logical_address,
112− mem_info->mapped_length);
120+ mem_info->cur_mm = mm;
121+ goto access;
122+ }
123+
124+ /* Create a new mappings list entry */
125+ mm = ACPI_ALLOCATE_ZEROED(sizeof(*mm));
126+ if (!mm) {
127+ ACPI_ERROR((AE_INFO,
128+ "Unable to save memory mapping at 0x%8.8X%8.8X, size %u",
129+ ACPI_FORMAT_UINT64(address), length));
130+ return_ACPI_STATUS(AE_NO_MEMORY);
113131 }
114132
115133 /*
@@ -143,29 +161,39 @@ acpi_ex_system_memory_space_handler(u32 function, · 27 unmodified lines
143161
144162 /* Create a new mapping starting at the address given */
145163
146− mem_info->mapped_logical_address =
147− acpi_os_map_memory(address, map_length);
148− if (!mem_info->mapped_logical_address) {
164+ logical_addr_ptr = acpi_os_map_memory(address, map_length);
165+ if (!logical_addr_ptr) {
149166 ACPI_ERROR((AE_INFO,
150167 "Could not map memory at 0x%8.8X%8.8X, size %u",
151168 ACPI_FORMAT_UINT64(address),
152169 (u32)map_length));
153− mem_info->mapped_length = 0;
170+ ACPI_FREE(mm);
154171 return_ACPI_STATUS(AE_NO_MEMORY);
155172 }
156173
157174 /* Save the physical address and mapping size */
158175
159− mem_info->mapped_physical_address = address;
160− mem_info->mapped_length = map_length;
176+ mm->logical_address = logical_addr_ptr;
177+ mm->physical_address = address;
178+ mm->length = map_length;
179+
180+ /*
181+ * Add the new entry to the mappigs list and save it as the
182+ * current mapping.
183+ */
184+ mm->next_mm = mem_info->first_mm;
185+ mem_info->first_mm = mm;
186+
187+ mem_info->cur_mm = mm;
161188 }
162189
190+access:
163191 /*
164192 * Generate a logical pointer corresponding to the address we want to
165193 * access
166194 */
167− logical_addr_ptr = mem_info->mapped_logical_address +
168− ((u64) address - (u64) mem_info->mapped_physical_address);
195+ logical_addr_ptr = mm->logical_address +
196+ ((u64) address - (u64) mm->physical_address);
169197
170198 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
171199 "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
drivers/acpi/acpica/utdelete.c+1−5
@@ -568,11 +568,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) · 567 unmodified lines
568568 next_object = object->buffer_field.buffer_obj;
569569 break;
570570
571− case ACPI_TYPE_LOCAL_REGION_FIELD:
572−
573− next_object = object->field.region_obj;
574− break;
575−
576571 case ACPI_TYPE_LOCAL_BANK_FIELD:
577572
578573 next_object = object->bank_field.bank_obj;
@@ -613,6 +608,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) · 34 unmodified lines
613608 }
614609 break;
615610
611+ case ACPI_TYPE_LOCAL_REGION_FIELD:
616612 case ACPI_TYPE_REGION:
617613 default:
618614
drivers/acpi/acpica/utids.c+1−2
@@ -263,8 +263,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node, · 262 unmodified lines
263263 * 3) Size of the actual CID strings
264264 */
265265 cid_list_size = sizeof(struct acpi_pnp_device_id_list) +
266− ((count - 1) * sizeof(struct acpi_pnp_device_id)) +
267− string_area_size;
266+ (count * sizeof(struct acpi_pnp_device_id)) + string_area_size;
268267
269268 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size);
270269 if (!cid_list) {
drivers/acpi/apei/hest.c+1−1
@@ -227,7 +227,7 @@ __setup("hest_disable", setup_hest_disable); · 226 unmodified lines
227227 void __init acpi_hest_init(void)
228228 {
229229 acpi_status status;
230− int rc = -ENODEV;
230+ int rc;
231231 unsigned int ghes_count = 0;
232232
233233 if (hest_disable) {
drivers/acpi/battery.c+0−255
@@ -24,12 +24,6 @@ · 23 unmodified lines
2424
2525 #include <asm/unaligned.h>
2626
27−#ifdef CONFIG_ACPI_PROCFS_POWER
28−#include <linux/proc_fs.h>
29−#include <linux/seq_file.h>
30−#include <linux/uaccess.h>
31−#endif
32−
3327 #include <linux/acpi.h>
3428 #include <linux/power_supply.h>
3529
@@ -69,11 +63,6 @@ static unsigned int cache_time = 1000; · 33 unmodified lines
6963 module_param(cache_time, uint, 0644);
7064 MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
7165
72−#ifdef CONFIG_ACPI_PROCFS_POWER
73−extern struct proc_dir_entry *acpi_lock_battery_dir(void);
74−extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
75−#endif
76−
7766 static const struct acpi_device_id battery_device_ids[] = {
7867 {"PNP0C0A", 0},
7968 {"", 0},
@@ -1023,226 +1012,6 @@ static void acpi_battery_refresh(struct acpi_battery *battery) · 943 unmodified lines
10231012 sysfs_add_battery(battery);
10241013 }
10251014
1026−/* --------------------------------------------------------------------------
1027− FS Interface (/proc)
1028− -------------------------------------------------------------------------- */
1029−
1030−#ifdef CONFIG_ACPI_PROCFS_POWER
1031−static struct proc_dir_entry *acpi_battery_dir;
1032−
1033−static const char *acpi_battery_units(const struct acpi_battery *battery)
1034−{
1035− return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ?
1036− "mA" : "mW";
1037−}
1038−
1039−static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset)
1040−{
1041− struct acpi_battery *battery = seq->private;
1042− int result = acpi_battery_update(battery, false);
1043−
1044− if (result)
1045− goto end;
1046−
1047− seq_printf(seq, "present: %s\n",
1048− acpi_battery_present(battery) ? "yes" : "no");
1049− if (!acpi_battery_present(battery))
1050− goto end;
1051− if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
1052− seq_printf(seq, "design capacity: unknown\n");
1053− else
1054− seq_printf(seq, "design capacity: %d %sh\n",
1055− battery->design_capacity,
1056− acpi_battery_units(battery));
1057−
1058− if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
1059− seq_printf(seq, "last full capacity: unknown\n");
1060− else
1061− seq_printf(seq, "last full capacity: %d %sh\n",
1062− battery->full_charge_capacity,
1063− acpi_battery_units(battery));
1064−
1065− seq_printf(seq, "battery technology: %srechargeable\n",
1066− battery->technology ? "" : "non-");
1067−
1068− if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
1069− seq_printf(seq, "design voltage: unknown\n");
1070− else
1071− seq_printf(seq, "design voltage: %d mV\n",
1072− battery->design_voltage);
1073− seq_printf(seq, "design capacity warning: %d %sh\n",
1074− battery->design_capacity_warning,
1075− acpi_battery_units(battery));
1076− seq_printf(seq, "design capacity low: %d %sh\n",
1077− battery->design_capacity_low,
1078− acpi_battery_units(battery));
1079− seq_printf(seq, "cycle count: %i\n", battery->cycle_count);
1080− seq_printf(seq, "capacity granularity 1: %d %sh\n",
1081− battery->capacity_granularity_1,
1082− acpi_battery_units(battery));
1083− seq_printf(seq, "capacity granularity 2: %d %sh\n",
1084− battery->capacity_granularity_2,
1085− acpi_battery_units(battery));
1086− seq_printf(seq, "model number: %s\n", battery->model_number);
1087− seq_printf(seq, "serial number: %s\n", battery->serial_number);
1088− seq_printf(seq, "battery type: %s\n", battery->type);
1089− seq_printf(seq, "OEM info: %s\n", battery->oem_info);
1090− end:
1091− if (result)
1092− seq_printf(seq, "ERROR: Unable to read battery info\n");
1093− return result;
1094−}
1095−
1096−static int acpi_battery_state_proc_show(struct seq_file *seq, void *offset)
1097−{
1098− struct acpi_battery *battery = seq->private;
1099− int result = acpi_battery_update(battery, false);
1100−
1101− if (result)
1102− goto end;
1103−
1104− seq_printf(seq, "present: %s\n",
1105− acpi_battery_present(battery) ? "yes" : "no");
1106− if (!acpi_battery_present(battery))
1107− goto end;
1108−
1109− seq_printf(seq, "capacity state: %s\n",
1110− (battery->state & 0x04) ? "critical" : "ok");
1111− if ((battery->state & 0x01) && (battery->state & 0x02))
1112− seq_printf(seq,
1113− "charging state: charging/discharging\n");
1114− else if (battery->state & 0x01)
1115− seq_printf(seq, "charging state: discharging\n");
1116− else if (battery->state & 0x02)
1117− seq_printf(seq, "charging state: charging\n");
1118− else
1119− seq_printf(seq, "charging state: charged\n");
1120−
1121− if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
1122− seq_printf(seq, "present rate: unknown\n");
1123− else
1124− seq_printf(seq, "present rate: %d %s\n",
1125− battery->rate_now, acpi_battery_units(battery));
1126−
1127− if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN)
1128− seq_printf(seq, "remaining capacity: unknown\n");
1129− else
1130− seq_printf(seq, "remaining capacity: %d %sh\n",
1131− battery->capacity_now, acpi_battery_units(battery));
1132− if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN)
1133− seq_printf(seq, "present voltage: unknown\n");
1134− else
1135− seq_printf(seq, "present voltage: %d mV\n",
1136− battery->voltage_now);
1137− end:
1138− if (result)
1139− seq_printf(seq, "ERROR: Unable to read battery state\n");
1140−
1141− return result;
1142−}
1143−
1144−static int acpi_battery_alarm_proc_show(struct seq_file *seq, void *offset)
1145−{
1146− struct acpi_battery *battery = seq->private;
1147− int result = acpi_battery_update(battery, false);
1148−
1149− if (result)
1150− goto end;
1151−
1152− if (!acpi_battery_present(battery)) {
1153− seq_printf(seq, "present: no\n");
1154− goto end;
1155− }
1156− seq_printf(seq, "alarm: ");
1157− if (battery->alarm) {
1158− seq_printf(seq, "%u %sh\n", battery->alarm,
1159− acpi_battery_units(battery));
1160− } else {
1161− seq_printf(seq, "unsupported\n");
1162− }
1163− end:
1164− if (result)
1165− seq_printf(seq, "ERROR: Unable to read battery alarm\n");
1166− return result;
1167−}
1168−
1169−static ssize_t acpi_battery_write_alarm(struct file *file,
1170− const char __user * buffer,
1171− size_t count, loff_t * ppos)
1172−{
1173− int result = 0;
1174− char alarm_string[12] = { '\0' };
1175− struct seq_file *m = file->private_data;
1176− struct acpi_battery *battery = m->private;
1177−
1178− if (!battery || (count > sizeof(alarm_string) - 1))
1179− return -EINVAL;
1180− if (!acpi_battery_present(battery)) {
1181− result = -ENODEV;
1182− goto end;
1183− }
1184− if (copy_from_user(alarm_string, buffer, count)) {
1185− result = -EFAULT;
1186− goto end;
1187− }
1188− alarm_string[count] = '\0';
1189− if (kstrtoint(alarm_string, 0, &battery->alarm)) {
1190− result = -EINVAL;
1191− goto end;
1192− }
1193− result = acpi_battery_set_alarm(battery);
1194− end:
1195− if (result)
1196− return result;
1197− return count;
1198−}
1199−
1200−static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file)
1201−{
1202− return single_open(file, acpi_battery_alarm_proc_show, PDE_DATA(inode));
1203−}
1204−
1205−static const struct proc_ops acpi_battery_alarm_proc_ops = {
1206− .proc_open = acpi_battery_alarm_proc_open,
1207− .proc_read = seq_read,
1208− .proc_write = acpi_battery_write_alarm,
1209− .proc_lseek = seq_lseek,
1210− .proc_release = single_release,
1211−};
1212−
1213−static int acpi_battery_add_fs(struct acpi_device *device)
1214−{
1215− pr_warn(PREFIX "Deprecated procfs I/F for battery is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
1216− if (!acpi_device_dir(device)) {
1217− acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1218− acpi_battery_dir);
1219− if (!acpi_device_dir(device))
1220− return -ENODEV;
1221− }
1222−
1223− if (!proc_create_single_data("info", S_IRUGO, acpi_device_dir(device),
1224− acpi_battery_info_proc_show, acpi_driver_data(device)))
1225− return -ENODEV;
1226− if (!proc_create_single_data("state", S_IRUGO, acpi_device_dir(device),
1227− acpi_battery_state_proc_show, acpi_driver_data(device)))
1228− return -ENODEV;
1229− if (!proc_create_data("alarm", S_IFREG | S_IRUGO | S_IWUSR,
1230− acpi_device_dir(device), &acpi_battery_alarm_proc_ops,
1231− acpi_driver_data(device)))
1232− return -ENODEV;
1233− return 0;
1234−}
1235−
1236−static void acpi_battery_remove_fs(struct acpi_device *device)
1237−{
1238− if (!acpi_device_dir(device))
1239− return;
1240− remove_proc_subtree(acpi_device_bid(device), acpi_battery_dir);
1241− acpi_device_dir(device) = NULL;
1242−}
1243−
1244−#endif
1245−
12461015 /* --------------------------------------------------------------------------
12471016 Driver Interface
12481017 -------------------------------------------------------------------------- */
@@ -1432,14 +1201,6 @@ static int acpi_battery_add(struct acpi_device *device) · 183 unmodified lines
14321201 if (result)
14331202 goto fail;
14341203
1435−#ifdef CONFIG_ACPI_PROCFS_POWER
1436− result = acpi_battery_add_fs(device);
1437− if (result) {
1438− acpi_battery_remove_fs(device);
1439− goto fail;
1440− }
1441−#endif
1442−
14431204 pr_info(PREFIX "%s Slot [%s] (battery %s)\n",
14441205 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
14451206 device->status.battery_present ? "present" : "absent");
@@ -1468,9 +1229,6 @@ static int acpi_battery_remove(struct acpi_device *device) · 22 unmodified lines
14681229 device_init_wakeup(&device->dev, 0);
14691230 battery = acpi_driver_data(device);
14701231 unregister_pm_notifier(&battery->pm_nb);
1471−#ifdef CONFIG_ACPI_PROCFS_POWER
1472− acpi_battery_remove_fs(device);
1473−#endif
14741232 sysfs_remove_battery(battery);
14751233 mutex_destroy(&battery->lock);
14761234 mutex_destroy(&battery->sysfs_lock);
@@ -1531,16 +1289,7 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) · 54 unmodified lines
15311289 }
15321290 }
15331291
1534−#ifdef CONFIG_ACPI_PROCFS_POWER
1535− acpi_battery_dir = acpi_lock_battery_dir();
1536− if (!acpi_battery_dir)
1537− return;
1538−#endif
15391292 result = acpi_bus_register_driver(&acpi_battery_driver);
1540−#ifdef CONFIG_ACPI_PROCFS_POWER
1541− if (result < 0)
1542− acpi_unlock_battery_dir(acpi_battery_dir);
1543−#endif
15441293 battery_driver_registered = (result == 0);
15451294 }
15461295
@@ -1560,10 +1309,6 @@ static void __exit acpi_battery_exit(void) · 13 unmodified lines
15601309 acpi_bus_unregister_driver(&acpi_battery_driver);
15611310 battery_hook_exit();
15621311 }
1563−#ifdef CONFIG_ACPI_PROCFS_POWER
1564− if (acpi_battery_dir)
1565− acpi_unlock_battery_dir(acpi_battery_dir);
1566−#endif
15671312 }
15681313
15691314 module_init(acpi_battery_init);
drivers/acpi/button.c+1−1
@@ -405,7 +405,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) · 404 unmodified lines
405405 switch (event) {
406406 case ACPI_FIXED_HARDWARE_EVENT:
407407 event = ACPI_BUTTON_NOTIFY_STATUS;
408− /* fall through */
408+ fallthrough;
409409 case ACPI_BUTTON_NOTIFY_STATUS:
410410 input = button->input;
411411 if (button->type == ACPI_BUTTON_TYPE_LID) {
drivers/acpi/cm_sbs.c+0−87
@@ -1,87 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-or-later
2−
3−#include <linux/kernel.h>
4−#include <linux/module.h>
5−#include <linux/init.h>
6−#include <linux/acpi.h>
7−#include <linux/types.h>
8−#include <linux/proc_fs.h>
9−#include <linux/seq_file.h>
10−#include <acpi/acpi_bus.h>
11−#include <acpi/acpi_drivers.h>
12−
13−#define PREFIX "ACPI: "
14−
15−ACPI_MODULE_NAME("cm_sbs");
16−#define ACPI_AC_CLASS "ac_adapter"
17−#define ACPI_BATTERY_CLASS "battery"
18−#define _COMPONENT ACPI_SBS_COMPONENT
19−static struct proc_dir_entry *acpi_ac_dir;
20−static struct proc_dir_entry *acpi_battery_dir;
21−
22−static DEFINE_MUTEX(cm_sbs_mutex);
23−
24−static int lock_ac_dir_cnt;
25−static int lock_battery_dir_cnt;
26−
27−struct proc_dir_entry *acpi_lock_ac_dir(void)
28−{
29− mutex_lock(&cm_sbs_mutex);
30− if (!acpi_ac_dir)
31− acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
32− if (acpi_ac_dir) {
33− lock_ac_dir_cnt++;
34− } else {
35− printk(KERN_ERR PREFIX
36− "Cannot create %s\n", ACPI_AC_CLASS);
37− }
38− mutex_unlock(&cm_sbs_mutex);
39− return acpi_ac_dir;
40−}
41−EXPORT_SYMBOL(acpi_lock_ac_dir);
42−
43−void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param)
44−{
45− mutex_lock(&cm_sbs_mutex);
46− if (acpi_ac_dir_param)
47− lock_ac_dir_cnt--;
48− if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) {
49− remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
50− acpi_ac_dir = NULL;
51− }
52− mutex_unlock(&cm_sbs_mutex);
53−}
54−EXPORT_SYMBOL(acpi_unlock_ac_dir);
55−
56−struct proc_dir_entry *acpi_lock_battery_dir(void)
57−{
58− mutex_lock(&cm_sbs_mutex);
59− if (!acpi_battery_dir) {
60− acpi_battery_dir =
61− proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
62− }
63− if (acpi_battery_dir) {
64− lock_battery_dir_cnt++;
65− } else {
66− printk(KERN_ERR PREFIX
67− "Cannot create %s\n", ACPI_BATTERY_CLASS);
68− }
69− mutex_unlock(&cm_sbs_mutex);
70− return acpi_battery_dir;
71−}
72−EXPORT_SYMBOL(acpi_lock_battery_dir);
73−
74−void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param)
75−{
76− mutex_lock(&cm_sbs_mutex);
77− if (acpi_battery_dir_param)
78− lock_battery_dir_cnt--;
79− if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param
80− && acpi_battery_dir) {
81− remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
82− acpi_battery_dir = NULL;
83− }
84− mutex_unlock(&cm_sbs_mutex);
85− return;
86−}
87−EXPORT_SYMBOL(acpi_unlock_battery_dir);
drivers/acpi/dock.c+1−1
@@ -469,7 +469,7 @@ int dock_notify(struct acpi_device *adev, u32 event) · 468 unmodified lines
469469 surprise_removal = 1;
470470 event = ACPI_NOTIFY_EJECT_REQUEST;
471471 /* Fall back */
472− /* fall through */
472+ fallthrough;
473473 case ACPI_NOTIFY_EJECT_REQUEST:
474474 begin_undock(ds);
475475 if ((immediate_undock && !(ds->flags & DOCK_IS_ATA))
drivers/acpi/ec.c+4−4
@@ -2059,13 +2059,13 @@ static int param_get_event_clearing(char *buffer, · 2058 unmodified lines
20592059 {
20602060 switch (ec_event_clearing) {
20612061 case ACPI_EC_EVT_TIMING_STATUS:
2062− return sprintf(buffer, "status");
2062+ return sprintf(buffer, "status\n");
20632063 case ACPI_EC_EVT_TIMING_QUERY:
2064− return sprintf(buffer, "query");
2064+ return sprintf(buffer, "query\n");
20652065 case ACPI_EC_EVT_TIMING_EVENT:
2066− return sprintf(buffer, "event");
2066+ return sprintf(buffer, "event\n");
20672067 default:
2068− return sprintf(buffer, "invalid");
2068+ return sprintf(buffer, "invalid\n");
20692069 }
20702070 return 0;
20712071 }
drivers/acpi/evged.c+1−1
@@ -106,7 +106,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares, · 105 unmodified lines
106106
107107 if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
108108 break;
109− /* fall through */
109+ fallthrough;
110110 default:
111111 if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle)))
112112 break;
drivers/acpi/nfit/nfit.h+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 /* ACPI 6.1 */
1717 #define UUID_NFIT_BUS "2f10e7a4-9e91-11e4-89d3-123b93f75cba"
1818
19−/* http://pmem.io/documents/NVDIMM_DSM_Interface-V1.6.pdf */
19+/* https://pmem.io/documents/NVDIMM_DSM_Interface-V1.6.pdf */
2020 #define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66"
2121
2222 /* https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/ */
drivers/acpi/numa/srat.c+1−9
@@ -230,7 +230,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) · 229 unmodified lines
230230 pxm &= 0xff;
231231
232232 node = acpi_map_pxm_to_node(pxm);
233− if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) {
233+ if (node == NUMA_NO_NODE) {
234234 pr_err("SRAT: Too many proximity domains.\n");
235235 goto out_err_bad_srat;
236236 }
@@ -291,8 +291,6 @@ acpi_parse_x2apic_affinity(union acpi_subtable_headers *header, · 54 unmodified lines
291291 struct acpi_srat_x2apic_cpu_affinity *processor_affinity;
292292
293293 processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header;
294− if (!processor_affinity)
295− return -EINVAL;
296294
297295 acpi_table_print_srat_entry(&header->common);
298296
@@ -309,8 +307,6 @@ acpi_parse_processor_affinity(union acpi_subtable_headers *header, · 10 unmodified lines
309307 struct acpi_srat_cpu_affinity *processor_affinity;
310308
311309 processor_affinity = (struct acpi_srat_cpu_affinity *)header;
312− if (!processor_affinity)
313− return -EINVAL;
314310
315311 acpi_table_print_srat_entry(&header->common);
316312
@@ -327,8 +323,6 @@ acpi_parse_gicc_affinity(union acpi_subtable_headers *header, · 10 unmodified lines
327323 struct acpi_srat_gicc_affinity *processor_affinity;
328324
329325 processor_affinity = (struct acpi_srat_gicc_affinity *)header;
330− if (!processor_affinity)
331− return -EINVAL;
332326
333327 acpi_table_print_srat_entry(&header->common);
334328
@@ -347,8 +341,6 @@ acpi_parse_memory_affinity(union acpi_subtable_headers * header, · 12 unmodified lines
347341 struct acpi_srat_mem_affinity *memory_affinity;
348342
349343 memory_affinity = (struct acpi_srat_mem_affinity *)header;
350− if (!memory_affinity)
351− return -EINVAL;
352344
353345 acpi_table_print_srat_entry(&header->common);
354346
drivers/acpi/osl.c+36−27
@@ -77,7 +77,10 @@ struct acpi_ioremap { · 76 unmodified lines
7777 void __iomem *virt;
7878 acpi_physical_address phys;
7979 acpi_size size;
80− unsigned long refcount;
80+ union {
81+ unsigned long refcount;
82+ struct rcu_work rwork;
83+ } track;
8184 };
8285
8386 static LIST_HEAD(acpi_ioremaps);
@@ -250,7 +253,7 @@ void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size) · 166 unmodified lines
250253 map = acpi_map_lookup(phys, size);
251254 if (map) {
252255 virt = map->virt + (phys - map->phys);
253− map->refcount++;
256+ map->track.refcount++;
254257 }
255258 mutex_unlock(&acpi_ioremap_lock);
256259 return virt;
@@ -335,7 +338,7 @@ void __iomem __ref · 78 unmodified lines
335338 /* Check if there's a suitable mapping already. */
336339 map = acpi_map_lookup(phys, size);
337340 if (map) {
338− map->refcount++;
341+ map->track.refcount++;
339342 goto out;
340343 }
341344
@@ -358,7 +361,7 @@ void __iomem __ref · 16 unmodified lines
358361 map->virt = virt;
359362 map->phys = pg_off;
360363 map->size = pg_sz;
361− map->refcount = 1;
364+ map->track.refcount = 1;
362365
363366 list_add_tail_rcu(&map->list, &acpi_ioremaps);
364367
@@ -374,21 +377,26 @@ void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size) · 9 unmodified lines
374377 }
375378 EXPORT_SYMBOL_GPL(acpi_os_map_memory);
376379
377−/* Must be called with mutex_lock(&acpi_ioremap_lock) */
378−static unsigned long acpi_os_drop_map_ref(struct acpi_ioremap *map)
380+static void acpi_os_map_remove(struct work_struct *work)
379381 {
380− unsigned long refcount = --map->refcount;
382+ struct acpi_ioremap *map = container_of(to_rcu_work(work),
383+ struct acpi_ioremap,
384+ track.rwork);
381385
382− if (!refcount)
383− list_del_rcu(&map->list);
384− return refcount;
386+ acpi_unmap(map->phys, map->virt);
387+ kfree(map);
385388 }
386389
387−static void acpi_os_map_cleanup(struct acpi_ioremap *map)
390+/* Must be called with mutex_lock(&acpi_ioremap_lock) */
391+static void acpi_os_drop_map_ref(struct acpi_ioremap *map)
388392 {
389− synchronize_rcu_expedited();
390− acpi_unmap(map->phys, map->virt);
391− kfree(map);
393+ if (--map->track.refcount)
394+ return;
395+
396+ list_del_rcu(&map->list);
397+
398+ INIT_RCU_WORK(&map->track.rwork, acpi_os_map_remove);
399+ queue_rcu_work(system_wq, &map->track.rwork);
392400 }
393401
394402 /**
@@ -397,8 +405,8 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) · 2 unmodified lines
397405 * @size: Size of the address range to drop a reference to.
398406 *
399407 * Look up the given virtual address range in the list of existing ACPI memory
400− * mappings, drop a reference to it and unmap it if there are no more active
401− * references to it.
408+ * mappings, drop a reference to it and if there are no more active references
409+ * to it, queue it up for later removal.
402410 *
403411 * During early init (when acpi_permanent_mmap has not been set yet) this
404412 * routine simply calls __acpi_unmap_table() to get the job done. Since
@@ -408,7 +416,6 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) · 3 unmodified lines
408416 void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size)
409417 {
410418 struct acpi_ioremap *map;
411− unsigned long refcount;
412419
413420 if (!acpi_permanent_mmap) {
414421 __acpi_unmap_table(virt, size);
@@ -416,23 +423,27 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) · 1 unmodified line
416423 }
417424
418425 mutex_lock(&acpi_ioremap_lock);
426+
419427 map = acpi_map_lookup_virt(virt, size);
420428 if (!map) {
421429 mutex_unlock(&acpi_ioremap_lock);
422430 WARN(true, PREFIX "%s: bad address %p\n", __func__, virt);
423431 return;
424432 }
425− refcount = acpi_os_drop_map_ref(map);
426− mutex_unlock(&acpi_ioremap_lock);
433+ acpi_os_drop_map_ref(map);
427434
428− if (!refcount)
429− acpi_os_map_cleanup(map);
435+ mutex_unlock(&acpi_ioremap_lock);
430436 }
431437 EXPORT_SYMBOL_GPL(acpi_os_unmap_iomem);
432438
439+/**
440+ * acpi_os_unmap_memory - Drop a memory mapping reference.
441+ * @virt: Start of the address range to drop a reference to.
442+ * @size: Size of the address range to drop a reference to.
443+ */
433444 void __ref acpi_os_unmap_memory(void *virt, acpi_size size)
434445 {
435− return acpi_os_unmap_iomem((void __iomem *)virt, size);
446+ acpi_os_unmap_iomem((void __iomem *)virt, size);
436447 }
437448 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
438449
@@ -461,7 +472,6 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) · 22 unmodified lines
461472 {
462473 u64 addr;
463474 struct acpi_ioremap *map;
464− unsigned long refcount;
465475
466476 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
467477 return;
@@ -472,16 +482,15 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) · 4 unmodified lines
472482 return;
473483
474484 mutex_lock(&acpi_ioremap_lock);
485+
475486 map = acpi_map_lookup(addr, gas->bit_width / 8);
476487 if (!map) {
477488 mutex_unlock(&acpi_ioremap_lock);
478489 return;
479490 }
480− refcount = acpi_os_drop_map_ref(map);
481− mutex_unlock(&acpi_ioremap_lock);
491+ acpi_os_drop_map_ref(map);
482492
483− if (!refcount)
484− acpi_os_map_cleanup(map);
493+ mutex_unlock(&acpi_ioremap_lock);
485494 }
486495 EXPORT_SYMBOL(acpi_os_unmap_generic_address);
487496
drivers/acpi/processor_idle.c+1−2
@@ -203,8 +203,7 @@ static void tsc_check_state(int state) · 202 unmodified lines
203203 */
204204 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
205205 return;
206−
207− /*FALL THROUGH*/
206+ fallthrough;
208207 default:
209208 /* TSC could halt in idle, so notify users */
210209 if (state > ACPI_STATE_C1)
drivers/acpi/property.c+2−12
@@ -606,13 +606,7 @@ static struct fwnode_handle * · 605 unmodified lines
606606 acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
607607 const char *childname)
608608 {
609− char name[ACPI_PATH_SEGMENT_LENGTH];
610609 struct fwnode_handle *child;
611− struct acpi_buffer path;
612− acpi_status status;
613−
614− path.length = sizeof(name);
615− path.pointer = name;
616610
617611 fwnode_for_each_child_node(fwnode, child) {
618612 if (is_acpi_data_node(child)) {
@@ -621,12 +615,8 @@ acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode, · 2 unmodified lines
621615 continue;
622616 }
623617
624− status = acpi_get_name(ACPI_HANDLE_FWNODE(child),
625− ACPI_SINGLE_NAME, &path);
626− if (ACPI_FAILURE(status))
627− break;
628−
629− if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
618+ if (!strncmp(acpi_device_bid(to_acpi_device_node(child)),
619+ childname, ACPI_NAMESEG_SIZE))
630620 return child;
631621 }
632622
drivers/acpi/resource.c+1−1
@@ -373,7 +373,7 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity) · 372 unmodified lines
373373 case ACPI_ACTIVE_BOTH:
374374 if (triggering == ACPI_EDGE_SENSITIVE)
375375 return IRQ_TYPE_EDGE_BOTH;
376− /* fall through */
376+ fallthrough;
377377 default:
378378 return IRQ_TYPE_NONE;
379379 }
drivers/acpi/spcr.c+2−2
@@ -111,7 +111,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) · 110 unmodified lines
111111 table->serial_port.access_width))) {
112112 default:
113113 pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
114− /* fall through */
114+ fallthrough;
115115 case 8:
116116 iotype = "mmio";
117117 break;
@@ -128,7 +128,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) · 10 unmodified lines
128128 switch (table->interface_type) {
129129 case ACPI_DBG2_ARM_SBSA_32BIT:
130130 iotype = "mmio32";
131− /* fall through */
131+ fallthrough;
132132 case ACPI_DBG2_ARM_PL011:
133133 case ACPI_DBG2_ARM_SBSA_GENERIC:
134134 case ACPI_DBG2_BCM2835:
drivers/acpi/sysfs.c+6−6
@@ -214,7 +214,7 @@ static int param_set_trace_method_name(const char *val, · 213 unmodified lines
214214
215215 static int param_get_trace_method_name(char *buffer, const struct kernel_param *kp)
216216 {
217− return scnprintf(buffer, PAGE_SIZE, "%s", acpi_gbl_trace_method_name);
217+ return scnprintf(buffer, PAGE_SIZE, "%s\n", acpi_gbl_trace_method_name);
218218 }
219219
220220 static const struct kernel_param_ops param_ops_trace_method = {
@@ -271,15 +271,15 @@ static int param_set_trace_state(const char *val, · 50 unmodified lines
271271 static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
272272 {
273273 if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED))
274− return sprintf(buffer, "disable");
274+ return sprintf(buffer, "disable\n");
275275 else {
276276 if (acpi_gbl_trace_method_name) {
277277 if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
278− return sprintf(buffer, "method-once");
278+ return sprintf(buffer, "method-once\n");
279279 else
280− return sprintf(buffer, "method");
280+ return sprintf(buffer, "method\n");
281281 } else
282− return sprintf(buffer, "enable");
282+ return sprintf(buffer, "enable\n");
283283 }
284284 return 0;
285285 }
@@ -302,7 +302,7 @@ static int param_get_acpica_version(char *buffer, · 16 unmodified lines
302302 {
303303 int result;
304304
305− result = sprintf(buffer, "%x", ACPI_CA_VERSION);
305+ result = sprintf(buffer, "%x\n", ACPI_CA_VERSION);
306306
307307 return result;
308308 }
drivers/acpi/tables.c+7−18
@@ -292,20 +292,6 @@ static int __init acpi_parse_entries_array(char *id, unsigned long table_size, · 291 unmodified lines
292292 int errs = 0;
293293 int i;
294294
295− if (acpi_disabled)
296− return -ENODEV;
297−
298− if (!id)
299− return -EINVAL;
300−
301− if (!table_size)
302− return -EINVAL;
303−
304− if (!table_header) {
305− pr_warn("%4.4s not present\n", id);
306− return -ENODEV;
307− }
308−
309295 table_end = (unsigned long)table_header + table_header->length;
310296
311297 /* Parse all entries looking for a match. */
@@ -371,6 +357,9 @@ int __init acpi_table_parse_entries_array(char *id, · 59 unmodified lines
371357 if (!id)
372358 return -EINVAL;
373359
360+ if (!table_size)
361+ return -EINVAL;
362+
374363 if (!strncmp(id, ACPI_SIG_MADT, 4))
375364 instance = acpi_apic_instance;
376365
@@ -490,7 +479,7 @@ static u8 __init acpi_table_checksum(u8 *buffer, u32 length) · 113 unmodified lines
490479 }
491480
492481 /* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */
493−static const char * const table_sigs[] = {
482+static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst = {
494483 ACPI_SIG_BERT, ACPI_SIG_BGRT, ACPI_SIG_CPEP, ACPI_SIG_ECDT,
495484 ACPI_SIG_EINJ, ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT,
496485 ACPI_SIG_MSCT, ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT,
@@ -501,7 +490,7 @@ static const char * const table_sigs[] = { · 4 unmodified lines
501490 ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT,
502491 ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT,
503492 ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT,
504− ACPI_SIG_NHLT, NULL };
493+ ACPI_SIG_NHLT };
505494
506495 #define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)
507496
@@ -548,11 +537,11 @@ void __init acpi_table_upgrade(void) · 40 unmodified lines
548537
549538 table = file.data;
550539
551− for (sig = 0; table_sigs[sig]; sig++)
540+ for (sig = 0; sig < ARRAY_SIZE(table_sigs); sig++)
552541 if (!memcmp(table->signature, table_sigs[sig], 4))
553542 break;
554543
555− if (!table_sigs[sig]) {
544+ if (sig >= ARRAY_SIZE(table_sigs)) {
556545 pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n",
557546 cpio_path, file.name);
558547 continue;
drivers/pci/hotplug/acpiphp_glue.c+11−3
@@ -122,13 +122,21 @@ static struct acpiphp_context *acpiphp_grab_context(struct acpi_device *adev) · 121 unmodified lines
122122 struct acpiphp_context *context;
123123
124124 acpi_lock_hp_context();
125+
125126 context = acpiphp_get_context(adev);
126− if (!context || context->func.parent->is_going_away) {
127− acpi_unlock_hp_context();
128− return NULL;
127+ if (!context)
128+ goto unlock;
129+
130+ if (context->func.parent->is_going_away) {
131+ acpiphp_put_context(context);
132+ context = NULL;
133+ goto unlock;
129134 }
135+
130136 get_bridge(context->func.parent);
131137 acpiphp_put_context(context);
138+
139+unlock:
132140 acpi_unlock_hp_context();
133141 return context;
134142 }
drivers/pci/pci-acpi.c+3−3
@@ -527,8 +527,8 @@ static void program_hpx_type3_register(struct pci_dev *dev, · 526 unmodified lines
527527 return;
528528
529529 break;
530− case HPX_CFG_VEND_CAP: /* Fall through */
531− case HPX_CFG_DVSEC: /* Fall through */
530+ case HPX_CFG_VEND_CAP:
531+ case HPX_CFG_DVSEC:
532532 default:
533533 pci_warn(dev, "Encountered _HPX type 3 with unsupported config space location");
534534 return;
@@ -1001,7 +1001,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 466 unmodified lines
10011001 error = -EBUSY;
10021002 break;
10031003 }
1004− /* Fall through */
1004+ fallthrough;
10051005 case PCI_D0:
10061006 case PCI_D1:
10071007 case PCI_D2:
include/acpi/acpixf.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212
1313 /* Current ACPICA subsystem version in YYYYMMDD format */
1414
15−#define ACPI_CA_VERSION 0x20200528
15+#define ACPI_CA_VERSION 0x20200717
1616
1717 #include <acpi/acconfig.h>
1818 #include <acpi/actypes.h>
include/acpi/actypes.h+10−4
@@ -1146,7 +1146,7 @@ struct acpi_pnp_device_id { · 1145 unmodified lines
11461146 struct acpi_pnp_device_id_list {
11471147 u32 count; /* Number of IDs in Ids array */
11481148 u32 list_size; /* Size of list, including ID strings */
1149− struct acpi_pnp_device_id ids[1]; /* ID array */
1149+ struct acpi_pnp_device_id ids[]; /* ID array */
11501150 };
11511151
11521152 /*
@@ -1201,12 +1201,18 @@ struct acpi_pci_id { · 48 unmodified lines
12011201 u16 function;
12021202 };
12031203
1204+struct acpi_mem_mapping {
1205+ acpi_physical_address physical_address;
1206+ u8 *logical_address;
1207+ acpi_size length;
1208+ struct acpi_mem_mapping *next_mm;
1209+};
1210+
12041211 struct acpi_mem_space_context {
12051212 u32 length;
12061213 acpi_physical_address address;
1207− acpi_physical_address mapped_physical_address;
1208− u8 *mapped_logical_address;
1209− acpi_size mapped_length;
1214+ struct acpi_mem_mapping *cur_mm;
1215+ struct acpi_mem_mapping *first_mm;
12101216 };
12111217
12121218 /*
include/linux/tboot.h+1−1
@@ -44,7 +44,7 @@ struct tboot_acpi_generic_address { · 43 unmodified lines
4444
4545 /*
4646 * combines Sx info from FADT and FACS tables per ACPI 2.0+ spec
47− * (http://www.acpi.info/)
47+ * (https://uefi.org/specifications)
4848 */
4949 struct tboot_acpi_sleep_info {
5050 struct tboot_acpi_generic_address pm1a_cnt_blk;
tools/power/cpupower/man/cpupower-idle-info.1+1−1
@@ -75,7 +75,7 @@ By default only values of core zero are displayed. How to display settings of · 74 unmodified lines
7575 other cores is described in the cpupower(1) manpage in the \-\-cpu option
7676 section.
7777 .SH REFERENCES
78−http://www.acpi.info/spec.htm
78+https://uefi.org/specifications
7979 .SH "FILES"
8080 .nf
8181 \fI/sys/devices/system/cpu/cpu*/cpuidle/state*\fP

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t