Received: by 10.223.185.111 with SMTP id b44csp912513wrg; Fri, 9 Mar 2018 16:41:14 -0800 (PST) X-Google-Smtp-Source: AG47ELu1JnGKgSNI8jiAnO5JIHcelazTrJQatmioxPDcxVizbTEEBmbmAdaMimE3EbqWkAfjdppU X-Received: by 2002:a17:902:710f:: with SMTP id a15-v6mr352933pll.87.1520642474604; Fri, 09 Mar 2018 16:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642474; cv=none; d=google.com; s=arc-20160816; b=SWhRSr+s8ylRh79wPL4sFnNnTqlrcLyfjMJEIZPqY9MMwdW1O0Dl8WapX+bBk8gS9E GTUmxIS4ksBUvs/KXRYizTVORmbpR1xklKwZQaszeLYF1TfuT4x7jURqd1N90837X2gy JnmcWRm6sF4CFgJUqg0OcgR3gpihNUjTuf3uUVu2w6IPIEfMOR9OH3rxeg4Y8pqZLeZ4 fWWwug/S1AkqbcrEUwL0eLXRzRun8LdScXQSbRF2vYJievrWL2gAbMy7NBCIZD7+aDh3 gVygd3Us1ftE1NoM0WJ7xFGAjOfFfPPAMwqWD9dKQZ4dLLKkqr/eEJcovtN9KaIDKdXR OPYQ== 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=oqTS2s6PCDk8FpeqKIm7WjVx5ndpnupPjxqY8nRo7Fk=; b=ZOTNycbR2SlgnUTZ5rswjVNlBH6UoEpbL51wKFZTO5s4Bk3I+wUnAM9mXhZC+WhsLu u8pdLRfleKIpqRep9FzkN5r7Sm5S42wFSm4oZahPcVt251VXmocyUrwUouZFeAUy+KPb qjgJcfdyOYovhdH32yND/2vR9X1Wp9WkmGoQk+M/Z/8WwDaFs0wDj1VusAaVTx9Mjsby G9g6FeIxM0jA/sP9TwpFdMbXMTL6YtaYfQAxGyD73xcRSzL1UayTs7Zwq2D3rsFHVPbQ AHKPZBIMZFdwsXbXfRJnZ9JKcVKn+Ja3Xxzngo737+d7jtW5ZvURQkFato9UMCOTqrvq 2ozg== 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 u82si1744093pfg.389.2018.03.09.16.41.00; Fri, 09 Mar 2018 16:41:14 -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 S1751946AbeCJAkI (ORCPT + 99 others); Fri, 9 Mar 2018 19:40:08 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39518 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933653AbeCJAVX (ORCPT ); Fri, 9 Mar 2018 19:21:23 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9CC99FDE; Sat, 10 Mar 2018 00:21:22 +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.9 20/65] ARM: kvm: fix building with gcc-8 Date: Fri, 9 Mar 2018 16:18:20 -0800 Message-Id: <20180310001826.586782429@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001824.927996722@linuxfoundation.org> References: <20180310001824.927996722@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.9-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 @@ -6,6 +6,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 @@ -14,7 +16,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)