RE: [EXTERNAL] Re: [PATCH] misc: mrvl-cn10k-dpi: resolve compilation issues on 32-bit ARM

From: Vamsi Krishna Attunuru
Date: Wed Jul 17 2024 - 07:46:23 EST




>-----Original Message-----
>From: Arnd Bergmann <arnd@xxxxxxxx>
>Sent: Wednesday, July 17, 2024 11:10 AM
>To: Vamsi Krishna Attunuru <vattunuru@xxxxxxxxxxx>; Greg Kroah-Hartman
><gregkh@xxxxxxxxxxxxxxxxxxx>
>Cc: linux-kernel@xxxxxxxxxxxxxxx; Nathan Chancellor <nathan@xxxxxxxxxx>;
>Jeff Johnson <quic_jjohnson@xxxxxxxxxxx>
>Subject: Re: [EXTERNAL] Re: [PATCH] misc: mrvl-cn10k-dpi: resolve
>compilation issues on 32-bit ARM
>
>On Wed, Jul 17, 2024, at 07: 35, Vamsi Krishna Attunuru wrote: >>> #include
><uapi/misc/mrvl_cn10k_dpi. h> >>> >>> @@ -185,6 +188,8 @@ struct
>dpi_mbox_message { >>> uint64_t word_h; >>> }; >>>
>
>On Wed, Jul 17, 2024, at 07:35, Vamsi Krishna Attunuru wrote:
>
>>>> #include <uapi/misc/mrvl_cn10k_dpi.h>
>>>>
>>>> @@ -185,6 +188,8 @@ struct dpi_mbox_message {
>>>> uint64_t word_h;
>>>> };
>>>>
>>>> +#ifdef CONFIG_64BIT
>>>> +
>>>> static inline void dpi_reg_write(struct dpipf *dpi, u64 offset, u64
>>>> val) {
>>>> writeq(val, dpi->reg_base + offset); @@ -195,6 +200,40 @@ static
>>>> inline u64 dpi_reg_read(struct dpipf *dpi, u64 offset)
>>>> return readq(dpi->reg_base + offset); }
>>>>
>>>> +static inline void dpi_writeq(u64 val, void __iomem *addr) {
>>>> + writeq(val, addr);
>>>> +}
>>>> +
>>>> +static inline u64 dpi_readq(const void __iomem *addr) {
>>>> + return readq(addr);
>>>> +}
>>>> +
>>>> +#else
>>>
>>>Normally we do not like #ifdef in .c files, are you sure this is the
>>>correct way to handle this?
>>
>> Ok, came across the similar usage in some other drivers and presumed
>> it's fine with small routines. I will move the #ifdef inside the
>> routines than.
>>
>> Thank you, Greg, for the prompt feedback.
>
>You shouldn't need any #ifdef here, just call readq/writeq unconditionally
>after including the header.
>
>Have you been able to confirm whether the device works correctly with the
>lo_hi ordering?
>

Neither of them worked in our case, HW folks also confirmed that only 64bit access work correctly.
I will just include the header that address the compilation errors with ARCH=arm, anyways nobody
will use this driver on 32-bit kernel.

Thanks Arnd.

Vamsi

> Arnd