Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1745256pxb; Mon, 13 Sep 2021 04:44:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCtDaLwzk9L8H3NFVDSOw994MCKMQORK+VxwzLvK4g6Trs6d672l/8nF1/MqxcSfzh5h8e X-Received: by 2002:a17:906:7ac5:: with SMTP id k5mr12720574ejo.386.1631533488148; Mon, 13 Sep 2021 04:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631533488; cv=none; d=google.com; s=arc-20160816; b=KzeGC8+PQxdnF863X13Fqo6piR817XzbqJqrBcPoS/NGafGqhlg4KC2ZPkM/aEyAoF Lwr3HVwK1cpfytM4Q6J+Ww9O8BoBoGaTA8TUqjK1qXGWBsWG8EH4R9wiB//BJhi6nWri 5KALc75me7xILzAzQScI2YPxStF2DNJfWKwWNYAZpEDVTHDXkOMSnXSw6ywSk9D1Q3iN +Y3Z1Gq6x4i9dsNfbm1WWXmYdE16v/2PXM1RSBkPAzhpEgVaHN11hfYLt4+fZEVWXz75 2B94U+CDJVJ8Y9ima2YWxh169wTpArKfYaLdTfMcsw/Ma/egD+2AgiGrZA6q50g3VN6t fV2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:cc:to:subject:from; bh=GAdYAgqTGKXZiAwQbH37uYv4KjS2uViNVdh1QeBwtzc=; b=OMnCo70tDU2iCb2Zu9KMAB1MntUaOvBHsIkNT0Ur28Zr7NMY7wdmCKNRb/2AkPar2L sthpUl1ap+zHu2j/1vgoGoEzx9otLFPN/gVnYpzyDUTOk4+PMgJ+86y9wprNOIpmqQAx 61/ZN5RTl0X2rEhCKAM+BEeABc3ir0E23/Q2I0XhBLko+gfS5pKvvgbgYZXcPqNQS+yz pjLiTSgWj1i4+j26aag35HOK0Ks3sArpXohQSU2gtdrYkZZ40WpOIGfDd3vJGz8LR0rl hA/IeVkYFPNLxeWFwaZ6ngdtcxnq1+8dHVoy97QZTj8BNxBkoOlL0KA+2Pz23bmnk6sE Sn4g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si7515435ejc.571.2021.09.13.04.44.24; Mon, 13 Sep 2021 04:44:48 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239580AbhIMLnT (ORCPT + 99 others); Mon, 13 Sep 2021 07:43:19 -0400 Received: from gecko.sbs.de ([194.138.37.40]:49200 "EHLO gecko.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236395AbhIMLnS (ORCPT ); Mon, 13 Sep 2021 07:43:18 -0400 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id 18DBfiqp009507 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Sep 2021 13:41:44 +0200 Received: from [167.87.36.252] ([167.87.36.252]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 18DBfhOV005983; Mon, 13 Sep 2021 13:41:43 +0200 From: Jan Kiszka Subject: [RFC][PATCH] watchdog: rti-wdt: Provide set_timeout handler to make existing userspace happy To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, Linux Kernel Mailing List , Tero Kristo , "Su, Bao Cheng (RC-CN DF FA R&D)" Message-ID: <4d82b8ce-bc34-e4b2-c5fe-9e883b0db59d@siemens.com> Date: Mon, 13 Sep 2021 13:41:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kiszka Prominent userspace - systemd - cannot handle watchdogs without WDIOF_SETTIMEOUT, even if it was configured to the same time as the driver selected or was used by firmware to start the watchdog. To avoid failing in this case, implement a handler that only fails if a deviating set_timeout is requested. Signed-off-by: Jan Kiszka --- See also https://github.com/systemd/systemd/issues/20683 drivers/watchdog/rti_wdt.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index 359302f71f7e..365255b15a0d 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -173,13 +173,27 @@ static unsigned int rti_wdt_get_timeleft_ms(struct watchdog_device *wdd) return timer_counter; } +static int rti_wdt_set_timeout(struct watchdog_device *wdd, + unsigned int timeout) +{ + /* + * Updating the timeout after start is actually not supported, but + * let's ignore requests for the already configured value. Helps + * existing userspace such as systemd. + */ + if (timeout != heartbeat) + return -EOPNOTSUPP; + + return 0; +} + static unsigned int rti_wdt_get_timeleft(struct watchdog_device *wdd) { return rti_wdt_get_timeleft_ms(wdd) / 1000; } static const struct watchdog_info rti_wdt_info = { - .options = WDIOF_KEEPALIVEPING, + .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, .identity = "K3 RTI Watchdog", }; @@ -187,6 +201,7 @@ static const struct watchdog_ops rti_wdt_ops = { .owner = THIS_MODULE, .start = rti_wdt_start, .ping = rti_wdt_ping, + .set_timeout = rti_wdt_set_timeout, .get_timeleft = rti_wdt_get_timeleft, }; -- 2.31.1