Received: by 10.223.185.116 with SMTP id b49csp5442563wrg; Wed, 7 Mar 2018 11:50:18 -0800 (PST) X-Google-Smtp-Source: AG47ELtk5pW0+4fBEpbnLzfv4c6BqdsmTN3L1j/escS7EhhjYd6TUxqEMqo5/PupRWHqL/DvTMmz X-Received: by 10.98.58.129 with SMTP id v1mr23706006pfj.203.1520452218053; Wed, 07 Mar 2018 11:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520452218; cv=none; d=google.com; s=arc-20160816; b=tcAcx638pVrLobyCubdatrHY+AFji//mneSHrik+KyQbeH2Nkz/ZH/09dRfRRzSptq mFlS8kAfKX9nyOfWxyU9DTDybPE8dO8+6eaGC2a1ck/ZJonJGoGMjDvBszd58TmaKFcE CcmH6E8lMxz7emT9DMpiiobGlFIr0SApkhBJLK5EVdpMA1OWMZFPq2LBMsY/kmC3BTur Y/pPSrQZ69DDyaoAIAI3VvjWOaMSWxiitu7oCAaEeW5hbYLbfBEIc+L66DN+HWNxWdKw 6ZlsvHsfJL/VfpE/y7u1eNUOUYQPHeY7gU4J0h2R6+Ntx0NCFnoE9JW7fTS73+HmAAQF Lbjg== 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=dEFlMm1xB/uMZZyDlqyEGztfIQXebBF61TkOS022MKY=; b=KJWqNfGQ7YV3JSgtNWhyRPUpUplTv7MiR33AxUyZfirtI/xvqeBC2WUDGZlW/YLRIY 6D0ahMAYxf+haoKSpR9TP4aaPn3XuP84cBxXkTgh0+0ctZB3aHEmKfXQCiqC29C2lVxY ZR41F2UVzPRWE8T5ll+aVTjdzWDWU4Yy571w3Qe4H6cB5a8T9AG5N6LHiL0Vamw3HosS faztk3a1OM+rIzmFTxypQj0xm0+J+0mEGuzR0t2H2h3lTZuX34KXY7bGKOLBRuwMp0sZ 5jVs/ZshqafaA+IaWn9a3hY6W8zuOuyW1rUwfdVT4hlN6WKYLhwQMrjZuX/FmsbXEYgO Y1tA== 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 e5-v6si13378910plb.566.2018.03.07.11.50.03; Wed, 07 Mar 2018 11:50:18 -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 S965969AbeCGTsg (ORCPT + 99 others); Wed, 7 Mar 2018 14:48:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45594 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965954AbeCGTs2 (ORCPT ); Wed, 7 Mar 2018 14:48:28 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 98006CAA; Wed, 7 Mar 2018 19:48:27 +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.14 095/110] ARM: kvm: fix building with gcc-8 Date: Wed, 7 Mar 2018 11:39:18 -0800 Message-Id: <20180307191052.008235354@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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.14-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)