[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTfhpRRA4bga0qSI@agluck-desk3>
Date: Tue, 24 Oct 2023 08:24:21 -0700
From: Tony Luck <tony.luck@...el.com>
To: Jeshua Smith <jeshuas@...dia.com>
Cc: keescook@...omium.org, gpiccoli@...lia.com, rafael@...nel.org,
lenb@...nel.org, james.morse@....com, bp@...en8.de,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, linux-tegra@...r.kernel.org,
treding@...dia.com, jonathanh@...dia.com
Subject: Re: [PATCH V2] ACPI: APEI: Use ERST timeout for slow devices
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@...dia.com>
> +/* 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@...el.com>
-Tony
Powered by blists - more mailing lists