Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp697757pxb; Thu, 9 Sep 2021 09:56:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBH5PPkxYGVGovFQhJaPWIOWfzx/YfW6h7D219COuhy1EEsMc2jZYoddTib4qLK1aT1sFs X-Received: by 2002:a17:906:686:: with SMTP id u6mr4322409ejb.569.1631206606521; Thu, 09 Sep 2021 09:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631206606; cv=none; d=google.com; s=arc-20160816; b=ijzYbWoWgzr2QxZihszW7GN28taOdVcCOxVvgFc4+v8VFYc/442aPG/3ujr6HNRAeb h5PY2x+XBfkn8JRAZQWfejlczvUHH9Xv90x6cfMYyhQiDi/qzAse7+AOAeOHfV/nbMTi rL6fCgvSAk2I7B5smi4sP1Bs5txuSDzYKqf2CVHIV4qOMXrxjhbnvA9FMMG5gf1q0CHa EIzZi6qPr8tWclTDZWeWZnRtlFrK80lxreIXLTvybNMfGrZlFvKFhNpV+4bhw+mKbsly zdYeTEYYYZm09897rKty3wX1MQx90LpbFkouzjhGWSoLBKkXu0hJebHPgXYlHR3BqPUz MoYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=koo56xDEDJfNlkz6/wICLDEQvftY5giDkHhB/R6R2jk=; b=gJz5ZItUNTDUVabjGvZJrqCHJ9lyP6Zz+AKXNkylqwhEBlV0VCmqiuIqtk5GPxma2E T+xwgrTb77fv+jDgYgPuthdJxTA0ccplrctOuibqAuyaqE92yW2slh54sJVaOECs/156 CiEyJHe3FEdrFW6Kfd/I07dd48V6XNgj5UyrC1cdRLxsQEONqGWVt+wslbYGohfsl6bb PQvyT27xBSQjs3rifIEGxFmf1Rvu1/XJqkAONxS1vlbVfWydU2EWsv8lxrgxPysSy4Qe +TpvODFfTXGe40HnrJZk45D2/KKtcrI+09kPHAP/BcVjL3R+e9R0wm4ivSeF5L8rRMXU mSHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U61AkWk+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bj25si2674953ejb.201.2021.09.09.09.56.16; Thu, 09 Sep 2021 09:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U61AkWk+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239647AbhIIQzo (ORCPT + 99 others); Thu, 9 Sep 2021 12:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbhIIQzn (ORCPT ); Thu, 9 Sep 2021 12:55:43 -0400 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB7BC061574; Thu, 9 Sep 2021 09:54:34 -0700 (PDT) Received: by mail-oo1-xc2e.google.com with SMTP id q26-20020a4adc5a000000b002918a69c8eeso747186oov.13; Thu, 09 Sep 2021 09:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=koo56xDEDJfNlkz6/wICLDEQvftY5giDkHhB/R6R2jk=; b=U61AkWk+xSU8f6zbscu3oIlqmTpD/yfgNsdYMpS+23LKGfOQ3pEXfWs94f0Ia6NqY1 eWia1nIi1IDPxfSVpfjmfrRRLN1aqFaxkd3/mPMnarLkH7pfGWx3UbhyvP89it5tQv7S 7udXbhqZC+u+ToEzEtUMn5Bu8i/59myyK1LWM6OhLcba82Jbv+CESSZmlTCX+eo269H4 8pD9fomrDm9Em7OogC5FUYMZoqQCipJCEQ5Ztohf5rYWojsuLpCtJJg6dCigb6zgXJoT Z38WwZ4gZwEQlcd8rtiwmquJnYQuza3HhD8PcHMBuVjRyYIEnSZ7kYVi6VsvXUY8TWoo 3OJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=koo56xDEDJfNlkz6/wICLDEQvftY5giDkHhB/R6R2jk=; b=nN1byXNF/+XTuhBq5ziC9A3lnSSZpTrPGo3+0tRiNaAzDtPsB9rrjOhMobq01MPucM SD0YOLkkuCmJBykEoRydHFoHurFg38KzByO83JGrQexE5CN+Vaw3VnM0jq4QhkDZQeQv GBGmTKz1RjBrcQZV7/tCfUN5HVz9OitXAPil2nJZzBSEXicZttKVDoPrHFgbgYiQ6qJ5 bgPc4gKdTlmWoFGbqa7A2VWFMEt0RLayRKf2myQUYUW7oG6fULvvZ7gx4FrbBlxI14RW NQoGwmHJbNqKbcFpAcIff+Xuu6yQEnevaGGYkCuatvBjxvJsZ7ZnO2/ywC24GyGqeOyE xJfg== X-Gm-Message-State: AOAM532Lgrxks5Xi/2Ydx0j/Uj7hBRma+20LAPxBoBxTi1Xlo6Zl0/bc jvkkwfGPRXdh8w3zw8ntBTY= X-Received: by 2002:a4a:bd17:: with SMTP id n23mr682036oop.54.1631206473539; Thu, 09 Sep 2021 09:54:33 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id n73sm569093oig.9.2021.09.09.09.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 09:54:33 -0700 (PDT) Sender: Guenter Roeck Date: Thu, 9 Sep 2021 09:54:31 -0700 From: Guenter Roeck To: Avri Altman Cc: "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Bart Van Assche , Adrian Hunter , Bean Huo Subject: Re: [PATCH v2 2/2] scsi: ufs: Add temperature notification exception handling Message-ID: <20210909165431.GB3973437@roeck-us.net> References: <20210909063444.22407-1-avri.altman@wdc.com> <20210909063444.22407-3-avri.altman@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210909063444.22407-3-avri.altman@wdc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 09, 2021 at 09:34:44AM +0300, Avri Altman wrote: > The device may notify the host of an extreme temperature by using the > exception event mechanism. The exception can be raised when the device’s > Tcase temperature is either too high or too low. > > It is essentially up to the platform to decide what further actions need > to be taken. leave a placeholder for a designated vop for that. > > Signed-off-by: Avri Altman > --- > drivers/scsi/ufs/ufs.h | 2 ++ > drivers/scsi/ufs/ufshcd.c | 19 +++++++++++++++++++ > 2 files changed, 21 insertions(+) > > diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h > index 171b27be7b1d..d9bc048c2a71 100644 > --- a/drivers/scsi/ufs/ufs.h > +++ b/drivers/scsi/ufs/ufs.h > @@ -377,6 +377,8 @@ enum { > MASK_EE_PERFORMANCE_THROTTLING = BIT(6), > }; > > +#define MASK_EE_URGENT_TEMP (MASK_EE_TOO_HIGH_TEMP | MASK_EE_TOO_LOW_TEMP) > + > /* Background operation status */ > enum bkops_status { > BKOPS_STATUS_NO_OP = 0x0, > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index fc995bf1f296..1f61e8090220 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -5642,6 +5642,22 @@ static void ufshcd_bkops_exception_event_handler(struct ufs_hba *hba) > __func__, err); > } > > +static void ufshcd_temp_exception_event_handler(struct ufs_hba *hba, u16 status) > +{ > + u32 value; > + > + if (ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, > + QUERY_ATTR_IDN_CASE_ROUGH_TEMP, 0, 0, &value)) > + return; > + > + dev_info(hba->dev, "exception Tcase %d\n", value - 80); > + It would probably make sense to call hwmon_notify_event() here. Guenter > + /* > + * A placeholder for the platform vendors to add whatever additional > + * steps required > + */ > +} > + > static int __ufshcd_wb_toggle(struct ufs_hba *hba, bool set, enum flag_idn idn) > { > u8 index; > @@ -5821,6 +5837,9 @@ static void ufshcd_exception_event_handler(struct work_struct *work) > if (status & hba->ee_drv_mask & MASK_EE_URGENT_BKOPS) > ufshcd_bkops_exception_event_handler(hba); > > + if (status & hba->ee_drv_mask & MASK_EE_URGENT_TEMP) > + ufshcd_temp_exception_event_handler(hba, status); > + > ufs_debugfs_exception_event(hba, status); > out: > ufshcd_scsi_unblock_requests(hba); > -- > 2.17.1 >