From patchwork Thu Jun 25 13:14:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brazdil X-Patchwork-Id: 11625325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD35E6C1 for ; Thu, 25 Jun 2020 13:17:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A08A4206A1 for ; Thu, 25 Jun 2020 13:17:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="W3d/Ii4S"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="I5+P3u/y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A08A4206A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=heEcM6t/p8knMGUibgP8fG+v4RkZGAUtYGGlcVA6rxs=; b=W3d/Ii4Su0+XFi6lWaKUCbkoO KY9ZK/8mZ4MBxyoiWAecY3GCyMWUyhUj/IPXZRS8bBV9x6UfRiNBvK776BRQVAZkI0jreROQJRLuQ z/N6AsiIVlV4sISxWfJTY+cgwfQyCyusWH8/67h6Fa0LmLJB369fd+z79TWtmiNmKTkQ8Md8UcGVa gtAWRV3Fgnv7ShhNDu9Lf1p0vwSUmX7XmczFUL6ujv9fd6Jnhrz23wKfQ1Vca/D6VBp8pnEAXPaDc HsN0TRIQdQKn4CZDU8I6EmmqwzmHD8K2GVF5Fvr+E1SFJgcqBY5vGikzv4BJb/OHG5Gll3UOwi7iV vgf6OyjUQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joRjE-0007LH-E7; Thu, 25 Jun 2020 13:15:44 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joRi2-0006u3-1v for linux-arm-kernel@lists.infradead.org; Thu, 25 Jun 2020 13:14:32 +0000 Received: by mail-wr1-x432.google.com with SMTP id h5so5793867wrc.7 for ; Thu, 25 Jun 2020 06:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1nJ1ieQpwNl0Pfw6B6FeqmHmOVT4IL4HZr2WtH3E820=; b=I5+P3u/ybHhlGS18JjAn1ZjLv6bR28LbgebFgG/w9VsgANqy8JBuJes3yv3leJ0CiN 2Z3lfThuvuOqCeTU2ix7fcWZFNduqbwLBACGdO/ClPo6BMQfGdtD/T7/W33nMHJKn+Uq 6Hc6V5pZfzk5xLPssLkXWMx1QYk3nAswm4kWs3TAnM9MLaabYskSi/qQS4rbX1045/Ae bbOtu19iiprRDl6agJmCiBiBI5ezKqqRaCYJmnftY3y/7nInBYSi+Xu1T6R49dtKOhYC ZdkH/3JoP+jVIj17Sc8Kb8Br5/9OqnHCq2NOh9ViFhaskHdp4vCus3RCDWC63A/k7+X3 ar7w== 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:mime-version:content-transfer-encoding; bh=1nJ1ieQpwNl0Pfw6B6FeqmHmOVT4IL4HZr2WtH3E820=; b=WRNbaDiMmJBCu75bL4x3yiYhTs3Vg1qfMknOia79bAML2tlnBnn2+z+OT2V2ib4I5M Xm0TfGUeixqXmS5w3+u28ZlXN1kzSkmttLTF3Sd7nLff3i7IGTo/+jmKKoQ/vxSXUeI5 4jzGvQeUatK3On207yUoSzNkNTRi8epq4apB2ApElLVH8G4SfaPbww2qLfU1NkqgZxF5 GG9CtcCqEHoUXqlX0wKOIZsPAjPklptQZUZ9EHd7fFosTSuTvwxZFv7iYBgoL/JPRrp4 lilbclbPOjwZs6QR95sO+nCmGbxkPddBReURJntyRU43ELuM2Vm1fvaPFuuOiuIhSKnP EW2w== X-Gm-Message-State: AOAM530djIy6G5sInb/P3tDgi6UYn3DblLs1mDYKB0ejLIltQHm880YL gP9fe2a7tUjcWcYMRVqyUxjUng== X-Google-Smtp-Source: ABdhPJxZyOZhuCkCHMP8yaqY1hsW/6w4L0M3eUhJ8CkRDos6inOe28ZOBSDT0wbf2qrGrV/+bkISLg== X-Received: by 2002:adf:dfcd:: with SMTP id q13mr23473875wrn.295.1593090867881; Thu, 25 Jun 2020 06:14:27 -0700 (PDT) Received: from localhost ([2a01:4b00:8523:2d03:c126:6748:7a9d:2d]) by smtp.gmail.com with ESMTPSA id u20sm11201541wmm.15.2020.06.25.06.14.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jun 2020 06:14:27 -0700 (PDT) From: David Brazdil To: Marc Zyngier , Will Deacon , Catalin Marinas , James Morse , Julien Thierry , Suzuki K Poulose Subject: [PATCH v4 02/15] arm64: kvm: Move __smccc_workaround_1_smc to .rodata Date: Thu, 25 Jun 2020 14:14:07 +0100 Message-Id: <20200625131420.71444-3-dbrazdil@google.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200625131420.71444-1-dbrazdil@google.com> References: <20200625131420.71444-1-dbrazdil@google.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -15.7 (---------------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-15.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:432 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -7.5 USER_IN_DEF_SPF_WL From: address is in the default SPF white-list -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.5 ENV_AND_HDR_SPF_MATCH Env and Hdr From used in default SPF WL Match -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: android-kvm@google.com, linux-kernel@vger.kernel.org, David Brazdil , kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 33 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 - -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..b0441dbdf68b --- /dev/null +++ b/arch/arm64/kvm/hyp/smccc_wa.S @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2015-2018 - ARM Ltd + * Author: Marc Zyngier + */ + +#include +#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 +SYM_DATA_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_DATA_END(__smccc_workaround_1_smc)