Re: [PATCH V2] ACPI: APEI: Use ERST timeout for slow devices

From: Rafael J. Wysocki
Date: Tue Oct 24 2023 - 14:52:12 EST


On Tue, Oct 24, 2023 at 5:27 PM Tony Luck <tony.luck@xxxxxxxxx> wrote:
>
> 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>

Applied as 6.7 material, thanks!