一.WB的框图
WriteBooster Buffer的大小是由FTL去配置,可以配置为12G,24G,36G等,
二. Exception Event 的介绍以及UFS Driver Exception Event FLow的介绍
1. 首先介绍一下Exception Event的流程
1.1
Exception Event Control: UFS Devices在运行过程中会出现异常,如果对应的Bit位置1,就会通过Response UPIU上报给UFS Host
1.2
UFS Host Verify Accept Exception Event: UFS Host在收到UFS Devices返回的Response UPIU时,会去Check Response UPIU的Byte 9 : Device Information,如果Bit[0]时1,说明UFS Device上报了Exception Event。
/**
* struct utp_upiu_header - UPIU header structure
* @dword_0: UPIU header DW-0
* @dword_1: UPIU header DW-1
* @dword_2: UPIU header DW-2
*/
struct utp_upiu_header {
__be32 dword_0; --->对应UPIU Basic Header byte[3:0]
__be32 dword_1;--->对应UPIU Basic Header byte[7:4]
__be32 dword_2;--->对应UPIU Basic Header byte[11:8]
};
/**
* ufshcd_is_exception_event - Check if the device raised an exception event
* @ucd_rsp_ptr: pointer to response UPIU
*
* The function checks if the device raised an exception event indicated in
* the Device Information field of response UPIU.
*
* Returns true if exception is raised, false otherwise.
*/
static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr)
{
return be32_to_cpu(ucd_rsp_ptr->header.dword_2) &
MASK_RSP_EXCEPTION_EVENT ? true : false;
}
enum {
MASK_SCSI_STATUS = 0xFF,
MASK_TASK_RESPONSE = 0xFF00,
MASK_RSP_UPIU_RESULT = 0xFFFF,
MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
MASK_RSP_EXCEPTION_EVENT = 0x10000,
MASK_TM_SERVICE_RESP = 0xFF,
};
1.3 UFS Host Accept Exception Event will to do:
以Urgent Bkops举个例子:
ufs host accept exception event ---> send query read attribute cmd (CDB:03 0e) to ufs devices verify exception event type---> query exception event status is URGENT_BKOP---> send query read attribute cmd (CDB:03 05) to ufs devices verify bkops status --->
---> query bkops status >=1 ---> send query set flag (CDB:06 04)to ufs devices enable fBackgroundOpsEn-->send query write attributes(CDB:04 0d) to ufs devices disable wExceptionEventControl bit[2] URGENT_BKOPS_EN---> flow finish
2. WriteBooster Buffer Flush needed
三. WriteBooster Buffer FLush Exception event control (wExceptionEventControl) bit[5] WRITEBOOSTER_EVENT_EN置1对Performance的影响
当持续对UFS Devices写入或写入量比较大(超过Writebooster buffer 大小)的数据量,如果WRITEBOOSTER_EVENT_EN置1,ufs devices会持续上报WriteBooster Flush needed exception event 异常给ufs devices, ufs devices会持续query read attributes(CDB:03 0e) ufs devices的exception event status, 可能会导致random read performance drop.