Commit 7e9609d2 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen
Browse files

scsi: ufs: core: Remove HPB support



Interest among UFS users in HPB has reduced significantly. I am not aware
of any current users of the HPB functionality. Hence remove HPB support
from the kernel.

A note: the work in JEDEC on a successor for HPB is nearing completion.
Zoned storage for UFS or ZUFS combines the UFS standard with ZBC-2.

Acked-by: default avatarAvri Altman <avri.altman@wdc.com>
Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: ChanWoo Lee <cw9316.lee@samsung.com>
Cc: Daejun Park <daejun7.park@samsung.com>
Cc: Keoseong Park <keosung.park@samsung.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230719165758.2787573-1-bvanassche@acm.org


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f669b8a6
Loading
Loading
Loading
Loading
+0 −247
Original line number Diff line number Diff line
@@ -1437,180 +1437,6 @@ Description:
		If avail_wb_buff < wb_flush_threshold, it indicates that WriteBooster buffer needs to
		be flushed, otherwise it is not necessary.

What:		/sys/bus/platform/drivers/ufshcd/*/device_descriptor/hpb_version
What:		/sys/bus/platform/devices/*.ufs/device_descriptor/hpb_version
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the HPB specification version.
		The full information about the descriptor can be found in the UFS
		HPB (Host Performance Booster) Extension specifications.
		Example: version 1.2.3 = 0123h

		The file is read only.

What:		/sys/bus/platform/drivers/ufshcd/*/device_descriptor/hpb_control
What:		/sys/bus/platform/devices/*.ufs/device_descriptor/hpb_control
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows an indication of the HPB control mode.
		00h: Host control mode
		01h: Device control mode

		The file is read only.

What:		/sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_region_size
What:		/sys/bus/platform/devices/*.ufs/geometry_descriptor/hpb_region_size
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the bHPBRegionSize which can be calculated
		as in the following (in bytes):
		HPB Region size = 512B * 2^bHPBRegionSize

		The file is read only.

What:		/sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_number_lu
What:		/sys/bus/platform/devices/*.ufs/geometry_descriptor/hpb_number_lu
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the maximum number of HPB LU supported	by
		the device.
		00h: HPB is not supported by the device.
		01h ~ 20h: Maximum number of HPB LU supported by the device

		The file is read only.

What:		/sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_subregion_size
What:		/sys/bus/platform/devices/*.ufs/geometry_descriptor/hpb_subregion_size
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the bHPBSubRegionSize, which can be
		calculated as in the following (in bytes) and shall be a multiple of
		logical block size:
		HPB Sub-Region size = 512B x 2^bHPBSubRegionSize
		bHPBSubRegionSize shall not exceed bHPBRegionSize.

		The file is read only.

What:		/sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_max_active_regions
What:		/sys/bus/platform/devices/*.ufs/geometry_descriptor/hpb_max_active_regions
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the maximum number of active HPB regions that
		is supported by the device.

		The file is read only.

What:		/sys/class/scsi_device/*/device/unit_descriptor/hpb_lu_max_active_regions
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the maximum number of HPB regions assigned to
		the HPB logical unit.

		The file is read only.

What:		/sys/class/scsi_device/*/device/unit_descriptor/hpb_pinned_region_start_offset
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the start offset of HPB pinned region.

		The file is read only.

What:		/sys/class/scsi_device/*/device/unit_descriptor/hpb_number_pinned_regions
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the number of HPB pinned regions assigned to
		the HPB logical unit.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_stats/hit_cnt
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the number of reads that changed to HPB read.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_stats/miss_cnt
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the number of reads that cannot be changed to
		HPB read.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_stats/rcmd_noti_cnt
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the number of response UPIUs that has
		recommendations for activating sub-regions and/or inactivating region.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_stats/rcmd_active_cnt
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	For the HPB device control mode, this entry shows the number of
        active sub-regions recommended by response UPIUs. For the HPB host control
        mode, this entry shows the number of active sub-regions recommended by the
        HPB host control mode heuristic algorithm.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_stats/rcmd_inactive_cnt
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	For the HPB device control mode, this entry shows the number of
        inactive regions recommended by response UPIUs. For the HPB host control
        mode, this entry shows the number of inactive regions recommended by the
        HPB host control mode heuristic algorithm.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_stats/map_req_cnt
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the number of read buffer commands for
		activating sub-regions recommended by response UPIUs.

		The file is read only.

What:		/sys/class/scsi_device/*/device/hpb_params/requeue_timeout_ms
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the requeue timeout threshold for write buffer
		command in ms. The value can be changed by writing an integer to
		this entry.

What:		/sys/bus/platform/drivers/ufshcd/*/attributes/max_data_size_hpb_single_cmd
What:		/sys/bus/platform/devices/*.ufs/attributes/max_data_size_hpb_single_cmd
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the maximum HPB data size for using a single HPB
		command.

		===  ========
		00h  4KB
		01h  8KB
		02h  12KB
		...
		FFh  1024KB
		===  ========

		The file is read only.

What:		/sys/bus/platform/drivers/ufshcd/*/flags/hpb_enable
What:		/sys/bus/platform/devices/*.ufs/flags/hpb_enable
Date:		June 2021
Contact:	Daejun Park <daejun7.park@samsung.com>
Description:	This entry shows the status of HPB.

		== ============================
		0  HPB is not enabled.
		1  HPB is enabled
		== ============================

		The file is read only.

Contact:	Daniil Lunev <dlunev@chromium.org>
What:		/sys/bus/platform/drivers/ufshcd/*/capabilities/
What:		/sys/bus/platform/devices/*.ufs/capabilities/
@@ -1648,76 +1474,3 @@ Description: Indicates status of Write Booster.

		The file is read only.
What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/activation_thld
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	In host control mode, reads are the major source of activation
		trials.  Once this threshold hs met, the region is added to the
		"to-be-activated" list.  Since we reset the read counter upon
		write, this include sending a rb command updating the region
		ppn as well.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/normalization_factor
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	In host control mode, we think of the regions as "buckets".
		Those buckets are being filled with reads, and emptied on write.
		We use entries_per_srgn - the amount of blocks in a subregion as
		our bucket size.  This applies because HPB1.0 only handles
		single-block reads.  Once the bucket size is crossed, we trigger
		a normalization work - not only to avoid overflow, but mainly
		because we want to keep those counters normalized, as we are
		using those reads as a comparative score, to make various decisions.
		The normalization is dividing (shift right) the read counter by
		the normalization_factor. If during consecutive normalizations
		an active region has exhausted its reads - inactivate it.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/eviction_thld_enter
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	Region deactivation is often due to the fact that eviction took
		place: A region becomes active at the expense of another. This is
		happening when the max-active-regions limit has been crossed.
		In host mode, eviction is considered an extreme measure. We
		want to verify that the entering region has enough reads, and
		the exiting region has much fewer reads.  eviction_thld_enter is
		the min reads that a region must have in order to be considered
		a candidate for evicting another region.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/eviction_thld_exit
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	Same as above for the exiting region. A region is considered to
		be a candidate for eviction only if it has fewer reads than
		eviction_thld_exit.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/read_timeout_ms
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	In order not to hang on to "cold" regions, we inactivate
		a region that has no READ access for a predefined amount of
		time - read_timeout_ms. If read_timeout_ms has expired, and the
		region is dirty, it is less likely that we can make any use of
		HPB reading it so we inactivate it.  Still, deactivation has
		its overhead, and we may still benefit from HPB reading this
		region if it is clean - see read_timeout_expiries.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/read_timeout_expiries
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	If the region read timeout has expired, but the region is clean,
		just re-wind its timer for another spin.  Do that as long as it
		is clean and did not exhaust its read_timeout_expiries threshold.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/timeout_polling_interval_ms
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	The frequency with which the delayed worker that checks the
		read_timeouts is awakened.

What:		/sys/class/scsi_device/*/device/hpb_param_sysfs/inflight_map_req
Date:		February 2021
Contact:	Avri Altman <avri.altman@wdc.com>
Description:	In host control mode the host is the originator of map requests.
		To avoid flooding the device with map requests, use a simple throttling
		mechanism that limits the number of inflight map requests.
+0 −8
Original line number Diff line number Diff line
@@ -35,14 +35,6 @@ config SCSI_UFS_CRYPTO
	  capabilities of the UFS device (if present) to perform crypto
	  operations on data being transferred to/from the device.

config SCSI_UFS_HPB
	bool "Support UFS Host Performance Booster"
	help
	  The UFS HPB feature improves random read performance. It caches
	  L2P (logical to physical) map of UFS to host DRAM. The driver uses HPB
	  read command by piggybacking physical page number for bypassing FTL (flash
	  translation layer)'s L2P address translation.

config SCSI_UFS_FAULT_INJECTION
	bool "UFS Fault Injection Support"
	depends on FAULT_INJECTION
+0 −1
Original line number Diff line number Diff line
@@ -5,6 +5,5 @@ ufshcd-core-y += ufshcd.o ufs-sysfs.o ufs-mcq.o
ufshcd-core-$(CONFIG_DEBUG_FS)		+= ufs-debugfs.o
ufshcd-core-$(CONFIG_SCSI_UFS_BSG)	+= ufs_bsg.o
ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO)	+= ufshcd-crypto.o
ufshcd-core-$(CONFIG_SCSI_UFS_HPB)	+= ufshpb.o
ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o
ufshcd-core-$(CONFIG_SCSI_UFS_HWMON)	+= ufs-hwmon.o
+0 −22
Original line number Diff line number Diff line
@@ -718,8 +718,6 @@ UFS_DEVICE_DESC_PARAM(device_version, _DEV_VER, 2);
UFS_DEVICE_DESC_PARAM(number_of_secure_wpa, _NUM_SEC_WPA, 1);
UFS_DEVICE_DESC_PARAM(psa_max_data_size, _PSA_MAX_DATA, 4);
UFS_DEVICE_DESC_PARAM(psa_state_timeout, _PSA_TMT, 1);
UFS_DEVICE_DESC_PARAM(hpb_version, _HPB_VER, 2);
UFS_DEVICE_DESC_PARAM(hpb_control, _HPB_CONTROL, 1);
UFS_DEVICE_DESC_PARAM(ext_feature_sup, _EXT_UFS_FEATURE_SUP, 4);
UFS_DEVICE_DESC_PARAM(wb_presv_us_en, _WB_PRESRV_USRSPC_EN, 1);
UFS_DEVICE_DESC_PARAM(wb_type, _WB_TYPE, 1);
@@ -752,8 +750,6 @@ static struct attribute *ufs_sysfs_device_descriptor[] = {
	&dev_attr_number_of_secure_wpa.attr,
	&dev_attr_psa_max_data_size.attr,
	&dev_attr_psa_state_timeout.attr,
	&dev_attr_hpb_version.attr,
	&dev_attr_hpb_control.attr,
	&dev_attr_ext_feature_sup.attr,
	&dev_attr_wb_presv_us_en.attr,
	&dev_attr_wb_type.attr,
@@ -827,10 +823,6 @@ UFS_GEOMETRY_DESC_PARAM(enh4_memory_max_alloc_units,
	_ENM4_MAX_NUM_UNITS, 4);
UFS_GEOMETRY_DESC_PARAM(enh4_memory_capacity_adjustment_factor,
	_ENM4_CAP_ADJ_FCTR, 2);
UFS_GEOMETRY_DESC_PARAM(hpb_region_size, _HPB_REGION_SIZE, 1);
UFS_GEOMETRY_DESC_PARAM(hpb_number_lu, _HPB_NUMBER_LU, 1);
UFS_GEOMETRY_DESC_PARAM(hpb_subregion_size, _HPB_SUBREGION_SIZE, 1);
UFS_GEOMETRY_DESC_PARAM(hpb_max_active_regions, _HPB_MAX_ACTIVE_REGS, 2);
UFS_GEOMETRY_DESC_PARAM(wb_max_alloc_units, _WB_MAX_ALLOC_UNITS, 4);
UFS_GEOMETRY_DESC_PARAM(wb_max_wb_luns, _WB_MAX_WB_LUNS, 1);
UFS_GEOMETRY_DESC_PARAM(wb_buff_cap_adj, _WB_BUFF_CAP_ADJ, 1);
@@ -868,10 +860,6 @@ static struct attribute *ufs_sysfs_geometry_descriptor[] = {
	&dev_attr_enh3_memory_capacity_adjustment_factor.attr,
	&dev_attr_enh4_memory_max_alloc_units.attr,
	&dev_attr_enh4_memory_capacity_adjustment_factor.attr,
	&dev_attr_hpb_region_size.attr,
	&dev_attr_hpb_number_lu.attr,
	&dev_attr_hpb_subregion_size.attr,
	&dev_attr_hpb_max_active_regions.attr,
	&dev_attr_wb_max_alloc_units.attr,
	&dev_attr_wb_max_wb_luns.attr,
	&dev_attr_wb_buff_cap_adj.attr,
@@ -1132,7 +1120,6 @@ UFS_FLAG(disable_fw_update, _PERMANENTLY_DISABLE_FW_UPDATE);
UFS_FLAG(wb_enable, _WB_EN);
UFS_FLAG(wb_flush_en, _WB_BUFF_FLUSH_EN);
UFS_FLAG(wb_flush_during_h8, _WB_BUFF_FLUSH_DURING_HIBERN8);
UFS_FLAG(hpb_enable, _HPB_EN);

static struct attribute *ufs_sysfs_device_flags[] = {
	&dev_attr_device_init.attr,
@@ -1146,7 +1133,6 @@ static struct attribute *ufs_sysfs_device_flags[] = {
	&dev_attr_wb_enable.attr,
	&dev_attr_wb_flush_en.attr,
	&dev_attr_wb_flush_during_h8.attr,
	&dev_attr_hpb_enable.attr,
	NULL,
};

@@ -1193,7 +1179,6 @@ out: \
static DEVICE_ATTR_RO(_name)

UFS_ATTRIBUTE(boot_lun_enabled, _BOOT_LU_EN);
UFS_ATTRIBUTE(max_data_size_hpb_single_cmd, _MAX_HPB_SINGLE_CMD);
UFS_ATTRIBUTE(current_power_mode, _POWER_MODE);
UFS_ATTRIBUTE(active_icc_level, _ACTIVE_ICC_LVL);
UFS_ATTRIBUTE(ooo_data_enabled, _OOO_DATA_EN);
@@ -1217,7 +1202,6 @@ UFS_ATTRIBUTE(wb_cur_buf, _CURR_WB_BUFF_SIZE);

static struct attribute *ufs_sysfs_attributes[] = {
	&dev_attr_boot_lun_enabled.attr,
	&dev_attr_max_data_size_hpb_single_cmd.attr,
	&dev_attr_current_power_mode.attr,
	&dev_attr_active_icc_level.attr,
	&dev_attr_ooo_data_enabled.attr,
@@ -1291,9 +1275,6 @@ UFS_UNIT_DESC_PARAM(provisioning_type, _PROVISIONING_TYPE, 1);
UFS_UNIT_DESC_PARAM(physical_memory_resourse_count, _PHY_MEM_RSRC_CNT, 8);
UFS_UNIT_DESC_PARAM(context_capabilities, _CTX_CAPABILITIES, 2);
UFS_UNIT_DESC_PARAM(large_unit_granularity, _LARGE_UNIT_SIZE_M1, 1);
UFS_UNIT_DESC_PARAM(hpb_lu_max_active_regions, _HPB_LU_MAX_ACTIVE_RGNS, 2);
UFS_UNIT_DESC_PARAM(hpb_pinned_region_start_offset, _HPB_PIN_RGN_START_OFF, 2);
UFS_UNIT_DESC_PARAM(hpb_number_pinned_regions, _HPB_NUM_PIN_RGNS, 2);
UFS_UNIT_DESC_PARAM(wb_buf_alloc_units, _WB_BUF_ALLOC_UNITS, 4);

static struct attribute *ufs_sysfs_unit_descriptor[] = {
@@ -1311,9 +1292,6 @@ static struct attribute *ufs_sysfs_unit_descriptor[] = {
	&dev_attr_physical_memory_resourse_count.attr,
	&dev_attr_context_capabilities.attr,
	&dev_attr_large_unit_granularity.attr,
	&dev_attr_hpb_lu_max_active_regions.attr,
	&dev_attr_hpb_pinned_region_start_offset.attr,
	&dev_attr_hpb_number_pinned_regions.attr,
	&dev_attr_wb_buf_alloc_units.attr,
	NULL,
};
+1 −66
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
#include "ufs-fault-injection.h"
#include "ufs_bsg.h"
#include "ufshcd-crypto.h"
#include "ufshpb.h"
#include <asm/unaligned.h>

#define CREATE_TRACE_POINTS
@@ -238,8 +237,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = {
	/* UFS cards deviations table */
	{ .wmanufacturerid = UFS_VENDOR_MICRON,
	  .model = UFS_ANY_MODEL,
	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |
		   UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ },
	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM },
	{ .wmanufacturerid = UFS_VENDOR_SAMSUNG,
	  .model = UFS_ANY_MODEL,
	  .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |
@@ -2907,8 +2905,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)

	lrbp->req_abort_skip = false;

	ufshpb_prep(hba, lrbp);

	ufshcd_comp_scsi_upiu(hba, lrbp);

	err = ufshcd_map_sg(hba, lrbp);
@@ -5107,26 +5103,6 @@ static int ufshcd_change_queue_depth(struct scsi_device *sdev, int depth)
	return scsi_change_queue_depth(sdev, min(depth, sdev->host->can_queue));
}

static void ufshcd_hpb_destroy(struct ufs_hba *hba, struct scsi_device *sdev)
{
	/* skip well-known LU */
	if ((sdev->lun >= UFS_UPIU_MAX_UNIT_NUM_ID) ||
	    !(hba->dev_info.hpb_enabled) || !ufshpb_is_allowed(hba))
		return;

	ufshpb_destroy_lu(hba, sdev);
}

static void ufshcd_hpb_configure(struct ufs_hba *hba, struct scsi_device *sdev)
{
	/* skip well-known LU */
	if ((sdev->lun >= UFS_UPIU_MAX_UNIT_NUM_ID) ||
	    !(hba->dev_info.hpb_enabled) || !ufshpb_is_allowed(hba))
		return;

	ufshpb_init_hpb_lu(hba, sdev);
}

/**
 * ufshcd_slave_configure - adjust SCSI device configurations
 * @sdev: pointer to SCSI device
@@ -5136,8 +5112,6 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
	struct ufs_hba *hba = shost_priv(sdev->host);
	struct request_queue *q = sdev->request_queue;

	ufshcd_hpb_configure(hba, sdev);

	blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
	if (hba->quirks & UFSHCD_QUIRK_4KB_DMA_ALIGNMENT)
		blk_queue_update_dma_alignment(q, SZ_4K - 1);
@@ -5172,8 +5146,6 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)

	hba = shost_priv(sdev->host);

	ufshcd_hpb_destroy(hba, sdev);

	/* Drop the reference as it won't be needed anymore */
	if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) {
		spin_lock_irqsave(hba->host->host_lock, flags);
@@ -5299,9 +5271,6 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
			    ufshcd_is_exception_event(lrbp->ucd_rsp_ptr))
				/* Flushed in suspend */
				schedule_work(&hba->eeh_work);

			if (scsi_status == SAM_STAT_GOOD)
				ufshpb_rsp_upiu(hba, lrbp);
			break;
		case UPIU_TRANSACTION_REJECT_UPIU:
			/* TODO: handle Reject UPIU Response */
@@ -7658,7 +7627,6 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
	 * Stop the host controller and complete the requests
	 * cleared by h/w
	 */
	ufshpb_toggle_state(hba, HPB_PRESENT, HPB_RESET);
	ufshcd_hba_stop(hba);
	hba->silence_err_logs = true;
	ufshcd_complete_requests(hba, true);
@@ -8121,7 +8089,6 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
{
	int err;
	u8 model_index;
	u8 b_ufs_feature_sup;
	u8 *desc_buf;
	struct ufs_dev_info *dev_info = &hba->dev_info;

@@ -8150,26 +8117,9 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
	dev_info->wspecversion = desc_buf[DEVICE_DESC_PARAM_SPEC_VER] << 8 |
				      desc_buf[DEVICE_DESC_PARAM_SPEC_VER + 1];
	dev_info->bqueuedepth = desc_buf[DEVICE_DESC_PARAM_Q_DPTH];
	b_ufs_feature_sup = desc_buf[DEVICE_DESC_PARAM_UFS_FEAT];

	model_index = desc_buf[DEVICE_DESC_PARAM_PRDCT_NAME];

	if (dev_info->wspecversion >= UFS_DEV_HPB_SUPPORT_VERSION &&
	    (b_ufs_feature_sup & UFS_DEV_HPB_SUPPORT)) {
		bool hpb_en = false;

		ufshpb_get_dev_info(hba, desc_buf);

		if (!ufshpb_is_legacy(hba))
			err = ufshcd_query_flag_retry(hba,
						      UPIU_QUERY_OPCODE_READ_FLAG,
						      QUERY_FLAG_IDN_HPB_EN, 0,
						      &hpb_en);

		if (ufshpb_is_legacy(hba) || (!err && hpb_en))
			dev_info->hpb_enabled = true;
	}

	err = ufshcd_read_string_desc(hba, model_index,
				      &dev_info->model, SD_ASCII_STD);
	if (err < 0) {
@@ -8404,10 +8354,6 @@ static int ufshcd_device_geo_params_init(struct ufs_hba *hba)
	else if (desc_buf[GEOMETRY_DESC_PARAM_MAX_NUM_LUN] == 0)
		hba->dev_info.max_lu_supported = 8;

	if (desc_buf[QUERY_DESC_LENGTH_OFFSET] >=
		GEOMETRY_DESC_PARAM_HPB_MAX_ACTIVE_REGS)
		ufshpb_get_geo_info(hba, desc_buf);

out:
	kfree(desc_buf);
	return err;
@@ -8548,7 +8494,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
	}

	ufs_bsg_probe(hba);
	ufshpb_init(hba);
	scsi_scan_host(hba->host);
	pm_runtime_put_sync(hba->dev);

@@ -8780,7 +8725,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
	/* Enable Auto-Hibernate if configured */
	ufshcd_auto_hibern8_enable(hba);

	ufshpb_toggle_state(hba, HPB_RESET, HPB_PRESENT);
out:
	spin_lock_irqsave(hba->host->host_lock, flags);
	if (ret)
@@ -8850,10 +8794,6 @@ static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)
static const struct attribute_group *ufshcd_driver_groups[] = {
	&ufs_sysfs_unit_descriptor_group,
	&ufs_sysfs_lun_attributes_group,
#ifdef CONFIG_SCSI_UFS_HPB
	&ufs_sysfs_hpb_stat_group,
	&ufs_sysfs_hpb_param_group,
#endif
	NULL,
};

@@ -9538,8 +9478,6 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		req_link_state = UIC_LINK_OFF_STATE;
	}

	ufshpb_suspend(hba);

	/*
	 * If we can't transition into any of the low power modes
	 * just gate the clocks.
@@ -9693,7 +9631,6 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		ufshcd_update_evt_hist(hba, UFS_EVT_WL_SUSP_ERR, (u32)ret);
		hba->clk_gating.is_suspended = false;
		ufshcd_release(hba);
		ufshpb_resume(hba);
	}
	hba->pm_op_in_progress = false;
	return ret;
@@ -9773,7 +9710,6 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	/* Enable Auto-Hibernate if configured */
	ufshcd_auto_hibern8_enable(hba);

	ufshpb_resume(hba);
	goto out;

set_old_link_state:
@@ -10113,7 +10049,6 @@ void ufshcd_remove(struct ufs_hba *hba)
		ufshcd_rpm_get_sync(hba);
	ufs_hwmon_remove(hba);
	ufs_bsg_remove(hba);
	ufshpb_remove(hba);
	ufs_sysfs_remove_nodes(hba->dev);
	blk_mq_destroy_queue(hba->tmf_queue);
	blk_put_queue(hba->tmf_queue);
Loading