Re: [PATCH V2] ACPI: APEI: Use ERST timeout for slow devices
From: Tony Luck
Date: Tue Oct 24 2023 - 11:28:00 EST
On Wed, Jul 12, 2023 at 10:34:48PM +0000, Jeshua Smith wrote:
> Slow devices such as flash may not meet the default 1ms timeout value,
> so use the ERST max execution time value that they provide as the
> timeout if it is larger.
>
> Signed-off-by: Jeshua Smith <jeshuas@xxxxxxxxxx>
> +/* ERST Exec max timings */
> +#define ERST_EXEC_TIMING_MAX_MASK 0xFFFFFFFF00000000
> +#define ERST_EXEC_TIMING_MAX_SHIFT 32
I've recently become a fan of <linux/bitfield.h> I think this would
be easier on the eyes as:
#define ERST_EXEC_TIMING_MAX GENMASK_ULL(63, 32)
> +static inline u64 erst_get_timeout(void)
> +{
> + u64 timeout = FIRMWARE_TIMEOUT;
> +
> + if (erst_erange.attr & ERST_RANGE_SLOW) {
> + timeout = ((erst_erange.timings & ERST_EXEC_TIMING_MAX_MASK) >>
> + ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_MSEC;
then this becomes:
timeout = FIELD_GET(ERST_EXEC_TIMING_MAX, erst_erange.timings) *
NSEC_PER_MSEC;
> + if (timeout < FIRMWARE_TIMEOUT)
> + timeout = FIRMWARE_TIMEOUT;
But that's just a matter of style. Otherwise the patch looks fine.
Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
-Tony