Skip to contentSkip to conversation

ACPI:PRM: Reduce unnecessary printing to avoid the worries of regular users

PATCH Superseded Zhu Qiyu 2 participants 4 messages May 27, 2025 – Jul 4, 2025 ACPI

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Zhu Qiyu

author
#0 lore raw

PATCH v5 1/1 ACPI:PRM: Reduce unnecessary printing to avoid the worries of regular users

Commit 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context") introduces non-essential printing "Failed to find VA for GUID: xxxx, PA: 0x0" which causes unnecessary worry for regular users.

Refer to PRM Spec Section 4.1.2[1], both static data buffer address and ACPI parameter buffer address may be NULL if they are not needed. So there is no need to print out "Failed to find VA ... " to intimidate regular users.

---
Previous versions can be found at:
v1: https://lore.kernel.org/linux-acpi/[email protected]/
v2: https://lore.kernel.org/linux-acpi/[email protected]/#r
v3: https://lore.kernel.org/linux-acpi/[email protected]/t/#u
v4: https://lore.kernel.org/linux-acpi/[email protected]/

Changes in v2:
- Reduce the code changes.
Changes in v3:
- Fixed title letters not showing.
Changes in v4:
- Only print the necessary warnings.
Changes in v5:
- Add more cases of print warnings.

 drivers/acpi/prmt.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/acpi/prmt.c +20 -2
index e549914a636c..ed39502ed86f 100644
@@ -85,8 +85,6 @@ static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
 		}
 	}
 
-	pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
-
 	return 0;
 }
 
@@ -154,13 +152,33 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
 		guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
 		th->handler_addr =
 			(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
+		/*
+		 * Refer to PRM Spec, both static data buffer address and
+		 * ACPI parameter buffer address may be NULL if they are not
+		 * needed, so there print out warning if handler_addr is zero.
+		 */
+		if (unlikely(!th->handler_addr))
+			pr_warn("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx",
+				&th->guid, handler_info->handler_address);
 
 		th->static_data_buffer_addr =
 			efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+		/*
+		 * As for the static_data_buffer_addr/acpi_param_buffer_addr,
+		 * if the physical address passed to efi_pa_va_lookup() is nonzero
+		 * and the return value is zero, there should print out the warnings.
+		 */
+		if (unlikely(!th->static_data_buffer_addr && handler_info->static_data_buffer_address))
+			pr_warn("Failed to find VA of static data buffer for GUID: %pUL, PA: 0x%llx",
+				&th->guid, handler_info->static_data_buffer_address);
 
 		th->acpi_param_buffer_addr =
 			efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
 
+		if (unlikely(!th->acpi_param_buffer_addr && handler_info->acpi_param_buffer_address))
+			pr_warn("Failed to find VA of acpi param buffer for GUID: %pUL, PA: 0x%llx",
+				&th->guid, handler_info->acpi_param_buffer_address);
+
 	} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
 
 	return 0;

base-commit: a5806cd506af5a7c19bcd596e4708b5c464bfd21

Signature · 1 line
2.43.0
author
#1 lore raw

Query:[PATCH v5] ACPI:PRM: Reduce unnecessary printing to avoid the worries of regular users

Hi,Rafael

May I konw the process of this patch, thanks!

Qiyu

#2 lore raw
In reply to Zhu Qiyu
Quoted 7 lines · Zhu Qiyu

Commit 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context") introduces non-essential printing "Failed to find VA for GUID: xxxx, PA: 0x0" which causes unnecessary worry for regular users.

Refer to PRM Spec Section 4.1.2[1], both static data buffer address

s/Refer/According to/

Quoted 3 lines

and ACPI parameter buffer address may be NULL if they are not needed. So there is no need to print out "Failed to find VA ... " to intimidate regular users.

s/intimidate regular users/confuse users/

Quoted 37 lines

---
Previous versions can be found at:
v1: https://lore.kernel.org/linux-acpi/[email protected]/
v2: https://lore.kernel.org/linux-acpi/[email protected]/#r
v3: https://lore.kernel.org/linux-acpi/[email protected]/t/#u
v4: https://lore.kernel.org/linux-acpi/[email protected]/

Changes in v2:
- Reduce the code changes.
Changes in v3:
- Fixed title letters not showing.
Changes in v4:
- Only print the necessary warnings.
Changes in v5:
- Add more cases of print warnings.

 drivers/acpi/prmt.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/acpi/prmt.c +0 -2
index e549914a636c..ed39502ed86f 100644
@@ -85,8 +85,6 @@ static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
                }
        }
 
-       pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
-
        return 0;
 }
 

drivers/acpi/prmt.c acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end) · line 159

Quoted 8 lines
drivers/acpi/prmt.c +5 -0
@@ -154,13 +152,33 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
                guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
                th->handler_addr =
                        (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
+               /*
+                * Refer to PRM Spec, both static data buffer address and
+                * ACPI parameter buffer address may be NULL if they are not
+                * needed, so there print out warning if handler_addr is zero.
+                */

Change the comment above to something like "Print a warning message if handler_addr is zero which is not expected to ever happen."

drivers/acpi/prmt.c acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end) · line 170

Quoted 11 lines
drivers/acpi/prmt.c +8 -0
+               if (unlikely(!th->handler_addr))
+                       pr_warn("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx",
+                               &th->guid, handler_info->handler_address);
 
                th->static_data_buffer_addr =
                        efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+               /*
+                * As for the static_data_buffer_addr/acpi_param_buffer_addr,
+                * if the physical address passed to efi_pa_va_lookup() is nonzero
+                * and the return value is zero, there should print out the warnings.
+                */

Change the comment above to something like "According to the PRM specification, static_data_buffer_address can be zero, so avoid printing a warning message in that case."

drivers/acpi/prmt.c acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end) · line 180

Quoted 10 lines
drivers/acpi/prmt.c +6 -0
+               if (unlikely(!th->static_data_buffer_addr && handler_info->static_data_buffer_address))
+                       pr_warn("Failed to find VA of static data buffer for GUID: %pUL, PA: 0x%llx",
+                               &th->guid, handler_info->static_data_buffer_address);
 
                th->acpi_param_buffer_addr =
                        efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
 
+               if (unlikely(!th->acpi_param_buffer_addr && handler_info->acpi_param_buffer_address))
+                       pr_warn("Failed to find VA of acpi param buffer for GUID: %pUL, PA: 0x%llx",
+                               &th->guid, handler_info->acpi_param_buffer_address);

And analogously here.

drivers/acpi/prmt.c acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end) · line 184

Quoted 5 lines
drivers/acpi/prmt.c +1 -0
+
        } while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
 
        return 0;

Thanks!