Message ID | 20191024124833.4158-48-ard.biesheuvel@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2143247ill; Thu, 24 Oct 2019 05:50:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSxOu7x372kWHv3B6I+1o7Cwd3b+8XT5wLFbn5qu12npxP4a29lffFI/FlO9HL/a79Fthq X-Received: by 2002:aa7:de08:: with SMTP id h8mr19086886edv.169.1571921404359; Thu, 24 Oct 2019 05:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571921404; cv=none; d=google.com; s=arc-20160816; b=b/mLFJivo+ryP+VNydx7BUPZhHdKkYTYDS/A7bvN4+pmV+jSm/1ft9rTE9jJOEQ9VU 7y5D/qeYeOAjM5a3nVcOAnLK69utv+UNACl7BAm//eHlhqd+QpbskdJB3rXcPLmvB+Xj XkogdHqZjQn+P6h4Rqlmuw7ZWsyRUDnfCRHMF7OPFodMpA5aUEaxIOX+8bnJ8pY6lnKa KA2228Czr5ZqzQm77MqZclnQBVdmJhdSzwBPeQsKsvny4JKc1nu8G96WT1leJVXifT6q iVGPdHetU21SFcTJs2BHrxbZFrJlLSRWPfAk0jp00YbnOlwOHxddYB42MucgFQ7I7Aou WCCA== 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=1TXdc1CmrZ/ckjcWcEzqehZfZHfUvN6n3zMEabAraTw=; b=Hvref35S3t4pkQELy3HvDksky8FaNvciIomLH9ZH5kQSbhOjsFiJvSwZey0iEQUWc5 elLhVQp33bgUjrXzRz08/o7jOVgKVkE5POH+FZn1y9saZTuKYefe6oNfLBuOeXPdaPhe kFhqjeeQ9XnYFg5v+ADu51toyHmNwlu8Fb0YuavEM+8Ox3PSkm+CPfXXp2iDdbYZsGRR ZxBeXEJh7sUn+u9Z8QBQUstAANLkM4Xq9DGhNQ1J3lcRGxeNH65FKXMiVKdxYxshDkAl 172UjT+cqkyaOMcIIpEz+x/UBa0UeK3u2kAXj69Z7PtD+4MP/D9fO5cp2ZhLFdz0eNE+ RexA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ur0hIhaH; 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: <stable-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y71si17602216ede.135.2019.10.24.05.50.04; Thu, 24 Oct 2019 05:50:04 -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=ur0hIhaH; 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 S1730784AbfJXMuD (ORCPT <rfc822;lee.jones@linaro.org> + 14 others); Thu, 24 Oct 2019 08:50:03 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54124 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502116AbfJXMuD (ORCPT <rfc822;stable@vger.kernel.org>); Thu, 24 Oct 2019 08:50:03 -0400 Received: by mail-wm1-f65.google.com with SMTP id n7so1871770wmc.3 for <stable@vger.kernel.org>; Thu, 24 Oct 2019 05:50:02 -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=1TXdc1CmrZ/ckjcWcEzqehZfZHfUvN6n3zMEabAraTw=; b=ur0hIhaHS4BdmbKFtzUR2LVNQtiRKeeeOyey48YVQHGZaNkzjCCNc6ogOitBuVa6sZ h4usvwExHTmRxgVBoDUbugA/PQ8Y/wPazr1oYiuqEc7RgqfsX9luMhY1MB622WL3Z90w MvE54UbJ8K+27pZf0KcfPeLAWbzwDrlVbVjFXg3qj61pBkxjS1L1cViidemP5+Q1Anel suuunUYdWqVXBOzk5IV3bVEFG+aiOq7uhFxxGKm0VHmCa+jzYx1rtQEsUXgmU8hZO7ur AomqugCQe5pQZhmIoqzT5bhWWwcMQY3kXftvCHT5QE3Zwy4HvDR0vtWygYxHPXLdo1RN wFTQ== 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=1TXdc1CmrZ/ckjcWcEzqehZfZHfUvN6n3zMEabAraTw=; b=C0IqUrvLHglAHHNqwaH29ENkLGr2axeSoPtnkCH5hxg/JWFcB5aj3Z7AvzJsxUQmDe oPxt+y6emozQ06yv5Uclh2/yqGuuY+5qFeVNv1Vvy1HlKBq7U0AtnyzwPTISIFBHqZ8Z ldohp+2qbZMcvee5TsHPSDUi4o8un3tnvVhGBW+4FCrfIxRVm7+gP9YH81/ySslx1ca/ NE1rkndLe67Sqya6mKr/An4AG27qRnujx8p6hGCXxs8FKM8SpQjnlB/HE9q6Bit09MHR IrzXPff8jKwikU4b1miHJMjOfAprRQ1EigSwvHKTUSR1dtDMakcMs5YVnt7RS61pOu2A jM2w== X-Gm-Message-State: APjAAAXfVOKsqL4KEmqqB3gcrG/rYBvEGneUXkSKpZmyYfpdJ8nk777b DBRM0LVe/Vo5VuYH4SMxrSSBcz8bgUZve6EO X-Received: by 2002:a7b:cbc6:: with SMTP id n6mr2628724wmi.161.1571921401695; Thu, 24 Oct 2019 05:50:01 -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.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 05:50:00 -0700 (PDT) From: Ard Biesheuvel <ard.biesheuvel@linaro.org> To: stable@vger.kernel.org Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>, Will Deacon <will@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Marc Zyngier <maz@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Jeremy Linton <jeremy.linton@arm.com>, Andre Przywara <andre.przywara@arm.com>, Alexandru Elisei <alexandru.elisei@arm.com>, Marc Zyngier <marc.zyngier@arm.com>, Stefan Wahren <stefan.wahren@i2se.com>, Will Deacon <will.deacon@arm.com> Subject: [PATCH for-stable-4.14 47/48] arm64: Use firmware to detect CPUs that are not affected by Spectre-v2 Date: Thu, 24 Oct 2019 14:48:32 +0200 Message-Id: <20191024124833.4158-48-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 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
arm64 spec mitigation backports
|
expand
|
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 55526738ccbc..ca718250d5bd 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -190,22 +190,36 @@ static int detect_harden_bp_fw(void) case PSCI_CONDUIT_HVC: arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, ARM_SMCCC_ARCH_WORKAROUND_1, &res); - if ((int)res.a0 < 0) + switch ((int)res.a0) { + case 1: + /* Firmware says we're just fine */ + return 0; + case 0: + cb = call_hvc_arch_workaround_1; + /* This is a guest, no need to patch KVM vectors */ + smccc_start = NULL; + smccc_end = NULL; + break; + default: return -1; - cb = call_hvc_arch_workaround_1; - /* This is a guest, no need to patch KVM vectors */ - smccc_start = NULL; - smccc_end = NULL; + } break; case PSCI_CONDUIT_SMC: arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, ARM_SMCCC_ARCH_WORKAROUND_1, &res); - if ((int)res.a0 < 0) + switch ((int)res.a0) { + case 1: + /* Firmware says we're just fine */ + return 0; + case 0: + cb = call_smc_arch_workaround_1; + smccc_start = __smccc_workaround_1_smc_start; + smccc_end = __smccc_workaround_1_smc_end; + break; + default: return -1; - cb = call_smc_arch_workaround_1; - smccc_start = __smccc_workaround_1_smc_start; - smccc_end = __smccc_workaround_1_smc_end; + } break; default: