|
@@ -1549,7 +1549,7 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl)
|
|
|
if (!table)
|
|
|
return;
|
|
|
|
|
|
- if (ctrl->ps_max_latency_us == 0) {
|
|
|
+ if (!ctrl->apst_enabled || ctrl->ps_max_latency_us == 0) {
|
|
|
/* Turn off APST. */
|
|
|
apste = 0;
|
|
|
dev_dbg(ctrl->device, "APST disabled\n");
|
|
@@ -1716,7 +1716,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
|
|
|
u64 cap;
|
|
|
int ret, page_shift;
|
|
|
u32 max_hw_sectors;
|
|
|
- u8 prev_apsta;
|
|
|
+ bool prev_apst_enabled;
|
|
|
|
|
|
ret = ctrl->ops->reg_read32(ctrl, NVME_REG_VS, &ctrl->vs);
|
|
|
if (ret) {
|
|
@@ -1784,16 +1784,17 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
|
|
|
ctrl->kas = le16_to_cpu(id->kas);
|
|
|
|
|
|
ctrl->npss = id->npss;
|
|
|
- prev_apsta = ctrl->apsta;
|
|
|
+ ctrl->apsta = id->apsta;
|
|
|
+ prev_apst_enabled = ctrl->apst_enabled;
|
|
|
if (ctrl->quirks & NVME_QUIRK_NO_APST) {
|
|
|
if (force_apst && id->apsta) {
|
|
|
dev_warn(ctrl->device, "forcibly allowing APST due to nvme_core.force_apst -- use at your own risk\n");
|
|
|
- ctrl->apsta = 1;
|
|
|
+ ctrl->apst_enabled = true;
|
|
|
} else {
|
|
|
- ctrl->apsta = 0;
|
|
|
+ ctrl->apst_enabled = false;
|
|
|
}
|
|
|
} else {
|
|
|
- ctrl->apsta = id->apsta;
|
|
|
+ ctrl->apst_enabled = id->apsta;
|
|
|
}
|
|
|
memcpy(ctrl->psd, id->psd, sizeof(ctrl->psd));
|
|
|
|
|
@@ -1823,9 +1824,9 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
|
|
|
|
|
|
kfree(id);
|
|
|
|
|
|
- if (ctrl->apsta && !prev_apsta)
|
|
|
+ if (ctrl->apst_enabled && !prev_apst_enabled)
|
|
|
dev_pm_qos_expose_latency_tolerance(ctrl->device);
|
|
|
- else if (!ctrl->apsta && prev_apsta)
|
|
|
+ else if (!ctrl->apst_enabled && prev_apst_enabled)
|
|
|
dev_pm_qos_hide_latency_tolerance(ctrl->device);
|
|
|
|
|
|
nvme_configure_apst(ctrl);
|