Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1359228ybt; Thu, 18 Jun 2020 07:00:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW1jKR9N27ssTwv33PY2r1Tl7Z0PDgV/UKgj8Y4J44VAUFQTT0YU+wNQ1E5mUA3gLsJnlL X-Received: by 2002:a50:c219:: with SMTP id n25mr4255064edf.306.1592488803275; Thu, 18 Jun 2020 07:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592488803; cv=none; d=google.com; s=arc-20160816; b=nrejRNqK1MRgH5M1SyeeeSDxbEBp8L+F6dXkgJXOKgcWe0woKLxR00KtF73HZ5uLGI Dq0c1boTPeWFiISJQlBncZ71nj3RAC2iNZ0mB2lkeVC4/TCm3ap9NbsF58H5530PDh9a B4S9TwXzQxIAu9nqReMOVeJBmDVxA7qdS3XMxTxwTX8hQ+VnmfPz1WFolwtZJ+RnOENM 5CWpt3GFWwGMJ+BBjTds3VC6mhEPyNR4PBSj1r7F5WlFixzAldWCtuJgawo/EUCa91BS 94S2lGZ1EMq2pFq0DRPFgiDvFPfagisVj/AivEbTQlrIIuoIx0LPMYwtncNDjoW9B4VB vKkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=pHuoIraS4MtEH9QQKijPh/6Ot72aCGty7oo/zTtQ/Rg=; b=l8mLdiNFoGdpvDoxFXtjktzgKsQuCbB11X4IjXd2UxIQF3T+MrRpPdrEWHYDzDVMaD 9q6Kyts4nzputBfRPTfMIAzglqyIGZ+dP5tEWpS11btd9yrpj6yNDskXKZkirJmTAi0O q9qWdOLPEIX7I5ZLIPX3sh4GdtH4mPbS1r2Tt29eD38TwardHotnni93PI5bmXb+A34S kI36ywg5OxXTs56T+466Tcq9lyPL56zUNaonyD7WEA4CQAbC+xkisQAWF/AKFOp4mVfU McB0Hjm1LA5saXEoS4hyRPzdGqDn++f7YTBJHpdE/YIDmpH/O0eET5q7NDK3n4S3NsGh hqFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BvEtPq7y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si1987916ejo.179.2020.06.18.06.59.40; Thu, 18 Jun 2020 07:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BvEtPq7y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728159AbgFRN5s (ORCPT + 99 others); Thu, 18 Jun 2020 09:57:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:34766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbgFRN5s (ORCPT ); Thu, 18 Jun 2020 09:57:48 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C69B12082F; Thu, 18 Jun 2020 13:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592488667; bh=LnYEKbo5XLm8oVGmH1Jg4y8ZvUiouHun1liXREq5bac=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BvEtPq7yWq1HoWLreLAPoRHu9zg2dv4gVjA+/sWolyzzhzCuYfusljrsDt7PCh1Rl 8VzOVSWJVHPKOQf8ENECav3J03US/j4/DonegZKfy7eWRDwY3D9dWQ05qwLpA4LpOi HaPbrU2sScJRWJ14HAyMty8l/Dv/fn0Im1rhu9eQ= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlv34-004BYE-2D; Thu, 18 Jun 2020 14:57:46 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 18 Jun 2020 14:57:45 +0100 From: Marc Zyngier To: David Brazdil Cc: Will Deacon , Catalin Marinas , James Morse , Julien Thierry , Suzuki K Poulose , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, android-kvm@google.com, kernel-team@android.com Subject: Re: [PATCH v3 02/15] arm64: kvm: Move __smccc_workaround_1_smc to .rodata In-Reply-To: <20200618122537.9625-3-dbrazdil@google.com> References: <20200618122537.9625-1-dbrazdil@google.com> <20200618122537.9625-3-dbrazdil@google.com> User-Agent: Roundcube Webmail/1.4.5 Message-ID: <02322fdac903aa1786c334d0ddd7f38a@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: dbrazdil@google.com, will@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, android-kvm@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On 2020-06-18 13:25, David Brazdil wrote: > This snippet of assembly is used by cpu_errata.c to overwrite parts of > KVM hyp > vector. Move it to its own source file and change its ELF section to > .rodata. > > Signed-off-by: David Brazdil > --- > arch/arm64/kvm/hyp/Makefile | 1 + > arch/arm64/kvm/hyp/hyp-entry.S | 16 ---------------- > arch/arm64/kvm/hyp/smccc_wa.S | 30 ++++++++++++++++++++++++++++++ > 3 files changed, 31 insertions(+), 16 deletions(-) > create mode 100644 arch/arm64/kvm/hyp/smccc_wa.S > > diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile > index 8c9880783839..5d8357ddc234 100644 > --- a/arch/arm64/kvm/hyp/Makefile > +++ b/arch/arm64/kvm/hyp/Makefile > @@ -7,6 +7,7 @@ ccflags-y += -fno-stack-protector > -DDISABLE_BRANCH_PROFILING \ > $(DISABLE_STACKLEAK_PLUGIN) > > obj-$(CONFIG_KVM) += hyp.o > +obj-$(CONFIG_KVM_INDIRECT_VECTORS) += smccc_wa.o > > hyp-y := vgic-v3-sr.o timer-sr.o aarch32.o vgic-v2-cpuif-proxy.o > sysreg-sr.o \ > debug-sr.o entry.o switch.o fpsimd.o tlb.o hyp-entry.o > diff --git a/arch/arm64/kvm/hyp/hyp-entry.S > b/arch/arm64/kvm/hyp/hyp-entry.S > index 9c5cfb04170e..d362fad97cc8 100644 > --- a/arch/arm64/kvm/hyp/hyp-entry.S > +++ b/arch/arm64/kvm/hyp/hyp-entry.S > @@ -318,20 +318,4 @@ SYM_CODE_START(__bp_harden_hyp_vecs) > 1: .org __bp_harden_hyp_vecs + __BP_HARDEN_HYP_VECS_SZ > .org 1b > SYM_CODE_END(__bp_harden_hyp_vecs) > - > - .popsection I'd be tempted to leave the .popsection in place, if only for symmetry with the initial .pushsection. > - > -SYM_CODE_START(__smccc_workaround_1_smc) > - esb > - sub sp, sp, #(8 * 4) > - stp x2, x3, [sp, #(8 * 0)] > - stp x0, x1, [sp, #(8 * 2)] > - mov w0, #ARM_SMCCC_ARCH_WORKAROUND_1 > - smc #0 > - ldp x2, x3, [sp, #(8 * 0)] > - ldp x0, x1, [sp, #(8 * 2)] > - add sp, sp, #(8 * 4) > -1: .org __smccc_workaround_1_smc + __SMCCC_WORKAROUND_1_SMC_SZ > - .org 1b > -SYM_CODE_END(__smccc_workaround_1_smc) > #endif > diff --git a/arch/arm64/kvm/hyp/smccc_wa.S > b/arch/arm64/kvm/hyp/smccc_wa.S > new file mode 100644 > index 000000000000..aa25b5428e77 > --- /dev/null > +++ b/arch/arm64/kvm/hyp/smccc_wa.S > @@ -0,0 +1,30 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Copyright (C) 2015-2018 - ARM Ltd > + * Author: Marc Zyngier > + */ > + > +#include > + > +#include > +#include > + > + /* > + * This is not executed directly and is instead copied into the > vectors > + * by install_bp_hardening_cb(). > + */ > + .data > + .pushsection .rodata > + .global __smccc_workaround_1_smc > +__smccc_workaround_1_smc: You probably want to replace this with SYM_DATA_START (and SYM_DATA_END at the end). > + esb > + sub sp, sp, #(8 * 4) > + stp x2, x3, [sp, #(8 * 0)] > + stp x0, x1, [sp, #(8 * 2)] > + mov w0, #ARM_SMCCC_ARCH_WORKAROUND_1 > + smc #0 > + ldp x2, x3, [sp, #(8 * 0)] > + ldp x0, x1, [sp, #(8 * 2)] > + add sp, sp, #(8 * 4) > +1: .org __smccc_workaround_1_smc + __SMCCC_WORKAROUND_1_SMC_SZ > + .org 1b Otherwise, looks good. Thanks, M. -- Jazz is not dead. It just smells funny...