Re: [PATCH v4 2/3] scsi: ufs: core: Add UFS RTC support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 
> -- 
> மணிவண்ணன் சதாசிவம்

-- 
மணிவண்ணன் சதாசிவம்




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux