mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
BACKPORT: FROMLIST: Revert "scsi: ufs: core: Initialize devfreq synchronously"
This reverts commit7dafc3e007. This patch introduced a regression [1] where hba->pwr_info is used before being initialized, which could create issues in ufshcd_scale_gear(). Revert it until a better solution is found. [1] https://lore.kernel.org/all/CAGaU9a_PMZhqv+YJ0r3w-hJMsR922oxW6Kg59vw+oen-NZ6Otw@mail.gmail.com Fixes:7dafc3e007("scsi: ufs: core: Initialize devfreq synchronously") Change-Id: I83fcf15852f51ca24aa14700ea3d5a9c1bd721ec Signed-off-by: Adrien Thierry <athierry@redhat.com> [ bvanassche: left out the struct ufs_hba changes because of the GKI ] Link: https://lore.kernel.org/linux-scsi/20230329205426.46393-1-athierry@redhat.com/ Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
committed by
Bart Van Assche
parent
0bcb2dc28c
commit
702d62d943
@@ -1416,13 +1416,6 @@ static int ufshcd_devfreq_target(struct device *dev,
|
||||
struct ufs_clk_info *clki;
|
||||
unsigned long irq_flags;
|
||||
|
||||
/*
|
||||
* Skip devfreq if UFS initialization is not finished.
|
||||
* Otherwise ufs could be in a inconsistent state.
|
||||
*/
|
||||
if (!smp_load_acquire(&hba->logical_unit_scan_finished))
|
||||
return 0;
|
||||
|
||||
if (!ufshcd_is_clkscaling_supported(hba))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -8435,6 +8428,22 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
/* Initialize devfreq after UFS device is detected */
|
||||
if (ufshcd_is_clkscaling_supported(hba)) {
|
||||
memcpy(&hba->clk_scaling.saved_pwr_info.info,
|
||||
&hba->pwr_info,
|
||||
sizeof(struct ufs_pa_layer_attr));
|
||||
hba->clk_scaling.saved_pwr_info.is_valid = true;
|
||||
hba->clk_scaling.is_allowed = true;
|
||||
|
||||
ret = ufshcd_devfreq_init(hba);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
hba->clk_scaling.is_enabled = true;
|
||||
ufshcd_init_clk_scaling_sysfs(hba);
|
||||
}
|
||||
|
||||
ufs_bsg_probe(hba);
|
||||
ufshpb_init(hba);
|
||||
scsi_scan_host(hba->host);
|
||||
@@ -8675,12 +8684,6 @@ out:
|
||||
if (ret) {
|
||||
pm_runtime_put_sync(hba->dev);
|
||||
ufshcd_hba_exit(hba);
|
||||
} else {
|
||||
/*
|
||||
* Make sure that when reader code sees UFS initialization has finished,
|
||||
* all initialization steps have really been executed.
|
||||
*/
|
||||
smp_store_release(&hba->logical_unit_scan_finished, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10321,22 +10324,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
|
||||
*/
|
||||
ufshcd_set_ufs_dev_active(hba);
|
||||
|
||||
/* Initialize devfreq */
|
||||
if (ufshcd_is_clkscaling_supported(hba)) {
|
||||
memcpy(&hba->clk_scaling.saved_pwr_info.info,
|
||||
&hba->pwr_info,
|
||||
sizeof(struct ufs_pa_layer_attr));
|
||||
hba->clk_scaling.saved_pwr_info.is_valid = true;
|
||||
hba->clk_scaling.is_allowed = true;
|
||||
|
||||
err = ufshcd_devfreq_init(hba);
|
||||
if (err)
|
||||
goto rpm_put_sync;
|
||||
|
||||
hba->clk_scaling.is_enabled = true;
|
||||
ufshcd_init_clk_scaling_sysfs(hba);
|
||||
}
|
||||
|
||||
async_schedule(ufshcd_async_scan, hba);
|
||||
ufs_sysfs_add_nodes(dev);
|
||||
trace_android_vh_ufs_update_sysfs(hba);
|
||||
@@ -10344,8 +10331,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
|
||||
device_enable_async_suspend(dev);
|
||||
return 0;
|
||||
|
||||
rpm_put_sync:
|
||||
pm_runtime_put_sync(dev);
|
||||
free_tmf_queue:
|
||||
blk_mq_destroy_queue(hba->tmf_queue);
|
||||
blk_put_queue(hba->tmf_queue);
|
||||
|
||||
Reference in New Issue
Block a user