From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAC74C83004 for ; Wed, 29 Apr 2020 21:09:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CFD42137B for ; Wed, 29 Apr 2020 21:09:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="k3xBQeD8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xRvJ7kD4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CFD42137B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qmlKxAx0jOE4WNCi854HRZ6nRMGxOCNIVHnxAnbzYbQ=; b=k3xBQeD8n9Irxn dgcsKYNnZCEA7rziSWyvfBgpqVpDf8LMOUjcG7LuV8UejYjy92uZ0v7dbgVFAH+ZYXC3HJ1RmGbVe 48oFTj8Em3PR/4wR0FC4mu/8P8vEp+8CILbJ3IoEobzCst8wMWl8YY6W7XsdcZELMvaEbVBUk3UpO rsTDkRPku4z4+utRq5Cc58VlzWmusOxYJY5QsAHJW7aY5ZswXmrTgyBdoo7+fZjKR7fp8WcfF9jRr Huy6mdhpnt+WxISgsAUEmA0MaIlQjwb8ulUYNnT4LFy2FpuPVYbUbeXyqzIl+19Oca7e70e16lQpt 92PxLfYlKFfjf9RdbAWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTtxQ-0007dR-4N; Wed, 29 Apr 2020 21:09:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTtxM-0007ci-Nn for linux-arm-kernel@lists.infradead.org; Wed, 29 Apr 2020 21:09:26 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 14E65206F0; Wed, 29 Apr 2020 21:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588194564; bh=9usa5vqarbwkjusCiHaWM/qcbLoAS67d0O3WtQaWisU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xRvJ7kD4gYKl03I0KQFDTWgldsiBWbDFW3D3RecjNLi0Qs90Q9/Wks7p+ZAOIPMch GSTgqUGRqxkvQAfdo2J5zgGtbeSfFs/ZXoKj45ESezozEqQxKfWwzqmHlOfG3qzRlt uAMexcfFYSbEN5LP1eTk4lMWc4JHj6gTJONvfPMs= Date: Wed, 29 Apr 2020 22:09:17 +0100 From: Will Deacon To: Arnd Bergmann Subject: Re: [PATCH] arm64: kvm: fix gcc-10 shift warning Message-ID: <20200429210916.GB8604@willie-the-truck> References: <20200429185657.4085975-1-arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200429185657.4085975-1-arnd@arndb.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200429_140924_813853_70316EE4 X-CRM114-Status: GOOD ( 18.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , Geert Uytterhoeven , Catalin Marinas , Paul Mackerras , kvmarm@lists.cs.columbia.edu, Jonas Bonn , Stephen Rothwell , Brian Cain , Marc Zyngier , Russell King , Ley Foon Tan , Mike Rapoport , Benjamin Herrenschmidt , Julien Thierry , Fenghua Yu , Suzuki K Poulose , Stefan Kristiansson , Stafford Horne , Guan Xuetao , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Tony Luck , Yoshinori Sato , linux-kernel@vger.kernel.org, James Morse , Michael Ellerman , Paolo Bonzini , Andrew Morton Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 29, 2020 at 08:56:20PM +0200, Arnd Bergmann wrote: > gcc-10 warns that the 32-bit zero cannot be shifted more than > 32 bits to the right: > > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c: In function 'clear_hyp_p4d_entry': > arch/arm64/include/asm/pgtable.h:630:35: error: right shift count >= width of type [-Werror=shift-count-overflow] > 630 | #define pud_index(addr) (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) > | ^~ > arch/arm64/include/asm/memory.h:271:45: note: in definition of macro '__phys_to_virt' > 271 | #define __phys_to_virt(x) ((unsigned long)((x) - physvirt_offset)) > | ^ > arch/arm64/include/asm/pgtable.h:633:42: note: in expansion of macro '__va' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~ > arch/arm64/include/asm/pgtable.h:632:73: note: in expansion of macro 'pud_index' > 632 | #define pud_offset_phys(dir, addr) (p4d_page_paddr(READ_ONCE(*(dir))) + pud_index(addr) * sizeof(pud_t)) > | ^~~~~~~~~ > arch/arm64/include/asm/pgtable.h:633:47: note: in expansion of macro 'pud_offset_phys' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~~~~~~~~~~~~ > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c:510:36: note: in expansion of macro 'pud_offset' > 510 | pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > | ^~~~~~~~~~ > > This is harmless, and the warning is a little bit silly for > a zero constant, but it's trivial to fix by making it an > unsigned long, so do that. > > Fixes: 22998131ab33 ("arm64: add support for folded p4d page tables") > Signed-off-by: Arnd Bergmann > --- > virt/kvm/arm/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 48d4288c5f1b..534d9798c3cb 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -507,7 +507,7 @@ static void clear_hyp_pgd_entry(pgd_t *pgd) > > static void clear_hyp_p4d_entry(p4d_t *p4d) > { > - pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > + pud_t *pud_table __maybe_unused = pud_offset(p4d, 0UL); > VM_BUG_ON(p4d_huge(*p4d)); > p4d_clear(p4d); > pud_free(NULL, pud_table); > -- > 2.26.0 Acked-by: Will Deacon Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel