* acpi-mm: 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-tables: 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() ACPI: tables: avoid relocations for table signature array * acpi-apei: ACPI: APEI: remove redundant assignment to variable rc * acpi-misc: ACPI: Replace HTTP links with HTTPS ones ACPI: Use valid link to the ACPI specification ACPI: Use fallthrough pseudo-keyword
Unified · Split
| @@ -96,5 +96,5 @@ contents. · 95 unmodified lines | ||
| 96 | 96 | References |
| 97 | 97 | ========== |
| 98 | 98 | |
| 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 | |
| @@ -85,9 +85,9 @@ References · 84 unmodified lines | ||
| 85 | 85 | ========== |
| 86 | 86 | |
| 87 | 87 | [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>, | |
| 89 | 89 | referenced 2018-07-17. |
| 90 | 90 | |
| 91 | 91 | [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>, | |
| 93 | 93 | referenced 2016-10-04. |
| @@ -154,23 +154,23 @@ References · 153 unmodified lines | ||
| 154 | 154 | ========== |
| 155 | 155 | |
| 156 | 156 | [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, | |
| 158 | 158 | referenced 2016-10-03. |
| 159 | 159 | |
| 160 | −[2] Devicetree. http://www.devicetree.org, referenced 2016-10-03. | |
| 160 | +[2] Devicetree. https://www.devicetree.org, referenced 2016-10-03. | |
| 161 | 161 | |
| 162 | 162 | [3] Documentation/devicetree/bindings/graph.txt |
| 163 | 163 | |
| 164 | 164 | [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, | |
| 166 | 166 | referenced 2016-10-04. |
| 167 | 167 | |
| 168 | 168 | [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, | |
| 170 | 170 | referenced 2016-10-04. |
| 171 | 171 | |
| 172 | 172 | [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, | |
| 174 | 174 | referenced 2016-10-04. |
| 175 | 175 | |
| 176 | 176 | [7] _DSD Device Properties Usage Rules. |
| @@ -90,7 +90,7 @@ where · 89 unmodified lines | ||
| 90 | 90 | References |
| 91 | 91 | ========== |
| 92 | 92 | |
| 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. | |
| 94 | 94 | |
| 95 | 95 | [2] Advanced Configuration and Power Interface Specification. |
| 96 | 96 | <URL:https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf>, |
| @@ -101,11 +101,11 @@ References · 4 unmodified lines | ||
| 101 | 101 | [4] Documentation/devicetree/bindings/media/video-interfaces.txt |
| 102 | 102 | |
| 103 | 103 | [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>, | |
| 105 | 105 | referenced 2019-02-21. |
| 106 | 106 | |
| 107 | 107 | [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>, | |
| 109 | 109 | referenced 2019-02-21. |
| 110 | 110 | |
| 111 | 111 | [7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst |
| @@ -7,7 +7,7 @@ Low Power Idle Table (LPIT) · 6 unmodified lines | ||
| 7 | 7 | To enumerate platform Low Power Idle states, Intel platforms are using |
| 8 | 8 | “Low Power Idle Table” (LPIT). More details about this table can be |
| 9 | 9 | 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 | |
| 11 | 11 | |
| 12 | 12 | Residencies for each low power state can be read via FFH |
| 13 | 13 | (Function fixed hardware) or a memory mapped interface. |
| @@ -9,7 +9,7 @@ Supported systems: · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | Prefix: 'power_meter' |
| 11 | 11 | |
| 12 | − Datasheet: http://acpi.info/, section 10.4. | |
| 12 | + Datasheet: https://uefi.org/specifications, section 10.4. | |
| 13 | 13 | |
| 14 | 14 | Author: Darrick J. Wong |
| 15 | 15 | |
| @@ -32,7 +32,7 @@ menuconfig ACPI · 31 unmodified lines | ||
| 32 | 32 | Linux support for ACPI is based on Intel Corporation's ACPI |
| 33 | 33 | Component Architecture (ACPI CA). For more information on the |
| 34 | 34 | ACPI CA, see: |
| 35 | − <http://acpica.org/> | |
| 35 | + <https://acpica.org/> | |
| 36 | 36 | |
| 37 | 37 | ACPI is an open industry specification originally co-developed by |
| 38 | 38 | Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. Currently, |
| @@ -40,8 +40,7 @@ menuconfig ACPI · 1 unmodified line | ||
| 40 | 40 | the UEFI Forum and any UEFI member can join the ASWG and contribute |
| 41 | 41 | to the ACPI specification. |
| 42 | 42 | The specification is available at: |
| 43 | − <http://www.acpi.info> | |
| 44 | − <http://www.uefi.org/acpi/specs> | |
| 43 | + <https://uefi.org/specifications> | |
| 45 | 44 | |
| 46 | 45 | if ACPI |
| 47 | 46 | |
| @@ -155,7 +155,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) · 154 unmodified lines | ||
| 155 | 155 | default: |
| 156 | 156 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 157 | 157 | "Unsupported event [0x%x]\n", event)); |
| 158 | − /* fall through */ | |
| 158 | + fallthrough; | |
| 159 | 159 | case ACPI_AC_NOTIFY_STATUS: |
| 160 | 160 | case ACPI_NOTIFY_BUS_CHECK: |
| 161 | 161 | case ACPI_NOTIFY_DEVICE_CHECK: |
| @@ -79,7 +79,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) · 78 unmodified lines | ||
| 79 | 79 | * PIIX4 models. |
| 80 | 80 | */ |
| 81 | 81 | errata.piix4.throttle = 1; |
| 82 | − /* fall through*/ | |
| 82 | + fallthrough; | |
| 83 | 83 | |
| 84 | 84 | case 2: /* PIIX4E */ |
| 85 | 85 | case 3: /* PIIX4M */ |
| @@ -38,6 +38,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, · 37 unmodified lines | ||
| 38 | 38 | union acpi_operand_object *region_desc = |
| 39 | 39 | (union acpi_operand_object *)handle; |
| 40 | 40 | struct acpi_mem_space_context *local_region_context; |
| 41 | + struct acpi_mem_mapping *mm; | |
| 41 | 42 | |
| 42 | 43 | ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); |
| 43 | 44 | |
| @@ -46,13 +47,14 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, · 2 unmodified lines | ||
| 46 | 47 | local_region_context = |
| 47 | 48 | (struct acpi_mem_space_context *)*region_context; |
| 48 | 49 | |
| 49 | − /* Delete a cached mapping if present */ | |
| 50 | + /* Delete memory mappings if present */ | |
| 50 | 51 | |
| 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); | |
| 56 | 58 | } |
| 57 | 59 | ACPI_FREE(local_region_context); |
| 58 | 60 | *region_context = NULL; |
| @@ -41,6 +41,7 @@ acpi_ex_system_memory_space_handler(u32 function, · 40 unmodified lines | ||
| 41 | 41 | acpi_status status = AE_OK; |
| 42 | 42 | void *logical_addr_ptr = NULL; |
| 43 | 43 | struct acpi_mem_space_context *mem_info = region_context; |
| 44 | + struct acpi_mem_mapping *mm = mem_info->cur_mm; | |
| 44 | 45 | u32 length; |
| 45 | 46 | acpi_size map_length; |
| 46 | 47 | acpi_size page_boundary_map_length; |
| @@ -96,20 +97,37 @@ acpi_ex_system_memory_space_handler(u32 function, · 49 unmodified lines | ||
| 96 | 97 | * Is 1) Address below the current mapping? OR |
| 97 | 98 | * 2) Address beyond the current mapping? |
| 98 | 99 | */ |
| 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)) { | |
| 103 | 102 | /* |
| 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. | |
| 106 | 108 | */ |
| 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; | |
| 108 | 115 | |
| 109 | − /* Valid mapping, delete it */ | |
| 116 | + if ((u64) address + length > | |
| 117 | + (u64) mm->physical_address + mm->length) | |
| 118 | + continue; | |
| 110 | 119 | |
| 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); | |
| 113 | 131 | } |
| 114 | 132 | |
| 115 | 133 | /* |
| @@ -143,29 +161,39 @@ acpi_ex_system_memory_space_handler(u32 function, · 27 unmodified lines | ||
| 143 | 161 | |
| 144 | 162 | /* Create a new mapping starting at the address given */ |
| 145 | 163 | |
| 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) { | |
| 149 | 166 | ACPI_ERROR((AE_INFO, |
| 150 | 167 | "Could not map memory at 0x%8.8X%8.8X, size %u", |
| 151 | 168 | ACPI_FORMAT_UINT64(address), |
| 152 | 169 | (u32)map_length)); |
| 153 | − mem_info->mapped_length = 0; | |
| 170 | + ACPI_FREE(mm); | |
| 154 | 171 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 155 | 172 | } |
| 156 | 173 | |
| 157 | 174 | /* Save the physical address and mapping size */ |
| 158 | 175 | |
| 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; | |
| 161 | 188 | } |
| 162 | 189 | |
| 190 | +access: | |
| 163 | 191 | /* |
| 164 | 192 | * Generate a logical pointer corresponding to the address we want to |
| 165 | 193 | * access |
| 166 | 194 | */ |
| 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); | |
| 169 | 197 | |
| 170 | 198 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 171 | 199 | "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", |
| @@ -227,7 +227,7 @@ __setup("hest_disable", setup_hest_disable); · 226 unmodified lines | ||
| 227 | 227 | void __init acpi_hest_init(void) |
| 228 | 228 | { |
| 229 | 229 | acpi_status status; |
| 230 | − int rc = -ENODEV; | |
| 230 | + int rc; | |
| 231 | 231 | unsigned int ghes_count = 0; |
| 232 | 232 | |
| 233 | 233 | if (hest_disable) { |
| @@ -405,7 +405,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) · 404 unmodified lines | ||
| 405 | 405 | switch (event) { |
| 406 | 406 | case ACPI_FIXED_HARDWARE_EVENT: |
| 407 | 407 | event = ACPI_BUTTON_NOTIFY_STATUS; |
| 408 | − /* fall through */ | |
| 408 | + fallthrough; | |
| 409 | 409 | case ACPI_BUTTON_NOTIFY_STATUS: |
| 410 | 410 | input = button->input; |
| 411 | 411 | if (button->type == ACPI_BUTTON_TYPE_LID) { |
| @@ -469,7 +469,7 @@ int dock_notify(struct acpi_device *adev, u32 event) · 468 unmodified lines | ||
| 469 | 469 | surprise_removal = 1; |
| 470 | 470 | event = ACPI_NOTIFY_EJECT_REQUEST; |
| 471 | 471 | /* Fall back */ |
| 472 | − /* fall through */ | |
| 472 | + fallthrough; | |
| 473 | 473 | case ACPI_NOTIFY_EJECT_REQUEST: |
| 474 | 474 | begin_undock(ds); |
| 475 | 475 | if ((immediate_undock && !(ds->flags & DOCK_IS_ATA)) |
| @@ -106,7 +106,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares, · 105 unmodified lines | ||
| 106 | 106 | |
| 107 | 107 | if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle))) |
| 108 | 108 | break; |
| 109 | − /* fall through */ | |
| 109 | + fallthrough; | |
| 110 | 110 | default: |
| 111 | 111 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle))) |
| 112 | 112 | break; |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | /* ACPI 6.1 */ |
| 17 | 17 | #define UUID_NFIT_BUS "2f10e7a4-9e91-11e4-89d3-123b93f75cba" |
| 18 | 18 | |
| 19 | −/* http://pmem.io/documents/NVDIMM_DSM_Interface-V1.6.pdf */ | |
| 19 | +/* https://pmem.io/documents/NVDIMM_DSM_Interface-V1.6.pdf */ | |
| 20 | 20 | #define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66" |
| 21 | 21 | |
| 22 | 22 | /* https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/ */ |
| @@ -230,7 +230,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) · 229 unmodified lines | ||
| 230 | 230 | pxm &= 0xff; |
| 231 | 231 | |
| 232 | 232 | node = acpi_map_pxm_to_node(pxm); |
| 233 | − if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { | |
| 233 | + if (node == NUMA_NO_NODE) { | |
| 234 | 234 | pr_err("SRAT: Too many proximity domains.\n"); |
| 235 | 235 | goto out_err_bad_srat; |
| 236 | 236 | } |
| @@ -291,8 +291,6 @@ acpi_parse_x2apic_affinity(union acpi_subtable_headers *header, · 54 unmodified lines | ||
| 291 | 291 | struct acpi_srat_x2apic_cpu_affinity *processor_affinity; |
| 292 | 292 | |
| 293 | 293 | processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header; |
| 294 | − if (!processor_affinity) | |
| 295 | − return -EINVAL; | |
| 296 | 294 | |
| 297 | 295 | acpi_table_print_srat_entry(&header->common); |
| 298 | 296 | |
| @@ -309,8 +307,6 @@ acpi_parse_processor_affinity(union acpi_subtable_headers *header, · 10 unmodified lines | ||
| 309 | 307 | struct acpi_srat_cpu_affinity *processor_affinity; |
| 310 | 308 | |
| 311 | 309 | processor_affinity = (struct acpi_srat_cpu_affinity *)header; |
| 312 | − if (!processor_affinity) | |
| 313 | − return -EINVAL; | |
| 314 | 310 | |
| 315 | 311 | acpi_table_print_srat_entry(&header->common); |
| 316 | 312 | |
| @@ -327,8 +323,6 @@ acpi_parse_gicc_affinity(union acpi_subtable_headers *header, · 10 unmodified lines | ||
| 327 | 323 | struct acpi_srat_gicc_affinity *processor_affinity; |
| 328 | 324 | |
| 329 | 325 | processor_affinity = (struct acpi_srat_gicc_affinity *)header; |
| 330 | − if (!processor_affinity) | |
| 331 | − return -EINVAL; | |
| 332 | 326 | |
| 333 | 327 | acpi_table_print_srat_entry(&header->common); |
| 334 | 328 | |
| @@ -347,8 +341,6 @@ acpi_parse_memory_affinity(union acpi_subtable_headers * header, · 12 unmodified lines | ||
| 347 | 341 | struct acpi_srat_mem_affinity *memory_affinity; |
| 348 | 342 | |
| 349 | 343 | memory_affinity = (struct acpi_srat_mem_affinity *)header; |
| 350 | − if (!memory_affinity) | |
| 351 | − return -EINVAL; | |
| 352 | 344 | |
| 353 | 345 | acpi_table_print_srat_entry(&header->common); |
| 354 | 346 | |
| @@ -77,7 +77,10 @@ struct acpi_ioremap { · 76 unmodified lines | ||
| 77 | 77 | void __iomem *virt; |
| 78 | 78 | acpi_physical_address phys; |
| 79 | 79 | acpi_size size; |
| 80 | − unsigned long refcount; | |
| 80 | + union { | |
| 81 | + unsigned long refcount; | |
| 82 | + struct rcu_work rwork; | |
| 83 | + } track; | |
| 81 | 84 | }; |
| 82 | 85 | |
| 83 | 86 | 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 | ||
| 250 | 253 | map = acpi_map_lookup(phys, size); |
| 251 | 254 | if (map) { |
| 252 | 255 | virt = map->virt + (phys - map->phys); |
| 253 | − map->refcount++; | |
| 256 | + map->track.refcount++; | |
| 254 | 257 | } |
| 255 | 258 | mutex_unlock(&acpi_ioremap_lock); |
| 256 | 259 | return virt; |
| @@ -335,7 +338,7 @@ void __iomem __ref · 78 unmodified lines | ||
| 335 | 338 | /* Check if there's a suitable mapping already. */ |
| 336 | 339 | map = acpi_map_lookup(phys, size); |
| 337 | 340 | if (map) { |
| 338 | − map->refcount++; | |
| 341 | + map->track.refcount++; | |
| 339 | 342 | goto out; |
| 340 | 343 | } |
| 341 | 344 | |
| @@ -358,7 +361,7 @@ void __iomem __ref · 16 unmodified lines | ||
| 358 | 361 | map->virt = virt; |
| 359 | 362 | map->phys = pg_off; |
| 360 | 363 | map->size = pg_sz; |
| 361 | − map->refcount = 1; | |
| 364 | + map->track.refcount = 1; | |
| 362 | 365 | |
| 363 | 366 | list_add_tail_rcu(&map->list, &acpi_ioremaps); |
| 364 | 367 | |
| @@ -374,21 +377,26 @@ void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size) · 9 unmodified lines | ||
| 374 | 377 | } |
| 375 | 378 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); |
| 376 | 379 | |
| 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) | |
| 379 | 381 | { |
| 380 | − unsigned long refcount = --map->refcount; | |
| 382 | + struct acpi_ioremap *map = container_of(to_rcu_work(work), | |
| 383 | + struct acpi_ioremap, | |
| 384 | + track.rwork); | |
| 381 | 385 | |
| 382 | − if (!refcount) | |
| 383 | − list_del_rcu(&map->list); | |
| 384 | − return refcount; | |
| 386 | + acpi_unmap(map->phys, map->virt); | |
| 387 | + kfree(map); | |
| 385 | 388 | } |
| 386 | 389 | |
| 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) | |
| 388 | 392 | { |
| 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); | |
| 392 | 400 | } |
| 393 | 401 | |
| 394 | 402 | /** |
| @@ -397,8 +405,8 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) · 2 unmodified lines | ||
| 397 | 405 | * @size: Size of the address range to drop a reference to. |
| 398 | 406 | * |
| 399 | 407 | * 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. | |
| 402 | 410 | * |
| 403 | 411 | * During early init (when acpi_permanent_mmap has not been set yet) this |
| 404 | 412 | * 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 | ||
| 408 | 416 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) |
| 409 | 417 | { |
| 410 | 418 | struct acpi_ioremap *map; |
| 411 | − unsigned long refcount; | |
| 412 | 419 | |
| 413 | 420 | if (!acpi_permanent_mmap) { |
| 414 | 421 | __acpi_unmap_table(virt, size); |
| @@ -416,23 +423,27 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) · 1 unmodified line | ||
| 416 | 423 | } |
| 417 | 424 | |
| 418 | 425 | mutex_lock(&acpi_ioremap_lock); |
| 426 | + | |
| 419 | 427 | map = acpi_map_lookup_virt(virt, size); |
| 420 | 428 | if (!map) { |
| 421 | 429 | mutex_unlock(&acpi_ioremap_lock); |
| 422 | 430 | WARN(true, PREFIX "%s: bad address %p\n", __func__, virt); |
| 423 | 431 | return; |
| 424 | 432 | } |
| 425 | − refcount = acpi_os_drop_map_ref(map); | |
| 426 | − mutex_unlock(&acpi_ioremap_lock); | |
| 433 | + acpi_os_drop_map_ref(map); | |
| 427 | 434 | |
| 428 | − if (!refcount) | |
| 429 | − acpi_os_map_cleanup(map); | |
| 435 | + mutex_unlock(&acpi_ioremap_lock); | |
| 430 | 436 | } |
| 431 | 437 | EXPORT_SYMBOL_GPL(acpi_os_unmap_iomem); |
| 432 | 438 | |
| 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 | + */ | |
| 433 | 444 | void __ref acpi_os_unmap_memory(void *virt, acpi_size size) |
| 434 | 445 | { |
| 435 | − return acpi_os_unmap_iomem((void __iomem *)virt, size); | |
| 446 | + acpi_os_unmap_iomem((void __iomem *)virt, size); | |
| 436 | 447 | } |
| 437 | 448 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); |
| 438 | 449 | |
| @@ -461,7 +472,6 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) · 22 unmodified lines | ||
| 461 | 472 | { |
| 462 | 473 | u64 addr; |
| 463 | 474 | struct acpi_ioremap *map; |
| 464 | − unsigned long refcount; | |
| 465 | 475 | |
| 466 | 476 | if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) |
| 467 | 477 | return; |
| @@ -472,16 +482,15 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) · 4 unmodified lines | ||
| 472 | 482 | return; |
| 473 | 483 | |
| 474 | 484 | mutex_lock(&acpi_ioremap_lock); |
| 485 | + | |
| 475 | 486 | map = acpi_map_lookup(addr, gas->bit_width / 8); |
| 476 | 487 | if (!map) { |
| 477 | 488 | mutex_unlock(&acpi_ioremap_lock); |
| 478 | 489 | return; |
| 479 | 490 | } |
| 480 | − refcount = acpi_os_drop_map_ref(map); | |
| 481 | − mutex_unlock(&acpi_ioremap_lock); | |
| 491 | + acpi_os_drop_map_ref(map); | |
| 482 | 492 | |
| 483 | − if (!refcount) | |
| 484 | − acpi_os_map_cleanup(map); | |
| 493 | + mutex_unlock(&acpi_ioremap_lock); | |
| 485 | 494 | } |
| 486 | 495 | EXPORT_SYMBOL(acpi_os_unmap_generic_address); |
| 487 | 496 | |
| @@ -203,8 +203,7 @@ static void tsc_check_state(int state) · 202 unmodified lines | ||
| 203 | 203 | */ |
| 204 | 204 | if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
| 205 | 205 | return; |
| 206 | − | |
| 207 | − /*FALL THROUGH*/ | |
| 206 | + fallthrough; | |
| 208 | 207 | default: |
| 209 | 208 | /* TSC could halt in idle, so notify users */ |
| 210 | 209 | if (state > ACPI_STATE_C1) |
| @@ -373,7 +373,7 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity) · 372 unmodified lines | ||
| 373 | 373 | case ACPI_ACTIVE_BOTH: |
| 374 | 374 | if (triggering == ACPI_EDGE_SENSITIVE) |
| 375 | 375 | return IRQ_TYPE_EDGE_BOTH; |
| 376 | − /* fall through */ | |
| 376 | + fallthrough; | |
| 377 | 377 | default: |
| 378 | 378 | return IRQ_TYPE_NONE; |
| 379 | 379 | } |
| @@ -111,7 +111,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) · 110 unmodified lines | ||
| 111 | 111 | table->serial_port.access_width))) { |
| 112 | 112 | default: |
| 113 | 113 | pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); |
| 114 | − /* fall through */ | |
| 114 | + fallthrough; | |
| 115 | 115 | case 8: |
| 116 | 116 | iotype = "mmio"; |
| 117 | 117 | break; |
| @@ -128,7 +128,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) · 10 unmodified lines | ||
| 128 | 128 | switch (table->interface_type) { |
| 129 | 129 | case ACPI_DBG2_ARM_SBSA_32BIT: |
| 130 | 130 | iotype = "mmio32"; |
| 131 | − /* fall through */ | |
| 131 | + fallthrough; | |
| 132 | 132 | case ACPI_DBG2_ARM_PL011: |
| 133 | 133 | case ACPI_DBG2_ARM_SBSA_GENERIC: |
| 134 | 134 | case ACPI_DBG2_BCM2835: |
| @@ -292,20 +292,6 @@ static int __init acpi_parse_entries_array(char *id, unsigned long table_size, · 291 unmodified lines | ||
| 292 | 292 | int errs = 0; |
| 293 | 293 | int i; |
| 294 | 294 | |
| 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 | − | |
| 309 | 295 | table_end = (unsigned long)table_header + table_header->length; |
| 310 | 296 | |
| 311 | 297 | /* Parse all entries looking for a match. */ |
| @@ -371,6 +357,9 @@ int __init acpi_table_parse_entries_array(char *id, · 59 unmodified lines | ||
| 371 | 357 | if (!id) |
| 372 | 358 | return -EINVAL; |
| 373 | 359 | |
| 360 | + if (!table_size) | |
| 361 | + return -EINVAL; | |
| 362 | + | |
| 374 | 363 | if (!strncmp(id, ACPI_SIG_MADT, 4)) |
| 375 | 364 | instance = acpi_apic_instance; |
| 376 | 365 | |
| @@ -490,7 +479,7 @@ static u8 __init acpi_table_checksum(u8 *buffer, u32 length) · 113 unmodified lines | ||
| 490 | 479 | } |
| 491 | 480 | |
| 492 | 481 | /* 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 = { | |
| 494 | 483 | ACPI_SIG_BERT, ACPI_SIG_BGRT, ACPI_SIG_CPEP, ACPI_SIG_ECDT, |
| 495 | 484 | ACPI_SIG_EINJ, ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT, |
| 496 | 485 | 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 | ||
| 501 | 490 | ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, |
| 502 | 491 | ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, |
| 503 | 492 | ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT, |
| 504 | − ACPI_SIG_NHLT, NULL }; | |
| 493 | + ACPI_SIG_NHLT }; | |
| 505 | 494 | |
| 506 | 495 | #define ACPI_HEADER_SIZE sizeof(struct acpi_table_header) |
| 507 | 496 | |
| @@ -548,11 +537,11 @@ void __init acpi_table_upgrade(void) · 40 unmodified lines | ||
| 548 | 537 | |
| 549 | 538 | table = file.data; |
| 550 | 539 | |
| 551 | − for (sig = 0; table_sigs[sig]; sig++) | |
| 540 | + for (sig = 0; sig < ARRAY_SIZE(table_sigs); sig++) | |
| 552 | 541 | if (!memcmp(table->signature, table_sigs[sig], 4)) |
| 553 | 542 | break; |
| 554 | 543 | |
| 555 | − if (!table_sigs[sig]) { | |
| 544 | + if (sig >= ARRAY_SIZE(table_sigs)) { | |
| 556 | 545 | pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n", |
| 557 | 546 | cpio_path, file.name); |
| 558 | 547 | continue; |
| @@ -527,8 +527,8 @@ static void program_hpx_type3_register(struct pci_dev *dev, · 526 unmodified lines | ||
| 527 | 527 | return; |
| 528 | 528 | |
| 529 | 529 | 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: | |
| 532 | 532 | default: |
| 533 | 533 | pci_warn(dev, "Encountered _HPX type 3 with unsupported config space location"); |
| 534 | 534 | return; |
| @@ -1001,7 +1001,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 466 unmodified lines | ||
| 1001 | 1001 | error = -EBUSY; |
| 1002 | 1002 | break; |
| 1003 | 1003 | } |
| 1004 | − /* Fall through */ | |
| 1004 | + fallthrough; | |
| 1005 | 1005 | case PCI_D0: |
| 1006 | 1006 | case PCI_D1: |
| 1007 | 1007 | case PCI_D2: |
| @@ -1201,12 +1201,18 @@ struct acpi_pci_id { · 1200 unmodified lines | ||
| 1201 | 1201 | u16 function; |
| 1202 | 1202 | }; |
| 1203 | 1203 | |
| 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 | + | |
| 1204 | 1211 | struct acpi_mem_space_context { |
| 1205 | 1212 | u32 length; |
| 1206 | 1213 | 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; | |
| 1210 | 1216 | }; |
| 1211 | 1217 | |
| 1212 | 1218 | /* |
| @@ -44,7 +44,7 @@ struct tboot_acpi_generic_address { · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | /* |
| 46 | 46 | * combines Sx info from FADT and FACS tables per ACPI 2.0+ spec |
| 47 | − * (http://www.acpi.info/) | |
| 47 | + * (https://uefi.org/specifications) | |
| 48 | 48 | */ |
| 49 | 49 | struct tboot_acpi_sleep_info { |
| 50 | 50 | struct tboot_acpi_generic_address pm1a_cnt_blk; |
| @@ -75,7 +75,7 @@ By default only values of core zero are displayed. How to display settings of · 74 unmodified lines | ||
| 75 | 75 | other cores is described in the cpupower(1) manpage in the \-\-cpu option |
| 76 | 76 | section. |
| 77 | 77 | .SH REFERENCES |
| 78 | −http://www.acpi.info/spec.htm | |
| 78 | +https://uefi.org/specifications | |
| 79 | 79 | .SH "FILES" |
| 80 | 80 | .nf |
| 81 | 81 | \fI/sys/devices/system/cpu/cpu*/cpuidle/state*\fP |