Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2517457ybe; Thu, 12 Sep 2019 10:33:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3WunnjZ1Uty+Yjdibeus4rvM0OTYdCEyxwnXxppJmCe6i3BqPeBq6j1l09ZuWbiu+V/KX X-Received: by 2002:a17:906:fd1:: with SMTP id c17mr475199ejk.45.1568309638524; Thu, 12 Sep 2019 10:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568309638; cv=none; d=google.com; s=arc-20160816; b=YLbujdDesJDSF4A3IgUi1eLXaStjACzYyM1OBgigrDdEFCKmlnN5i5yldC0m3oV+f0 Ijs4PQxjd5oiCB2QhcEJLc/QRVvOl/u85BHrldcr6ASPZcKqcneN/c4DAylh6mJJKCpa SF2/SUR0tnZbnZP+QdPDCrzc8JNn3vbpCBRUp3QYrp45jquld6arG8F0Y+eNfuNrTfMi rkH/dDqqWUfnGnw6GURELyWLZIt3G1aq0PZWcV4GckGGZXAusXS4pxPQh15v+6WsPXNz spZmGMKeGMx3ht01m93zMTQGNcTwJK9RlTV7Fzty6KI5LrujvSAdG9GC6tCzDpEoNr6H 7ioQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:content-transfer-encoding :mime-version:subject:from:references:in-reply-to:message-id :dkim-signature; bh=tIuj7A2g/wU/lfgUsNki9hmYUsxY/tQJgq5pQBOkNp4=; b=sjS6zrQ0PkjIEHjrVZj5SgC5zCPbeHdosxMmUADGHtdixrS4kUmG/qT2I0ufyYN+HX dHX5QSQHYpjEs8RR5Lhd3UBQkUzSKQ6fcOUGzTVMcbmBUXv4h5TW9IGDnIeABdBlVvJO g5xC5g9YwZtcy6K/gXaQ1BaaWcx7pYUTVpCgdL7bjfHrmBC6az1XuUeyOdyOzvGnMIRW prFaUQDwVWMtpvtOqFDXertMevXbcQkHnISsMVujxt3g9DL1NraeIMiv8qkilA/tJmX2 COhGaOwJ6PldIl0gS8/R+5Jbwdqu7hBbap4vLiI2EJstxWO0WwvXNsjjh/pXJSLSpjsx 8o3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=gTfQ67k1; 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 f17si17934946eda.232.2019.09.12.10.33.33; Thu, 12 Sep 2019 10:33:58 -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=@c-s.fr header.s=mail header.b=gTfQ67k1; 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 S1732175AbfILNtu (ORCPT + 99 others); Thu, 12 Sep 2019 09:49:50 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:51845 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731420AbfILNto (ORCPT ); Thu, 12 Sep 2019 09:49:44 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46Tg9x2GMQz9tyn6; Thu, 12 Sep 2019 15:49:41 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=gTfQ67k1; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id S3aS4dXQEy-S; Thu, 12 Sep 2019 15:49:41 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 46Tg9x19tsz9tyn0; Thu, 12 Sep 2019 15:49:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1568296181; bh=tIuj7A2g/wU/lfgUsNki9hmYUsxY/tQJgq5pQBOkNp4=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=gTfQ67k1tf2KkSnDykBo5FX6Li0ChIVjzDG+72kVlnhGaywvk70KYgV4g1zYVXtX3 p5y7lqaPAYlQVhoo7fdOfj8B8MafL7Zci3rcugkwcvB0XL78Ln9v5bvs05MgRkhH/V JF1VBxY7YcG49WMAeglOIKpU434k0wKrIuii+s2g= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B11AE8B933; Thu, 12 Sep 2019 15:49:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id xXQnglXC8Qh4; Thu, 12 Sep 2019 15:49:42 +0200 (CEST) Received: from pc16032vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6D7228B93C; Thu, 12 Sep 2019 15:49:42 +0200 (CEST) Received: by pc16032vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 4F0CC6B736; Thu, 12 Sep 2019 13:49:42 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 2/4] powerpc/fixmap: Use __fix_to_virt() instead of fix_to_virt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , npiggin@gmail.com, hch@infradead.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 12 Sep 2019 13:49:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Modify back __set_fixmap() to using __fix_to_virt() instead of fix_to_virt() otherwise the following happens because it seems GCC doesn't see idx as a builtin const. CC mm/early_ioremap.o In file included from ./include/linux/kernel.h:11:0, from mm/early_ioremap.c:11: In function ‘fix_to_virt’, inlined from ‘__set_fixmap’ at ./arch/powerpc/include/asm/fixmap.h:87:2, inlined from ‘__early_ioremap’ at mm/early_ioremap.c:156:4: ./include/linux/compiler.h:350:38: error: call to ‘__compiletime_assert_32’ declared with attribute error: BUILD_BUG_ON failed: idx >= __end_of_fixed_addresses _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ ./include/linux/compiler.h:331:4: note: in definition of macro ‘__compiletime_assert’ prefix ## suffix(); \ ^ ./include/linux/compiler.h:350:2: note: in expansion of macro ‘_compiletime_assert’ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ ./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ ./include/asm-generic/fixmap.h:32:2: note: in expansion of macro ‘BUILD_BUG_ON’ BUILD_BUG_ON(idx >= __end_of_fixed_addresses); ^ Signed-off-by: Christophe Leroy Fixes: 4cfac2f9c7f1 ("powerpc/mm: Simplify __set_fixmap()") --- arch/powerpc/include/asm/fixmap.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h index 0cfc365d814b..722289a1d000 100644 --- a/arch/powerpc/include/asm/fixmap.h +++ b/arch/powerpc/include/asm/fixmap.h @@ -77,7 +77,12 @@ enum fixed_addresses { static inline void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) { - map_kernel_page(fix_to_virt(idx), phys, flags); + if (__builtin_constant_p(idx)) + BUILD_BUG_ON(idx >= __end_of_fixed_addresses); + else if (WARN_ON(idx >= __end_of_fixed_addresses)) + return; + + map_kernel_page(__fix_to_virt(idx), phys, flags); } #endif /* !__ASSEMBLY__ */ -- 2.13.3