mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: Fix ERST timeout unit conversion
@ 2026-07-21 18:25 Nirmoy Das
  2026-07-28  2:22 ` Hanjun Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Nirmoy Das @ 2026-07-21 18:25 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-kernel, Nirmoy Das, stable, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, Rafael J. Wysocki, Borislav Petkov,
	Hanjun Guo, Mauro Carvalho Chehab, Shuai Xue, Len Brown,
	Jeshua Smith

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")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
---
 drivers/acpi/apei/erst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index bf65e34615314..15ab797641cfc 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -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;
 	}
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: APEI: Fix ERST timeout unit conversion
  2026-07-21 18:25 [PATCH] ACPI: APEI: Fix ERST timeout unit conversion Nirmoy Das
@ 2026-07-28  2:22 ` Hanjun Guo
  2026-08-07 17:21   ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 3+ messages in thread
From: Hanjun Guo @ 2026-07-28  2:22 UTC (permalink / raw)
  To: Nirmoy Das, linux-acpi
  Cc: linux-kernel, stable, Kees Cook, Tony Luck, Guilherme G. Piccoli,
	Rafael J. Wysocki, Borislav Petkov, Mauro Carvalho Chehab,
	Shuai Xue, Len Brown, Jeshua Smith

On 2026/7/22 2:25, Nirmoy Das wrote:
> 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")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
> ---
>   drivers/acpi/apei/erst.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
> index bf65e34615314..15ab797641cfc 100644
> --- a/drivers/acpi/apei/erst.c
> +++ b/drivers/acpi/apei/erst.c
> @@ -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.

Reviewed-by: Hanjun Guo <guohanjun@huawei.com>

Thanks
Hanjun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: APEI: Fix ERST timeout unit conversion
  2026-07-28  2:22 ` Hanjun Guo
@ 2026-08-07 17:21   ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-08-07 17:21 UTC (permalink / raw)
  To: Hanjun Guo, Nirmoy Das
  Cc: linux-acpi, linux-kernel, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, Borislav Petkov, Mauro Carvalho Chehab,
	Shuai Xue, Jeshua Smith

On Tue, Jul 28, 2026 at 4:22 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>
> On 2026/7/22 2:25, Nirmoy Das wrote:
> > 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")
> > Cc: stable@vger.kernel.org
> > Assisted-by: Codex:gpt-5.6-sol
> > Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
> > ---
> >   drivers/acpi/apei/erst.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
> > index bf65e34615314..15ab797641cfc 100644
> > --- a/drivers/acpi/apei/erst.c
> > +++ b/drivers/acpi/apei/erst.c
> > @@ -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.

Applied as 7.3 material, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-07 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-21 18:25 [PATCH] ACPI: APEI: Fix ERST timeout unit conversion Nirmoy Das
2026-07-28  2:22 ` Hanjun Guo
2026-08-07 17:21   ` Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®