Skip to contentSkip to conversation

ACPI: APEI: Fix ERST timeout unit conversion

PATCH Applied Nirmoy Das 3 participants 3 messages Jul 21 – Aug 7

Subsystems (4)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 ACPI: APEI: Fix ERST timeout unit conversion

The ACPI specification defines bits 63:32 returned by GET_EXECUTE_OPERATION_TIMINGS as the maximum execution time in microseconds. erst_get_timeout() instead multiplies the value by NSEC_PER_MSEC.

Use NSEC_PER_USEC to express the firmware-provided microsecond timeout in the nanosecond units expected by erst_timedout().

Fixes fac475aab70b ("ACPI: APEI: Use ERST timeout for slow devices")
Assisted-by Codex:gpt-5.6-sol
---
 drivers/acpi/apei/erst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/erst.c +1 -1
index bf65e34615314..15ab797641cfc 100644
@@ -108,7 +108,7 @@ static inline u64 erst_get_timeout(void)
 
 	if (erst_erange.attr & ERST_RANGE_SLOW) {
 		timeout = ((erst_erange.timings & ERST_EXEC_TIMING_MAX_MASK) >>
-			ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_MSEC;
+			ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_USEC;
 		if (timeout < FIRMWARE_TIMEOUT)
 			timeout = FIRMWARE_TIMEOUT;
 	}
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Nirmoy Das

The ACPI specification defines bits 63:32 returned by GET_EXECUTE_OPERATION_TIMINGS as the maximum execution time in microseconds. erst_get_timeout() instead multiplies the value by NSEC_PER_MSEC.

Use NSEC_PER_USEC to express the firmware-provided microsecond timeout in the nanosecond units expected by erst_timedout().

Fixes fac475aab70b ("ACPI: APEI: Use ERST timeout for slow devices")
Assisted-by Codex:gpt-5.6-sol
---
  drivers/acpi/apei/erst.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/erst.c +0 -0
index bf65e34615314..15ab797641cfc 100644

drivers/acpi/apei/erst.c static inline u64 erst_get_timeout(void) · line 111

Quoted 5 lines
drivers/acpi/apei/erst.c +1 -1
@@ -108,7 +108,7 @@ static inline u64 erst_get_timeout(void)
 
  	if (erst_erange.attr & ERST_RANGE_SLOW) {
  		timeout = ((erst_erange.timings & ERST_EXEC_TIMING_MAX_MASK) >>
-			ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_MSEC;
+			ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_USEC;

Good catch! In the latest ACPI 6.6 spec, it says:

[63:32] value in *microseconds* that the platform expects would be the maximum amount of time it will take to process and complete an EXECUTE_OPERATION.

Thanks
Hanjun

maintainer Applied
#2 lore raw
Quoted 31 lines · Hanjun Guo
Quoted 21 lines · Nirmoy Das

The ACPI specification defines bits 63:32 returned by GET_EXECUTE_OPERATION_TIMINGS as the maximum execution time in microseconds. erst_get_timeout() instead multiplies the value by NSEC_PER_MSEC.

Use NSEC_PER_USEC to express the firmware-provided microsecond timeout in the nanosecond units expected by erst_timedout().

Fixes fac475aab70b ("ACPI: APEI: Use ERST timeout for slow devices")
Assisted-by Codex:gpt-5.6-sol
---
  drivers/acpi/apei/erst.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/erst.c +0 -0
index bf65e34615314..15ab797641cfc 100644

drivers/acpi/apei/erst.c static inline u64 erst_get_timeout(void) · line 111

Quoted 5 lines
drivers/acpi/apei/erst.c +1 -1
@@ -108,7 +108,7 @@ static inline u64 erst_get_timeout(void)
 
      if (erst_erange.attr & ERST_RANGE_SLOW) {
              timeout = ((erst_erange.timings & ERST_EXEC_TIMING_MAX_MASK) >>
-                     ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_MSEC;
+                     ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_USEC;

Good catch! In the latest ACPI 6.6 spec, it says:

Quoted 3 lines

[63:32] value in *microseconds* that the platform expects would be the maximum amount of time it will take to process and complete an EXECUTE_OPERATION.

Applied as 7.3 material, thanks!