Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp490667pxj; Wed, 2 Jun 2021 04:27:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSdtRL8ta/eRAqak4zq9aHQ53uDbwEod968xczJgfcPYogmFDmP+5kcox88WjE1u9eOc9i X-Received: by 2002:a05:6602:2e82:: with SMTP id m2mr23807136iow.190.1622633226241; Wed, 02 Jun 2021 04:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622633226; cv=none; d=google.com; s=arc-20160816; b=g6ATW2cL8Lk8Nem1BB5LQCniGe9jNSdxQ3fGIgOjKhzmUvg6Vpf+yYK8c6fCEvWsPv 8Rnh8WeQ6EfK9TY82Nv4q7U6I3cap+14KLdF3faQLDkBk7TLow3BUCZjNj77TW5vYesR DZc+OT1OWOScIk5kjQ5yzts57EW3+ZssTdOtOUqdpSE47bpYhwDB6pQvLJWPcXL3y6PA eEePnqCzsqwpV2W9kme2QGUy08jbqFJvKoiRnQzDj+Qf9bsCyflKfkkI8vE5TpFYyNjF NZK/5D+9yfPVjgGPkZ8OGW76GYysg/UwpkT7rk1beJ047JfPhvBFrSFCvr4Lx8nidWrB WgYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=lb5hfBQxVsi1Vg1j35N2ywJlavrlJQVrfj0rUb+Ytfc=; b=BTIyYiJEgow8F5jL11YWZa5D6vRMGpFRFJRcrRkNViylJMXPfNBi0Rrc8hGuYepjS4 7eMmpck48LqPXfzGMocwQbMfKfJbHWlNfbK4ccxXTItqUizD7rdHBUWTnzHM1t7lglwt 2GPhSL6NPVB0rHS9qik2dT2RA7BTodSchkU5YAJjeKv70CQ7wjJi4IRRjKvQNyRYGrFN ePsGZE5FL1m/O6GQ3WhfZuITg3S9qZgmLHt0af0aCgb2MVUJKnd7TXyh55QnXG3b0FPu Disv3W1KinvL//UmK916JTozmuOM5bB7u4BG5v2vBE+IsHaBooG3vEpts7aIAO1cuVWr 2Y8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JQ3H8P4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si22109006jav.104.2021.06.02.04.26.53; Wed, 02 Jun 2021 04:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JQ3H8P4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232915AbhFBL1M (ORCPT + 99 others); Wed, 2 Jun 2021 07:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232470AbhFBL0X (ORCPT ); Wed, 2 Jun 2021 07:26:23 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16587C061574; Wed, 2 Jun 2021 04:24:39 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id d21so2265908oic.11; Wed, 02 Jun 2021 04:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lb5hfBQxVsi1Vg1j35N2ywJlavrlJQVrfj0rUb+Ytfc=; b=JQ3H8P4T1qVbdFNFdAvk16t/Jn4BEobrG1ALFG+vpTHZx8CHsRz3vzBWGJBEYlCWS7 v4GTuPAq8N5qwRhE49aL1tO7A74BIQ4ddWVK4CBXnlVe8mUa6jSq+o5fuzCN/4UYpOZt lojqe3jBRSJJoBYX7GLDRlswkJhnaEyKSGyv9OXUFrtFNkM6ZJpduW0CtWNj3ITzZ236 nt5qNpJEoOSiPm6xNV/AyHVtEBg+CnzvLqXDKJt0p22gz9HWbeI0hbP1mcLBhXVXPXkG BXJL00577voR219BKpMFesPupvjUw6GXaLBoFR0iJPP9+2h8V3/Zxl/K8tKrdcVhV308 kY4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=lb5hfBQxVsi1Vg1j35N2ywJlavrlJQVrfj0rUb+Ytfc=; b=RzMab3ubNiIa4v+Knewl+pbADCVEIM75YQ4sTs8mJZrHodjaImLBtlesOCc0apa0vz ZW5crRYzQrLsHAzBLePZps01XLso3aP6RnPSNlbaOsjGBhM/T9kuINasgfgbI3tmGskW +vor01BUsmGgLyCbd8ywNk98+82eDXUdEiSs8hHdWMcUK6g6xAWjudyL8+GloLKWCrKo pnJ6eu5wX9q5Xa5Q/YsS3ngK8DV+JmfAAKN6iKfnTFEGMcXMLRrvuwgREtRzJ0kDjcJY bMkrOcGHtGLJ/oS3NOCjqHvwPnJd6bwEerO8AaGluvBuRuSPH/c0pPITm2X/Nk9X4YER Q7gA== X-Gm-Message-State: AOAM53376Rfqe6Y3g3YqSXhS1V/Y5P5EW6rtkMzMBIQE/tKaVtI28oQK LVFKgJMUMkSiEvZPMLpottE= X-Received: by 2002:aca:400b:: with SMTP id n11mr20962335oia.111.1622633078417; Wed, 02 Jun 2021 04:24:38 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id t23sm3997565oij.21.2021.06.02.04.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 04:24:37 -0700 (PDT) Sender: Guenter Roeck Date: Wed, 2 Jun 2021 04:24:36 -0700 From: Guenter Roeck To: Jan Kiszka Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, Linux Kernel Mailing List , Paolo Bonzini , Christian Storm , Andy Shevchenko Subject: Re: [PATCH v2] watchdog: iTCO_wdt: Account for rebooting on second timeout Message-ID: <20210602112436.GA2280802@roeck-us.net> References: <0b8bb307-d08b-41b5-696c-305cdac6789c@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0b8bb307-d08b-41b5-696c-305cdac6789c@siemens.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 30, 2021 at 01:24:23PM +0200, Jan Kiszka wrote: > From: Jan Kiszka > > This was already attempted to fix via 1fccb73011ea: If the BIOS did not > enable TCO SMIs, the timer definitely needs to trigger twice in order to > cause a reboot. If TCO SMIs are on, as well as SMIs in general, we can > continue to assume that the BIOS will perform a reboot on the first > timeout. > > QEMU with its ICH9 and related BIOS falls into the former category, > currently taking twice the configured timeout in order to reboot the > machine. For iTCO version that fall under turn_SMI_watchdog_clear_off, > this is also true and was currently only addressed for v1, irrespective > of the turn_SMI_watchdog_clear_off value. > > Signed-off-by: Jan Kiszka Reviewed-by: Guenter Roeck > --- > > Changes in v2: > - consider GBL_SMI_EN as well > > drivers/watchdog/iTCO_wdt.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c > index bf31d7b67a69..3f1324871cfd 100644 > --- a/drivers/watchdog/iTCO_wdt.c > +++ b/drivers/watchdog/iTCO_wdt.c > @@ -71,6 +71,8 @@ > #define TCOBASE(p) ((p)->tco_res->start) > /* SMI Control and Enable Register */ > #define SMI_EN(p) ((p)->smi_res->start) > +#define TCO_EN (1 << 13) > +#define GBL_SMI_EN (1 << 0) > > #define TCO_RLD(p) (TCOBASE(p) + 0x00) /* TCO Timer Reload/Curr. Value */ > #define TCOv1_TMR(p) (TCOBASE(p) + 0x01) /* TCOv1 Timer Initial Value*/ > @@ -355,8 +357,12 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t) > > tmrval = seconds_to_ticks(p, t); > > - /* For TCO v1 the timer counts down twice before rebooting */ > - if (p->iTCO_version == 1) > + /* > + * If TCO SMIs are off, the timer counts down twice before rebooting. > + * Otherwise, the BIOS generally reboots when the SMI triggers. > + */ > + if (p->smi_res && > + (SMI_EN(p) & (TCO_EN | GBL_SMI_EN)) != (TCO_EN | GBL_SMI_EN)) > tmrval /= 2; > > /* from the specs: */ > @@ -521,7 +527,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev) > * Disables TCO logic generating an SMI# > */ > val32 = inl(SMI_EN(p)); > - val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ > + val32 &= ~TCO_EN; /* Turn off SMI clearing watchdog */ > outl(val32, SMI_EN(p)); > } > > -- > 2.26.2