Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3794462ybi; Mon, 29 Jul 2019 12:45:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzes6hvzaHz/EdYUUkh+dpto6Ju26V1PbLuYvF7pypN+Xeww7ez10ITE0ClzynDNkWjfzbO X-Received: by 2002:a63:f04:: with SMTP id e4mr102898566pgl.38.1564429543438; Mon, 29 Jul 2019 12:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429543; cv=none; d=google.com; s=arc-20160816; b=SJAeLF29fAr0yj6f5zfHmeQT1cGYYSfG6YuwZwW4JhQKKNu4clS8OGUZZ1uu1dVzZV HGJujIVfGop+0L9NjF9YesDBSkuTj/8BTwj/rSXDCoSK1bdBV/CGQeXPOnLI7Qsq+h4T A7WT5PfwSv99ayKN7MWdkFnrcJeEuo+F9C3tb/NR7UfxFPn33KDorMGTjAz/pJB+X/la 4HY8qRsEgzmnytvIoS2zeIkHWJ6hX+cfnBNptEyPgULblmg/VyFL5msYfdj6wWtIZdmZ HH7pJjtrWnZNdG+TRa/CEfNlxqZ9G5Esr/nFIVDW13lNKT0Y7mhdTPzoRwHu+g8M+Yu/ rFyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MoBRwmB8MWUVoLtPefHTpELJ3rsrhW7FviAYvex7tfU=; b=QGjjCxK4pZfjlbUT5S7cbyT/sZltV4rMffCQmFvohZ4h0T5LaUYy7s+jiQEsPKTiof 5buQc6lzp4b9Snj7Ibv6a3pUpSxnzBbowVnaNRbZ6wXUVXvOCMR9axF7L7MUVnsd1ZKW ZprssuBdxzAV7YlIGht12q7WNR9R+D09en8yW3I+hFP5KMzLC52CM3f0v33GC3MXNQFJ 1hEusitRyW2xSq5ercazkHsGwRIZOtFTccQ/adglOflwvVyR81kVT7ce1WgKxsThodf8 1OkBMeT4ZXgwsfj0jc49FS8Iknh34VxFC+FTdJUvZlbVeZ0wyRq5zNv8bfTV3xjLCODH ohBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uKQnx0cR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si29665232pgv.577.2019.07.29.12.45.28; Mon, 29 Jul 2019 12:45:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uKQnx0cR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389768AbfG2ToS (ORCPT + 99 others); Mon, 29 Jul 2019 15:44:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:60946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389330AbfG2ToM (ORCPT ); Mon, 29 Jul 2019 15:44:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D030205F4; Mon, 29 Jul 2019 19:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429451; bh=Jb5//ygbKyXJ/q7wmeUpiah/CscHFECierkUDcF46nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uKQnx0cRij/fP/oaUclzM2iBL9BqfICS+bstNF5J9Qc6gyyxjqr5/u3+gKgp8GVlH zFx7YFlNvqS/TGpVp05Fy6i3r1Yvp6Rc22DUOZ+Cj1IVHIFN2YB7673e5hb0COswnk Evp261Sj8O4oqTB5tPWB6JIUmYMQET7mNJnRVB8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 075/113] powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h Date: Mon, 29 Jul 2019 21:22:42 +0200 Message-Id: <20190729190713.461109334@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 9e005b761e7ad153dcf40a6cba1d681fe0830ac6 ] The next commit will make the way of passing CONFIG options more robust. Unfortunately, it would uncover another hidden issue; without this commit, skiroot_defconfig would be broken like this: | WRAP arch/powerpc/boot/zImage.pseries | arch/powerpc/boot/wrapper.a(decompress.o): In function `bcj_powerpc.isra.10': | decompress.c:(.text+0x720): undefined reference to `get_unaligned_be32' | decompress.c:(.text+0x7a8): undefined reference to `put_unaligned_be32' | make[1]: *** [arch/powerpc/boot/Makefile;383: arch/powerpc/boot/zImage.pseries] Error 1 | make: *** [arch/powerpc/Makefile;295: zImage] Error 2 skiroot_defconfig is the only defconfig that enables CONFIG_KERNEL_XZ for ppc, which has never been correctly built before. I figured out the root cause in lib/decompress_unxz.c: | #ifdef CONFIG_PPC | # define XZ_DEC_POWERPC | #endif CONFIG_PPC is undefined here in the ppc bootwrapper because autoconf.h is not included except by arch/powerpc/boot/serial.c XZ_DEC_POWERPC is not defined, therefore, bcj_powerpc() is not compiled for the bootwrapper. With the next commit passing CONFIG_PPC correctly, we would realize that {get,put}_unaligned_be32 was missing. Unlike the other decompressors, the ppc bootwrapper duplicates all the necessary helpers in arch/powerpc/boot/. The other architectures define __KERNEL__ and pull in helpers for building the decompressors. If ppc bootwrapper had defined __KERNEL__, lib/xz/xz_private.h would have included : | #ifdef __KERNEL__ | # include | # include | # include However, doing so would cause tons of definition conflicts since the bootwrapper has duplicated everything. I just added copies of {get,put}_unaligned_be32, following the bootwrapper coding convention. Signed-off-by: Masahiro Yamada Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20190705100144.28785-1-yamada.masahiro@socionext.com Signed-off-by: Sasha Levin --- arch/powerpc/boot/xz_config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/powerpc/boot/xz_config.h b/arch/powerpc/boot/xz_config.h index e22e5b3770dd..ebfadd39e192 100644 --- a/arch/powerpc/boot/xz_config.h +++ b/arch/powerpc/boot/xz_config.h @@ -20,10 +20,30 @@ static inline uint32_t swab32p(void *p) #ifdef __LITTLE_ENDIAN__ #define get_le32(p) (*((uint32_t *) (p))) +#define cpu_to_be32(x) swab32(x) +static inline u32 be32_to_cpup(const u32 *p) +{ + return swab32p((u32 *)p); +} #else #define get_le32(p) swab32p(p) +#define cpu_to_be32(x) (x) +static inline u32 be32_to_cpup(const u32 *p) +{ + return *p; +} #endif +static inline uint32_t get_unaligned_be32(const void *p) +{ + return be32_to_cpup(p); +} + +static inline void put_unaligned_be32(u32 val, void *p) +{ + *((u32 *)p) = cpu_to_be32(val); +} + #define memeq(a, b, size) (memcmp(a, b, size) == 0) #define memzero(buf, size) memset(buf, 0, size) -- 2.20.1