Re: [v5,1/4] powerpc/nvram: move generic code for nvram and pstore

From: Michael Ellerman
Date: Sun Mar 22 2015 - 23:11:48 EST


On Thu, 2015-05-02 at 19:36:04 UTC, Hari Bathini wrote:
> With minor checks, we can move most of the code for nvram
> under pseries to a common place to be re-used by other
> powerpc platforms like powernv. This patch moves such
> common code to arch/powerpc/kernel/nvram_64.c file.
>
> Signed-off-by: Hari Bathini <hbathini@xxxxxxxxxxxxxxxxxx>
> ---
> arch/powerpc/include/asm/nvram.h | 50 ++
> arch/powerpc/include/asm/rtas.h | 4
> arch/powerpc/kernel/nvram_64.c | 656 ++++++++++++++++++++++++++++++++
> arch/powerpc/platforms/pseries/nvram.c | 665 --------------------------------
> 4 files changed, 714 insertions(+), 661 deletions(-)
>
> diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
> index 34f7c9b..42e5c6a 100644
> --- a/arch/powerpc/kernel/nvram_64.c
> +++ b/arch/powerpc/kernel/nvram_64.c
> @@ -26,6 +26,9 @@

...

> +/* Derived from logfs_compress() */
> +static int nvram_compress(const void *in, void *out, size_t inlen,
> + size_t outlen)
> +{
> + int err, ret;
> +
> + ret = -EIO;
> + err = zlib_deflateInit2(&stream, COMPR_LEVEL, Z_DEFLATED, WINDOW_BITS,
> + MEM_LEVEL, Z_DEFAULT_STRATEGY);
> + if (err != Z_OK)
> + goto error;


This fails the build for ppc64e_defconfig:

arch/powerpc/kernel/built-in.o: In function `.oops_to_nvram':
nvram_64.c:(.text+0x12148): undefined reference to `.zlib_deflateInit2'
nvram_64.c:(.text+0x12178): undefined reference to `.zlib_deflate'
nvram_64.c:(.text+0x1218c): undefined reference to `.zlib_deflateEnd'
arch/powerpc/kernel/built-in.o: In function `.nvram_init_oops_partition':
(.init.text+0x41e0): undefined reference to `.zlib_deflate_workspacesize'
make: *** [vmlinux] Error 1


It used to be OK because PSERIES selects ZLIB_DEFLATE.

I decided to just force ZLIB_DEFLATE on for PPC64. That will add ~22K to the
ppc64e kernel image.

Scott, if you guys are bothered by that let me know and we can add some #ifdefs
to avoid it.

cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/