From patchwork Fri Feb 2 15:07:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 126727 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp726250ljc; Fri, 2 Feb 2018 07:08:38 -0800 (PST) X-Google-Smtp-Source: AH8x225Ib9+Oy0o9MLxRGFjMdxz9NPxf9Sy0FpulltdI0Dcti/ZCb213TCwKePuP+jS+BBuSKYK+ X-Received: by 2002:a17:902:402:: with SMTP id 2-v6mr32845547ple.353.1517584118210; Fri, 02 Feb 2018 07:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517584118; cv=none; d=google.com; s=arc-20160816; b=kaSI/T+Ew5AdE9sTisM8EYnl15FxGblBU/+1XjQ0S9IqrJcnKf0xuJUZVSwLZrtlZR UYMBngDOSpJBudLaYvQTcEC9RMWiCAWNpHN8mwGHLCk2B1UWGLxABZwSSBH17HumHupx gQJisbHVo39pAyw4V7x0brwPdEv6QzsYivbZVpj5ezKZp0/hjArMR4VBjOcIeI0DUscC qyM2mqRSI04bV8XCyDGH03Yp7OuTQvsDlp3KoP/GiST1uQ6u0rPz4BbTCKckK9w2McU1 HabGvYhrSFfP2i4+KfL1yWLAj7mKrkYITabE+I11Ce22B2yOHa5GAW6lbzwMPLXnjE4Y +kHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lhEDRQzORAjpcpPMO1ZA9uyYJf1mZbt+2dgjBYa2ypk=; b=gU1954J2Q6WmMrPQlCLfrIoChbQvrQYyf8DRdqzEX+GoAdBNx0RkGaX2hMTxDZte5Y 9688uzeg8R3kl7z4yh7aXzcGTAZeUG6kfmaueph9TLySl+xRcme2wnVxVRFa7a52ltBI dKasu60OSs+T9FKXRwAkRzPYJOSawWhF2KzTzaX9KphKR+EVY0PNR7wQ9Hv1WKEhKZec R30sfubZhkUNGLUNqte/+Xk4GuuFsXysVFAqcSNJ5qLDMYEzASa3aFnvaYTkRX993Aal sV4ldPnffdHDvwRKru1ElQYxaLxmX4GToG1TiXz7fg3SY7X3vUZa+70CECkC9paxsHIG /NVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 17si1991889pfw.21.2018.02.02.07.08.37; Fri, 02 Feb 2018 07:08:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751707AbeBBPIh (ORCPT + 10 others); Fri, 2 Feb 2018 10:08:37 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:60954 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbeBBPIg (ORCPT ); Fri, 2 Feb 2018 10:08:36 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0M5xcn-1exLPW2gLh-00xpzm; Fri, 02 Feb 2018 16:08:03 +0100 From: Arnd Bergmann To: Christoffer Dall , Marc Zyngier , Russell King Cc: Nicolas Pitre , Andi Kleen , Richard Earnshaw , Tamar Christina , Arnd Bergmann , stable@vger.kernel.org, Julien Thierry , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ARM: kvm: fix building with gcc-8 Date: Fri, 2 Feb 2018 16:07:34 +0100 Message-Id: <20180202150756.420422-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:o/lYdJ8CK5Cdort1B65GHmoSABFadVtvLpeBaWFOXYpGGZduw0U m3w0mlD7RgxnezE/HTE0dRPeYFrKHktJ07GuRaPhouISKHyw8Y+DO+3LyM+MoBLF3Q262ys CPobY1+gNnC6EgcdAN6K2uZLp0K7GDbEr7ZscXEkIwONoxlZ0Ms6vuYRYt0lqBdIGXZCAhS vhPsPlD9ZCKT6CGLmQP1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:nVwlNOozFt8=:hbp/wV5Nc+uHQzRoTPdvLR OLakWvyJUYCKegRDPhsv8t98X/hbAqMUGtG5dwLpjskxoD5muTjUIlgMtvrznjSJn0VR4e18g TXPc7G6fxodbS2g8P52rHwc8WL3S5VHWc8Vf6MAbsUiwECuO0uqqH3+Whcn84IijoEG41JmOe 0q87bqlvjY15sKzx83egn+dUMv3c0HjKyA/EADkdbcqj1oRM+ffp+o42yak05dA1D3BCgriL6 0a/UC45FUdxj15Y4ycIA69TxgDbWulLiDvw+4GakmbPDcQ04TRggBD9N9ZCyzwVJfYDxi0f6Y qS7SRIvLcWuTziWwYPf/0sL1qNnh50VAcZu8ZENkKD13fCAgy5YFCK6DIREcjkcHGFMRcbCmZ 82Li05J2XI9Bi73raDXJVsqiZBLx6Do6ZK28/5p5OzMsEbFbCe54Ipu+nMqpFUgriYIxJxK2s c946XDyCU7W1XmjIrQjcJ+jv9x6vN7Wa3gVsvfj3Q2v12mfzBg5U+9ufacN2U/K6iEviq24zu 3VVKhyKil/Fd85/6b9urVLahTs+/kq9P/UYFYIOsMSgd7VbnsIcQ0u4AhXPF06qvAzmHh92IB GMzcofJljEdZ2+Eg6jrQNJeMhQQlv/xqYEV8gmL3gVbA/1I80b17GU4bTAR/s5GKS/7cCbN+Z iuYzcf1bPi64sXZ0rBuwFP8MTudo1729EqmQKQVoxj9aixe3/y+zhPWSwr5N//RihezjTwkQ5 0bZhJ6hBs/O3Iy/ywIPOa/LkENpM/rcqruu69A== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 --- arch/arm/kvm/hyp/Makefile | 5 +++++ arch/arm/kvm/hyp/banked-sr.c | 4 ++++ 2 files changed, 9 insertions(+) -- 2.9.0 Acked-by: Christoffer Dall diff --git a/arch/arm/kvm/hyp/Makefile b/arch/arm/kvm/hyp/Makefile index 5638ce0c9524..63d6b404d88e 100644 --- a/arch/arm/kvm/hyp/Makefile +++ b/arch/arm/kvm/hyp/Makefile @@ -7,6 +7,8 @@ ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING 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 diff --git a/arch/arm/kvm/hyp/banked-sr.c b/arch/arm/kvm/hyp/banked-sr.c index 111bda8cdebd..be4b8b0a40ad 100644 --- 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)