Re: [PATCH] [v2] watchdog: introduce the ARM64 SBSA watchdog driver

Guenter Roeck
2015-05-14T23:41:15Z

On 05/14/2015 02:03 PM, Timur Tabi wrote:
> On 05/14/2015 03:45 PM, Guenter Roeck wrote:
>> It concerns me that you point to other drivers as argument for using the
>> endianness conversion your code. That raises the question if you really
>> understand the hardware.
>
> The only information I have on how the hardware works is the SBSA document and the internal documentation for our ARM64 server chip.
>
> > Is the register known to be a little endian register,
>> even on a big endian machine, or is it in host byte order ? You don't really
>> answer that question.
>
> The ARM SBSA says in section 4.1.1:
>
> * CPUs shall implement little-endian support.
>
That doesn't really say anything. It neither says that the CPU must _run_
in little endian mode, nor does it say anything about its register byte order.

> That's the only reference to endianness in the document. I don't know if that means that the device registers must also be little-endian. Does Linux even support running ARM64 in big-endian mode?
>

Interesting question. You should be able to answer it yourself.
Hint: Look in arch/arm64/Kconfig.

> So maybe it's safe to say that everything must be little endian? If so, do I still need the __le32 in the structs, and should I still use cpu_to_le32()?
>

We still don't know if the registers are in host byte order or in little endian
order. If registers are in host byte order, there is no need for a conversion.

Guenter