Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp739473iog; Mon, 13 Jun 2022 11:50:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxjX8+yvyijZt5SH8BPQVv/SkG8QT4TbO1nc0f712l9kHuv+2DU1inLQWOEz56WfuE/ueR X-Received: by 2002:a63:4c:0:b0:3fa:b4d8:26cf with SMTP id 73-20020a63004c000000b003fab4d826cfmr819659pga.463.1655146247720; Mon, 13 Jun 2022 11:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655146247; cv=none; d=google.com; s=arc-20160816; b=VdRQBdx9HwKVGuBrwWSMTJX0XcmI2BhoOMSXBtVY1/2j1yCS9yLI+3R7rPuoS8zOY+ w9ulwAJjgah4f4XfXU2eRS6lL1EkIzmMjoW97+J+8ZSniEJgj34LgKyfiusg9PP9W4A/ bo9T0yAy3PUACHx0t5FV9mRGa6AeXoQCj6o7gFMom/et2QQmuPqFP4elj91HdM4ygZfV BOW1wBNu1s2WrcYpK2aWW2cJ3Ba71+38h86xtFoe6cevm7i1+arfVUf2QCEhuVWnr6Xu Gws0ZGhuN0EMoSjs7cYAo8LNvwj/62uupDpLUaqy0g9QTBzN4NrmUKEhcBldvVdhH/f7 YHGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BGAIi+/Ft53DX8CUrCtDAbQTz9ZPUzipX2JK4m40Fyc=; b=RsGxos6aqRglib0NTfRgZ94l5/3JiGtHmtW/mgFVR01Nn+TgpuYCjoiomPjxR2BQOd QLQ0NeYMEZEcPhBR+nOPZmSOb12pcXF53E1/x/DyHDXCZCzkhpzbRwLCqgybCfp4nzGF M1SQhPlbbsaXrju0+rZmkuRKVMu4OM6/NKHgm4fb8Tb0O1ZUoyD9LAKNmMaly93n9dhO y67CXrhbBWON1dv0BKR1OD5Ux6tgOZxkFQo1kJuo1XCBzU00RdNMARO/8Z0DwLw5k5kZ r7TL2Wb8co6M7QNlpSFuz+Y/M6oro9mD3sB7Z/cSFDnvgKgRFJdL/a8RmZ/264QCf1DK ruIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RPluaBvz; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ha2-20020a17090af3c200b001dfbea70331si724249pjb.37.2022.06.13.11.50.19; Mon, 13 Jun 2022 11:50:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RPluaBvz; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239951AbiFMSiM (ORCPT + 99 others); Mon, 13 Jun 2022 14:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243192AbiFMShz (ORCPT ); Mon, 13 Jun 2022 14:37:55 -0400 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95AE262130 for ; Mon, 13 Jun 2022 08:40:11 -0700 (PDT) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-f2a4c51c45so8865032fac.9 for ; Mon, 13 Jun 2022 08:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BGAIi+/Ft53DX8CUrCtDAbQTz9ZPUzipX2JK4m40Fyc=; b=RPluaBvzdSvJ5njD15mxkw0ob6qmuyOBJo1hMaQ2AFBjUq++UqkyqjMZzoFpoAhmIr ec01sWqSFKsJB6FZgwGP7drgPr4gYSWF10aZZIvHqpTM4uKuRPArOtlTZ65e2oWlcIJc 0gAKcSwnh35acodyjWgGJzwhHUz3FRGrcu+tA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BGAIi+/Ft53DX8CUrCtDAbQTz9ZPUzipX2JK4m40Fyc=; b=jgPCyeeumVTPBk3gR5vo8QDRR0lq1FHjEulJvK3DzyITBf32nzxYKMOSahyn3d7yig nE8CDiDjF/bKZYBAjV5h7oQMvdi6ZkSzh6zNsapzxIWqNc5Wdd7BhDzLQpaiZ8/3GcpM F+xF+FJl/vBrwcByZQNJOyh6cpQ1EqejHvH051dLUbs8wngn2IUxG4cxZlZ91fj8EHil 315dBHVwvqfmdw6tFQRBILGsd8Sac3sXkpwjpKDs/OowcRtf1kS44NmAkZrXFt6mB/09 z1KkbKQVeVAVjLocsXiQxh8ns7MoeaXj8L2miEN4C0rgJ6QePniNRFiCba6XsD5pDY9d +78A== X-Gm-Message-State: AJIora8BzgoICP4PNiYb7ppXphYINEqb7KSkB4LsFfXt02QSio+eWsw7 NbiAIWY0UoAcrXA9+0f8wfyPsDHtMve1+Q== X-Received: by 2002:a05:6871:290:b0:f3:426e:e74e with SMTP id i16-20020a056871029000b000f3426ee74emr177187oae.31.1655134810045; Mon, 13 Jun 2022 08:40:10 -0700 (PDT) Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com. [209.85.160.46]) by smtp.gmail.com with ESMTPSA id n3-20020a0568301e8300b0060603221281sm3542478otr.81.2022.06.13.08.40.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jun 2022 08:40:08 -0700 (PDT) Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-fe51318ccfso8956966fac.0 for ; Mon, 13 Jun 2022 08:40:08 -0700 (PDT) X-Received: by 2002:a05:6870:5247:b0:fb:2e60:26c6 with SMTP id o7-20020a056870524700b000fb2e6026c6mr157351oai.241.1655134808192; Mon, 13 Jun 2022 08:40:08 -0700 (PDT) MIME-Version: 1.0 References: <20220611061825.4119270-1-swboyd@chromium.org> In-Reply-To: <20220611061825.4119270-1-swboyd@chromium.org> From: Evan Green Date: Mon, 13 Jun 2022 08:39:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] platform/chrome: cros_ec: Always expose last resume result To: Stephen Boyd Cc: Benson Leung , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Guenter Roeck , chrome-platform@lists.linux.dev, Rajat Jain , Matthias Kaehlcke , Hsin-Yi Wang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Fri, Jun 10, 2022 at 11:18 PM Stephen Boyd wrote: > > The last resume result exposing logic in cros_ec_sleep_event() > incorrectly requires S0ix support, which doesn't work on ARM based > systems where S0ix doesn't exist. That's because cros_ec_sleep_event() > only reports the last resume result when the EC indicates the last sleep > event was an S0ix resume. On ARM systems, the last sleep event is always > S3 resume, but the EC can still detect sleep hang events in case some > other part of the AP is blocking sleep. > > Always expose the last resume result if the EC supports it so that this > works on all devices regardless of S0ix support. This fixes sleep hang > detection on ARM based chromebooks like Trogdor. > > Cc: Evan Green > Cc: Rajat Jain > Cc: Matthias Kaehlcke > Cc: Hsin-Yi Wang > Fixes: 7235560ac77a ("platform/chrome: Add support for v1 of host sleep event") > Signed-off-by: Stephen Boyd I looked at the EC code for firmware-hatch-12669.B, which is I think the oldest board shipping the suspend_transitions support, and saw that it correctly initializes resume_response.sleep_transitions for both S0IX_RESUME and S3_RESUME. I think that mitigates my only concern that we might be interpreting garbage sleep_transitions from the EC on some older platforms. So, Reviewed-by: Evan Green > --- > > Changes from v1 (https://lore.kernel.org/r/20220610223703.3387691-1-swboyd@chromium.org): > * Fixed typo > > drivers/platform/chrome/cros_ec.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c > index b3e94cdf7d1a..3abef9747482 100644 > --- a/drivers/platform/chrome/cros_ec.c > +++ b/drivers/platform/chrome/cros_ec.c > @@ -135,10 +135,10 @@ static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event) > buf.msg.command = EC_CMD_HOST_SLEEP_EVENT; > > ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg); > - > - /* For now, report failure to transition to S0ix with a warning. */ > + /* Report failure to transition to system wide suspend with a warning. */ > if (ret >= 0 && ec_dev->host_sleep_v1 && > - (sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME)) { > + (sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME || > + sleep_event == HOST_SLEEP_EVENT_S3_RESUME)) { > ec_dev->last_resume_result = > buf.u.resp1.resume_response.sleep_transitions; > > > base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56 > -- > https://chromeos.dev >