[PATCH v4 1/1] scsi: ufs: core: add device level exception support

Arthur Simchaev Arthur.Simchaev at sandisk.com
Wed Mar 26 00:30:17 PDT 2025


> Hi Arthur,
> This is not a flags attribute. This is for a Query Read 64-bit Attribute data. In
> the existing code, we do not have a read 64-bit attribute, so adding this new
> code would also allow future re-use.
> 
> The new "struct utp_upiu_query_response_v4_0" would improve readability
> because it is formatted exactly as how the jedec standard defines for Attribute
> Read. We won't need to use type cast to get the 64-bit value.
> There would be no issue with efficiency because the same machine code
> would be generated.
> 
> The existing "struct utp_upiu_query_v4_0" probably has a bug in it. It does
> not use the  __attribute__((__packed__)) attribute. The compiler is free to add
> padding in this structure, resulting in the read attribute value being incorrect. I
> plan to provide a separate patch to fix this issue.

Hi Bao 

Upiu_query can be used for all device management command (descriptions, attributes, flags)
See section 10.7.9 UPIU QUERY RESPONSE in the UFS 4.1 specification.
If "struct utp_upiu_query" was properly defined, according to the UFS specification  (by OSF's),
we would not need to add additional "struct utp_upiu_query_v4_0" structures.
If you think the structure should be packaged, you can fix "struct utp_upiu_query" and 
"struct utp_upiu_query_v4_0".

Regards
Arthur

> -----Original Message-----
> From: Bao D. Nguyen <quic_nguyenb at quicinc.com>
> Sent: Wednesday, March 26, 2025 12:16 AM
> To: Arthur Simchaev <Arthur.Simchaev at sandisk.com>;
> quic_cang at quicinc.com; quic_nitirawa at quicinc.com; bvanassche at acm.org;
> avri.altman at wdc.com; peter.wang at mediatek.com;
> manivannan.sadhasivam at linaro.org; minwoo.im at samsung.com;
> adrian.hunter at intel.com; martin.petersen at oracle.com
> Cc: linux-scsi at vger.kernel.org; Alim Akhtar <alim.akhtar at samsung.com>;
> James E.J. Bottomley <James.Bottomley at HansenPartnership.com>; Matthias
> Brugger <matthias.bgg at gmail.com>; AngeloGioacchino Del Regno
> <angelogioacchino.delregno at collabora.com>; Bean Huo
> <beanhuo at micron.com>; Keoseong Park <keosung.park at samsung.com>;
> Ziqi Chen <quic_ziqichen at quicinc.com>; Al Viro <viro at zeniv.linux.org.uk>;
> Gwendal Grignou <gwendal at chromium.org>; Eric Biggers
> <ebiggers at google.com>; open list <linux-kernel at vger.kernel.org>; moderated
> list:ARM/Mediatek SoC support:Keyword:mediatek <linux-arm-
> kernel at lists.infradead.org>; moderated list:ARM/Mediatek SoC
> support:Keyword:mediatek <linux-mediatek at lists.infradead.org>
> Subject: Re: [PATCH v4 1/1] scsi: ufs: core: add device level exception support
> 
> On 3/25/2025 9:33 AM, Arthur Simchaev wrote:
> > Hi Bao
> >
> > I think adding "struct utp_upiu_query_response_v4_0" is redundant and not
> correct for flags upiu response .
> > You can use "struct utp_upiu_query_v4_0"
> >
> Hi Arthur,
> This is not a flags attribute. This is for a Query Read 64-bit Attribute data. In
> the existing code, we do not have a read 64-bit attribute, so adding this new
> code would also allow future re-use.
> 
> The new "struct utp_upiu_query_response_v4_0" would improve readability
> because it is formatted exactly as how the jedec standard defines for Attribute
> Read. We won't need to use type cast to get the 64-bit value.
> There would be no issue with efficiency because the same machine code
> would be generated.
> 
> The existing "struct utp_upiu_query_v4_0" probably has a bug in it. It does
> not use the  __attribute__((__packed__)) attribute. The compiler is free to add
> padding in this structure, resulting in the read attribute value being incorrect. I
> plan to provide a separate patch to fix this issue.
> 
> Thanks, Bao


More information about the linux-arm-kernel mailing list