* Re: [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization
[not found] ` <20230727194457.3152309-12-bvanassche@acm.org>
@ 2023-08-02 11:25 ` Kumar, Udit
2023-08-02 16:05 ` Bart Van Assche
0 siblings, 1 reply; 4+ messages in thread
From: Kumar, Udit @ 2023-08-02 11:25 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Avri Altman, Adrian Hunter, Bao D . Nguyen,
Eric Biggers, Bean Huo, James E.J. Bottomley, Stanley Chu,
Can Guo, Manivannan Sadhasivam, Asutosh Das, Po-Wen Kao, Yang Li,
Arthur Simchaev, Kiwoong Kim, Nishanth Menon, d-gole, linux-next,
u-kumar1
Hi Bart,
On 7/28/2023 1:11 AM, Bart Van Assche wrote:
> Make the code that initializes UTP transfer request headers easier to
> read by using bitfields instead of __le32 where appropriate.
>
> Cc: Bao D. Nguyen <quic_nguyenb@quicinc.com>
> Cc: Eric Biggers <ebiggers@google.com>
> Cc: Avri Altman <avri.altman@wdc.com>
> Cc: Bean Huo <beanhuo@micron.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> [...]
>
> +static void ufshcd_check_header_layout(void)
> +{
> + BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
> + .cci = 3})[0] != 3);
> +
> + BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
> + .ehs_length = 2})[1] != 2);
> +
> + BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
> + .enable_crypto = 1})[2]
> + != 0x80);
> +
> + BUILD_BUG_ON((((u8 *)&(struct request_desc_header){
> + .command_type = 5,
> + .data_direction = 3,
> + .interrupt = 1,
> + })[3]) != ((5 << 4) | (3 << 1) | 1));
> +
> + BUILD_BUG_ON(((__le32 *)&(struct request_desc_header){
> + .dunl = cpu_to_le32(0xdeadbeef)})[1] !=
> + cpu_to_le32(0xdeadbeef));
> +
> + BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
> + .ocs = 4})[8] != 4);
> +
> + BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
> + .cds = 5})[9] != 5);
> +
> + BUILD_BUG_ON(((__le32 *)&(struct request_desc_header){
> + .dunu = cpu_to_le32(0xbadcafe)})[3] !=
> + cpu_to_le32(0xbadcafe));
> +}
> +
While building next-20230801 for ARM64 architecture,
this patch is giving compilation error
In function ‘ufshcd_check_header_layout’,
inlined from ‘ufshcd_core_init’ at drivers/ufs/core/ufshcd.c:10629:2:
././include/linux/compiler_types.h:397:38: error: call to
‘__compiletime_assert_554’ declared with attribute error: BUILD_BUG_ON
failed: ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] !=
0x80
397 | _compiletime_assert(condition, msg, __compiletime_assert_,
__COUNTER__)
compiler information
wget
https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
tar -Jxvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
Build steps
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- Image
> [...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization
2023-08-02 11:25 ` [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization Kumar, Udit
@ 2023-08-02 16:05 ` Bart Van Assche
2023-08-02 16:44 ` Kumar, Udit
0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2023-08-02 16:05 UTC (permalink / raw)
To: Kumar, Udit, Martin K . Petersen
Cc: linux-scsi, Avri Altman, Adrian Hunter, Bao D . Nguyen,
Eric Biggers, Bean Huo, James E.J. Bottomley, Stanley Chu,
Can Guo, Manivannan Sadhasivam, Asutosh Das, Po-Wen Kao, Yang Li,
Arthur Simchaev, Kiwoong Kim, Nishanth Menon, d-gole, linux-next
On 8/2/23 04:25, Kumar, Udit wrote:
> While building next-20230801 for ARM64 architecture,
>
> this patch is giving compilation error
>
> In function ‘ufshcd_check_header_layout’,
> inlined from ‘ufshcd_core_init’ at drivers/ufs/core/ufshcd.c:10629:2:
> ././include/linux/compiler_types.h:397:38: error: call to
> ‘__compiletime_assert_554’ declared with attribute error: BUILD_BUG_ON
> failed: ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] !=
> 0x80
> 397 | _compiletime_assert(condition, msg, __compiletime_assert_,
> __COUNTER__)
>
>
> compiler information
>
> wget
> https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
Does this patch help:
https://lore.kernel.org/linux-scsi/20230801232204.1481902-1-bvanassche@acm.org/?
Thanks,
Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization
2023-08-02 16:05 ` Bart Van Assche
@ 2023-08-02 16:44 ` Kumar, Udit
2023-08-02 16:46 ` Bart Van Assche
0 siblings, 1 reply; 4+ messages in thread
From: Kumar, Udit @ 2023-08-02 16:44 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Avri Altman, Adrian Hunter, Bao D . Nguyen,
Eric Biggers, Bean Huo, James E.J. Bottomley, Stanley Chu,
Can Guo, Manivannan Sadhasivam, Asutosh Das, Po-Wen Kao, Yang Li,
Arthur Simchaev, Kiwoong Kim, Menon, Nishanth, Gole, Dhruva,
linux-next
Thanks Bart
>
>On 8/2/23 04:25, Kumar, Udit wrote:
>> While building next-20230801 for ARM64 architecture,
>>
>> this patch is giving compilation error
>>
>> In function ‘ufshcd_check_header_layout’,
>> inlined from ‘ufshcd_core_init’ at drivers/ufs/core/ufshcd.c:10629:2:
>> ././include/linux/compiler_types.h:397:38: error: call to
>> ‘__compiletime_assert_554’ declared with attribute error: BUILD_BUG_ON
>> failed: ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2]
>> !=
>> 0x80
>> 397 | _compiletime_assert(condition, msg, __compiletime_assert_,
>> __COUNTER__)
>>
>>
>> compiler information
>>
>> wget
>> https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/bi
>> nrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
>
>Does this patch help:
>https://lore.kernel.org/linux-scsi/20230801232204.1481902-1-
>bvanassche@acm.org/?
Yes , build works for me with this patch.
You just skipped based upon compiler version but
what about checks you want to do in this function.
>Thanks,
>
>Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization
2023-08-02 16:44 ` Kumar, Udit
@ 2023-08-02 16:46 ` Bart Van Assche
0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2023-08-02 16:46 UTC (permalink / raw)
To: Kumar, Udit, Martin K . Petersen
Cc: linux-scsi, Avri Altman, Adrian Hunter, Bao D . Nguyen,
Eric Biggers, Bean Huo, James E.J. Bottomley, Stanley Chu,
Can Guo, Manivannan Sadhasivam, Asutosh Das, Po-Wen Kao, Yang Li,
Arthur Simchaev, Kiwoong Kim, Menon, Nishanth, Gole, Dhruva,
linux-next
On 8/2/23 09:44, Kumar, Udit wrote:
>> Does this patch help:
>> https://lore.kernel.org/linux-scsi/20230801232204.1481902-1-
>> bvanassche@acm.org/?
>
> Yes , build works for me with this patch.
> You just skipped based upon compiler version but
> what about checks you want to do in this function.
These checks verify that the layout of the structures matches the layout
from the UFS standard. I want these checks to performed at compile time.
I'm not sure how to let gcc 9 or older perform these checks at compile time.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-02 16:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230727194457.3152309-1-bvanassche@acm.org>
[not found] ` <20230727194457.3152309-12-bvanassche@acm.org>
2023-08-02 11:25 ` [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization Kumar, Udit
2023-08-02 16:05 ` Bart Van Assche
2023-08-02 16:44 ` Kumar, Udit
2023-08-02 16:46 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).