From patchwork Thu Oct 24 12:48:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 177453 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2142786ill; Thu, 24 Oct 2019 05:49:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwv+1mb1ViaZBbyra6ctnY36l2gGfDXI9Rxkxyo8YZgZLzE2iJd86te7jNU1Qq+dZMDhyi1 X-Received: by 2002:aa7:d958:: with SMTP id l24mr25684187eds.234.1571921381293; Thu, 24 Oct 2019 05:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571921381; cv=none; d=google.com; s=arc-20160816; b=DMG9+FxLLPxX+ofT5EoAMs/VY4mIh4p+A0usf9bNiMDtinT+/yyVvyPZR2iW1+pz1l Zi/necQID1j2pUzI6WyM4CJ7mP631haRrQUdyqxctZTBMSrOQ2tTkfYzpITkvU3xFXIh 0ZyXGIjs1qbSdIDUddyxGKKX0IidJ2fbklR44fteb2R8XeEx841lS9m52ro9pkXW8tnK bWzixWpc4vEvJXv/cso/L0DCThZdBBSQMvpCpPLJKyBeToq3QQ4lzuIPp6ARmxyNc0i1 kSAMzYf1+HAeK0w6C836dkcxr6lr+T0/f2Agpa2w0c1MQclaZD/Y+l3rakkxsguzUJ/x hMgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bn5xGW9Dm+/jGdh0DNWtC1DwAKZpmDxLKIpavICJQ1s=; b=lvtnkojBvaeesStoa/gZOVTXcMfPFsP5sp1wC3JZS+1Cv7Z61aIUrFGUyNjIq4uBpj PRs7FrqZ9qCvQcMMSlMRF06o9+NRgrjJMJ5u6K7XVVIt+R72jJEyWV84Vlb3GdoVNeWu ZGWleR2olO3rFRuShBipDDMTtneHT0xVwZhZIs+HpbSYLshrCyOaXnKHwUG/pNn0GW81 5jK6OKKx3sztCs1wjhMp9ozdnxQ9m4D6O1Cya1m0X2fgOqbmmHhvl8LlHbyFzJZZ+ucs CLJUU5/QzWY3AVolMqrJGF8uw7ArjXNFgxpFkW+EPa/s11FIX9phU9wzrEscrmIx+7On msdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oe1GlQKt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si12973378eda.251.2019.10.24.05.49.40; Thu, 24 Oct 2019 05:49:41 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=oe1GlQKt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502113AbfJXMtk (ORCPT + 14 others); Thu, 24 Oct 2019 08:49:40 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40587 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502111AbfJXMtk (ORCPT ); Thu, 24 Oct 2019 08:49:40 -0400 Received: by mail-wm1-f65.google.com with SMTP id w9so1306612wmm.5 for ; Thu, 24 Oct 2019 05:49:39 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=bn5xGW9Dm+/jGdh0DNWtC1DwAKZpmDxLKIpavICJQ1s=; b=oe1GlQKt6KtQTGHoVB8cc+TILiFRP9d2PBW2WSP7Kb5JCdxAatdxlpODmWS7YOqk7M bHBUgOdoY8vyPuLxvQdXYzAk2+A/6IiLO77CagWWP4BHNwy1oEOmkd+1nP3Y6LmBF1ih VJWetC4Ray2bkqszc1o+e4CQ/ZkDtJT259CCyGi+kyG2aHd7XGfZoNVJVFsP9I9ebKdh NzDC9kFmOB9PL9BL7yAz1e6zmB8fwtpt7RAYLzTcdcPzgvtRU8slLls3NK6eJ6t/wzB6 h1XD1A9l7/1Y/cmqDH1IBrMwSGD4IZ3LQqa7uBty2x4LuB9qLyFh+r4lz6bAQPtltsuY zTEQ== 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=bn5xGW9Dm+/jGdh0DNWtC1DwAKZpmDxLKIpavICJQ1s=; b=E06laOQpXBDqnWQ7+Id24dXRSOsEQH5JUcp152X9oLiqSVzhOAcLzRtRIxyO+/7v00 BBFuklL/SaHZbSc/MQM0xZbZlTM23VHW8O+PRwUMSkO7GXSFBNWOU6jgugaqLs8yxuUd 8tsBSMbv3Z+5++YLmpzR7vFweU/DUHQ/pdk46SFEwKbVjH9aFNqbyzdFYxsRxBhnzKGQ wRvaJf+vrLq8zZnkui3U1AONV8dswsFPhTOIhZO4OqJmAR8sed/Nxroc+WoVNBx5vgwx FqkHU3ZNZA+4zCgaWBxZFzuO8aZhrII99X6bqCqDWq+7O1js8nx/gDG/Tjo17PNZkReC zZjg== X-Gm-Message-State: APjAAAW0Nag5DGFYD535YKoQS19i08d1jKyGjwh/3NY86F2HhTcgKfEF voa79fRBQ4eDqzLAS3Cf1Ap1I2hSXRbZ0XuP X-Received: by 2002:a05:600c:2943:: with SMTP id n3mr4633489wmd.11.1571921378242; Thu, 24 Oct 2019 05:49:38 -0700 (PDT) Received: from localhost.localdomain (aaubervilliers-681-1-126-126.w90-88.abo.wanadoo.fr. [90.88.7.126]) by smtp.gmail.com with ESMTPSA id j22sm29111038wrd.41.2019.10.24.05.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 05:49:37 -0700 (PDT) From: Ard Biesheuvel To: stable@vger.kernel.org Cc: Ard Biesheuvel , Will Deacon , Catalin Marinas , Marc Zyngier , Mark Rutland , Suzuki K Poulose , Jeremy Linton , Andre Przywara , Alexandru Elisei , Marc Zyngier , Will Deacon Subject: [PATCH for-stable-4.14 31/48] arm64: Get rid of __smccc_workaround_1_hvc_* Date: Thu, 24 Oct 2019 14:48:16 +0200 Message-Id: <20191024124833.4158-32-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024124833.4158-1-ard.biesheuvel@linaro.org> References: <20191024124833.4158-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier [ Upstream commit 22765f30dbaf1118c6ff0fcb8b99c9f2b4d396d5 ] The very existence of __smccc_workaround_1_hvc_* is a thinko, as KVM will never use a HVC call to perform the branch prediction invalidation. Even as a nested hypervisor, it would use an SMC instruction. Let's get rid of it. Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/bpi.S | 12 ++---------- arch/arm64/kernel/cpu_errata.c | 9 +++------ 2 files changed, 5 insertions(+), 16 deletions(-) -- 2.20.1 diff --git a/arch/arm64/kernel/bpi.S b/arch/arm64/kernel/bpi.S index 0af46cfdbbf3..4cae34e5a24e 100644 --- a/arch/arm64/kernel/bpi.S +++ b/arch/arm64/kernel/bpi.S @@ -56,21 +56,13 @@ ENTRY(__bp_harden_hyp_vecs_start) ENTRY(__bp_harden_hyp_vecs_end) -.macro smccc_workaround_1 inst +ENTRY(__smccc_workaround_1_smc_start) sub sp, sp, #(8 * 4) stp x2, x3, [sp, #(8 * 0)] stp x0, x1, [sp, #(8 * 2)] mov w0, #ARM_SMCCC_ARCH_WORKAROUND_1 - \inst #0 + smc #0 ldp x2, x3, [sp, #(8 * 0)] ldp x0, x1, [sp, #(8 * 2)] add sp, sp, #(8 * 4) -.endm - -ENTRY(__smccc_workaround_1_smc_start) - smccc_workaround_1 smc ENTRY(__smccc_workaround_1_smc_end) - -ENTRY(__smccc_workaround_1_hvc_start) - smccc_workaround_1 hvc -ENTRY(__smccc_workaround_1_hvc_end) diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 4204b668df7a..6e565d8d4f71 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -85,8 +85,6 @@ DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data); #ifdef CONFIG_KVM extern char __smccc_workaround_1_smc_start[]; extern char __smccc_workaround_1_smc_end[]; -extern char __smccc_workaround_1_hvc_start[]; -extern char __smccc_workaround_1_hvc_end[]; static void __copy_hyp_vect_bpi(int slot, const char *hyp_vecs_start, const char *hyp_vecs_end) @@ -131,8 +129,6 @@ static void __install_bp_hardening_cb(bp_hardening_cb_t fn, #else #define __smccc_workaround_1_smc_start NULL #define __smccc_workaround_1_smc_end NULL -#define __smccc_workaround_1_hvc_start NULL -#define __smccc_workaround_1_hvc_end NULL static void __install_bp_hardening_cb(bp_hardening_cb_t fn, const char *hyp_vecs_start, @@ -206,8 +202,9 @@ enable_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry) if ((int)res.a0 < 0) return; cb = call_hvc_arch_workaround_1; - smccc_start = __smccc_workaround_1_hvc_start; - smccc_end = __smccc_workaround_1_hvc_end; + /* This is a guest, no need to patch KVM vectors */ + smccc_start = NULL; + smccc_end = NULL; break; case PSCI_CONDUIT_SMC: