From patchwork Fri Feb 3 07:39:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Egorenkov X-Patchwork-Id: 52374 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp700792wrn; Thu, 2 Feb 2023 23:54:39 -0800 (PST) X-Google-Smtp-Source: AK7set9gWRxTw0tPzV9ocnL0TBIIIH3M/FuEumJmAbcpGvVrghY8gASFm4RBkZUFtEVZMqHBPCYC X-Received: by 2002:a17:90b:1a8e:b0:230:2b29:aa66 with SMTP id ng14-20020a17090b1a8e00b002302b29aa66mr9537974pjb.36.1675410879225; Thu, 02 Feb 2023 23:54:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675410879; cv=none; d=google.com; s=arc-20160816; b=Aexcmosll8AxEA6T+Jrso2nLC/gzniv4OhvylA1jE/gzvz90B8bvsufbrNJbsfRz+S JIlWYUdvsPPuHrLRyXrQ4E7ADQY32WyTtni+A476TRstad7BtzX6y68iWipiaePsfyHB 2iSEzP/n/JNHS+rviXr2V4+KgSucVGI2//91x6Jx2hoe33RzphOfH9MQcQ2kNF3YWnJH +9JDizSEBYq2J1zdv8+iIcYf4b05wR3spGiL8ZX00bvyLly3hzi1bwqsKNSa2mOyu8ll OqgXoImh6sRB6lYEFXRCfC4oHAbbXb2gCKG/0Ev5psO8oYYXhZtOfg9D7jhsbqxPdgvS RO2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iLsMVUM9lmAtrcEhKWOz4nJ+jGFwhM8fO2Yr4tUse9Q=; b=WCfvVdd8uYzAzybGRAMpm8qKdDDPfMjXr1BI3hym6xzsfEUMYHU/LE1nVb4zxgtNhB iTvmw9SOpwZme1FdzK355V9N9X77TgivJDhhKvK7d8DsF/ZbJ5z+y4tRZknYzeTYvO6z 7Q3pQM3cM3YXLR7/v4OW9zwwBib6iyx8AaOObwnjYolbtyyYp6TvKS+FoQhuzaPE3tHk xhwSIkUpZ7hceC2YlO8hvRBMHAiIrqXBymtcP3m1gVMjqgR5l6HHtIqYNRRFPreoVm93 EnWumCKyKK3YlNCnrYuefSCxBiBTTK2xOrXoKSx3DC4rIhXsYdSVy1561vqFsZpbAtht Bttg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=WlcGlrF1; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a633508000000b00496b124b645si2208803pga.226.2023.02.02.23.54.25; Thu, 02 Feb 2023 23:54:39 -0800 (PST) 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=pass header.i=@ibm.com header.s=pp1 header.b=WlcGlrF1; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbjBCHk6 (ORCPT + 99 others); Fri, 3 Feb 2023 02:40:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232474AbjBCHke (ORCPT ); Fri, 3 Feb 2023 02:40:34 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC57893AEC; Thu, 2 Feb 2023 23:40:26 -0800 (PST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3137Ecc4025439; Fri, 3 Feb 2023 07:40:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=iLsMVUM9lmAtrcEhKWOz4nJ+jGFwhM8fO2Yr4tUse9Q=; b=WlcGlrF1rIeLe+P4CGn54QWKzlV5o6GUCAWOmg+MQguUCBSFNbcVnEvlN1bXXhUbpY74 e34lH+lOO6vzv1gbgZ6YLJf+fNRbdEE497ZY2VnAwGuEa8z56i+xo3pLZxbxOV1kEZV0 bnahahcyEX/cZlMZnZspvIUKSWhfbCzNSPnZmatFy0yUa2mjI/IHFdOWC/F0ZrWk1L+4 qp4NYZkfBwjy1Rn7jmfSkbauRPWHUEiwooSEnJZeVxXhEAo/it0hGYIwWMg/YHaTtddB z6CTcnEUW3640z89PgjWGPRifTy8cFDPrBQniqD521BW4ztnzB/QdlUbHyO1ksBA6fyu 7A== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ngwpr0j9g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:13 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 312G5BEM020245; Fri, 3 Feb 2023 07:40:11 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma04fra.de.ibm.com (PPS) with ESMTPS id 3ndn6ucbm7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:11 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3137e7Qo19726670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Feb 2023 07:40:07 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B0732141D; Fri, 3 Feb 2023 07:40:07 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C57D2142E; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) From: Alexander Egorenkov To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, hca@linux.ibm.com Subject: [PATCH 1/5] watchdog: diag288_wdt: get rid of register asm Date: Fri, 3 Feb 2023 08:39:54 +0100 Message-Id: <20230203073958.1585738-2-egorenar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230203073958.1585738-1-egorenar@linux.ibm.com> References: <20230203073958.1585738-1-egorenar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: skPicpaedP-BLxb1ZtJKpslJfwh7VgyH X-Proofpoint-GUID: skPicpaedP-BLxb1ZtJKpslJfwh7VgyH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-03_04,2023-02-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 impostorscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302030069 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756795638097549046?= X-GMAIL-MSGID: =?utf-8?q?1756795638097549046?= Using register asm statements has been proven to be very error prone, especially when using code instrumentation where gcc may add function calls, which clobbers register contents in an unexpected way. Therefore, get rid of register asm statements in watchdog code, and make sure this bug class cannot happen. Moreover, remove the register r1 from the clobber list because this register is not changed by DIAG 288. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Egorenkov Reviewed-by: Guenter Roeck --- drivers/watchdog/diag288_wdt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index 6ca5d9515d85..07ebbb709af4 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -73,20 +73,19 @@ MODULE_ALIAS("vmwatchdog"); static int __diag288(unsigned int func, unsigned int timeout, unsigned long action, unsigned int len) { - register unsigned long __func asm("2") = func; - register unsigned long __timeout asm("3") = timeout; - register unsigned long __action asm("4") = action; - register unsigned long __len asm("5") = len; + union register_pair r1 = { .even = func, .odd = timeout, }; + union register_pair r3 = { .even = action, .odd = len, }; int err; err = -EINVAL; asm volatile( - " diag %1, %3, 0x288\n" - "0: la %0, 0\n" + " diag %[r1],%[r3],0x288\n" + "0: la %[err],0\n" "1:\n" EX_TABLE(0b, 1b) - : "+d" (err) : "d"(__func), "d"(__timeout), - "d"(__action), "d"(__len) : "1", "cc", "memory"); + : [err] "+d" (err) + : [r1] "d" (r1.pair), [r3] "d" (r3.pair) + : "cc", "memory"); return err; } From patchwork Fri Feb 3 07:39:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Egorenkov X-Patchwork-Id: 52362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp696899wrn; Thu, 2 Feb 2023 23:41:16 -0800 (PST) X-Google-Smtp-Source: AK7set+jaq4DUZR7p7i0Q+BWyf0H4uAJGhi0L+hUDTYrb//+NaEEO2MM7idhxls+iY0svD1qq9HA X-Received: by 2002:a05:6a20:69a5:b0:be:e0c3:5012 with SMTP id t37-20020a056a2069a500b000bee0c35012mr4093914pzk.1.1675410075763; Thu, 02 Feb 2023 23:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675410075; cv=none; d=google.com; s=arc-20160816; b=dQdLflyMgefbw2GwB9lY2X4/ceg31w3FJRg8id5BdvKvVaKnUn4GpPhDV2Uwd7sIyV kl8/URuXVwV35Tb/ECkfAjz8Ewrw9pqpUjTcxWkquc+o14lYlaq62PFWR64+MroEVDrn j919MbRXoe2H3Kr39ndAOxHEsC8BZSBt5skCs+6c7VbtuFwqf7Aj2mWy2pciSZ3X33OZ p/2G+VKzbTa5Qzwd1guEc9nUZ1BJN6EAOMCMJdiZwqA1NDZwE0cB/7fMEIDoRKRfzDOZ WCLJh2wrm11mC5N9+jD34gaSmjOHWeqQQKmz7lseZT1XuOqy70d3ZQNVQxyjL0rDy+l0 08uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K0UhmP1F9ZlFA9OSI4ZHU52ngPm9Xi4QvjBfDFsjiWQ=; b=WqsTqVe7qsAOqX9M9ur26M2yIdfBAbI6MHFbiX/jvR+9c95odwAg4WcZcRN5r63b7X 6WPu/dQDzipW4Osfd+sD7gFN65Eaxbtisyk72/CrfF8AyjrkGrchs5MPfkzAtCV+XMOe PazTjXm6inNFQm+2X9wUPIhZSTJfHe74TYdF+Iq1cRuG/iak2l/F9EIjLCil78Qn2Oxc aPyQvpgJLZwOORRGOLM8ow2DdhayWYjrrfAlUl0DREdiBOXK42QqEBFPQmhdLDXuHmn5 p9lg/LBYhbeUi/zWOOhjBlK+eeQ2OZHzsH1Jh5KAJ4tXMDzXfIZxl+AjQiZ4Rt1A7gmw ZSOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="TKb2iDg/"; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a63ab49000000b004ad057fcf5bsi1958773pgp.728.2023.02.02.23.41.03; Thu, 02 Feb 2023 23:41:15 -0800 (PST) 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=pass header.i=@ibm.com header.s=pp1 header.b="TKb2iDg/"; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232520AbjBCHkq (ORCPT + 99 others); Fri, 3 Feb 2023 02:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232463AbjBCHke (ORCPT ); Fri, 3 Feb 2023 02:40:34 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C09CE93E07; Thu, 2 Feb 2023 23:40:25 -0800 (PST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3137U10W028808; Fri, 3 Feb 2023 07:40:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=K0UhmP1F9ZlFA9OSI4ZHU52ngPm9Xi4QvjBfDFsjiWQ=; b=TKb2iDg/y8IyP7+aUuA1mTXGdpD7idcWpChbwKMaF3Zlfe/hi47R6yD8GJXfP/OfSaL9 UdZtYVEiGYH8v39+HTUo/Mxo9GePLhw2Rgo6+cO7jpDPwUMF+sKERp1UiHnyh01y4rIY SxUAGDHD1X/G0p27KvBX+VfFY/86tjZvxOKu4es7+a+J3Xcn8bW1XZkAfdJrjv1Ea4ja t0Oy79l//9QQMu26dvVCc2dS4Xts2FZimsFcamoVrlAZfwLsus2uJT68ed7QGOYmP1Hr B5kFxJJAGU/r2l7lsJ1uS2JtZc2mhJ/ES/5mfokq8BCPBX/MfYNS9QSEiAaSHopHG9HV MQ== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ngwxdg7q1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:12 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3136xHhp014735; Fri, 3 Feb 2023 07:40:10 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3ncvtty3vg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:09 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3137e7SU16908882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Feb 2023 07:40:07 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B87521445; Fri, 3 Feb 2023 07:40:07 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B93021430; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) From: Alexander Egorenkov To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, hca@linux.ibm.com Subject: [PATCH 2/5] watchdog: diag288_wdt: remove power management Date: Fri, 3 Feb 2023 08:39:55 +0100 Message-Id: <20230203073958.1585738-3-egorenar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230203073958.1585738-1-egorenar@linux.ibm.com> References: <20230203073958.1585738-1-egorenar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: bvLEypXLprd-xXauJl0jXOPhuucVvsbG X-Proofpoint-ORIG-GUID: bvLEypXLprd-xXauJl0jXOPhuucVvsbG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-03_04,2023-02-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 adultscore=0 spamscore=0 mlxscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302030069 X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TVD_SUBJ_WIPE_DEBT 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756794795597913734?= X-GMAIL-MSGID: =?utf-8?q?1756794795597913734?= Remove power management because s390 no longer supports hibernation since commit 394216275c7d ("s390: remove broken hibernate / power management support"). Reviewed-by: Heiko Carstens Signed-off-by: Alexander Egorenkov Reviewed-by: Guenter Roeck --- drivers/watchdog/diag288_wdt.c | 65 ++-------------------------------- 1 file changed, 2 insertions(+), 63 deletions(-) diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index 07ebbb709af4..c8d516ced6d2 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -103,10 +102,6 @@ static int __diag288_lpar(unsigned int func, unsigned int timeout, return __diag288(func, timeout, action, 0); } -static unsigned long wdt_status; - -#define DIAG_WDOG_BUSY 0 - static int wdt_start(struct watchdog_device *dev) { char *ebc_cmd; @@ -114,15 +109,10 @@ static int wdt_start(struct watchdog_device *dev) int ret; unsigned int func; - if (test_and_set_bit(DIAG_WDOG_BUSY, &wdt_status)) - return -EBUSY; - if (MACHINE_IS_VM) { ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); - if (!ebc_cmd) { - clear_bit(DIAG_WDOG_BUSY, &wdt_status); + if (!ebc_cmd) return -ENOMEM; - } len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); ASCEBC(ebc_cmd, MAX_CMDLEN); EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); @@ -139,7 +129,6 @@ static int wdt_start(struct watchdog_device *dev) if (ret) { pr_err("The watchdog cannot be activated\n"); - clear_bit(DIAG_WDOG_BUSY, &wdt_status); return ret; } return 0; @@ -152,8 +141,6 @@ static int wdt_stop(struct watchdog_device *dev) diag_stat_inc(DIAG_STAT_X288); ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0); - clear_bit(DIAG_WDOG_BUSY, &wdt_status); - return ret; } @@ -222,45 +209,6 @@ static struct watchdog_device wdt_dev = { .max_timeout = MAX_INTERVAL, }; -/* - * It makes no sense to go into suspend while the watchdog is running. - * Depending on the memory size, the watchdog might trigger, while we - * are still saving the memory. - */ -static int wdt_suspend(void) -{ - if (test_and_set_bit(DIAG_WDOG_BUSY, &wdt_status)) { - pr_err("Linux cannot be suspended while the watchdog is in use\n"); - return notifier_from_errno(-EBUSY); - } - return NOTIFY_DONE; -} - -static int wdt_resume(void) -{ - clear_bit(DIAG_WDOG_BUSY, &wdt_status); - return NOTIFY_DONE; -} - -static int wdt_power_event(struct notifier_block *this, unsigned long event, - void *ptr) -{ - switch (event) { - case PM_POST_HIBERNATION: - case PM_POST_SUSPEND: - return wdt_resume(); - case PM_HIBERNATION_PREPARE: - case PM_SUSPEND_PREPARE: - return wdt_suspend(); - default: - return NOTIFY_DONE; - } -} - -static struct notifier_block wdt_power_notifier = { - .notifier_call = wdt_power_event, -}; - static int __init diag288_init(void) { int ret; @@ -297,21 +245,12 @@ static int __init diag288_init(void) return -EINVAL; } - ret = register_pm_notifier(&wdt_power_notifier); - if (ret) - return ret; - - ret = watchdog_register_device(&wdt_dev); - if (ret) - unregister_pm_notifier(&wdt_power_notifier); - - return ret; + return watchdog_register_device(&wdt_dev); } static void __exit diag288_exit(void) { watchdog_unregister_device(&wdt_dev); - unregister_pm_notifier(&wdt_power_notifier); } module_init(diag288_init); From patchwork Fri Feb 3 07:39:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Egorenkov X-Patchwork-Id: 52361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp696889wrn; Thu, 2 Feb 2023 23:41:13 -0800 (PST) X-Google-Smtp-Source: AK7set9F863nspKY7EULd/Tu/lfGf66XSVUPWNqCc46cvSsAyLQ9MIFZYjlcXgTLEFi3ml0jiXrH X-Received: by 2002:a17:903:283:b0:196:d035:73bb with SMTP id j3-20020a170903028300b00196d03573bbmr10791999plr.66.1675410072973; Thu, 02 Feb 2023 23:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675410072; cv=none; d=google.com; s=arc-20160816; b=I3z+pcDw/9JSMGa+X6b+9/A0D7lQo9XcN68Q7eR/duQFwyGiwE9pZzKHtTjbpty+QG LsErmTGVCckvC4uJ4Htv4s/jQrKubwu27CErvOR5mWNolWXIkAwTVrFYylWiD5IzBYgm lltjmFIZqL/mEmLgSUB3PUmXR6COzu5DGD0JMo3z95NT/ewpMj6M/Lneeh0m4SrfKvGQ 7Qc8V9n+aX53IO4b7TpDHVItPjSAI/R8llLMWsdlSOyXs81vNs2R7NIz7esGBE+Hd+5N wSXW5X5JpcFGeBYENV7DNsk3vyoTx9dxz55MT78GZr1RCy7+gkLjdrdWNpnU34rAZEfI 3YUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BLULaKn6GLPcrMBfU9548ZtcKlLiJ/Gqk2e69uSWn0o=; b=oYGgglp5k0h0nwHq91RIJcQZQ6wZW7iDJBaaVW7DiKOei1+PF8dKDTtvTwQ8iU3vXo C9NZ/RVIDqKHyhiKxtIYbeX89hRKo9Oc+okLhl4E0sbaM7rpYLrN6p72xFNg9O5UaDpB CS33RBP7iR/zp5IkahjPA2ByyjVfCrdvOD4NX3LQsf51Ph9kwCh1D+49N6mGSPYSTkTS 9YUEVIdeg0tMg6QBrSv7p4EEmEqjEzaTqgz6c4UvbqO/DNPgr9Ld5ev/KZ6JhEzzPzCt Ud9dJLttEU1rjgO3HhwVYpfvzu02bLv03WjO02gHAjw7SUQ910rdDwfOu5vbr1xVm/wD YcKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QmV90DHD; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r19-20020a170903015300b00198b759b886si1526286plc.612.2023.02.02.23.40.59; Thu, 02 Feb 2023 23:41:12 -0800 (PST) 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=pass header.i=@ibm.com header.s=pp1 header.b=QmV90DHD; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232479AbjBCHkm (ORCPT + 99 others); Fri, 3 Feb 2023 02:40:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232448AbjBCHke (ORCPT ); Fri, 3 Feb 2023 02:40:34 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 490B693AFB; Thu, 2 Feb 2023 23:40:25 -0800 (PST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3136lQTI030471; Fri, 3 Feb 2023 07:40:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=BLULaKn6GLPcrMBfU9548ZtcKlLiJ/Gqk2e69uSWn0o=; b=QmV90DHDUcUiwmSaS6UCoRWWBok1OgshuwFJtzLETCUp1PZHFXC/twAHp/ehMUk0zvr2 5sSlzRqnw9ZJZiyKKX4FylnEObD+yaQh3ZxWyIhke2gQUikoMTRExW5ADurukG2ANsNy dJye06MMzb43fvwjA2bfV6y+eOcwKpVdMN4kJc3kNVsS5d5+9Ow3RAWbCicSryb3tnrl AGWOaixBvjX1FcmfbQtvWYwkc2GRKLyoh00c+sK08ANKztHUUBwPekQeO0Rj1BtK9jzC 4omDLGu7jtYcFRF/sYiFuJYiQVfKC4JxPLrckhK+qlMpbni9vDx8UpMx3KAlhFO8cVGk kg== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ngvkyj33n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:11 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 312DUkrD013066; Fri, 3 Feb 2023 07:40:10 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3ncvugn3cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:09 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3137e7w419596018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Feb 2023 07:40:07 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 441D121423; Fri, 3 Feb 2023 07:40:07 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A5D221431; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) From: Alexander Egorenkov To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, hca@linux.ibm.com Subject: [PATCH 3/5] watchdog: diag288_wdt: unify command buffer handling for diag288 zvm Date: Fri, 3 Feb 2023 08:39:56 +0100 Message-Id: <20230203073958.1585738-4-egorenar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230203073958.1585738-1-egorenar@linux.ibm.com> References: <20230203073958.1585738-1-egorenar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: WWNRe_oUxcoYQIf0tgAXJ9SDaU_v6Dnc X-Proofpoint-ORIG-GUID: WWNRe_oUxcoYQIf0tgAXJ9SDaU_v6Dnc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-03_04,2023-02-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 mlxscore=0 adultscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302030069 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756794792745715172?= X-GMAIL-MSGID: =?utf-8?q?1756794792745715172?= Simplify and de-duplicate code by introducing a common single command buffer allocated once at initialization. Moreover, simplify the interface of __diag288_vm() by accepting ASCII strings as the command parameter and converting it to the EBCDIC format within the function itself. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Egorenkov Reviewed-by: Guenter Roeck --- drivers/watchdog/diag288_wdt.c | 55 +++++++++++++--------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index c8d516ced6d2..c717f47dd4c3 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -69,6 +69,8 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default = C MODULE_ALIAS("vmwatchdog"); +static char *cmd_buf; + static int __diag288(unsigned int func, unsigned int timeout, unsigned long action, unsigned int len) { @@ -88,11 +90,18 @@ static int __diag288(unsigned int func, unsigned int timeout, return err; } -static int __diag288_vm(unsigned int func, unsigned int timeout, - char *cmd, size_t len) +static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd) { + ssize_t len; + + len = strscpy(cmd_buf, cmd, MAX_CMDLEN); + if (len < 0) + return len; + ASCEBC(cmd_buf, MAX_CMDLEN); + EBC_TOUPPER(cmd_buf, MAX_CMDLEN); + diag_stat_inc(DIAG_STAT_X288); - return __diag288(func, timeout, virt_to_phys(cmd), len); + return __diag288(func, timeout, virt_to_phys(cmd_buf), len); } static int __diag288_lpar(unsigned int func, unsigned int timeout, @@ -104,24 +113,14 @@ static int __diag288_lpar(unsigned int func, unsigned int timeout, static int wdt_start(struct watchdog_device *dev) { - char *ebc_cmd; - size_t len; int ret; unsigned int func; if (MACHINE_IS_VM) { - ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); - if (!ebc_cmd) - return -ENOMEM; - len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); - ASCEBC(ebc_cmd, MAX_CMDLEN); - EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); - func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) : WDT_FUNC_INIT; - ret = __diag288_vm(func, dev->timeout, ebc_cmd, len); + ret = __diag288_vm(func, dev->timeout, wdt_cmd); WARN_ON(ret != 0); - kfree(ebc_cmd); } else { ret = __diag288_lpar(WDT_FUNC_INIT, dev->timeout, LPARWDT_RESTART); @@ -146,19 +145,10 @@ static int wdt_stop(struct watchdog_device *dev) static int wdt_ping(struct watchdog_device *dev) { - char *ebc_cmd; - size_t len; int ret; unsigned int func; if (MACHINE_IS_VM) { - ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); - if (!ebc_cmd) - return -ENOMEM; - len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); - ASCEBC(ebc_cmd, MAX_CMDLEN); - EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); - /* * It seems to be ok to z/VM to use the init function to * retrigger the watchdog. On LPAR WDT_FUNC_CHANGE must @@ -167,9 +157,8 @@ static int wdt_ping(struct watchdog_device *dev) func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) : WDT_FUNC_INIT; - ret = __diag288_vm(func, dev->timeout, ebc_cmd, len); + ret = __diag288_vm(func, dev->timeout, wdt_cmd); WARN_ON(ret != 0); - kfree(ebc_cmd); } else { ret = __diag288_lpar(WDT_FUNC_CHANGE, dev->timeout, 0); } @@ -212,25 +201,20 @@ static struct watchdog_device wdt_dev = { static int __init diag288_init(void) { int ret; - char ebc_begin[] = { - 194, 197, 199, 201, 213 - }; - char *ebc_cmd; watchdog_set_nowayout(&wdt_dev, nowayout_info); if (MACHINE_IS_VM) { - ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL); - if (!ebc_cmd) { + cmd_buf = kmalloc(MAX_CMDLEN, GFP_KERNEL); + if (!cmd_buf) { pr_err("The watchdog cannot be initialized\n"); return -ENOMEM; } - memcpy(ebc_cmd, ebc_begin, sizeof(ebc_begin)); - ret = __diag288_vm(WDT_FUNC_INIT, 15, - ebc_cmd, sizeof(ebc_begin)); - kfree(ebc_cmd); + + ret = __diag288_vm(WDT_FUNC_INIT, MIN_INTERVAL, "BEGIN"); if (ret != 0) { pr_err("The watchdog cannot be initialized\n"); + kfree(cmd_buf); return -EINVAL; } } else { @@ -251,6 +235,7 @@ static int __init diag288_init(void) static void __exit diag288_exit(void) { watchdog_unregister_device(&wdt_dev); + kfree(cmd_buf); } module_init(diag288_init); From patchwork Fri Feb 3 07:39:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Egorenkov X-Patchwork-Id: 52365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp698043wrn; Thu, 2 Feb 2023 23:45:08 -0800 (PST) X-Google-Smtp-Source: AK7set/qs40GYl4uIqJ77c+puFoc/UjpOJYC0DNgFy+xj7OHJck/IqtXqD+NVNRzZOdBgjbxBG3K X-Received: by 2002:a05:6a20:4c94:b0:be:b137:9d1c with SMTP id fq20-20020a056a204c9400b000beb1379d1cmr8685957pzb.37.1675410308686; Thu, 02 Feb 2023 23:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675410308; cv=none; d=google.com; s=arc-20160816; b=zaLkV6s4EOGctINs+7bAV6bvcxonf6zN9m4a/1v9l8S4SOPVuT53Y1gpGqhXsrpsWc 5BpCJXVydUrxCZfOSFduuereNyj/ZYhba2bjewzGERbA+Jr+yt4TKbO9sDvLsYwmtZQx kbRxuRtBp7A3OdrjnL5jCdkd/joGdfa42sabDxLo1T4w1dIa3SmsNuw16ND4CSfLUYpu myxo1vzOPJLoowoD+QKSZqbkZ96QsHLLYPOpiSdHVY9G5Yk8rO6/NIX1Eq/9hBa5QDz1 358A5ZCzxuL5Beniw+jPyHAP7ZKEpleHXXYVph4c6Zq53zH4/IfHKZHqtg9GSYILXt9d 5Ecw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ax36eGVT6uv/rdk0f4LW7DqyFxU3vDre425F3oR0aSk=; b=UrKLN6BaVbd6vhnumkIKCnXPqHRrgZONPOFtIYdOFaukZ52w/zLwDvMjv+PRcJFkiZ lZkT/mcwwY5q3GjM9XCu0UR3E5wksuf8a9LOqH8BKXIRxNuKDacBPPDgbNBwSV8SPZOP LWEGj47UIQScaefNosIJGfw6vsPSKKg2qx6Yxc1f3lx8f4syZlYj5EtVLXIG/p8GBBM2 2nCLHfkj0j/9HD3vHJAkTqBWw3SQFzkl9JHfqCYY46F+M6i3iINfK1AXXKKwjL9nHVZx Nx5Pa2oEnhX2LuT066lwMmHd+wkxGjQk35lP9SzIJB1Drq30w4I2hqW81HxIHe86O98P kGHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=q2HQasjU; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k64-20020a633d43000000b004b484eb665bsi2208479pga.16.2023.02.02.23.44.55; Thu, 02 Feb 2023 23:45:08 -0800 (PST) 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=pass header.i=@ibm.com header.s=pp1 header.b=q2HQasjU; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232529AbjBCHkt (ORCPT + 99 others); Fri, 3 Feb 2023 02:40:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232417AbjBCHke (ORCPT ); Fri, 3 Feb 2023 02:40:34 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2942793E0B; Thu, 2 Feb 2023 23:40:26 -0800 (PST) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31370w03016120; Fri, 3 Feb 2023 07:40:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Ax36eGVT6uv/rdk0f4LW7DqyFxU3vDre425F3oR0aSk=; b=q2HQasjU3H1Q700XQ3aIhIW2zD3fgqNHW1ht1jXM3tC3R1bNLFERp/VtWPCCtFzadwW7 xn1eyDOItKcyO5lSgg/mEbNf618IuNOlggsvwc8dOZdxQHdyaFCu6qKjXEIXf/T7Cgd0 hQtnpw6om2Hhknd9GMSCg2uMSSN7bD/TlRgJntXio7Ooi7si4FI/LX9CG0Hy9gefxHN7 vIWAKI58LAm4+ncooc6Ye1Bvcrro+X2vaMK3G/kwZB7vLDKequXNka6UQxTeAiM/Wpzs jeLdEILtnLCYRQtmhPlazdf9n0NP7i+zWDMUY4jJ0c0iGegLqYOIIyLrhsz4vwUbri08 /g== Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ngwgegugy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:12 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3136QZPl012873; Fri, 3 Feb 2023 07:40:09 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3ncvtyf44y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:09 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3137e7h921037682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Feb 2023 07:40:07 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 318A621447; Fri, 3 Feb 2023 07:40:07 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98B0821433; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) From: Alexander Egorenkov To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, hca@linux.ibm.com Subject: [PATCH 4/5] watchdog: diag288_wdt: de-duplicate diag_stat_inc() calls Date: Fri, 3 Feb 2023 08:39:57 +0100 Message-Id: <20230203073958.1585738-5-egorenar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230203073958.1585738-1-egorenar@linux.ibm.com> References: <20230203073958.1585738-1-egorenar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PZXR6kb8t_yX_SNPtMpJOumrt29X-eNP X-Proofpoint-GUID: PZXR6kb8t_yX_SNPtMpJOumrt29X-eNP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-03_04,2023-02-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 adultscore=0 bulkscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302030069 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756795040243587793?= X-GMAIL-MSGID: =?utf-8?q?1756795040243587793?= Call diag_stat_inc() from __diag288() to reduce code duplication. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Egorenkov Reviewed-by: Guenter Roeck --- drivers/watchdog/diag288_wdt.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index c717f47dd4c3..a29ad164b27a 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -78,6 +78,8 @@ static int __diag288(unsigned int func, unsigned int timeout, union register_pair r3 = { .even = action, .odd = len, }; int err; + diag_stat_inc(DIAG_STAT_X288); + err = -EINVAL; asm volatile( " diag %[r1],%[r3],0x288\n" @@ -100,14 +102,12 @@ static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd) ASCEBC(cmd_buf, MAX_CMDLEN); EBC_TOUPPER(cmd_buf, MAX_CMDLEN); - diag_stat_inc(DIAG_STAT_X288); return __diag288(func, timeout, virt_to_phys(cmd_buf), len); } static int __diag288_lpar(unsigned int func, unsigned int timeout, unsigned long action) { - diag_stat_inc(DIAG_STAT_X288); return __diag288(func, timeout, action, 0); } @@ -135,12 +135,7 @@ static int wdt_start(struct watchdog_device *dev) static int wdt_stop(struct watchdog_device *dev) { - int ret; - - diag_stat_inc(DIAG_STAT_X288); - ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0); - - return ret; + return __diag288(WDT_FUNC_CANCEL, 0, 0, 0); } static int wdt_ping(struct watchdog_device *dev) From patchwork Fri Feb 3 07:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Egorenkov X-Patchwork-Id: 52376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp701646wrn; Thu, 2 Feb 2023 23:57:39 -0800 (PST) X-Google-Smtp-Source: AK7set904x4CqsK8VQaV3RiCNYRgHeZVMlXoC2WgvtgpLr+PGoMLW8hE4QjQr/6/A/yTtdHf98dt X-Received: by 2002:aa7:d653:0:b0:4a0:b63a:119f with SMTP id v19-20020aa7d653000000b004a0b63a119fmr9032910edr.30.1675411058921; Thu, 02 Feb 2023 23:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675411058; cv=none; d=google.com; s=arc-20160816; b=bJ0wtMakrxsY49ir0VPQM3LG/c2OU4A668yKADyMIVrsoJf2jZHEAE2QWwEwvcju4z b+ifytkso58cytQ1kDDmOeZcHhBLKKMam1td985xiLJLAL9wdmPhDt6joyWk5Acccv52 L9L2P10t7FA8+kVyUy68yefqVkL/7QLBZ730D/O62pHFh0CIjl3C+kA5qroQzxzSL2xp 93ZxDs2EL0Drx4dgXSzGPW9iiEkh+KPhGFvzs0WbuYw9nSUmfh5aZI3WOPNepG5udawv f4J6/vDKz2J9sUaTgzLitmPRT3BLdSYDCEfkd51Lc/qVWwoMuSpo1O0EmHprLIqhAbqR 21XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tIvJlJrYU4Flf0lu2LlXiqfJqpjr0G6K3AKhGGPmAVs=; b=eYxMiqccwsPKAOYCAP6nvQE4EeWuj3txGWkIz3Qd5/HUMyhWkv9eR2eCHfgiNju+GT 7+8ZU8oWo/jAyiz6JXkPcvrEY3wwlCANYs7BLmbq1CMIal29kmBXze15qyMFtMwenqqs kFLPK4dWswne4PDGUvMaDfC/o1eqvgU+4CU2mpl6cp6ECM2bKel94wneHtVBLJG+q0RT W3L9V35QuAvYsBSKIXJV7m0CK/ocDyhiIsF1MBU1Y9DOec3wFfF80yESB8X8VCTFflRR x2A2yAqWW/g3mFFRezCdXKuJCGT2C0JODz9hRgt1/oa4yEmNfbSEb7i1xs5Fyi15xbTx SzFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=n92bHkMC; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020aa7d0d1000000b0046b05ca8929si1949951edo.592.2023.02.02.23.57.14; Thu, 02 Feb 2023 23:57:38 -0800 (PST) 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=pass header.i=@ibm.com header.s=pp1 header.b=n92bHkMC; 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; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232541AbjBCHky (ORCPT + 99 others); Fri, 3 Feb 2023 02:40:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232392AbjBCHke (ORCPT ); Fri, 3 Feb 2023 02:40:34 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291AF93E08; Thu, 2 Feb 2023 23:40:25 -0800 (PST) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31370nHu015928; Fri, 3 Feb 2023 07:40:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=tIvJlJrYU4Flf0lu2LlXiqfJqpjr0G6K3AKhGGPmAVs=; b=n92bHkMC6MzB/nXIOfHWT1pcrEjXAwJyQ8KJiD9DbNUCKSnd4z9gkQ9zQJHWB99Wmjcp F350SJJ1FTq7WZyPuzPhoucgZtpVY+kjG60Xd9tIzky/93bBewLWlGVjQVnJYPhPJh6z PNNCh0xqgmuDq34TtJKJYq35VhzgjAXi0vMGOslaHqU3IwdHCMMk7u6yYp/YUNMy9ok5 Z7uOBLUwSSm3duDySAyq0NFNMMiSoefttNB5iWeHDXJVP+fzb9PdXz4X3TwQiMEBQmS/ yPsA5hZ4aS8m3UyJ1566DfXSckxCOq2p1R5+46zoozb8t73CaWtxsUyk4GLlFXHjPLhF 8Q== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ngwgeguh5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:12 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3136xHho014735; Fri, 3 Feb 2023 07:40:10 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3ncvtty3vf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Feb 2023 07:40:09 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3137e7Qj22282850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Feb 2023 07:40:07 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2136821426; Fri, 3 Feb 2023 07:40:07 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B75F621435; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Feb 2023 07:40:04 +0000 (GMT) From: Alexander Egorenkov To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, hca@linux.ibm.com Subject: [PATCH 5/5] watchdog: diag288_wdt: unify lpar and zvm diag288 helpers Date: Fri, 3 Feb 2023 08:39:58 +0100 Message-Id: <20230203073958.1585738-6-egorenar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230203073958.1585738-1-egorenar@linux.ibm.com> References: <20230203073958.1585738-1-egorenar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Lff_S4qLoP8GXhEN0LtVG907S7o0xdIU X-Proofpoint-GUID: Lff_S4qLoP8GXhEN0LtVG907S7o0xdIU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-03_04,2023-02-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=990 phishscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 adultscore=0 bulkscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302030069 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756795826412074598?= X-GMAIL-MSGID: =?utf-8?q?1756795826412074598?= Change naming of the internal diag288 helper functions to improve overall readability and reduce confusion: * Rename __diag288() to diag288(). * Get rid of the misnamed helper __diag288_lpar() that was used not only on LPARs but also zVM and KVM systems. * Rename __diag288_vm() to diag288_str(). Reviewed-by: Heiko Carstens Signed-off-by: Alexander Egorenkov Reviewed-by: Guenter Roeck --- drivers/watchdog/diag288_wdt.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index a29ad164b27a..4631d0a3866a 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -71,8 +71,8 @@ MODULE_ALIAS("vmwatchdog"); static char *cmd_buf; -static int __diag288(unsigned int func, unsigned int timeout, - unsigned long action, unsigned int len) +static int diag288(unsigned int func, unsigned int timeout, + unsigned long action, unsigned int len) { union register_pair r1 = { .even = func, .odd = timeout, }; union register_pair r3 = { .even = action, .odd = len, }; @@ -92,7 +92,7 @@ static int __diag288(unsigned int func, unsigned int timeout, return err; } -static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd) +static int diag288_str(unsigned int func, unsigned int timeout, char *cmd) { ssize_t len; @@ -102,13 +102,7 @@ static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd) ASCEBC(cmd_buf, MAX_CMDLEN); EBC_TOUPPER(cmd_buf, MAX_CMDLEN); - return __diag288(func, timeout, virt_to_phys(cmd_buf), len); -} - -static int __diag288_lpar(unsigned int func, unsigned int timeout, - unsigned long action) -{ - return __diag288(func, timeout, action, 0); + return diag288(func, timeout, virt_to_phys(cmd_buf), len); } static int wdt_start(struct watchdog_device *dev) @@ -119,11 +113,10 @@ static int wdt_start(struct watchdog_device *dev) if (MACHINE_IS_VM) { func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) : WDT_FUNC_INIT; - ret = __diag288_vm(func, dev->timeout, wdt_cmd); + ret = diag288_str(func, dev->timeout, wdt_cmd); WARN_ON(ret != 0); } else { - ret = __diag288_lpar(WDT_FUNC_INIT, - dev->timeout, LPARWDT_RESTART); + ret = diag288(WDT_FUNC_INIT, dev->timeout, LPARWDT_RESTART, 0); } if (ret) { @@ -135,7 +128,7 @@ static int wdt_start(struct watchdog_device *dev) static int wdt_stop(struct watchdog_device *dev) { - return __diag288(WDT_FUNC_CANCEL, 0, 0, 0); + return diag288(WDT_FUNC_CANCEL, 0, 0, 0); } static int wdt_ping(struct watchdog_device *dev) @@ -152,10 +145,10 @@ static int wdt_ping(struct watchdog_device *dev) func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) : WDT_FUNC_INIT; - ret = __diag288_vm(func, dev->timeout, wdt_cmd); + ret = diag288_str(func, dev->timeout, wdt_cmd); WARN_ON(ret != 0); } else { - ret = __diag288_lpar(WDT_FUNC_CHANGE, dev->timeout, 0); + ret = diag288(WDT_FUNC_CHANGE, dev->timeout, 0, 0); } if (ret) @@ -206,20 +199,21 @@ static int __init diag288_init(void) return -ENOMEM; } - ret = __diag288_vm(WDT_FUNC_INIT, MIN_INTERVAL, "BEGIN"); + ret = diag288_str(WDT_FUNC_INIT, MIN_INTERVAL, "BEGIN"); if (ret != 0) { pr_err("The watchdog cannot be initialized\n"); kfree(cmd_buf); return -EINVAL; } } else { - if (__diag288_lpar(WDT_FUNC_INIT, 30, LPARWDT_RESTART)) { + if (diag288(WDT_FUNC_INIT, WDT_DEFAULT_TIMEOUT, + LPARWDT_RESTART, 0)) { pr_err("The watchdog cannot be initialized\n"); return -EINVAL; } } - if (__diag288_lpar(WDT_FUNC_CANCEL, 0, 0)) { + if (diag288(WDT_FUNC_CANCEL, 0, 0, 0)) { pr_err("The watchdog cannot be deactivated\n"); return -EINVAL; }