Received: by 10.223.176.5 with SMTP id f5csp852444wra; Fri, 2 Feb 2018 07:10:38 -0800 (PST) X-Google-Smtp-Source: AH8x224R1KgqNlkSQ5MhMG8aiI8Fnvfrggf2rSYXnqY2QZf1gnChUulP/F2yqqwWnNVXqolRuaq9 X-Received: by 10.99.181.4 with SMTP id y4mr2568674pge.344.1517584238354; Fri, 02 Feb 2018 07:10:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517584238; cv=none; d=google.com; s=arc-20160816; b=VmP1M47Rm+h0IJoT6RP5DH4w6QmCjRZymgc6S6yt/x2XODQXgxxGCfC27JV7xIq/et nx8VvGC0UWwZz/jZ59mEVbm/cTzY/nuZmE27YF8YtX9BUpgGKVy0O0kwklX7F0HqbSw9 GyPwJwkpqClDDnCiEsDRAJAXYFqTaSouDr8+GrGD1GS7aKxLooy+2Xar1EnVwG6x7XE0 BdwFV6XhqBxtDG+n7mCOTxJp7/iE3olfPsxyNgCMflwlmwzUF3ZLljsR67MH6SwZxqs6 XQerN/JoupFiRatZBFeLr4euij2gHchBumKzSrZ8O6dUED8uIBNmXQrsjp0UZQSpnk1U YTZg== 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=LgvGHubegwXIuaKR+/hznTfZPDKmKA9QdMErNDxbYxa1WuZ1wIAQvTup2XpEKeVLcr hNlq5cCMo72bNOTQZGOLPdGJVruDuovd3ekF6XOyv44Lnxo+6K/PY7tZ7iYcG+i3suWy 8BBQilM6kB73fCCbJicTgm7lYtgklMOlFlT4wnpMoD4gLvCwo+17+aNrfBlpadmtyzkU IlKSOCNfB/COcMTkvoccqsm4HIqU2S2fQ+ZZUcNro0s6V+HHkMT/iT0EZ4NDiAnjbVCh vvFHy3ZV76DEdaDtlPetj5eK4EdRdhfpiYKuxZ4Rg8f7HU1H7ROl1ehaUzCqNWsGSw7w rigA== 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 k9-v6si1939985pll.578.2018.02.02.07.10.23; Fri, 02 Feb 2018 07:10:38 -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 S1752380AbeBBPIl (ORCPT + 99 others); Fri, 2 Feb 2018 10:08:41 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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) -- 2.9.0