From patchwork Sat Dec 14 00:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Anderson X-Patchwork-Id: 13908226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04D43E7717F for ; Sat, 14 Dec 2024 00:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HCYhLJZhR58ewaFrjgMGyGbHfnpNdzHm23IqgQZ/0wM=; b=26sdoya8NhSfavl4LS3k5pDXL4 6nn74phQxawc3wA6EIPCZPlmYjCQRKW2/dnG2sT+OcdE2okPbShXGbo0XIQMlgydZTSqb4L6S+0k8 Q7+6MjqzO3bIYI7B3HA1Sd7ss081BTE7dJ2Dvuc73NbZuKB8eRsd8ZVM6N4L+aCjpWh+YQjLTrUeh 8/qXjF+4gd8QBZPCDy37Y9GZeVVd0ciCGL5hOEt9NCdZ2KOrv3dbTiOU1Ngh0wayn6XsHpSYrAvlv JHn3gkXWioUCCw3F+vC2dFikiKnoR8u2bRjaD7j9M0snmZ4NKDuSGTFnFp7sPsVLkqiqqVof2L9Cr e7MDI4aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tMGRE-00000005RAW-10z8; Sat, 14 Dec 2024 00:55:20 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tMGP7-00000005Qlf-2aLH for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2024 00:53:10 +0000 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2ee989553c1so1951698a91.3 for ; Fri, 13 Dec 2024 16:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734137589; x=1734742389; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HCYhLJZhR58ewaFrjgMGyGbHfnpNdzHm23IqgQZ/0wM=; b=KEIkP9fJ3ud1hPJ+rlV/jWzTxj2VPZQzZb5ICr6R8L7ANZeuIfxDk9Ja+GKEiRmS1I o8hCGuWEvh/TR0xJcsPriHsI/1BLalqgQYgm5A9dfXynyz5vGiybkP+lKMhjS/NlRx4o nIPbuQ5Kvll4EO58E0+McV5XTutyhSaX4tjlc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734137589; x=1734742389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HCYhLJZhR58ewaFrjgMGyGbHfnpNdzHm23IqgQZ/0wM=; b=J/iM/r7EenpZxPBHsEhmPOMkmNuLUHcZeHCu/p3PQB3clHrs6nixtHWBaClrfnRRJe znaoll4a+EA6odPpflyXytMz+A7+kpPxW57XOAfXH0SMw/jNpbqO/fY7IHVOdAwN0syZ uNObN9TZFTeksp/EvtNqz4+/y3gGd2Xa/N1o8v4yRqEoVDwzUce/5exdMqTrADK9tg7d ddzuPOpsqqAwErvtX8CTc4jimzLLqyZ537zGRsgdokeew7oeC1m+SECWpicmUJ+oQxaL uyxX6itkSpVV9fFqpV1vBoPaD/omGJc/dlSOXtOgL0I69zwrSuyW4f6p9HujvVKpTk/Z ozug== X-Forwarded-Encrypted: i=1; AJvYcCXekm4ktaj1XG7naqtlTpIcEiHOwTyVqhFc0IStdowWFPIFukXG43ZmwRrucoQTEuCc8tbpaFRHMedK0qpV9t3+@lists.infradead.org X-Gm-Message-State: AOJu0YyhcEEIPoGmzo1YDT3w2ccGtxal0cDytp/F001tDgsZEIWbBALa mDdbNs9E96yBF1/OL6IvsPwmi38n6Mvr5ZLPLSPlVI3GniziX0z3KHnYr9Ipem6biYDSzDgUCHX 92IRY X-Gm-Gg: ASbGncv+a0KyrkPmkQL2f67z15wDkvVzcGvRrJ3qAyFCkj0QtvTWQeI0GW3WL47buhD evrfwdgC6slcoMN5ZHM20VjDRH8rURIcYikZ7fk/EMl9tQTFlVVwc5Uj/KTq8RCokL7p6Sgaooj 81HFmAXAOJCH1iJtwJOW9urbYlkOxCChptLc4G4IMn6PfMBxCT6ZpaqvGBuzmlhYsr6QxsBd5Td RbKI9fkQl/xDjW4uU9ObjIQVEYwIf9p7qYkM9JqgUFwuHpJ2yGtCIYP64K2DOuQ+9ElrsrfXv98 X-Google-Smtp-Source: AGHT+IGyZAYcBNhvS6uotk+yKNrfDXGIRBKVBPzRwnHoQvCbP1TZ1iFVgP8Qo1WHFe4yMk8mfH9X9g== X-Received: by 2002:a17:90b:4d08:b0:2ee:ab10:c187 with SMTP id 98e67ed59e1d1-2f28fd6b5f3mr6479214a91.18.1734137588765; Fri, 13 Dec 2024 16:53:08 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:ae86:44a5:253c:f9bf]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142f9e186sm3788270a91.41.2024.12.13.16.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 16:53:08 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, Jeffrey Hugo , Julius Werner , linux-arm-kernel@lists.infradead.org, Roxana Bradescu , Trilok Soni , bjorn.andersson@oss.qualcomm.com, Douglas Anderson , stable@vger.kernel.org, James Morse , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/6] arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB Date: Fri, 13 Dec 2024 16:52:02 -0800 Message-ID: <20241213165201.v2.1.I2040fa004dafe196243f67ebcc647cbedbb516e6@changeid> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241214005248.198803-1-dianders@chromium.org> References: <20241214005248.198803-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_165309_653731_3DFB106E X-CRM114-Status: GOOD ( 21.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The code for detecting CPUs that are vulnerable to Spectre BHB was based on a hardcoded list of CPU IDs that were known to be affected. Unfortunately, the list mostly only contained the IDs of standard ARM cores. The IDs for many cores that are minor variants of the standard ARM cores (like many Qualcomm Kyro CPUs) weren't listed. This led the code to assume that those variants were not affected. Flip the code on its head and instead list CPU IDs for cores that are known to be _not_ affected. Now CPUs will be assumed vulnerable until added to the list saying that they're safe. As of right now, the only CPU IDs added to the "unaffected" list are ARM Cortex A35, A53, and A55. This list was created by looking at older cores listed in cputype.h that weren't listed in the "affected" list previously. Unfortunately, while this solution is better than what we had before, it's still an imperfect solution. Specifically there are two ways to mitigate Spectre BHB and one of those ways is parameterized with a "k" value indicating how many loops are needed to mitigate. If we have an unknown CPU ID then we've got to guess about how to mitigate it. Since more cores seem to be mitigated by looping (and because it's unlikely that the needed FW code will be in place for FW mitigation for unknown cores), we'll choose looping for unknown CPUs and choose the highest "k" value of 32. The downside of our guessing is that some CPUs may now report as "mitigated" when in reality they should need a firmware mitigation. We'll choose to put a WARN_ON splat in the logs in this case any time we had to make a guess since guessing the right mitigation is pretty awful. Hopefully this will encourage CPU vendors to add their CPU IDs to the list. Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels") Cc: stable@vger.kernel.org Signed-off-by: Douglas Anderson --- Changes in v2: - New arch/arm64/kernel/proton-pack.c | 46 +++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index da53722f95d4..39c5573c7527 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -841,13 +841,31 @@ enum bhb_mitigation_bits { }; static unsigned long system_bhb_mitigations; +static const struct midr_range spectre_bhb_firmware_mitigated_list[] = { + MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A75), + {}, +}; + +static const struct midr_range spectre_bhb_safe_list[] = { + MIDR_ALL_VERSIONS(MIDR_CORTEX_A35), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A53), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), + {}, +}; + /* * This must be called with SCOPE_LOCAL_CPU for each type of CPU, before any * SCOPE_SYSTEM call will give the right answer. + * + * NOTE: Unknown CPUs are reported as affected. In order to make this work + * and still keep the list short, only handle CPUs where: + * - supports_csv2p3() returned false + * - supports_clearbhb() returned false. */ u8 spectre_bhb_loop_affected(int scope) { - u8 k = 0; + u8 k; static u8 max_bhb_k; if (scope == SCOPE_LOCAL_CPU) { @@ -886,6 +904,16 @@ u8 spectre_bhb_loop_affected(int scope) k = 11; else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list)) k = 8; + else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_safe_list) || + is_midr_in_range_list(read_cpuid_id(), spectre_bhb_firmware_mitigated_list)) + k = 0; + else { + WARN_ONCE(true, + "Unrecognized CPU %#010x, assuming Spectre BHB vulnerable\n", + read_cpuid_id()); + /* Hopefully k = 32 handles the worst case for unknown CPUs */ + k = 32; + } max_bhb_k = max(max_bhb_k, k); } else { @@ -916,24 +944,26 @@ static enum mitigation_state spectre_bhb_get_cpu_fw_mitigation_state(void) } } +/* + * NOTE: Unknown CPUs are reported as affected. In order to make this work + * and still keep the list short, only handle CPUs where: + * - supports_csv2p3() returned false + * - supports_clearbhb() returned false. + * - spectre_bhb_loop_affected() returned 0. + */ static bool is_spectre_bhb_fw_affected(int scope) { static bool system_affected; enum mitigation_state fw_state; bool has_smccc = arm_smccc_1_1_get_conduit() != SMCCC_CONDUIT_NONE; - static const struct midr_range spectre_bhb_firmware_mitigated_list[] = { - MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), - MIDR_ALL_VERSIONS(MIDR_CORTEX_A75), - {}, - }; bool cpu_in_list = is_midr_in_range_list(read_cpuid_id(), - spectre_bhb_firmware_mitigated_list); + spectre_bhb_safe_list); if (scope != SCOPE_LOCAL_CPU) return system_affected; fw_state = spectre_bhb_get_cpu_fw_mitigation_state(); - if (cpu_in_list || (has_smccc && fw_state == SPECTRE_MITIGATED)) { + if (!cpu_in_list || (has_smccc && fw_state == SPECTRE_MITIGATED)) { system_affected = true; return true; } From patchwork Sat Dec 14 00:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Anderson X-Patchwork-Id: 13908227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EDBCE77183 for ; Sat, 14 Dec 2024 00:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lb40kxSySziI3vHFr8SIoDrNL6+Q2SvOcQax38nrL70=; b=Bl6wnPDFy+2mE11LrgpPVVZr4M h8GtfCYrF+Z7r0UrIuHahLkEvR97cy9P5TJNw+4q6wVjc24WE667GOjVE29WvCySJo2aj0lnMpSaa yyR+o3zeFxQ0VH29G9jm1kSNP2p/R3pn6yHaPQLQBams/BQB3OKlBON60zyZUK/Bl0viLpuOOBxBR iDilib1yz8STTZU8O6BdCcBMOQU95eq8g7bCJqRyOurg4KtXmcBpMEYJbytVHVZAelerVF3tchHnC rjfa+eU1X0SBYk3JlGIB2P4TFKIaQkbOQn3gF+SSDI0rbLRSGPYJtJDa9YIw8IgUNQMWpTCiR85yp 0IYl0Kaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tMGSH-00000005RNY-1voQ; Sat, 14 Dec 2024 00:56:25 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tMGP9-00000005QmC-2cnK for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2024 00:53:12 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-7fcfb7db9bfso1762942a12.1 for ; Fri, 13 Dec 2024 16:53:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734137591; x=1734742391; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lb40kxSySziI3vHFr8SIoDrNL6+Q2SvOcQax38nrL70=; b=fJJCN4JiEfru2OEWArdCaLR7HNsL8xBMDu3WTE36M8E7ONh6hrJESOazNydj7DVV6P qHK29xXPg7OSB3VLn9AVyKjgjYKDtdUiwc6KeDOJ8yue2TNX+NaORoHqbHzvgDOlK4Kj kA0OL2COfSqLlRCr6S2nukxgbiRQxP1GT0Ks0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734137591; x=1734742391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lb40kxSySziI3vHFr8SIoDrNL6+Q2SvOcQax38nrL70=; b=IM9qc9nqNfn0Si4Ze3OI3v4MehjAYAYy3wEbx7m9JCd3h7KXIiav566MtPbzOJQB1U zRP4xwrDcvc25pOOaYX/EIhh8ShTvIegoYIK6R3G4SGwznCztqbkPcLQ4ONRDmIBnsTa P8wBlyPAdpv/22YwoI3bACai8hajzOtqyreTWAEIuN7jC5E88iuGnRSjAvQOxmgK07U6 4eDc7lDJVmp+Un1DN0fMTEIAqoH/GSQzyME3VXOrWUNVmvbdpfo/1KCv+mDA0tdJnIIl Ig80hjojdxXkjrHpyQw1PC3rzPb2QMpTlA9bMfsNVhXQreTuy2QmWhWLznpwSkOoaBlb UA7w== X-Forwarded-Encrypted: i=1; AJvYcCWN9bzDkjsEU2cpmWOMRh/EtX1hAVQ78twIxCwD4nkvti109a6i5sIgDmOwl9gjDNfvTQ6a7Qg5tM9BAQInewQC@lists.infradead.org X-Gm-Message-State: AOJu0YztoW41q/PBszuEt8Xq2uzx5b6Q5+YV8VPV2oFkX2b39T5/BAjD 9TJPsyo+SKH2vKnA0XjyPk43STv4x90/iUW8z0TOnskK2KFnrPHLpPgmijH+1g== X-Gm-Gg: ASbGncu0TMeP2ehuxImpdL+FyEDxSIkLlDPegt47XaN22UEa3Y03s37hVgiap6mXVL6 +Li+AgxBYLDCkSiEPtFfOO7MZq9cZn8YhJhgauoSw/OqyxTFOA1OWVuiN8iv7VrUoQYZK4kQWh9 G8HwSP6mktJv/bZxkdAGyNDUY6MhP6/dYFk2faaZcCTC12PAlTs9wzeJ1/4e1tvnQk67WATjs+K pf7Bnn8jb1Tyjw95e1ghHxQ/ucemKKymTJwpYwEvSQNSqQivNQ1mFQny7LcNaTObxEGY3T5S2gY X-Google-Smtp-Source: AGHT+IHA02wdX7gbQpc2VM52GOd1+IrxDgEcszoQJP7VGIrV4tHzcaG0wjdjW5xSAzMH6mwnDjKcmA== X-Received: by 2002:a17:90a:d450:b0:2ee:f687:6ad3 with SMTP id 98e67ed59e1d1-2f290d96c48mr6152633a91.28.1734137590982; Fri, 13 Dec 2024 16:53:10 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:ae86:44a5:253c:f9bf]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142f9e186sm3788270a91.41.2024.12.13.16.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 16:53:10 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, Jeffrey Hugo , Julius Werner , linux-arm-kernel@lists.infradead.org, Roxana Bradescu , Trilok Soni , bjorn.andersson@oss.qualcomm.com, Douglas Anderson , stable@vger.kernel.org, James Morse , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre safe list Date: Fri, 13 Dec 2024 16:52:03 -0800 Message-ID: <20241213165201.v2.2.Iab8dbfb5c9b1e143e7a29f410bce5f9525a0ba32@changeid> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241214005248.198803-1-dianders@chromium.org> References: <20241214005248.198803-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_165311_661213_53F273D2 X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 2XX cores appear to be based on ARM Cortex A53. The 3XX and 4XX cores appear to be based on ARM Cortex A55. Both of those cores appear to be "safe" from a Spectre point of view. While it would be nice to get confirmation from Qualcomm, it seems hard to believe that they made big enough changes to these cores to affect the Spectre BHB vulnerability status. Add them to the safe list. Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels") Cc: stable@vger.kernel.org Signed-off-by: Douglas Anderson --- Changes in v2: - New arch/arm64/kernel/proton-pack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index 39c5573c7527..012485b75019 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -851,6 +851,9 @@ static const struct midr_range spectre_bhb_safe_list[] = { MIDR_ALL_VERSIONS(MIDR_CORTEX_A35), MIDR_ALL_VERSIONS(MIDR_CORTEX_A53), MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_2XX_SILVER), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_SILVER), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER), {}, }; From patchwork Sat Dec 14 00:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Anderson X-Patchwork-Id: 13908228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8868E77180 for ; Sat, 14 Dec 2024 00:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aUvE2f6iOzNwCrYNdrQY+FL/vDHn4ndwLWchPd2QhtQ=; b=0jkXOMdNIj56zY35Xf14QEDlmL XUSwAIXmJoyz/cSJXuDUViGr5QVI7Bw6pRZQUgaEKfEW2YP175qnfFQHPCeNusOwTf3D3vBHWZg4x RwBYpqWPC2sJJmYOBP/LX5Wa0SgOK7XahQLgzZsEaOdWdR/KsS7hUbewju9Ri77Hap80EKV5UURiP m9A2bVS/ySUv0ycQFUML7k8ynsE5BF4qp1vOVeekAQH7ZfJjl6dYA3+F3FNRDgCYvPmUK2DP77b7T WMZWC2xs4hdAfxVd5PmoxDEyZ/OHQb14w6xpuurfysDFAgrW/iygXn9lUeCrzqwWj+XVFyjHag+mC IqbNDeZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tMGTL-00000005RdW-0Odq; Sat, 14 Dec 2024 00:57:31 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tMGPC-00000005Qmc-0Udp for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2024 00:53:15 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2ee6dd1dd5eso1774343a91.3 for ; Fri, 13 Dec 2024 16:53:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734137593; x=1734742393; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aUvE2f6iOzNwCrYNdrQY+FL/vDHn4ndwLWchPd2QhtQ=; b=FHkzAQonO8liPf1mdwtaUSTDgjKSVH/4MXewygjo/BcqiZc8yF+UC8v+C2VYKJtosy PiT5JCF1/OhNNkOOYDzp54XsIejSUVASAt75De04QQkxtx4arOZdxVmxLr1R9za+j76c tkise1r2K8AvQqjPklaEWgbyyNgBLfwIqQ0ZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734137593; x=1734742393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aUvE2f6iOzNwCrYNdrQY+FL/vDHn4ndwLWchPd2QhtQ=; b=bXjPBEA4piBQF73FnCKRQDuRNjopLF4fWZm0lsQVvmjz11C9D2qbd6WBRUjl6WIeQR Q1VhXhHruVFHhxwXacbtQVv/kc7q2on64WGTf43eT1fitmWG9K9Et9PdqMcz1xWapwMm euHC5BDScrMImwZvK+x09YtEqvq1OMzOYl6NUERNaHcEZHdvF32rt8PMg5ZuHKgr0W4l gBiL7SeNG9GtbBFSF+Qk5i8Xddk925w38IcTLiA3U1PTM+/+VjH0e1dfAAZbfa2MRGYv ATAY25I1x9wnySoznLKWFw6+EFuiDX2+pXmnGPjw3t4vzrr1kDgbVGTjq4gTuyJejXqn mJYQ== X-Forwarded-Encrypted: i=1; AJvYcCWD7bHmbr9MarAChw71t1LsiL7UC2ShseP12KD1S+/bXGgeVVp9h1UyJ13JMA527SOXAjIdlR48WmK78IZxcQiO@lists.infradead.org X-Gm-Message-State: AOJu0YyXvQF62lC1sMveHARlUmqaX4h1+Nk4SayUtLEcRkrbahGBXa/H jlpYSBtPAhyfb8qNeIM5H859IQPoKVs/joDmbmjoUzaKtjwmmc2dvnPQaSpGLg== X-Gm-Gg: ASbGncuoeZRTDtpURZlzRHluIXVEBdz7kipysCsk4r816KSQNjVhLGEOFo49h8a06Su /4YKxYRRQyCLJipt5mut5OwD0Q7aC8oT7WwBk0WMZAHQvhEsbWGJBwMp7AtognzLisKSSgyyhDB SD/3LhVsqyr2TobqT7lrvqcGrJJI41AyLjHiS7SQJTeLSapSATLdoWq2uyZEm2P/Ev5tD9g4XIT lXCDHSD1BS/OSkHfn+0pK2fz7PjeGm/cCDZikq0kodvdBctc0n1YYfCq3AMOscLUNPauO8LDLRR X-Google-Smtp-Source: AGHT+IGU2S6Z3GVHm0+57veKVF9GWyDASh7uUNfkbmZbC9Zjun4Gf1t3LPe02j8X69XemOFEZkD8aQ== X-Received: by 2002:a17:90b:3c02:b0:2ee:c9d8:d01a with SMTP id 98e67ed59e1d1-2f28fb63bf1mr6635097a91.11.1734137593296; Fri, 13 Dec 2024 16:53:13 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:ae86:44a5:253c:f9bf]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142f9e186sm3788270a91.41.2024.12.13.16.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 16:53:12 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, Jeffrey Hugo , Julius Werner , linux-arm-kernel@lists.infradead.org, Roxana Bradescu , Trilok Soni , bjorn.andersson@oss.qualcomm.com, Douglas Anderson , stable@vger.kernel.org, James Morse , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list Date: Fri, 13 Dec 2024 16:52:04 -0800 Message-ID: <20241213165201.v2.3.Ie4ef54abe02e7eb0eee50f830575719bf23bda48@changeid> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241214005248.198803-1-dianders@chromium.org> References: <20241214005248.198803-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_165314_154275_ACE0C03F X-CRM114-Status: GOOD ( 15.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Qualcomm Kryo 400-series Gold cores appear to have a derivative of an ARM Cortex A76 in them. Since A76 needs Spectre mitigation via looping then the Kyro 400-series Gold cores also should need Spectre mitigation via looping. Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels") Cc: stable@vger.kernel.org Signed-off-by: Douglas Anderson --- The "k" value here really should come from analysis by Qualcomm, but until we can get that analysis let's choose the same value as A76: 24. Ideally someone from Qualcomm can confirm that this mitigation is needed and confirm / provide the proper "k" value. ...or do people think that this should go in the k32 list to be safe. At least adding it to the list of CPUs we don't warn about seems like a good idea since it seems very unlikely that it needs a FW mitigation when the A76 it's based on doesn't. ...or should we just drop this until Qualcomm tells us the right "k" value here? Changes in v2: - Slight change to wording and notes of KRYO_4XX_GOLD patch arch/arm64/kernel/proton-pack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index 012485b75019..04c3f0567999 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -887,6 +887,7 @@ u8 spectre_bhb_loop_affected(int scope) MIDR_ALL_VERSIONS(MIDR_CORTEX_A76), MIDR_ALL_VERSIONS(MIDR_CORTEX_A77), MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), {}, }; static const struct midr_range spectre_bhb_k11_list[] = { From patchwork Sat Dec 14 00:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Anderson X-Patchwork-Id: 13908229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71764E7717F for ; Sat, 14 Dec 2024 00:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iDl/86yemlzCX5AmWhge7CoGQnGj7feSxXoMoerczhc=; b=qprQJ9XzCrhVFQy9rBvBjvk+T2 yCgyfvC0n+sRYM7WyRc+Y0u1uwjAW1J19RNrV/j6Vt3tpPHA+sSgksXQIkVtNbiya0mSBTNuv2WDW r+b3MEkxPSxWo70svOfqaxxpTpUUnuT8JvOVLtcnvnJH7Osl/OZAvRvSflctMFipdRomYP6fKYZyP Wisojn8mvAMeUJGzJrS36ujbL2r1LwrSVjjX0XM8Svzy1gXIl2TaleVCi0A6+d+ahLVxD5ZykNCdT CblKYAiFB85+RsyMR6qMlC51ExrNWgRv9slTKZUoND9gNSWBfJ98T092GZjkWJbRT7cN9hmLuPR9/ +BgTmEgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tMGUN-00000005RkB-2vpi; Sat, 14 Dec 2024 00:58:35 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tMGPD-00000005Qn0-3uet for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2024 00:53:17 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2ee86a1a92dso1582849a91.1 for ; Fri, 13 Dec 2024 16:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734137595; x=1734742395; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iDl/86yemlzCX5AmWhge7CoGQnGj7feSxXoMoerczhc=; b=hxxHDjli3r18FMbIAMEMTNz+tH5tNeOjn/37wvEIuxUZRCs3pPOVV18Qu48gDfkdSQ 4GmzOOyoEZgFcbQEvnTPROlRkv4TzLqI6A7ERJTEss30G9JqkcYhkTL0ospJCuNKUMKF SotOw9AClCS3drgWjpYa2OmAgj6HRd29HlBy8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734137595; x=1734742395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iDl/86yemlzCX5AmWhge7CoGQnGj7feSxXoMoerczhc=; b=BTlhDiH/RorZWfTN50eeSMCDD3nDrBrMzJecIDvTWXCcjmo35iY8mszTLlGlMi/dAe OFXx622flcOQgdMQ11Apj+DSmmKNuBdbOdr1OnNQH58XFVNVbXUyFR3ilngqLEJHAGSy e/thS9lZL2oZDL0Qnqg99NcSVMbqy66FcDSR86QSGgLEfilQn+e+YEmhVv3Ztkx+FtkY FBwFKAoRIfNVga/kIv2Yfpp/V0LeEn6izK/0c8WlUidPeFUwKFVbzFLJGgMgRou4rnMa CulRZYdf9EL8v0oJRal9Ub3Vgarm9B/K2bDjeSRmpMKNIafOalXRDTk4I54Jl0K0mG5f yfGA== X-Forwarded-Encrypted: i=1; AJvYcCX3Zmy4KK4LFfdVEoP2GgnQDtxTC3CFKa1o2QmWyFxqP/Zr1GteLAglbEMNSlRgmdOcm/ek4Uzf1vpzwDihpYXk@lists.infradead.org X-Gm-Message-State: AOJu0YxtWb0ayTx/OisHDCzvNJQJhHHFV49SwAJh7cpo5Qf3RfOTBIw5 KvvfaInxMrJuaD9xl+RsOMoU/8ox78U0uishPIzFfhryASGFpaX4SX3QubTidQ== X-Gm-Gg: ASbGncv5dejOh3RTnGw1VJNpzii1vNXATZWnc/3XKsk/umKZ9VwzNAYlvgiG2tOF5JD vKMBEKUnCVEJa8Cc84Q7KHxfntd8WzKBtaIP9zrzJPBAX8IowLpOn+YworqsymSkbqSXyLm9IKb V4YEFALAdnVEQqttLWoQVoqtsS6IR5idftAfrkupxR74TktUMMhjzoWMxE8VFnWXFRh2A2UkyjY mdMfBHJCH3Fm4V57bL/MFrfaE6IoHVZfe+T+i1q18GQQj0Y3OQ8lVDTROEEuC+KV4BsNpfmuv8z X-Google-Smtp-Source: AGHT+IEWnlkjBeBQBC3iIoArI1oOo5CsVi/i/Wbk8mN1sXE73heVuvKgGafObymqxw6xhGs3c8XA1A== X-Received: by 2002:a17:90b:4b51:b0:2ee:d186:fe48 with SMTP id 98e67ed59e1d1-2f2900a6737mr6197559a91.28.1734137595490; Fri, 13 Dec 2024 16:53:15 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:ae86:44a5:253c:f9bf]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142f9e186sm3788270a91.41.2024.12.13.16.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 16:53:14 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, Jeffrey Hugo , Julius Werner , linux-arm-kernel@lists.infradead.org, Roxana Bradescu , Trilok Soni , bjorn.andersson@oss.qualcomm.com, Douglas Anderson , stable@vger.kernel.org, James Morse , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] arm64: errata: Add QCOM_KRYO_2XX_GOLD to the spectre_bhb_firmware_mitigated_list Date: Fri, 13 Dec 2024 16:52:05 -0800 Message-ID: <20241213165201.v2.4.Ia3dfc0afadbfbee81bb2efb0672262470973dd08@changeid> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241214005248.198803-1-dianders@chromium.org> References: <20241214005248.198803-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_165315_968004_292BBB1A X-CRM114-Status: GOOD ( 14.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Qualcomm Kryo 200-series Gold cores appear to have a derivative of an ARM Cortex A73 in them. Since A73 needs Spectre mitigation via firmware then the Kyro 200-series Gold cores also should need Spectre mitigation via firmware. Unless devices with a Kryo 2XX gold core have a firmware that provides ARM_SMCCC_ARCH_WORKAROUND_3 (which seems unlikely at the time this patch is posted), this will make devices with these cores report that they are vulnerable to Spectre BHB with no mitigation in place. This patch will also cause them not to do a WARN splat at boot about an unknown CPU ID and to stop trying to do a "loop" mitigation for these cores which is (presumably) not reliable for them. Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels") Cc: stable@vger.kernel.org Signed-off-by: Douglas Anderson --- I don't really have any good way to test this patch but it seems likely it's needed. If nothing else the claim is that that Qualcomm Kyro 280 CPU is vulnerable [1] but I don't see any mitigations in the kernel for it. NOTE: presumably this patch won't actually do much on its own because (I believe) it requires a firmware update (one adding ARM_SMCCC_ARCH_WORKAROUND_3) to go with it. [1] https://spectreattack.com/spectre.pdf Changes in v2: - Rebased / reworded QCOM_KRYO_2XX_GOLD patch arch/arm64/kernel/proton-pack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index 04c3f0567999..3b179a1bf815 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -844,6 +844,7 @@ static unsigned long system_bhb_mitigations; static const struct midr_range spectre_bhb_firmware_mitigated_list[] = { MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), MIDR_ALL_VERSIONS(MIDR_CORTEX_A75), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_2XX_GOLD), {}, }; From patchwork Sat Dec 14 00:52:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Anderson X-Patchwork-Id: 13908230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9F7BE7717F for ; Sat, 14 Dec 2024 00:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wrdqv5su9sKfrkNYXwk3VMWny97c1fSpv0cdthxhYIM=; b=cvxHBW1ZssY2JjBeVlC+c82Zy8 8XyySfQBECS9IJnirJUWnsTkKduRitcaODl38WWjof/qpmg3cn2HTxfQt88OyvHkw06C/W7IIzW1t zLfb3K55sAKNwlyt7r8pzWi8G2B0JQoJmSyv16D0hH4eHwdKACE046eoYPlVQW3d1yEDG35udTHZA TXRc7TkL3EbFtQddFtS8w8COT1ZvQImMMEDCY7/gPKm+G0ddjwNiNYXRdcp2BgN/31+UJI1NnJrAT x1JqEvT+7es4lhqQkdPuPAegrUaBHW8BPD+YNRbH2jvsVGFejkH6WP+IE39lBdinznvmHmpk0dY9G csmYHLhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tMGVQ-00000005Rqa-1Fvk; Sat, 14 Dec 2024 00:59:40 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tMGPH-00000005QnR-0ZB6 for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2024 00:53:20 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7f71f2b1370so1435601a12.1 for ; Fri, 13 Dec 2024 16:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734137598; x=1734742398; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wrdqv5su9sKfrkNYXwk3VMWny97c1fSpv0cdthxhYIM=; b=PJu2Cfv//MyeOuzYMbPOdZViOIE9gkFleB46R3voKJaT+vwIQ8wZ9n2Au+BTLVCMmQ zbrgEp8lxnVqZs8kEGAkgNHCMeOm2yO9LTlcF3ZMA85c7VIYNNd11iBymu3XeNXKYv2q XhOzyIoYX8PX8QHjyV4+xi3xuMiaYEB9wa8rE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734137598; x=1734742398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wrdqv5su9sKfrkNYXwk3VMWny97c1fSpv0cdthxhYIM=; b=JKGprhBE7QVbn0qa4PLlQV/MG5mSjXSuukft6CF/ixkjzxKXyx9IG1C/NLjVDr7rF9 JJ9ViAS81CgYFjP9yRykr6ajJu88oCHUd0wf6PX1UO6I2HWJEH/AdNw00dk7h2NsQRRI NwYudXneRGRBBK6Z7fX5W9exoeL5WmK2Ohc7XOTxzI6q3Jq4AxXA6Brr8D4SdYTQHIXK yhPh+QSXw3Ub5Av8uuDYv/w1ZRHLptjCzermDqY3hh8739vto+O2Ujs8pGc1T9WnGZpi 2OrQieBkcJ7v9m3PFZ2XBRnIudNuqzn03GhykYRB0muITVEDy+vTPTJsYgH5+99JRyIL RIXg== X-Forwarded-Encrypted: i=1; AJvYcCXpIFnr8SXF0MFpOxU48PK1JnI7/nDqfFe/qdVmV9pafyesENsxBBTqpobmHOeRthZr052H/tJVxJKtEQzkOAK9@lists.infradead.org X-Gm-Message-State: AOJu0YzCOmHd2vGojScq6zoh8BMzqFx1IEOdzmLjEJ2GvTeTeTycwFQv Vwb+/tfpqN4WPWuYAsAQ6GoBxAlOqhOD9JsKjbJisa207b1h/8MsxjvJyzxVkQ== X-Gm-Gg: ASbGncuym0sChdsNJbhp9s+DXEQk5u7QWo/yYezdHM88qz5dHXby96z0nQosfUe2PY9 EJ8Ksh0nof6I/wabPFohFjnYY2HD67zM3a4G249JeKBiPqfHqh5GyAyQ/dQIBJFiBgT50fpLH9a sTHnwWo++AaTj03FUgTslYl1QT/1TkL1HPxC68EjK9GzyrZABjQ4V/3Oprd+7o2nLrc/N1yD0Tb yj+MJ9lHHW+X/FPvQTZvE2APWR39yzdzIYzCZuzC2fRy1MWgx7vuQdGwbsSP6zuam88JmW45gXX X-Google-Smtp-Source: AGHT+IHOcPfHNBrkQn6M2DPoYqrW9wGOVpvFmhjU4MB0966dHygCTCiPIakP//mkJvwDEs162n4ynA== X-Received: by 2002:a17:90b:4b81:b0:2ee:b66d:6576 with SMTP id 98e67ed59e1d1-2f2901b3256mr7290054a91.30.1734137598295; Fri, 13 Dec 2024 16:53:18 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:ae86:44a5:253c:f9bf]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142f9e186sm3788270a91.41.2024.12.13.16.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 16:53:17 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, Jeffrey Hugo , Julius Werner , linux-arm-kernel@lists.infradead.org, Roxana Bradescu , Trilok Soni , bjorn.andersson@oss.qualcomm.com, Douglas Anderson , stable@vger.kernel.org, Dmitry Baryshkov , Anshuman Khandual , Besar Wicaksono , D Scott Phillips , Easwar Hariharan , Oliver Upton , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/6] arm64: cputype: Add QCOM_CPU_PART_KRYO_3XX_GOLD Date: Fri, 13 Dec 2024 16:52:06 -0800 Message-ID: <20241213165201.v2.5.I18e0288742871393228249a768e5d56ea65d93dc@changeid> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241214005248.198803-1-dianders@chromium.org> References: <20241214005248.198803-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_165319_178355_AA2E7D7A X-CRM114-Status: UNSURE ( 9.15 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a definition for the Qualcomm Kryo 300-series Gold cores. Cc: stable@vger.kernel.org Reviewed-by: Dmitry Baryshkov Signed-off-by: Douglas Anderson --- (no changes since v1) arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index 488f8e751349..c8058f91a5bd 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -119,6 +119,7 @@ #define QCOM_CPU_PART_KRYO 0x200 #define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800 #define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801 +#define QCOM_CPU_PART_KRYO_3XX_GOLD 0x802 #define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803 #define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804 #define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805 @@ -195,6 +196,7 @@ #define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO) #define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD) #define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER) +#define MIDR_QCOM_KRYO_3XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_GOLD) #define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER) #define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD) #define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER) From patchwork Sat Dec 14 00:52:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Anderson X-Patchwork-Id: 13908232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B9E4E7717F for ; Sat, 14 Dec 2024 01:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nevtJ7/NdNl+3R/l/o9OoX53K9dVtdSsX5xkWCrYzfY=; b=I4lN0UBimuPJAolKCCKtM3Orkj DiPp3MIyEgQlyj5S2SOdzCzMqTBjVaqBMzgaR9De4D08c42fAp6aLqrJ6MpCD9FLp+K9b1xaEaXWI rIyhwWPMMybrjsVgE3tkd6T6gidMXW7e9ApxH6ZsYLkpF0PIHACBtgfsUBUXe0vcsI770yRs0Qg9i RLihdKalRuqqFSHyODlZQvzkD0KycmVL14FYAPecpwv1CQaiQCvFJDNWXULEdKqk2fd33xKEK9XBF pdp5OlcaPrn+ZNupvahuqymYgUzZLwpASxgyjP+3pin9COBJdoAn3DW8l2BLnf0RFV7rORFrVYQpY ohQHs/mw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tMGXV-00000005S85-2V8H; Sat, 14 Dec 2024 01:01:49 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tMGPJ-00000005QoQ-4BsX for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2024 00:53:23 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-7f46d5d1ad5so1705804a12.3 for ; Fri, 13 Dec 2024 16:53:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734137601; x=1734742401; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nevtJ7/NdNl+3R/l/o9OoX53K9dVtdSsX5xkWCrYzfY=; b=KMFX6Ydb6awfjPpuu4xtONuY3bdgiUuX6q0Bd1Bd4No6i8MpU3/THb42rmssQzT4pC TFf7ZOmnTQKCqP5lsy80zOSbIIgZdmw3D7Fc0bD6j3V5DIT3bQgGI3f7ueE8dZvdwTg7 WoIRfsCaXWZ+csRlG/9evlh/RZgaOd2W/ooRs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734137601; x=1734742401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nevtJ7/NdNl+3R/l/o9OoX53K9dVtdSsX5xkWCrYzfY=; b=Paux98FCgsIiKRMv4uDOEPT7el2TDhCHLubOAu/6mGq/J1TyLFJTPQlZ17vyR8Kkk7 0aQpYvrKRkSt9bbFjj4kSniVn5i8z0OQkC16u2UgvhiRfLwJyDeNcXOAlFRwcZ0uyZuY dh18lxotzSIQSwqNyZzvi3vxIuX9xObnQAjqQzS4v+AQYaqDGUJ4cP/9vo5WoSZGWFB0 0g2Usjr8DFV7STLkP0lWmFIhO6UKYqpqKXwmW/XDMYvJLWNIoBfRs/TFGQdGS6T9L5HG 48SHuLlUCgXSfbPphGfXVlU4fH5D6czySiIvNbFDQRooiXdYXcQhY6r2btrlygk6C2S0 quuw== X-Forwarded-Encrypted: i=1; AJvYcCUzK+QVWGxue31LYP6jaxNoIfo+uK5ejrE1oMcDXFF0VZLI6Ibj2+3SYIlI9cEWI7bZe/LZTfFxrEpFrmIMXWIy@lists.infradead.org X-Gm-Message-State: AOJu0Yxm/OWIdECDOacJYqVWFehT+qSkdnBlqqeCRn9bDHCNlz1s39tH BTLu5pGQy64KXojlakNRtIFy+wAv1HqUul1d55Np+VHn/ISoa1A4ejbTNxqWyw== X-Gm-Gg: ASbGncuNRW5uvRnEkbZWfyKqu5fe60iNw55DzI8sS3VW5rnE7WkRhUYy2+cKUG/XbsN 2rQ7iynvk4nXxtWveX9D8y8MpIa7eErUXNBC9q4gENyzKTo0lIT1RO+7YAJOcjIKXJX7/HUvjBL 9RnmHvAz83RgHiXafQ8UarflLNyv1SC80kAZJ6G7L1t2TB+kyp4gJsYOzMiSlAgvihAWYhTV4rm 8uhkYWPPARu9/Ittrotb6hlV5IQhH4HD+ZTla41JS+wBOf6Zf9hbDEt66BzZTQFssE8XX/Mt+sg X-Google-Smtp-Source: AGHT+IFJ8Kx/APKjEY2akHY9UEwVqJx5Yk5K0Is7GrRpeWUBuPmnbC0N3jdlyzrLaN+NBvohTNedbA== X-Received: by 2002:a17:90b:28c8:b0:2ea:b564:4b31 with SMTP id 98e67ed59e1d1-2f28fd73e92mr6735419a91.19.1734137601489; Fri, 13 Dec 2024 16:53:21 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:ae86:44a5:253c:f9bf]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142f9e186sm3788270a91.41.2024.12.13.16.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 16:53:20 -0800 (PST) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, Jeffrey Hugo , Julius Werner , linux-arm-kernel@lists.infradead.org, Roxana Bradescu , Trilok Soni , bjorn.andersson@oss.qualcomm.com, Douglas Anderson , stable@vger.kernel.org, James Morse , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] arm64: errata: Add QCOM_KRYO_3XX_GOLD to the spectre_bhb_firmware_mitigated_list Date: Fri, 13 Dec 2024 16:52:07 -0800 Message-ID: <20241213165201.v2.6.Ic6fdf0e43851269d10596da7e6ceae959431f9fa@changeid> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241214005248.198803-1-dianders@chromium.org> References: <20241214005248.198803-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241213_165322_032868_C51BA4FE X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Qualcomm Kryo 200-series Gold cores appear to have a derivative of an ARM Cortex A75 in them. Since A75 needs Spectre mitigation via firmware then the Kyro 300-series Gold cores also should need Spectre mitigation via firmware. Unless devices with a Kryo 3XX gold core have a firmware that provides ARM_SMCCC_ARCH_WORKAROUND_3 (which seems unlikely at the time this patch is posted), this will make devices with these cores report that they are vulnerable to Spectre BHB with no mitigation in place. This patch will also cause them not to do a WARN splat at boot about an unknown CPU ID and to stop trying to do a "loop" mitigation for these cores which is (presumably) not reliable for them. Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels") Cc: stable@vger.kernel.org Signed-off-by: Douglas Anderson --- I don't really have any good way to test this patch but it seems likely it's needed. NOTE: presumably this patch won't actually do much on its own because (I believe) it requires a firmware update (one adding ARM_SMCCC_ARCH_WORKAROUND_3) to go with it. Changes in v2: - Rebased / reworded QCOM_KRYO_3XX_GOLD patch arch/arm64/kernel/proton-pack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index 3b179a1bf815..f8e0d87d9e2d 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -845,6 +845,7 @@ static const struct midr_range spectre_bhb_firmware_mitigated_list[] = { MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), MIDR_ALL_VERSIONS(MIDR_CORTEX_A75), MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_2XX_GOLD), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_GOLD), {}, };