Re: [PATCH 8/9] Remove most checks of __BYTE_ORDER

Steve Wise
2016-09-29T23:46:02Z

> On Sep 29, 2016, at 5:28 PM, Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
>
> On Thu, Sep 29, 2016 at 04:26:52PM -0500, Steve Wise wrote:
>
>>> +/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
>>> + probably wrong */
>>> +#define cpu_to_pci32(val) htole32(val)
>>
>> If this was wrong, then nothing would work. So I think you should
>> remove the comment.
>
> I added the comment because cxgb* was the only provider that seemed to
> be obviously byte swapping MMIO.
>
> Since htole32 is a NOP on x86 and ARM64 the driver would work fine
> with or without it. Do you know this driver works on big endian
> powerpc? That would help answer the question for sure.
>

Yes, PowerPC and arm.

> I looked at this some more, and I still don't really know what is the
> right answer.
>
> In the kernel the swapping behavior of 'writel' is architecture (and
> sometimes even platform) specific. Looking at the kernel headers
> suggests that BE PPC needs an explicit swap and BE ARM does not (eg
> the hardware swaps). Maybe. There are a lot of layers of macros in
> this area..
>
> However, I can't find an obvious swap in mlx4, which I think is the
> most widely tested provider. Does it work on BE PPC?
>
> One of the things I'd like to see done is to consolidate the mmio
> accessors.. The note was a reminder to try and figure out what is
> actually right here.. Appreciate any help!
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html