From patchwork Fri Feb 23 18:00:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10238469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0EAAA602DC for ; Fri, 23 Feb 2018 18:02:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB5E0297B6 for ; Fri, 23 Feb 2018 18:02:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE423297C2; Fri, 23 Feb 2018 18:02:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6AD59297B6 for ; Fri, 23 Feb 2018 18:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Vp2O75LrxJiQO8Pb+XDbrpx3VLblwR+FDr9o57JyUZk=; b=rQEbdjnHRdv2JsnkqPL88LwKuh bHLrU4YLS2UyGJotT2L1WSAwW0o1JQFPk/h/Uf/BszMtikKEBjE1W1Po0xGT+mK6VIxqGzLne4BoW o6X4LShZEs+Sdw0xCGf4kF1sr+j/0KUlUEJ8AiTzxxCOd3/fkUQ+5xGRmXRl56j7JjIB11BEZcG/m 4RysPMxmYk226XyDDinwtfUqu5UbLXaktRKbDPyZ+kxWkoogoxRhRwL0lKp1lBPSUL0Rxq5HNjEMX xO0KU0hURW+kMGuJGT67CbRpzItGLBSC956pMtZhM4cZKu341Who/Y7lhlVhaYXEoCDCe69eWlEwj yBZ4Kdhg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1epHfX-0008Q6-SF; Fri, 23 Feb 2018 18:02:03 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1epHeG-0007kr-Uk for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2018 18:00:47 +0000 Received: by mail-wm0-x244.google.com with SMTP id t74so6228025wme.3 for ; Fri, 23 Feb 2018 10:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Kfkw9ZD5tds9lSp3Uv/bmpxaRTm1nJeVdaEjobuazYU=; b=Q/Trp0qMmJm2+BCII2Ka6t+7ioQUy/7UWSto6RH1bE9iY3hcvS8zru3Yy71kMNfvU8 qwbbAkoXtrHy/AbzMESPYPXnawCP0Sgy3FzIF6NUZ/wG7o+mkgoQGFBZMd+nrR4jdzCC gGb2P0T5qZRyPTf00sEgJO3g6wginllOt3RVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Kfkw9ZD5tds9lSp3Uv/bmpxaRTm1nJeVdaEjobuazYU=; b=suyGnk0j9bLMtCyQxRsbwYOa7278YgG/SzgACS6dipgjkHA1uTvdwtnuOuADPUx+1Z Biuzr0lzAGD1u6nNfrcETABJXZmk15pRHwN2Ow6qm10Hl2tBLNvLILIKFvVMTovGPFqm 54ye97j2PIbXMY9BEDOGQL8qxsrpYGs4BLpuc/PaXD1Wu5iQ3iHfck2UnftncKPRKlJA gmN7DB86Oh74+qB39Pe5sli5RIPKIwIL07WUWdQOGFCFsmIZBR0UFhLJirBr+W/gwv9J uXKN9DAxxqzyQN/a45UM0JDww4pAZk6d2W/OYPlsxsec0CUNw52k00eyveLK0OisZQF3 oO5A== X-Gm-Message-State: APf1xPA4q3iYgv/SA0p/Fxx3AEUVwzKgFadQmeruaYyuuYOVZQT16Z6W aZl9QuDx8eP1R+4s6jg0HfRyrg== X-Google-Smtp-Source: AH8x224Rp43r0OxltUaU6GyN5Sl/iHYawBFQ5Ta/cGYaCXRpY/ZQyIkoqInh13YPyHabRZXEEPxF0Q== X-Received: by 10.80.169.230 with SMTP id n93mr3837968edc.202.1519408833068; Fri, 23 Feb 2018 10:00:33 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id 6sm2198349edl.87.2018.02.23.10.00.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Feb 2018 10:00:32 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 2/2] ARM: kvm: fix building with gcc-8 Date: Fri, 23 Feb 2018 19:00:24 +0100 Message-Id: <20180223180024.8846-3-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180223180024.8846-1-christoffer.dall@linaro.org> References: <20180223180024.8846-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180223_100045_033939_7F7BE1EC X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Arnd Bergmann , Marc Zyngier , stable@vger.kernel.org, Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Arnd Bergmann 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 --- 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)