Message ID | 20221108233339.412808-5-bvanassche@acm.org |
---|---|
State | Superseded |
Headers | show |
Series | Prepare for upstreaming Pixel 6 and 7 UFS support | expand |
> This functionality is needed by UFS drivers to e.g. suspend SCSI command > processing while reprogramming encryption keys if the hardware does not > support concurrent I/O and key reprogramming. This patch prepares for adding > support in the upstream kernel for the Pixel 6 and 7 UFS controllers. > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> I guess that you are planning to upstream the code that uses it, hence: Reviewed-by: Avri Altman <avri.altman@wdc.com> > --- > drivers/ufs/core/ufshcd.c | 20 ++++++++++++++++++++ > include/ufs/ufshcd.h | 3 +++ > 2 files changed, 23 insertions(+) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index > 7b2948592c4a..fa1c84731b8e 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -1707,6 +1707,26 @@ static void ufshcd_ungate_work(struct work_struct > *work) > ufshcd_scsi_unblock_requests(hba); > } > > +/* > + * Block processing of new SCSI commands and wait until pending SCSI > + * commands and TMFs have finished. ufshcd_exec_dev_cmd() and > + * ufshcd_issue_devman_upiu_cmd() are not affected by this function. > + * > + * Return: 0 upon success; -EBUSY upon timeout. > + */ > +int ufshcd_freeze_scsi_devs(struct ufs_hba *hba, u64 timeout_us) { > + return ufshcd_clock_scaling_prepare(hba, timeout_us); } > +EXPORT_SYMBOL_GPL(ufshcd_freeze_scsi_devs); > + > +/* Resume processing of SCSI commands. */ void > +ufshcd_unfreeze_scsi_devs(struct ufs_hba *hba) { > + ufshcd_clock_scaling_unprepare(hba, true); } > +EXPORT_SYMBOL_GPL(ufshcd_unfreeze_scsi_devs); > + > /** > * ufshcd_hold - Enable clocks that were gated earlier due to ufshcd_release. > * Also, exit from hibern8 mode and set the link as active. > diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index > 5cf81dff60aa..bd45818bf0e8 100644 > --- a/include/ufs/ufshcd.h > +++ b/include/ufs/ufshcd.h > @@ -1186,6 +1186,9 @@ void ufshcd_release(struct ufs_hba *hba); > > void ufshcd_clkgate_delay_set(struct device *dev, unsigned long value); > > +int ufshcd_freeze_scsi_devs(struct ufs_hba *hba, u64 timeout_us); void > +ufshcd_unfreeze_scsi_devs(struct ufs_hba *hba); > + > void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn > desc_id, > int *desc_length);
On 11/10/22 03:07, Avri Altman wrote:
> I guess that you are planning to upstream the code that uses it [ ... ]
The code that uses these functions will be sent upstream by Linaro.
Linaro has been asked to do the majority of the work of upstreaming the
Pixel 6 kernel code. My goal with this patch series is to minimize the
differences between the AOSP UFS code and the upstream UFS code.
Thanks,
Bart.
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 7b2948592c4a..fa1c84731b8e 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1707,6 +1707,26 @@ static void ufshcd_ungate_work(struct work_struct *work) ufshcd_scsi_unblock_requests(hba); } +/* + * Block processing of new SCSI commands and wait until pending SCSI + * commands and TMFs have finished. ufshcd_exec_dev_cmd() and + * ufshcd_issue_devman_upiu_cmd() are not affected by this function. + * + * Return: 0 upon success; -EBUSY upon timeout. + */ +int ufshcd_freeze_scsi_devs(struct ufs_hba *hba, u64 timeout_us) +{ + return ufshcd_clock_scaling_prepare(hba, timeout_us); +} +EXPORT_SYMBOL_GPL(ufshcd_freeze_scsi_devs); + +/* Resume processing of SCSI commands. */ +void ufshcd_unfreeze_scsi_devs(struct ufs_hba *hba) +{ + ufshcd_clock_scaling_unprepare(hba, true); +} +EXPORT_SYMBOL_GPL(ufshcd_unfreeze_scsi_devs); + /** * ufshcd_hold - Enable clocks that were gated earlier due to ufshcd_release. * Also, exit from hibern8 mode and set the link as active. diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 5cf81dff60aa..bd45818bf0e8 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1186,6 +1186,9 @@ void ufshcd_release(struct ufs_hba *hba); void ufshcd_clkgate_delay_set(struct device *dev, unsigned long value); +int ufshcd_freeze_scsi_devs(struct ufs_hba *hba, u64 timeout_us); +void ufshcd_unfreeze_scsi_devs(struct ufs_hba *hba); + void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, int *desc_length);
This functionality is needed by UFS drivers to e.g. suspend SCSI command processing while reprogramming encryption keys if the hardware does not support concurrent I/O and key reprogramming. This patch prepares for adding support in the upstream kernel for the Pixel 6 and 7 UFS controllers. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/ufs/core/ufshcd.c | 20 ++++++++++++++++++++ include/ufs/ufshcd.h | 3 +++ 2 files changed, 23 insertions(+)