Age | Commit message (Collapse) | Author | Files | Lines |
|
We are hitting below warning on gcc9.
gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -Wall -Werror -Wno-stringop-truncation -I. -c libflash/ecc.c -o libflash-ecc.o
libflash/ecc.c: In function 'memcpy_to_ecc_unaligned':
libflash/ecc.c:419:24: error: taking address of packed member of 'struct ecc64' may result in an unaligned pointer value [-Werror=address-of-packed-member]
419 | memcpy(inc_uint64_by(&ecc_word.data, alignment), src, bytes_wanted);
| ^~~~~~~~~~~~~~
libflash/ecc.c:448:24: error: taking address of packed member of 'struct ecc64' may result in an unaligned pointer value [-Werror=address-of-packed-member]
448 | memcpy(inc_uint64_by(&ecc_word.data, len), inc_ecc64_by(dst, len),
| ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Fixes: https://github.com/open-power/skiboot/issues/218
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
|
|
We get the same code generation using the builtin:
GCC 7.3:
a3584: 7d 29 00 f4 popcntb r9,r9
a3588: 7d 29 01 74 prtyd r9,r9
GCC 6.3:
a0bfc: 7d 29 00 f4 popcntb r9,r9
a0c00: 7d 29 01 74 prtyd r9,r9
Clang 7 (and clang 6):
bd48c: 7c e7 03 f4 popcntd r7,r7
bd490: 54 e7 07 fe clrlwi r7,r7,31
(Not sure why the clang builtin generates different code)
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
|
|
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
|
|
To calculate the ECC syndrome we need to calculate the parity of a 64bit
number. On non-powerpc platforms we use the gcc builtin function
__builtin_parityl() to do this calculation. This is broken on 32bit ARM
where sizeof(unsigned long) is four bytes. Using __builtin_parityll()
instead cures this.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This makes the size of flash 64 bit safe so that we can have flash
devices greater than 4GB. This is especially useful for mambo disks
passed through to Linux.
Fortunately the device tree interface and the linux device driver are
64bit safe so no changes are required there.
Userspace gard and flash tools are also updated to ensure "make check"
still passes.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
In commit 8f5b8616, we introduced a dependency on libgcc, for the
__builtin_parityl() function in commit 6cfaa3ba.
However, if we're building with a biarch compiler, we may not have a
libgcc available.
This commit removes the __builtin_parityl() call, and replaces with the
equivalent instructions, and removes the dependency on libgcc.
Although this is untested, I have confirmed that the __builtin_parityl()
functions emits the same instructions (on power7 and power8, with
gcc-4.9) as we're using in the parity() function.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
[stewart@linux.vnet.ibm.com: only use inline asm for skiboot build]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The ecc 'memcpy' style functions return success or fail in terms of the ECC
enum. This doesn't really make sense, use true or false. As the result the
ecc enum doesn't need to be exposed anymore, which makes more sense, not
clear why it was exposed in the first place.
Convert some of the ecc #defines to static inlines, shouldn't make any
difference but feels safer.
Fix minor stylistic and typo issues.
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
uint64_t is a long long, the constants need the "ull" suffix.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This patch is twofold.
1. Improves the low level ecc memcpy code to better
specify that we're reading/writing buffers with ecc bytes.
2. Improves/creates the libflash interfaces for ecc.
This patch also includes some tests
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The flash is in big endian and the ecc code must be aware of this when
performing ecc checks on a little endian cpu.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The ecc.h header is used by libflash, so should sit in libflash, to
allow non-skiboot tools to access it.
This change is a simple move of the header file - no changes are made to
the header itself.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reviewed-By: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We don't have prerror / prlog functions when compiling outside of
skiboot. Use the FL_* macros instead.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Add ECC checking code. This code is based on the hostboot code.
Unused currently, but will be soon. This uses __builtin_parityl() hence adding
libgcc linking previously.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|