diff options
author | Greg Kurz <gkurz@linux.vnet.ibm.com> | 2015-02-23 16:14:37 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-03-18 10:48:59 +1100 |
commit | 3338a65badd5758c8723e2b1e5a0db88151f2774 (patch) | |
tree | 64d0f14de7a054c890dcd620b8b9281d2d183886 /arch/powerpc/mm/vphn.h | |
parent | 4b6cfb2a8cd7520e8a747718e5c1da047697ca31 (diff) |
powerpc/vphn: parsing code rewrite
The current VPHN parsing logic has some flaws that this patch aims to fix:
1) when the value 0xffff is read, the value 0xffffffff gets added to the
the output list and its element count isn't incremented. This is wrong.
According to PAPR+ the domain identifiers are packed into a sequence
terminated by the "reserved value of all ones". This means that 0xffff
is a stream terminator.
2) the combination of byteswaps and casts make the code hardly readable.
Let's parse the stream one 16-bit field at a time instead.
3) it is assumed that the hypercall returns 12 32-bit values packed into
6 64-bit registers. According to PAPR+, the domain identifiers may be
streamed as 16-bit values. Let's increase the number of expected numbers
to 24.
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/vphn.h')
-rw-r--r-- | arch/powerpc/mm/vphn.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/powerpc/mm/vphn.h b/arch/powerpc/mm/vphn.h index 96af9a474693..fe8b7805b78f 100644 --- a/arch/powerpc/mm/vphn.h +++ b/arch/powerpc/mm/vphn.h @@ -6,10 +6,10 @@ #define VPHN_REGISTER_COUNT 6 /* - * 6 64-bit registers unpacked into 12 32-bit associativity values. To form - * the complete property we have to add the length in the first cell. + * 6 64-bit registers unpacked into up to 24 be32 associativity values. To + * form the complete property we have to add the length in the first cell. */ -#define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u32) + 1) +#define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1) extern int vphn_unpack_associativity(const long *packed, __be32 *unpacked); |