[v2] powerpc/vphn: fix endian issue in NUMA device node code

Michael Ellerman mpe at ellerman.id.au
Tue Oct 7 20:28:23 EST 2014

On Fri, 2014-03-10 at 09:13:17 UTC, Greg Kurz wrote:
> The associativity domain numbers are obtained from the hypervisor through
> registers and written into memory by the guest: the packed array passed to
> vphn_unpack_associativity() is then native-endian, unlike what was assumed
> in the following commit:
> This patch does two things:
> - extract values from the packed array with shifts, in order to be endian
>   neutral
> - convert the resulting values to be32 as expected
> Suggested-by: Anton Blanchard <anton at samba.org>
> Signed-off-by: Greg Kurz <gkurz at linux.vnet.ibm.com>
> Reviewed-by: Nishanth Aravamudan <nacc at linux.vnet.ibm.com>
> Tested-by: Nishanth Aravamudan <nacc at linux.vnet.ibm.com>

Hi Greg,

I'm a bit dense, it's after 8pm, but this seems like it's more complicated than
it needs to be?

We get six 64-bit registers back from the hypervisor, they're cpu endian
obviously, and each is defined to consist of four 2 byte fields.

So to unpack them, can't we just iterate over those six 64-bit values, which if
we load them as 64-bit values will be back in cpu endian?


More information about the Linuxppc-dev mailing list