From patchwork Thu May 24 00:13:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919460 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqdS48M6z9s1B for ; Thu, 24 May 2018 10:14:52 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Cis3M8jo"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqdS0T0BzF1Hg for ; Thu, 24 May 2018 10:14:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Cis3M8jo"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:400c:c05::24a; helo=mail-vk0-x24a.google.com; envelope-from=3zgmgwwmkb8sdr1x55x2v.t5391zs55a2z9a9.5g2rs9.58x@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Cis3M8jo"; dkim-atps=neutral Received: from mail-vk0-x24a.google.com (mail-vk0-x24a.google.com [IPv6:2607:f8b0:400c:c05::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqcl1qgzzF1Gj for ; Thu, 24 May 2018 10:14:08 +1000 (AEST) Received: by mail-vk0-x24a.google.com with SMTP id i205-v6so13860084vke.17 for ; Wed, 23 May 2018 17:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=2dobfiu+Q4fDdm6aS0et4hdO1S1nvGsPL8Xq/AmcLFE=; b=Cis3M8joqNIK2OH0VHUZwkawwcwbrMjGUrJZH3IAbJ+2pueLOJo6o5ukysnJQ4XFlL FzUQq8NOdJcuEFhR6TvyNw6lNGZ1e+PHmUBgVElfkvDaR8KPytFe0NJdaLoDd071VM3S GMBAijmmul+58K7/+cT0TB9/TbncEp5wJPuHX0rEx81TGVGCioDR3RqyET0fD3w/Zs2B VdsVgIne5PRMDJrLfZVBsfmL8GFjMpA16wqnmPpxmLonTgGgSa/oPOTWO1viUVUaNrNo 8sWT2AKtcxUGVhUO8zMVOWsHS9kkWArFWEVqr7/i1xbJ7GJlJWZfe8B5Bb2AlXgCLQxF Ec7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=2dobfiu+Q4fDdm6aS0et4hdO1S1nvGsPL8Xq/AmcLFE=; b=t9CIOf7440eJThXRy8DxBKaXwUma68CHE2R1eYfMTXrdd9PyMQ0AWji86mbXmFxS1a dyQ3AhBp5g/MTwZwmcS9Kx6ozP/GY5T87r2+d4TJwEaa/mEwpyGyqMTsQCGjeWqdS+My bPSjE8S8zGNi+AsiM7NQY8dbO6HLg2GF+AVg/s++rpnY3OmIJ0VEDi2Z5Fyvd9twkWtv SAskEaWCEdhivyltKF20DB0Ch6R2RJZe7QlaeSi1h0pMreGmR/wE/hKtyAguPLASFjY/ cqhgBmnYLm26MIPv3wENdmeGxyUappWSIHsssiPErD0F10gkyhwzplnKJ/jtQK/YkBMV bloQ== X-Gm-Message-State: ALKqPwcq2YPvlKu6mTRxvBPxsqQvkGHjo3+2g0koL74Zd93wtoUYItIp 51YDdBYW3UrJV5YtBbCwXb9IJd+q6BfFyFxzkHZFCN0ibILReA5+Qkv4RoQz3qAdkwszagg8Gma yb6qzTuhtW0nGHYYJi2t43Anb7BL4UHHfKCUMvd8iR4DwtP803AdKHe3w X-Google-Smtp-Source: AB8JxZrWNkvmELQonzTiTlE2Fam7g3GEZ+Wu+xs5qWpZRZCQymfUZWcYbXk0qWdmIG5aAp8GxOGtFME= MIME-Version: 1.0 X-Received: by 2002:a1f:9d4b:: with SMTP id g72-v6mr2120058vke.89.1527120846777; Wed, 23 May 2018 17:14:06 -0700 (PDT) Date: Wed, 23 May 2018 17:13:27 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-2-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 1/9] ipmi-watchdog: WD_POWER_CYCLE_ACTION -> WD_RESET_ACTION X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The IPMI specification denotes that action 0x1 is Host Reset and 0x3 is Host Power Cycle. Use the correct name for Reset in our watchdog code. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index 55c3bf555..966d10de4 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -31,7 +31,7 @@ /* WDT expiration actions */ #define WDT_PRETIMEOUT_SMI 0x10 -#define WDT_POWER_CYCLE_ACTION 0x01 +#define WDT_RESET_ACTION 0x01 #define WDT_NO_ACTION 0x00 /* How long to set the overall watchdog timeout for. In units of @@ -122,7 +122,7 @@ void ipmi_wdt_final_reset(void) /* todo: this is disabled while we're waiting on fixed watchdog * behaviour */ #if 0 - set_wdt(WDT_POWER_CYCLE_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT, + set_wdt(WDT_RESET_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT, WDT_MARGIN/10); reset_wdt(NULL, (void *) 1); #endif @@ -134,7 +134,7 @@ void ipmi_wdt_final_reset(void) void ipmi_wdt_init(void) { init_timer(&wdt_timer, reset_wdt, NULL); - set_wdt(WDT_POWER_CYCLE_ACTION, WDT_TIMEOUT, 0); + set_wdt(WDT_RESET_ACTION, WDT_TIMEOUT, 0); /* Start the WDT. We do it synchronously to make sure it has * started before skiboot continues booting. Otherwise we From patchwork Thu May 24 00:13:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqfD4tqnz9s1B for ; Thu, 24 May 2018 10:15:32 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="hmymTfMS"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqfD1vYpzF1Hp for ; Thu, 24 May 2018 10:15:32 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="hmymTfMS"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:400d:c0d::249; helo=mail-qt0-x249.google.com; envelope-from=30qmgwwmkb84gu408805y.w86c42v88d52cdc.8j5uvc.8b0@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="hmymTfMS"; dkim-atps=neutral Received: from mail-qt0-x249.google.com (mail-qt0-x249.google.com [IPv6:2607:f8b0:400d:c0d::249]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqcp0xD1zF1H5 for ; Thu, 24 May 2018 10:14:11 +1000 (AEST) Received: by mail-qt0-x249.google.com with SMTP id f1-v6so23631001qth.2 for ; Wed, 23 May 2018 17:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=QYxL8Piso5f1Quk5VUIQ4l7bV5NKEXNP2uh+TBIM6T4=; b=hmymTfMSk5zjMpacQ+ui5chGJzZhdRm8huv3cm5p97V4KYoMVL35Dy5BK/HW7m+lgS bNBDTKAv+eLyphiI55AGHBvUWVY0rudR6r31qRoW2m2tyXspJriiTt/yWPkA1hUi+H5x mCEcQbSG5QXdnTEN+3HDO7D4jI5bJc8feAu5prHb8U90F0F2oL9PkkYPcxC9/U0oLAUV NcLU504NIyMpf9Vcca68TmVg68O1S94oO6CRTjv3d9+RyiT2Vs9f4Hf0i6wZ6SMg29CT sZTuVilhQ5va+JJ3xuk5twkKC918bbZRXoteBFd7D+OL7RX8fKTqwh+35pM2HB083PLz INkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=QYxL8Piso5f1Quk5VUIQ4l7bV5NKEXNP2uh+TBIM6T4=; b=ERmXHoSNGWB0B7dW/0qDkEob6EiZfa8vbfSt+5/QZUk8sIj8GC4nRcUMG0KbUQJ1IU 8wWbKGdQBfDNHFB0ub+pkmhb2wZeqvjtYZ7fMg8F1fit7j4WppB+PWscszG3/UkDvy98 viT/VDx/dZvVPI7++xWIfAZ7uwO9/mk/l1kZDM8YbAZfNcnkzQcbrKV92F4LN1tpFv80 BE5yWbb8WGT1nCv5GSgJfPk12TTaHM8r5VMCsd53kdMrNJ/hrHYChen1x7qh/WJA5SIA oPayrwYp8oOtayeWKtVwcXGw2dWQ5JHwAZLAbNTSSECavjwnMHYjajEwXg/0narLA9nU nErw== X-Gm-Message-State: ALKqPwc8eJdUEMIcA5xx3ztMexj14sag0Q3qoF+RwW7X2Q50uZBdjLSH M90jmf6TAcn+pOuqOKBmtWSobjEZa+M8Qf4gBSqNUGSNIVeTNGWesAhXw6geo3uSdkKu1cZ3MDh 6Kdtl7FTYgpC2Sx/rVr/BkFPze7xwbOgNwBv/O3P3eCht9jkN39z/r8+5 X-Google-Smtp-Source: ADUXVKK7snKXiPNVZXlun4nAiG6pQLIghL7TIAcXUql88iG55cc9j3x9NNnfMO92CZwwbuAuRCJo2vU= MIME-Version: 1.0 X-Received: by 2002:ac8:41cb:: with SMTP id o11-v6mr2622633qtm.26.1527120849382; Wed, 23 May 2018 17:14:09 -0700 (PDT) Date: Wed, 23 May 2018 17:13:28 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-3-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 2/9] ipmi-watchdog: Make it possible to set DONT_STOP X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The IPMI standard supports setting a DONT_STOP bit during an Watchdog Set operation. Most of the time we don't want to stop the Watchdog when updating the settings so we should be using this bit. This patch makes it possible for callers of set_wdt to prevent the watchdog from being stopped. This only changes the behavior of the watchdog during the initial settings update when initializing skiboot. The watchdog is no longer disabled and then immediately re-enabled. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index 966d10de4..ee1608443 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -57,7 +57,8 @@ static void ipmi_wdt_complete(struct ipmi_msg *msg) ipmi_free_msg(msg); } -static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout) +static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout, + bool dont_stop) { struct ipmi_msg *ipmi_msg; @@ -69,7 +70,8 @@ static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout) } ipmi_msg->error = ipmi_wdt_complete; ipmi_msg->data[0] = TIMER_USE_POST | - TIMER_USE_DONT_LOG; /* Timer Use */ + TIMER_USE_DONT_LOG | + (dont_stop ? TIMER_USE_DONT_STOP : 0); ipmi_msg->data[1] = action; /* Timer Actions */ ipmi_msg->data[2] = pretimeout; /* Pre-timeout Interval */ ipmi_msg->data[3] = 0; /* Timer Use Flags */ @@ -113,7 +115,7 @@ void ipmi_wdt_stop(void) { if (!wdt_stopped) { wdt_stopped = true; - set_wdt(WDT_NO_ACTION, 100, 0); + set_wdt(WDT_NO_ACTION, 100, 0, false); } } @@ -123,10 +125,10 @@ void ipmi_wdt_final_reset(void) * behaviour */ #if 0 set_wdt(WDT_RESET_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT, - WDT_MARGIN/10); + WDT_MARGIN/10, true); reset_wdt(NULL, (void *) 1); #endif - set_wdt(WDT_NO_ACTION, 100, 0); + set_wdt(WDT_NO_ACTION, 100, 0, false); ipmi_set_boot_count(); cancel_timer(&wdt_timer); } @@ -134,7 +136,7 @@ void ipmi_wdt_final_reset(void) void ipmi_wdt_init(void) { init_timer(&wdt_timer, reset_wdt, NULL); - set_wdt(WDT_RESET_ACTION, WDT_TIMEOUT, 0); + set_wdt(WDT_RESET_ACTION, WDT_TIMEOUT, 0, true); /* Start the WDT. We do it synchronously to make sure it has * started before skiboot continues booting. Otherwise we From patchwork Thu May 24 00:13:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqdt1KFwz9s1B for ; Thu, 24 May 2018 10:15:14 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="CGx3FOsk"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqds6pD6zF1KG for ; Thu, 24 May 2018 10:15:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="CGx3FOsk"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:4001:c0b::24a; helo=mail-it0-x24a.google.com; envelope-from=31amgwwmkb9ejx73bb381.zb9f75ybbg85fgf.bm8xyf.be3@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="CGx3FOsk"; dkim-atps=neutral Received: from mail-it0-x24a.google.com (mail-it0-x24a.google.com [IPv6:2607:f8b0:4001:c0b::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqcn5nrfzF1Gj for ; Thu, 24 May 2018 10:14:14 +1000 (AEST) Received: by mail-it0-x24a.google.com with SMTP id c82-v6so177532itg.1 for ; Wed, 23 May 2018 17:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=loeAAwKqEJMfOckMI/qAswQ/RPOoDfhyKMVY023THT4=; b=CGx3FOskvBQlg8CeX1hJ7MGXgbjufrMmd5HVsxkwsROixAws/Z5LZVfcAFeR4VtxrQ 1AYAR00txi0eo393skqNN6GBKVVMiTsghXjA5RDQeiwDzY3kiSDhIzmyWgObez20xOnn cykuTKmNNtowgr9ucPo8XAoBJALSQPM4LbgUEd6mZEll/FZ8bAjVQeo/imqGF5jQmZDN xMTjjJ/yMZdKLvWURdY0JZUCgrPnC7sTjIei9xV+A/FQUTDx7dJxYv7jnWDUiu0L0aO/ joaiVmtjNrYBBPMPiiRPNMWVLQddrrhsPT/1fYASvlkbX8s5Sg+w7wlTppncPMf2Ui16 5cPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=loeAAwKqEJMfOckMI/qAswQ/RPOoDfhyKMVY023THT4=; b=eZeCu0Qhcvn8GddYITc8e4UzlQhzLZow+38yZkQPrIEtXLt5xyTPuW2wGr/ld6chtO lqO6U22S/7rSCkPvMYBElTiTM/3UlW/aWDR7CLisS4fMYU+R8B/4UaEPCPhOvUV0Y4V+ Vx2xOIUP9SktJc0gHIMMBx8fGzLEzO9yVCWsDXbylIpCl5LD9mYRmsUFHe8NTwrsOMp3 Tv1kO5s4eRfEW/ojrgoJ8czfn72t7rVJE6ImKhCg9XPvhmBCnWQ6P/an7dnoagzsQnYr 9bMcwQBT/LsT61Kya2fDIgWu6eGsgBKeuj5lpknwSWkuW24zZGtvQr6HdKMp9KPRTBXg Bwog== X-Gm-Message-State: ALKqPweUvj5MAvzv1y3GublNmGwX+jHyZSu9dBShr8OmRl0lQ6u7fEWc YHjQwNTD00zcepFFHSs043jlDRnmcL+haF7PG+xUeygKG95X4sT9JwJAsvtyBMmmh/2XdynvtFm 9yHLyYPtg84jKpfj8j5ORouLyk+AuoKeFxYLR8kVkWrgPIEHIkU5Mx4lV X-Google-Smtp-Source: AB8JxZqv6qkfVjeXIlzzjwT7F/GRlC9/kkUV7tGZOY0k/FL1/OnAUChFXxkxSbeMvN3nxoLE+ByI7yQ= MIME-Version: 1.0 X-Received: by 2002:a24:8307:: with SMTP id d7-v6mr3544589ite.20.1527120852055; Wed, 23 May 2018 17:14:12 -0700 (PDT) Date: Wed, 23 May 2018 17:13:29 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-4-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 3/9] ipmi-watchdog: Don't reset the watchdog twice X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" There is no clarification for why this change was needed, but presumably this is due to a buggy BMC implementation where the Watchdog Set command was processed concurrently or after the initial Watchdog Reset. This inversion would cause the watchdog to stop since the DONT_STOP bit was not set. Since we are now using the DONT_STOP bit during initialization, the watchdog should not be stopped even if an inversion occurs. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index ee1608443..e8efba2b4 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -143,9 +143,5 @@ void ipmi_wdt_init(void) * could crash before the wdt has actually been started. */ sync_reset_wdt(); - /* For some reason we have to reset it twice to get it to - * actually start the first time. */ - sync_reset_wdt(); - return; } From patchwork Thu May 24 00:13:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqfk2Vghz9s2S for ; Thu, 24 May 2018 10:15:58 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Cb2Chd1c"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqfj2CCFzF1Hj for ; Thu, 24 May 2018 10:15:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Cb2Chd1c"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:4001:c0b::24a; helo=mail-it0-x24a.google.com; envelope-from=31gmgwwmkb9mlz95dd5a3.1dbh970ddia7hih.doaz0h.dg5@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Cb2Chd1c"; dkim-atps=neutral Received: from mail-it0-x24a.google.com (mail-it0-x24a.google.com [IPv6:2607:f8b0:4001:c0b::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqcq2GFgzF1HF for ; Thu, 24 May 2018 10:14:16 +1000 (AEST) Received: by mail-it0-x24a.google.com with SMTP id r76-v6so177917itc.0 for ; Wed, 23 May 2018 17:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=NSJlW2S780mY0EPBWEs3xDe6DX1qSjkopgxq4VW2ykA=; b=Cb2Chd1cF4Cc0p90wZ4jEvk0Xfm/Y0YXtvTBqMUVd+SwkNPyFaUTlHfwZJYY1xLFfk 6JYB0y7ha70ebVHkM6OA11cQQkeF9zSFay/Xo60DX8nHBQYqku+64p5Almvqf7ZWg4iS cDAz0SyL/er6CZ0urryBYjlpg+J2kQhChYTTcPzL4m1kP2n/DEkOGP3XjLIQDqGnHRh8 3QiM0h7WNxPnGUfkBHIjt3Ugfn1OyrwiiQ7dLn9Ic0+4IPnL9zahKcNdtutRGZfMNZhn tadk+N55yK+Rlq/+aojMLDTkzoE6GkZ/QfcBoL2g04F171nvSqhbARf4FgV1sLoCgAbu e7VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=NSJlW2S780mY0EPBWEs3xDe6DX1qSjkopgxq4VW2ykA=; b=NHeba7Od3awLLsOqw2Qu3rcFXZiILeEekTttXLSm7kxS5mP00K4gJ9h9oQT6+3izlD 29XC4J4wqkHfdefL8n5oenWGYNORN21BztyUXMWxzSZFL7YzCdb8siaS1b7FN8PvLvc2 ZoH6CtQ/bGV7pMV11odbQYg29QL/TAbuKDPoRN2rinQycjsH/FngyJmRfwg7VKdMe1UJ 2W6/wqJYTHPtQllTa4EtMIYQmwrhqrvrETVnFarubwS7k49hgFCcBGZ+tMV7hdKsOyQV 17PwieBhAWmRrKwiEUKv8iLoOIQ7H1h/30oVo9Utfc0IVx6NCjCFLZEDtCskGQS3wC+O nxOQ== X-Gm-Message-State: ALKqPwcMuZGipZR/xE7O8Sp5kkvGB4IA7Z3Mnqg1qPZOcFMdN+PbRJsh holDCUhpHYl8eIjc93usbMCfDlb4sksyhe63MkGc8T/gog9yZ+rgDH+s34CAjI7rpM3vKR141XL IbaNglk74nCWwUs4OP7wqMq7YEHD+MYQRF7mbT+PXmIQIfxvKN8/cu1Qq X-Google-Smtp-Source: AB8JxZoI6rZeZjEAC9d/vm4Xn3/rXbR17vDmokJLUL0sNgig5BNaRUWMeEJLTHfxFAIghmf11Zah0DI= MIME-Version: 1.0 X-Received: by 2002:a24:a088:: with SMTP id o130-v6mr3598325ite.35.1527120854281; Wed, 23 May 2018 17:14:14 -0700 (PDT) Date: Wed, 23 May 2018 17:13:30 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-5-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 4/9] ipmi-watchdog: Don't disable at shutdown X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The op-build linux kernel has been configured to support the ipmi watchdog. This driver will always handle the watchdog by either leaving it enabled if configured, or by disabling it during module load if no configuration is provided. This increases the coverage of the watchdog during the boot process. The watchdog should no longer be disabled at any point during skiboot execution. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index e8efba2b4..b5cb5fee4 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -121,14 +121,9 @@ void ipmi_wdt_stop(void) void ipmi_wdt_final_reset(void) { - /* todo: this is disabled while we're waiting on fixed watchdog - * behaviour */ -#if 0 set_wdt(WDT_RESET_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT, WDT_MARGIN/10, true); - reset_wdt(NULL, (void *) 1); -#endif - set_wdt(WDT_NO_ACTION, 100, 0, false); + sync_reset_wdt(); ipmi_set_boot_count(); cancel_timer(&wdt_timer); } From patchwork Thu May 24 00:13:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqgB6Xzbz9s1w for ; Thu, 24 May 2018 10:16:22 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ezVOUDEB"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqgB4Fw6zF1Hf for ; Thu, 24 May 2018 10:16:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ezVOUDEB"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:4002:c05::24a; helo=mail-yw0-x24a.google.com; envelope-from=32amgwwmkb9un1b7ff7c5.3fdjb92ffkc9jkj.fqc12j.fi7@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ezVOUDEB"; dkim-atps=neutral Received: from mail-yw0-x24a.google.com (mail-yw0-x24a.google.com [IPv6:2607:f8b0:4002:c05::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqcx2rdMzF1LJ for ; Thu, 24 May 2018 10:14:19 +1000 (AEST) Received: by mail-yw0-x24a.google.com with SMTP id v2-v6so12959251ywg.9 for ; Wed, 23 May 2018 17:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=XY0wVcszuU9lwGz26slkcmFkxUm3+nUR9FXxXsnk9WY=; b=ezVOUDEBFdCxl8yHIYy9daV+j4uWPqgqctMEosvvLoypMS/yzuGSvN/9h+yovLVycq WfeT9Sfj7gwvlO16HlsTUUUjHYZ/cGyXiSMtDTMN6GGcQ2M7VNdWjJ4mZ2UaeSJnRCzn nNdeatS+DSV8slM2zYskCeHU+tPeSMAC6pBTCWxgvCQ0ZYOPnJ2NVHvgJKmusNiKf9BL vIKM1gT3itn57UxuobODGXms69nFJKqjNQPD+kXli5y4bkC1DLzQV+nb3ItNxkDeWSO0 fsJ06u+SxdKP95qfBetc2DsVWEwVJ7N7qGdLWGSiZjiL8EH39BKmiFPIYQf1eZKU4+1E vH1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=XY0wVcszuU9lwGz26slkcmFkxUm3+nUR9FXxXsnk9WY=; b=rmfzC3/k4TIuIuwB/L5qcP4/elEMayrYY0Ax55/Y9hin1BNCozvXwUOlLh1n4ph6jb xaK6Mjl2YU5VbzgF08Rn0HTxkF56Y5VvDU4RA4oc0fYFFn21XywQvprh4z8EQDfsAXJX Nn4wWRpdEE7ItkU1BVuyAxqoq7Y1UX2CKIxPUTGo7Fj/C3nSNJWBWWVN3wTZBivFlseB 3iBm1sRIC+am8Ft1fzSlX7iOLNyLAfGuPE6ohViRb9q04GOfpSdfKBiFW+JqVJ7aL+xl qSoYyehCJtjRNijdXoAQeFSsw8rv7acG82PHFRw1S8DsPFVzn1xNy133+z/hL6C3dd+r tXSA== X-Gm-Message-State: ALKqPwdP51HW1AY/6gRS2ORysP8UAc365qDbS1zofk0OZwnWs4sYKY4x AelX2CnPRpl1jLcavhStrx9HKfVWLMu1KoHPXcmBM7JbQAUB3Ud8laKWZcyBwRNSPyWNiNJtnn3 ysCeTCMTbxhocr4brKx5L+lAy5dHNIbI74I4NcZel+a+ycmflVOZCi8lu X-Google-Smtp-Source: AB8JxZqyvyCbvWw4YBAaLHgZYSGXrWwrsgKrARiWZgG09Gja9xFA6/5Ub2infQYZ1yRRImyC5m1RnsM= MIME-Version: 1.0 X-Received: by 2002:a0d:dd0c:: with SMTP id g12-v6mr1542959ywe.34.1527120856652; Wed, 23 May 2018 17:14:16 -0700 (PDT) Date: Wed, 23 May 2018 17:13:31 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-6-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 5/9] ipmi-watchdog: Add a flag to determine if we are still ticking X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This makes it easier for future changes to ensure that the watchdog stops ticking and doesn't requeue itself for execution in the background. This way it is safe for resets to be performed after the ticks are assumed to be stopped and it won't start the timer again. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index b5cb5fee4..fc559c6da 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -46,11 +46,12 @@ more frequently than necessary. */ #define WDT_MARGIN 300 static struct timer wdt_timer; -static bool wdt_stopped = false; +static bool wdt_stopped; +static bool wdt_ticking; static void ipmi_wdt_complete(struct ipmi_msg *msg) { - if (msg->cmd == IPMI_CMD(IPMI_RESET_WDT) && !msg->user_data) + if (msg->cmd == IPMI_CMD(IPMI_RESET_WDT) && wdt_ticking) schedule_timer(&wdt_timer, msecs_to_tb( (WDT_TIMEOUT - WDT_MARGIN)*100)); @@ -121,11 +122,18 @@ void ipmi_wdt_stop(void) void ipmi_wdt_final_reset(void) { + /* We can safely stop the timer prior to setting up our final + * watchdog timeout since we have enough margin before the + * timeout. */ + wdt_ticking = false; + cancel_timer(&wdt_timer); + + /* Configure the watchdog and make sure it is still enabled */ set_wdt(WDT_RESET_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT, WDT_MARGIN/10, true); sync_reset_wdt(); + ipmi_set_boot_count(); - cancel_timer(&wdt_timer); } void ipmi_wdt_init(void) @@ -136,6 +144,7 @@ void ipmi_wdt_init(void) /* Start the WDT. We do it synchronously to make sure it has * started before skiboot continues booting. Otherwise we * could crash before the wdt has actually been started. */ + wdt_ticking = true; sync_reset_wdt(); return; From patchwork Thu May 24 00:13:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqgZ01msz9s1B for ; Thu, 24 May 2018 10:16:42 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="odSbfUuN"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqgY57VJzF1Hf for ; Thu, 24 May 2018 10:16:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="odSbfUuN"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:4001:c06::24a; helo=mail-io0-x24a.google.com; envelope-from=32wmgwwmkb9gq4eaiiaf8.6igmec5iinfcmnm.itf45m.ila@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="odSbfUuN"; dkim-atps=neutral Received: from mail-io0-x24a.google.com (mail-io0-x24a.google.com [IPv6:2607:f8b0:4001:c06::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqd02rTvzF1HG for ; Thu, 24 May 2018 10:14:21 +1000 (AEST) Received: by mail-io0-x24a.google.com with SMTP id q8-v6so154342ioh.7 for ; Wed, 23 May 2018 17:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=lOaYJGn9fGwibGzjhV8qKcUhB9cd6iV7iRVxzZHg8Ug=; b=odSbfUuNioktTEtm3hCCG9O4fUzeE29niqTcn8Rk7OFP4Z+iHIGA6o8NVkq82uIpxm qczRDHXoU8cVLcLWCZXItx0U3X9xrUJgsv0DUQEgcQVO9RMJwtdpYjy+IOXgx3EgwDhO vuUOGP3+4AP9+9cPs+ROz14RLOYVo3qrYeXc2np8ZndfvA2BtagAGdqE+5QKVk+fOpzu 3o5GkdhWvuJcEL9l5LT9xdbcXZGVH4f1wL0ApHx0aGiEGju4et8nuWDc9jfnBhS/xAy1 BnVdTRSoPm7BZPYmD9UT328SqvSff7hUFfgzbrPqWn22V+yU8GBzt9yZ2GBJq/WhGqji 4r4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=lOaYJGn9fGwibGzjhV8qKcUhB9cd6iV7iRVxzZHg8Ug=; b=NkMu4QFMCaD8KACv/AMFPcfiHcb/NEovR4H/5tj+R7QCpnY8oIkV+y/ZV4dESpAYIS eKwukwWZalat7+L5MjYdIP+ZduB3hKue56RB89yCN5N3S2P3qkzwq9fFZdQJjFsD4XkW Az3IavUMDE0oPy3vu5rdl8yMU7msAv+5iGr93ErrXKdWBly6aSLRQIHb49/S1QZn2TUg XiQVf0dq1PMGpYXTgq4sgig3gdG2wmi/3hKpTuGrnY4dktmabX/EAgDiQ2bKy4dU4OqL /rMn7mQMQwjefh2EUV+SDMWJrlXURUeaKg3SsUKAAFUAodx72T/zaMeDT0EHqouCmfUG Q2mA== X-Gm-Message-State: ALKqPwd3Him0oDyHHtZGozYCnt9xWdQ32pltUFYhHVGN81gGpzFcaHUJ tCfk1Kv981ghNQZ0aysfAcR7dQVYKVz4QVdAGPC75VAa0eds7wH8eabT3avjXOU3m6He+A6byV3 orhdh8cogeg3TwA0AJixRT6YF8GmhXNBPuOlpJFpWedgPt9wazbcKtGcC X-Google-Smtp-Source: AB8JxZrqEqfPcLh1aDIYcBSMwF/yCmbA+4al71XYp2B4GM3X1Sip6ajHe9gEPAvhkFTrbnR+1qvHi30= MIME-Version: 1.0 X-Received: by 2002:a24:f90b:: with SMTP id l11-v6mr3536816ith.53.1527120859168; Wed, 23 May 2018 17:14:19 -0700 (PDT) Date: Wed, 23 May 2018 17:13:32 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-7-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 6/9] ipmi-watchdog: The stop action should disable reset X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Otherwise it is possible for the reset timer to elapse and trigger the watchdog to wake back up. This doesn't affect the behavior of the system since we are providing a NONE action to the BMC. However we would like to avoid the action from taking place if possible. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index fc559c6da..6f2ac4abf 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -115,6 +115,15 @@ static void reset_wdt(struct timer *t __unused, void *data __unused, void ipmi_wdt_stop(void) { if (!wdt_stopped) { + /* Make sure the background reset timer is disabled before + * stopping the watchdog. If we issue a reset after disabling + * the timer, it will be re-enabled. */ + wdt_ticking = false; + cancel_timer(&wdt_timer); + + /* Configure the watchdog to be disabled and do no action + * in case the underlying implementation is buggy and times + * out anyway. */ wdt_stopped = true; set_wdt(WDT_NO_ACTION, 100, 0, false); } From patchwork Thu May 24 00:13:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqgz03Qwz9s1w for ; Thu, 24 May 2018 10:17:03 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ly6lEQ3o"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqgy58H5zF1H5 for ; Thu, 24 May 2018 10:17:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ly6lEQ3o"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:400d:c0d::249; helo=mail-qt0-x249.google.com; envelope-from=33qmgwwmkb9os6gckkcha.8kioge7kkpheopo.kvh67o.knc@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ly6lEQ3o"; dkim-atps=neutral Received: from mail-qt0-x249.google.com (mail-qt0-x249.google.com [IPv6:2607:f8b0:400d:c0d::249]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqd331vKzF1F0 for ; Thu, 24 May 2018 10:14:23 +1000 (AEST) Received: by mail-qt0-x249.google.com with SMTP id g12-v6so22301566qtj.22 for ; Wed, 23 May 2018 17:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=1NYqjWKpv0CjyL+yRKc/DDUzWF17ZxPyN4xuu9XeKLk=; b=ly6lEQ3oeMsMz8lLRbTQ2Mh+NvqUMHu64ekt2V1jZ7/QV9B/1uayR4LCeb5e/F4c1l jeZNxYqjuPOQyLL+twRUNqTZA5DYjBOK0h5UjZgfQTveCAGMVa0C19UuCGKbFwxs68R4 oWo/i5c/EYUgskA0AAE1GASAwKXowZ1xK6r7CB/FVlGDS9hGYynMtS/sUyw8O7dTBjgQ NlKf/ScqO8fPNR13X5BmMG17NkihJNQZZ/iqbLe9E2CSkH7HpejTtSnVV7pPqe/mdbVA 5utFPzpxXnDn39oI6xPCqFgAOVjf6lAigiljMLeuPhSICSimJ2RA+nD52u78C6TJMegp Xf4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=1NYqjWKpv0CjyL+yRKc/DDUzWF17ZxPyN4xuu9XeKLk=; b=gOOPJc1WG25gFLv+qRhsjfIbua3SpL4f/HtMHMLYNpEgkrLuApmNkrfPy8YCBPA6S8 dq3+4fLR3gVCne87xk1EQg1REhUFAEbCVveLV0HdcFEezrxClmb8+f/pkkjoVfEgEwiK s0uizrqqH97a9dyyarBtlRzFYLbJPOehw1rd+0m6Oin15SR07zHviyz6f7+TpM6X5YUz r5Lj/0990ZT8pNaHZAbxIK2IATzxwQRH8ztzoPK6tIsRjFohZtwYjCUZr2HaQnpnCyTC ofmA7GmE95EhEPg8EEjbRBXZsSUBlgkd/kwuxSpzm4DfbZMp8ct6RcTi14/SGNff5UpT XTvg== X-Gm-Message-State: ALKqPwcgI2YuH3NXQpt5Glunew2UB+YOvw68fKDnHSeVecZTHwxFYG8u GaJZBFsv2MYbhKixtuih7GOOW+owj22BVeD2soEShrv2QhLQMDuWJOE+zeR8b4Vhmpq0njs5YCn Bnm94F2BHejecU3NnM1DjuaVPKvmV/m65Jq9FOA+Tv/jiDPZ4ZrTTQwTR X-Google-Smtp-Source: AB8JxZqCzftcMzHTIhCS15xKkx7+NyJBZP7lQGhWqudelrf6Vo0lkYgWFMxERF2DROTg/d8zqOYXuh8= MIME-Version: 1.0 X-Received: by 2002:a0c:d2ee:: with SMTP id x43-v6mr2559213qvh.45.1527120861559; Wed, 23 May 2018 17:14:21 -0700 (PDT) Date: Wed, 23 May 2018 17:13:33 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-8-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 7/9] ipmi-watchdog: Simplify our completion function X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This makes no functional changes, just refactors the completion function to be used for reset only, since it does nothing but free the message for set calls. This will be useful for future changes to reduce nesting depth. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index 6f2ac4abf..a43100ade 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -49,27 +49,18 @@ static struct timer wdt_timer; static bool wdt_stopped; static bool wdt_ticking; -static void ipmi_wdt_complete(struct ipmi_msg *msg) -{ - if (msg->cmd == IPMI_CMD(IPMI_RESET_WDT) && wdt_ticking) - schedule_timer(&wdt_timer, msecs_to_tb( - (WDT_TIMEOUT - WDT_MARGIN)*100)); - - ipmi_free_msg(msg); -} - static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout, bool dont_stop) { struct ipmi_msg *ipmi_msg; ipmi_msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_SET_WDT, - ipmi_wdt_complete, NULL, NULL, 6, 0); + ipmi_free_msg, NULL, NULL, 6, 0); if (!ipmi_msg) { prerror("Unable to allocate set wdt message\n"); return; } - ipmi_msg->error = ipmi_wdt_complete; + ipmi_msg->error = ipmi_free_msg; ipmi_msg->data[0] = TIMER_USE_POST | TIMER_USE_DONT_LOG | (dont_stop ? TIMER_USE_DONT_STOP : 0); @@ -81,12 +72,24 @@ static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout, ipmi_queue_msg(ipmi_msg); } +static void reset_wdt_complete(struct ipmi_msg *msg) +{ + const uint64_t reset_delay_ms = (WDT_TIMEOUT - WDT_MARGIN) * 100; + + /* If we are inside of skiboot we need to periodically restart the + * timer. Reschedule a reset so it happens before the timeout. */ + if (wdt_ticking) + schedule_timer(&wdt_timer, msecs_to_tb(reset_delay_ms)); + + ipmi_free_msg(msg); +} + static struct ipmi_msg *wdt_reset_mkmsg(void) { struct ipmi_msg *ipmi_msg; ipmi_msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_RESET_WDT, - ipmi_wdt_complete, NULL, NULL, 0, 0); + reset_wdt_complete, NULL, NULL, 0, 0); if (!ipmi_msg) { prerror("Unable to allocate reset wdt message\n"); return NULL; From patchwork Thu May 24 00:13:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqhP0G31z9s1B for ; Thu, 24 May 2018 10:17:25 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="DmqAW1GK"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqhN5fZdzF1Hg for ; Thu, 24 May 2018 10:17:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="DmqAW1GK"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:4003:c06::24a; helo=mail-oi0-x24a.google.com; envelope-from=34amgwwmkb90v9jfnnfkd.bnlrjhannskhrsr.nyk9ar.nqf@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="DmqAW1GK"; dkim-atps=neutral Received: from mail-oi0-x24a.google.com (mail-oi0-x24a.google.com [IPv6:2607:f8b0:4003:c06::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqd51GntzF1Hh for ; Thu, 24 May 2018 10:14:26 +1000 (AEST) Received: by mail-oi0-x24a.google.com with SMTP id h70-v6so15089010oib.21 for ; Wed, 23 May 2018 17:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=48MA0Mw4csRXkcxQ/j5AG2EDTkmkqcgmpky+ItWHNQ8=; b=DmqAW1GKkF2lWqRd6uqCKcHQfUrpwoNZ/ffPxzAvH98an/1LsAyuwp6sIleqtmaNVW EtrTRPr0m1qbTiAoGdvVWmmKyhs1I/lmbjBYH5sNF0Ge2K3ngc4cpwYCt3ZItysD0e0R s5IEbelWRsSZ5aD0jMcVGA0mp57VK2nCq+NKlHnlRwvHevxhG6yLn3OBprXz9XfTRUvT UkUmn0aj4aLGX1vrfUNe9QcxtUrM/zZcxMSjI8GIO7tYNIT6LFNF9nhrky4v8LV5Nc6L zIgivEvQ07b9noRTak4t5XjTS34dR3KSIbgJi+TwfGhqDitiIp6ZDnt5PCtEZ3ro1I5+ 6i5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=48MA0Mw4csRXkcxQ/j5AG2EDTkmkqcgmpky+ItWHNQ8=; b=mOuETcMEULroDNu7WMnZ0lVO4TrPRJA0Wj9bX3uDVUmTfVYe+RqT6IMU71Rej9/upx 4eOW9728/TRbW2qF1IhOnN4pjhavrdf749GpcRi284rxhLgFR9fv1ySxdeUjXGgiLLCu APoaMgDJOpJJAOPHKX73Snht6iSCuszyJcl3aZ/mPb3IdyiN6vrmPAfRb7Ww09lX7ssq S+uWK2fyEhaksW9YwOKCU/xbLOHr1hhC1ZygHKKAD87mQ5dc6VZfYPuXVf2M4XatfEqj kHTnsmzvohgSGXWkwzIw0sZaUNCaFrqMxTv9pVFkHCRiB8+p2oC6VFrwrlMr42r0lBFQ w/Lw== X-Gm-Message-State: ALKqPwd7xwPUEPZyXxtaX58iK42MgPKphijYvcgL6qCkQKHxicsxIwhX pXXq+gG2g2brcsndrB8jG+FCt2pXv4mswMQ2CV0nRfGKFrjtUsF16dHl849dHP7wnFQ1qQDWQy3 vHFOOw6pH4OxseHDOLAtquEZABc7oQ/+KYa7IG3ly3i2rldM740LpuYqt X-Google-Smtp-Source: AB8JxZpWXY27c16K1ai/q4T0e7k3IpebRfaWaIvLmqEKTvkkXfpB67zz6IszWYFvPt9IzWbvq7rPqpQ= MIME-Version: 1.0 X-Received: by 2002:a9d:cfa:: with SMTP id o55-v6mr2328427otd.29.1527120864080; Wed, 23 May 2018 17:14:24 -0700 (PDT) Date: Wed, 23 May 2018 17:13:34 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-9-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 8/9] ipmi-watchdog: Support resetting the watchdog after set X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This does not create any behavioral change yet, but this will be useful in a future commit that adds support for re-initializing the watchdog. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index a43100ade..1472a8ea1 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -34,6 +34,9 @@ #define WDT_RESET_ACTION 0x01 #define WDT_NO_ACTION 0x00 +/* Flags used for IPMI callbacks */ +#define WDT_SET_DO_RESET 0x01 + /* How long to set the overall watchdog timeout for. In units of * 100ms. If the timer is not reset within this time the watchdog * expiration action will occur. */ @@ -49,18 +52,35 @@ static struct timer wdt_timer; static bool wdt_stopped; static bool wdt_ticking; +static void reset_wdt(struct timer *t, void *data, uint64_t now); + +static void set_wdt_complete(struct ipmi_msg *msg) +{ + const uintptr_t flags = (uintptr_t)msg->user_data; + + if (flags & WDT_SET_DO_RESET) + reset_wdt(NULL, NULL, 0); + + ipmi_free_msg(msg); +} + static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout, - bool dont_stop) + bool dont_stop, bool do_reset) { struct ipmi_msg *ipmi_msg; + uintptr_t completion_flags = 0; + + if (do_reset) + completion_flags |= WDT_SET_DO_RESET; ipmi_msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_SET_WDT, - ipmi_free_msg, NULL, NULL, 6, 0); + set_wdt_complete, NULL, NULL, 6, 0); if (!ipmi_msg) { prerror("Unable to allocate set wdt message\n"); return; } - ipmi_msg->error = ipmi_free_msg; + ipmi_msg->error = set_wdt_complete; + ipmi_msg->user_data = (void *)completion_flags; ipmi_msg->data[0] = TIMER_USE_POST | TIMER_USE_DONT_LOG | (dont_stop ? TIMER_USE_DONT_STOP : 0); @@ -128,7 +148,7 @@ void ipmi_wdt_stop(void) * in case the underlying implementation is buggy and times * out anyway. */ wdt_stopped = true; - set_wdt(WDT_NO_ACTION, 100, 0, false); + set_wdt(WDT_NO_ACTION, 100, 0, false, false); } } @@ -142,8 +162,7 @@ void ipmi_wdt_final_reset(void) /* Configure the watchdog and make sure it is still enabled */ set_wdt(WDT_RESET_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT, - WDT_MARGIN/10, true); - sync_reset_wdt(); + WDT_MARGIN/10, true, true); ipmi_set_boot_count(); } @@ -151,7 +170,7 @@ void ipmi_wdt_final_reset(void) void ipmi_wdt_init(void) { init_timer(&wdt_timer, reset_wdt, NULL); - set_wdt(WDT_RESET_ACTION, WDT_TIMEOUT, 0, true); + set_wdt(WDT_RESET_ACTION, WDT_TIMEOUT, 0, true, false); /* Start the WDT. We do it synchronously to make sure it has * started before skiboot continues booting. Otherwise we From patchwork Thu May 24 00:13:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 919473 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rqhr0HJZz9s1B for ; Thu, 24 May 2018 10:17:48 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="YlwoqwSj"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rqhq4hz5zF1F0 for ; Thu, 24 May 2018 10:17:47 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="YlwoqwSj"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=flex--wak.bounces.google.com (client-ip=2607:f8b0:4001:c06::249; helo=mail-io0-x249.google.com; envelope-from=34gmgwwmkb98xblhpphmf.dpntljcppumjtut.pambct.psh@flex--wak.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="YlwoqwSj"; dkim-atps=neutral Received: from mail-io0-x249.google.com (mail-io0-x249.google.com [IPv6:2607:f8b0:4001:c06::249]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rqd658HqzF1H5 for ; Thu, 24 May 2018 10:14:28 +1000 (AEST) Received: by mail-io0-x249.google.com with SMTP id w1-v6so166283iod.1 for ; Wed, 23 May 2018 17:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=ftwlXVycVA9UU/qzwRWWU9qdvZg8Uw/lnodIy7qj9Gs=; b=YlwoqwSj2cREK10PQWVRm6joDa4zWnXoiLjViH+jG+POhf7G5NbQ8slb0y1zCMpcPH RD5fyzGQV7jyBfDoSiR0KN5k5nQXiXXDEDEftwXJ6sUp8bOZ7bfadZl9rxKg76EVG9g9 srQONryWWlUihpgyPOedFQhDMBszrH+hkt09iO5neNHeBs6i7CTvQVxDv7Vc6+bme3n2 hzs0akDkUjZC9MJ8hRCifYTbQbOVdvrEg02surMT9c9hQtWLY2o3fGT7p4QSFcYnW4pL iFwufs61myr72OOUWelCROU5m2j3gi8wko0/qY7sR21a26Jbgw92B3bYwj3ZlOBFhjZm mzuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=ftwlXVycVA9UU/qzwRWWU9qdvZg8Uw/lnodIy7qj9Gs=; b=N3oOewjKTkVcDwP0sLOiDs1pYsjxvxObBclqtCenFjCQrcpmhr94VOSNpJ01bwW/0r 28hf2chGH/LQDIyPwYNdE9eBmit4NatJDB43RZouAJPvDjyXL8W0SkFHBY1vbCi4tr2e utyggnUE4Jksd3eMUR3w/KhhLpmCytLlnbhaOQ4rvpOGINryi/LrOLz8eUtgsNkNqekv CXxi3KeWda295WU/Tirrn9lL4FKSGlUlqiMfsGmpYk6MxtZPzisYTL5NNkN/7Sm/ym02 qR6oUcmvgQ0FIujjuUSi+AhichCL2e3D2TmsIpwbxWScxP4AeHn9hMFk8oakrqQBRzfE h0eA== X-Gm-Message-State: ALKqPwcxph/IQ8Zg3HQKVffwjgO6KFm8O0PqpnBbaX8OlZg2Jh64svEh LuxRMUC+vgTpJOwj7V+YFRsXv/y5FDQ42gxrfJvD0ZDgh9PX/k0bl7m4uBWy2XmJBv1JA2Zc6Mu woVHHqY/x5gohg7OV8p7CaZ1tWU55mE/oG/XsEsaBIM+xldXDXQlIze15 X-Google-Smtp-Source: AB8JxZotWk2uu7RUCH3a9pVsmnHn5EP1AohL7jW2iz0zrSta2L6CZ/h4ysnm0gbeW98/7zSjPMefOmk= MIME-Version: 1.0 X-Received: by 2002:a24:e4d:: with SMTP id 74-v6mr3451606ite.24.1527120866752; Wed, 23 May 2018 17:14:26 -0700 (PDT) Date: Wed, 23 May 2018 17:13:35 -0700 In-Reply-To: <20180524001335.15457-1-wak@google.com> Message-Id: <20180524001335.15457-10-wak@google.com> References: <20180524001335.15457-1-wak@google.com> X-Mailer: git-send-email 2.17.0 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org, alistair@popple.id.au, jk@ozlabs.org Subject: [Skiboot] [PATCH 9/9] ipmi-watchdog: Support handling re-initialization X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Watchdog resets can return an error code from the BMC indicating that the BMC watchdog was not initialized. Currently we abort skiboot due to a missing error handler. This patch implements handling re-initialization for the watchdog, automatically saving the last watchdog set values and re-issuing them if needed. Signed-off-by: William A. Kennington III --- hw/ipmi/ipmi-watchdog.c | 47 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c index 1472a8ea1..105270f5e 100644 --- a/hw/ipmi/ipmi-watchdog.c +++ b/hw/ipmi/ipmi-watchdog.c @@ -34,8 +34,13 @@ #define WDT_RESET_ACTION 0x01 #define WDT_NO_ACTION 0x00 +/* IPMI defined custom completion codes for the watchdog */ +#define WDT_CC_OK 0x00 +#define WDT_CC_NOT_INITIALIZED 0x80 + /* Flags used for IPMI callbacks */ #define WDT_SET_DO_RESET 0x01 +#define WDT_RESET_NO_REINIT 0x01 /* How long to set the overall watchdog timeout for. In units of * 100ms. If the timer is not reset within this time the watchdog @@ -52,14 +57,23 @@ static struct timer wdt_timer; static bool wdt_stopped; static bool wdt_ticking; +/* Saved values from the last watchdog set action */ +static uint8_t last_action; +static uint16_t last_count; +static uint8_t last_pretimeout; + static void reset_wdt(struct timer *t, void *data, uint64_t now); static void set_wdt_complete(struct ipmi_msg *msg) { const uintptr_t flags = (uintptr_t)msg->user_data; - if (flags & WDT_SET_DO_RESET) - reset_wdt(NULL, NULL, 0); + if (flags & WDT_SET_DO_RESET) { + /* Make sure the reset action does not create a loop and + * perform a reset in the case where the BMC send an + * uninitialized error. */ + reset_wdt(NULL, (void *)WDT_RESET_NO_REINIT, 0); + } ipmi_free_msg(msg); } @@ -73,6 +87,12 @@ static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout, if (do_reset) completion_flags |= WDT_SET_DO_RESET; + /* Save the values prior to issuing the set operation so that we can + * re-initialize the watchdog in error cases. */ + last_action = action; + last_count = count; + last_pretimeout = pretimeout; + ipmi_msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_SET_WDT, set_wdt_complete, NULL, NULL, 6, 0); if (!ipmi_msg) { @@ -94,7 +114,21 @@ static void set_wdt(uint8_t action, uint16_t count, uint8_t pretimeout, static void reset_wdt_complete(struct ipmi_msg *msg) { - const uint64_t reset_delay_ms = (WDT_TIMEOUT - WDT_MARGIN) * 100; + const uintptr_t flags = (uintptr_t)msg->user_data; + uint64_t reset_delay_ms = (WDT_TIMEOUT - WDT_MARGIN) * 100; + + if (msg->cc == WDT_CC_NOT_INITIALIZED && + !(flags & WDT_RESET_NO_REINIT)) { + /* If our timer was not initialized on the BMC side, we should + * perform a single attempt to set it up again. */ + set_wdt(last_action, last_count, last_pretimeout, true, true); + } else if (msg->cc != WDT_CC_OK) { + /* Use a short (10s) timeout before performing the next reset + * if we encounter an unknown error. This makes sure that we + * are able to reset and re-initialize the timer since it might + * expire. */ + reset_delay_ms = 10 * 1000; + } /* If we are inside of skiboot we need to periodically restart the * timer. Reschedule a reset so it happens before the timeout. */ @@ -114,6 +148,7 @@ static struct ipmi_msg *wdt_reset_mkmsg(void) prerror("Unable to allocate reset wdt message\n"); return NULL; } + ipmi_msg->error = reset_wdt_complete; return ipmi_msg; } @@ -126,13 +161,15 @@ static void sync_reset_wdt(void) ipmi_queue_msg_sync(ipmi_msg); } -static void reset_wdt(struct timer *t __unused, void *data __unused, +static void reset_wdt(struct timer *t __unused, void *data, uint64_t now __unused) { struct ipmi_msg *ipmi_msg; - if ((ipmi_msg = wdt_reset_mkmsg())) + if ((ipmi_msg = wdt_reset_mkmsg())) { + ipmi_msg->user_data = data; ipmi_queue_msg_head(ipmi_msg); + } } void ipmi_wdt_stop(void)