Received: by 10.223.185.116 with SMTP id b49csp5439415wrg; Wed, 7 Mar 2018 11:46:34 -0800 (PST) X-Google-Smtp-Source: AG47ELs4NZeIxfJEg+FezHajG1h5YfKCDWjPwI9wKX6WCT2EJ4wZUoo+cjjAxYcNsCwgGwbOgj8R X-Received: by 2002:a17:902:2904:: with SMTP id g4-v6mr21172828plb.170.1520451994234; Wed, 07 Mar 2018 11:46:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520451994; cv=none; d=google.com; s=arc-20160816; b=qQkfm+wtGcBBEC5KT2T9AMTpIL5jDrU2yePmBkgxcQnEraLECa6KThohPCFEAMLWJH RPxCzEyKnaDJNAfHdhEstTTi2+2QIOwdjHuIqRlMcySHi/anUrShfgjDQkESTWJg0sZN gQooElzKMviQZcPJTriTWIbLr3VJCRlqtNRRUK/h/4JZ98DtMptOIv57gnIDepRH7YDn pI7lCCQcYhiytBgTboUi/e3x4td/deRWw1MS2+0e9OuSGmi/nMgeeA0+U+6cKgHJOiq8 ZEalVl6JfKAOvBsfbA85KO1xEA0pQGZGYY86Zdmj7n84a3vnYohtxeZ3ctMUihITLoMr 9G9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aNRTCt++iVK0G5ybRdp6ssn41MsElMNx5j7ehMAWDuw=; b=ENiGTpqNDUzv8wse87c9UwBuob7i42KR9N5HAq/bjfpWK2bRMyHlsMdjMSkuzPjblb CMG3bH92xpoJYdq0Sp6YB20l2cSVuOA7pUrzVxXkfHfYfO0bUw4ndozysp+CkPTjFIj2 2gLAtAm+9UH0Drk13NjZppLEOjdyAV7CeMKEY/3SVgULoFKKUEtZfOytEQzvy1VAdOSO Y5GhjefhCPMWkhCc4k037yACcInM2pX7VLFkifEC/KKrhqxDERgap3FU7WHNqWzuXvyY UlXxynY0i6tP4UbBjlP6S8X0dh/8OgLK4wCEJBqbHKthoJSoqh7UyBHl/bMiDqvuX2PN rfFQ== ARC-Authentication-Results: i=1; mx.google.com; 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 u128si11808474pgc.587.2018.03.07.11.46.18; Wed, 07 Mar 2018 11:46:34 -0800 (PST) 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; 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 S965061AbeCGToM (ORCPT + 99 others); Wed, 7 Mar 2018 14:44:12 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43636 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935003AbeCGToK (ORCPT ); Wed, 7 Mar 2018 14:44:10 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D4CE931; Wed, 7 Mar 2018 19:44:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Christoffer Dall Subject: [PATCH 4.15 110/122] ARM: kvm: fix building with gcc-8 Date: Wed, 7 Mar 2018 11:38:42 -0800 Message-Id: <20180307191745.542317710@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 67870eb1204223598ea6d8a4467b482e9f5875b5 upstream. In banked-sr.c, we use a top-level '__asm__(".arch_extension virt")' statement to allow compilation of a multi-CPU kernel for ARMv6 and older ARMv7-A that don't normally support access to the banked registers. This is considered to be a programming error by the gcc developers and will no longer work in gcc-8, where we now get a build error: /tmp/cc4Qy7GR.s:34: Error: Banked registers are not available with this architecture. -- `mrs r3,SP_usr' /tmp/cc4Qy7GR.s:41: Error: Banked registers are not available with this architecture. -- `mrs r3,ELR_hyp' /tmp/cc4Qy7GR.s:55: Error: Banked registers are not available with this architecture. -- `mrs r3,SP_svc' /tmp/cc4Qy7GR.s:62: Error: Banked registers are not available with this architecture. -- `mrs r3,LR_svc' /tmp/cc4Qy7GR.s:69: Error: Banked registers are not available with this architecture. -- `mrs r3,SPSR_svc' /tmp/cc4Qy7GR.s:76: Error: Banked registers are not available with this architecture. -- `mrs r3,SP_abt' Passign the '-march-armv7ve' flag to gcc works, and is ok here, because we know the functions won't ever be called on pre-ARMv7VE machines. Unfortunately, older compiler versions (4.8 and earlier) do not understand that flag, so we still need to keep the asm around. Backporting to stable kernels (4.6+) is needed to allow those to be built with future compilers as well. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84129 Fixes: 33280b4cd1dc ("ARM: KVM: Add banked registers save/restore") Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann Signed-off-by: Christoffer Dall Signed-off-by: Greg Kroah-Hartman --- arch/arm/kvm/hyp/Makefile | 5 +++++ arch/arm/kvm/hyp/banked-sr.c | 4 ++++ 2 files changed, 9 insertions(+) --- a/arch/arm/kvm/hyp/Makefile +++ b/arch/arm/kvm/hyp/Makefile @@ -7,6 +7,8 @@ ccflags-y += -fno-stack-protector -DDISA KVM=../../../../virt/kvm +CFLAGS_ARMV7VE :=$(call cc-option, -march=armv7ve) + obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v2-sr.o obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v3-sr.o obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/timer-sr.o @@ -15,7 +17,10 @@ obj-$(CONFIG_KVM_ARM_HOST) += tlb.o obj-$(CONFIG_KVM_ARM_HOST) += cp15-sr.o obj-$(CONFIG_KVM_ARM_HOST) += vfp.o obj-$(CONFIG_KVM_ARM_HOST) += banked-sr.o +CFLAGS_banked-sr.o += $(CFLAGS_ARMV7VE) + obj-$(CONFIG_KVM_ARM_HOST) += entry.o obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o obj-$(CONFIG_KVM_ARM_HOST) += switch.o +CFLAGS_switch.o += $(CFLAGS_ARMV7VE) obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o --- a/arch/arm/kvm/hyp/banked-sr.c +++ b/arch/arm/kvm/hyp/banked-sr.c @@ -20,6 +20,10 @@ #include +/* + * gcc before 4.9 doesn't understand -march=armv7ve, so we have to + * trick the assembler. + */ __asm__(".arch_extension virt"); void __hyp_text __banked_save_state(struct kvm_cpu_context *ctxt)