From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36464C25B47 for ; Tue, 24 Oct 2023 18:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344013AbjJXSwM convert rfc822-to-8bit (ORCPT ); Tue, 24 Oct 2023 14:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbjJXSwK (ORCPT ); Tue, 24 Oct 2023 14:52:10 -0400 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C063BA6; Tue, 24 Oct 2023 11:52:08 -0700 (PDT) Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-1ea1742c1a5so1380458fac.0; Tue, 24 Oct 2023 11:52:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698173528; x=1698778328; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b47eW1W1ZA3iY9fGQWptMYQkO14e99bJy5u+/oy5i2Y=; b=aZEwBny9h18y3Sexpm1gP6WTOHnyV+grEkCz6WuZVsCCwZ2JVuDM/GR3oH2n2MVgMD LMBQCQfVWdV92nSSvAl2DZXuMIyxyToOV8EuiEVpohVVvZZQs0wIDl6ntkLK/jEWlva3 6IaMeyzOO0loI1COrMmRKa6SzTehfiZeOoRb9o6Blu6BNbO8iPIjX1rX81lZ2h/R6yQK /YtksuEUYxoJM3KCIaW9z55oPKD1O5F1Hy8XmzvOgSxXYD/hBxQjZLeZiUqdr5cRlDV6 sBWjeBgQgbHpak/qLLWZ+7+6fbhI+pbyo9zyEbPFDDSXtrif6mpxwrR9gEt0qt4GYXSt iVVA== X-Gm-Message-State: AOJu0Yw04wr7yV0HId29biuCd9JJWS9GVl7/RWdLVvMRccapd6clWVIQ gL4fvXGmmZnXr4XK5ctYVGhDuJt0pUTfNjcawZg= X-Google-Smtp-Source: AGHT+IGEyL46Vaabh0PQgToQaEorF+rTwJ2e/VuAsoUSTFafddKjwzGKWYy/ed+ekhC8GDeNVIsCZEpkTFfXDb/+gKo= X-Received: by 2002:a05:6870:9a98:b0:1e9:9e04:1d24 with SMTP id hp24-20020a0568709a9800b001e99e041d24mr16645138oab.5.1698173528060; Tue, 24 Oct 2023 11:52:08 -0700 (PDT) MIME-Version: 1.0 References: <20230712223448.145079-1-jeshuas@nvidia.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 24 Oct 2023 20:51:57 +0200 Message-ID: Subject: Re: [PATCH V2] ACPI: APEI: Use ERST timeout for slow devices To: Tony Luck , Jeshua Smith Cc: keescook@chromium.org, gpiccoli@igalia.com, rafael@kernel.org, lenb@kernel.org, james.morse@arm.com, bp@alien8.de, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-tegra@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 24, 2023 at 5:27 PM Tony Luck 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 > > > +/* 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 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 Applied as 6.7 material, thanks!