Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2490109rdb; Fri, 8 Dec 2023 09:31:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIhstTwnEdcBMuINEyv/KrGpeId1zL9JtLKNG/C2Ln1VH1NRBX4PPJsxN4d+w+xHohMazp X-Received: by 2002:a05:6a00:6714:b0:6ce:379c:ced1 with SMTP id hm20-20020a056a00671400b006ce379cced1mr310345pfb.59.1702056705152; Fri, 08 Dec 2023 09:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702056705; cv=none; d=google.com; s=arc-20160816; b=GlbpttqZLFzEmJ9u9uLGfgq3TlyR20D0peW+a+I+iNshH6naDZ7RlMBkAWBpxziRAW nDm+7cjW2ogjPXdygD5XtPORJ3/36v4DnHzhkCoF3V0NUE1+2sq07Ni9sX46/NJxt619 l3JZFSV7Gp3ctABUwWMxlMiCpJqYHj9c+obMqDPkQxL79JwgU9UKcQUYNaZ6+2xEGOSf Rxbdwgyg0nhb4iLIalAmEnT14I1YTGiGUrtGb3UwVbiwIqmRLmcVpCMl0tU+u6tTY60/ ogarGBxO7A/JZrawNkc7VY+MybSQOtXdFAXxGCV06NUZN/DDYhGMdwFfYFjRV3Sjq8XN 2Zxw== 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:dkim-signature; bh=2ybI9NoqWAEd5aJtCWjhHIclbHS0S80JRMe+/sKFsk4=; fh=D0zHzE0rSeaV5xnFPtatb+q+bG5HGveof5GzyGf4cew=; b=xFPShiXUjDdpe77GQrzpeYTRBmhIu3eFIFy93H8hhh8OpqBKi7schF0AoCRCcUdGZQ 0V2FuZoCqroI1mUmAIGrZz4Hqm12J55paITYZdPaQ4+QW8JkJpIQ6O5C42SxsqGvlebY 6pug2mVerKH1WzFwczVyiGMrh1kIHu6qjCSL5McE5/rIvLt+6Sd3vz+DtqZgQPYxkpUj BNePLarrwh+4zk+xQItJPFhYUzxJyS+0Ynq8izd2QJxm2a1Mo9NganK8UV7tmWVSkiNI aQGOYKNjU/9r15so3yn91PsQkGGxiV7/cCgwROG6Xjr574bzhLj6R8Oh2RPWqhDpSIkY L0KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hW2bMg+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h10-20020a63e14a000000b005c67bb15866si1904693pgk.52.2023.12.08.09.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:31:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hW2bMg+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7A3278135BC6; Fri, 8 Dec 2023 09:31:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbjLHRb2 (ORCPT + 99 others); Fri, 8 Dec 2023 12:31:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbjLHRb1 (ORCPT ); Fri, 8 Dec 2023 12:31:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA8F85 for ; Fri, 8 Dec 2023 09:31:33 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C51CC433C8; Fri, 8 Dec 2023 17:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702056693; bh=jidHsWIy2RHPmyo07QZHtscgTyRrcFhr6KRNd4KD7GM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hW2bMg+Zx2738kwJe6NZncA2ed73Ll2e9F8xe//9HeMtmq67+V4HP2A8WVE4L6XWF QwrcSkj3EbGS+mLhuzZ3LlQjCQOeQ7VZDZbVXCuTv/gkz2vCY0S3MvOyx3kdk4i9bj bbP8qTl93yyHpElsq900A7jaUyxdL3cbMjqqdhc8toITR0Gu2yITqo/dxQb+H+jS8c Izy08HF9QYgweXwt4BtjLJU0M6dPvuxTrjw/Zd0Gm34mLnJ8uC472rIEWvrg/zRy6X KnYuvwlwFBm0LH6/xQepk77R/CiRaCNM+JQceJRYRBK7Y+TNEw2L53wKZEpVA/J7Z7 ePmptf5yQrdxA== Date: Fri, 8 Dec 2023 23:01:18 +0530 From: Manivannan Sadhasivam To: Bean Huo Cc: avri.altman@wdc.com, bvanassche@acm.org, alim.akhtar@samsung.com, jejb@linux.ibm.com, martin.petersen@oracle.com, quic_cang@quicinc.com, quic_asutoshd@quicinc.com, beanhuo@micron.com, thomas@t-8ch.de, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, mikebi@micron.com, lporzio@micron.com Subject: Re: [PATCH v4 2/3] scsi: ufs: core: Add UFS RTC support Message-ID: <20231208173118.GE15552@thinkpad> References: <20231208103940.153734-1-beanhuo@iokpp.de> <20231208103940.153734-3-beanhuo@iokpp.de> <20231208145021.GC15552@thinkpad> <89c02f8b999a90329f2125380ad2d984767d25ae.camel@iokpp.de> <20231208170609.GD15552@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231208170609.GD15552@thinkpad> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 09:31:41 -0800 (PST) On Fri, Dec 08, 2023 at 10:36:24PM +0530, Manivannan Sadhasivam wrote: > On Fri, Dec 08, 2023 at 04:12:44PM +0100, Bean Huo wrote: > > On Fri, 2023-12-08 at 20:20 +0530, Manivannan Sadhasivam wrote: > > > > +        */ > > > > +       val = ts64.tv_sec - hba->dev_info.rtc_time_baseline; > > > > + > > > > > > This logic will work if the host has RTC. But if there is no RTC, > > > then tv_sec > > > will return time elapsed since boot. The spec clearly states that > > > host should > > > use absolute mode if it has RTC and relative otherwise. > > > > > > Maybe you should add a logic to detect whether RTC is present or not > > > and > > > override the mode in device? > > > > Thank you for your reviews. I will incorporate the suggested changes > > into the patch, addressing all comments except for the RTC mode switch. > > The proposal is to perform the RTC mode switch during UFS provisioning, > > not at runtime in the UFS online phase. This approach ensures that the > > UFS configuration is populated based on the RTC configuration > > established during provisioning. It is advisable not to change the RTC > > mode after provisioning is complete. Additionally, the usage of tv_sec, > > which returns time elapsed since boot, suggests that there is no issue > > with utilizing the RTC in this context. > > Except that the warning will be issued to users after each 10s for 40 years. > Atleast get rid of that. > I tried this series on Qcom RB5 board and found the issue due to the usage of UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH flag. When this flag is set, ufshcd_device_init() will be called twice due to reinit of the controller and PHY. Since RTC work is initialized and scheduled from ufshcd_device_init(), panic happens during second time. Is it possible to move RTC init outside of ufshcd_device_init(). Maybe you can parse RTC params in ufshcd_device_init() and initialize the work elsewhere. Or you can cancel the work before calling ufshcd_device_init() second time. - Mani > - Mani > > > > > Kind regards, > > Bean > > -- > மணிவண்ணன் சதாசிவம் -- மணிவண்ணன் சதாசிவம்