Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3656375rwb; Tue, 20 Sep 2022 02:48:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GuB46FP8umsbg40shkq4WlYBQHnBE/SyWUogpYvoNbrYKWewwX7aNs7tjIqOwVm8NtEfw X-Received: by 2002:a17:907:72c7:b0:780:43d1:e9d7 with SMTP id du7-20020a17090772c700b0078043d1e9d7mr16032303ejc.571.1663667324478; Tue, 20 Sep 2022 02:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663667324; cv=none; d=google.com; s=arc-20160816; b=aL0Nf+mCfORegpwdU8UFPHl9LfJx7MHZbTusq2jdtWIwccIz2JFTpPGt/7ovaiexaP IbiDhSXRPcFuquHYrDeMD6JC6CzoX6vOCIwWtJ+bSvSiG24vROnvkvu38bpBebidOHbh d2K99J9lkHpySGghyNQUWt42wDi/0PsCeoL0k/wch+3zy5dxPFC2ckUgpmt+2EQYKthN 5tUAKz8zLVsTxuZYdnrruzZ2oAYYZPWO7MiGcFMhetMLAT6pO8d8WuuF+4BE3v1shDUD 9BYG85/6IF0OcyLW/PhBJhg1CNzS0vkrlCCvDr5pNa1ZW5vTXBrQm29iyE6AFiEzo1er RG/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QpkkQ4WyftxxHWS4ArtYNAZoBCGANNfQssOOdKoio5E=; b=oQNVcgMl4+gblryx81dcKDv2hlilfdZppV/C1IlN4CASNjIIDAelpC8TqJkCPSKqOE 2Znjhy8Yt6DHkrjPJ5pB2Pz58KgLRPEoA1mlRbS6TcyFT2vide1QrJYe5f4neaiw27gk jQBzTOo5wj8ZCuYCUOP6tzGFirBOiep1iYf5tJDNencm4amofCxqSBpxQeqlnIlM2unu 8XLUJEh3a1q6wr8DXdCoBYbwXhP9LxXsgVBf3NChAy+nRQ9um19kVv3yd0zPAaKKnG25 N+s9vhCcgT++TljWH8+m3aL0FtD/VrXrQzBRSKKoPoITyL4u1zWmi3eYxZXvEoq5+v0R a5XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@home.thecybershadow.net header.s=home header.b=yMH1LLnz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z26-20020a1709064e1a00b007801a197a1bsi676673eju.449.2022.09.20.02.48.19; Tue, 20 Sep 2022 02:48:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@home.thecybershadow.net header.s=home header.b=yMH1LLnz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbiITJ3R (ORCPT + 99 others); Tue, 20 Sep 2022 05:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbiITJ3N (ORCPT ); Tue, 20 Sep 2022 05:29:13 -0400 X-Greylist: delayed 155969 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 20 Sep 2022 02:29:09 PDT Received: from home.thecybershadow.net (tunnel258969-pt.tunnel.tserv1.bud1.ipv6.he.net [IPv6:2001:470:1f1a:172::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D642D6B174; Tue, 20 Sep 2022 02:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=home.thecybershadow.net; s=home; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QpkkQ4WyftxxHWS4ArtYNAZoBCGANNfQssOOdKoio5E=; b=yMH1LLnzMU0hvSaHHwGZWqn4cT GWixLgYiaKD7u5H8UwyfT+zR6HqWwgrI3y7/9eCwUJD2QVav8xBUc4sS+bDzBGscZH9OCmCl3o+bU 2UnP7WNQa1ote39LeYSPdWpOxk9OcF71LPx0QzSAoz/UbOfQOPyuHCnFRvy9VR66ZuqA=; Received: from vladimir by home.thecybershadow.net with local (Exim 4.96) (envelope-from ) id 1oaZYw-0002ER-1a; Tue, 20 Sep 2022 09:29:06 +0000 From: Vladimir Panteleev To: Wim Van Sebroeck , Guenter Roeck Cc: Vladimir Panteleev , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] watchdog: sp5100_tco: Add "action" module parameter Date: Tue, 20 Sep 2022 09:27:21 +0000 Message-Id: <20220920092721.7686-1-git@vladimir.panteleev.md> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow configuring the "action" bit, as documented in [1]. Previously, the only action supported by this module was to reset the system (0). It can now be configured to power off (1) instead. [1]: https://www.amd.com/system/files/TechDocs/44413.pdf Signed-off-by: Vladimir Panteleev --- Changes since v1: - Drop the rename of the SP5100_WDT_ACTION_RESET define - Make the new parameter not visible in sysfs for consistency drivers/watchdog/sp5100_tco.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index ae54dd33e233..fb426b7d81da 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c @@ -65,6 +65,12 @@ static struct pci_dev *sp5100_tco_pci; /* module parameters */ +#define WATCHDOG_ACTION 0 +static bool action = WATCHDOG_ACTION; +module_param(action, bool, 0); +MODULE_PARM_DESC(action, "Action taken when watchdog expires, 0 to reset, 1 to poweroff (default=" + __MODULE_STRING(WATCHDOG_ACTION) ")"); + #define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat. */ static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ module_param(heartbeat, int, 0); @@ -297,8 +303,11 @@ static int sp5100_tco_timer_init(struct sp5100_tco *tco) if (val & SP5100_WDT_FIRED) wdd->bootstatus = WDIOF_CARDRESET; - /* Set watchdog action to reset the system */ - val &= ~SP5100_WDT_ACTION_RESET; + /* Set watchdog action */ + if (action) + val |= SP5100_WDT_ACTION_RESET; + else + val &= ~SP5100_WDT_ACTION_RESET; writel(val, SP5100_WDT_CONTROL(tco->tcobase)); /* Set a reasonable heartbeat before we stop the timer */ -- 2.37.3