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: 13908219 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E6BEDF78 for ; Sat, 14 Dec 2024 00:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137591; cv=none; b=K+C9LRcTbwv4gLswnVpQjTc/SbHnKiTJMfsLntPNq8ycCFTZV8XpJgN3Vhd4xXcxIYHR3ytNl5qHeZJyfNO59rvZmsq4SZYInS64jxtrLTZ0TV9OcmJB549rAv9vAZpLR18Go4OamDM6skQ0eO2RrmB0B9vp2A4hzF9xxoU4l4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137591; c=relaxed/simple; bh=9VcI1y4DrqTHAqxzGhnqIkcAzN8r48f8mRzXZKwipic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ocTWnStrzb3frzG1bbQtwAbcFwSubzT++DKH2wQeVGqr+743rxcSXLcCPEMVR0FPDI50aucohLkfKFWRB50iEDBmhD2QtV/j6U4C79rVbK6A3Wu7gx4qV5jKhdinemejkhGMumx2XAz8tPMhjg/ioqRRPiw2G6/dEMI8ABJ/kJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=XZhzuWgi; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XZhzuWgi" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2eed82ca5b4so1952440a91.2 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=vger.kernel.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=XZhzuWgiWcMoHTc1oBI2ureLcOzeudbOg7Sl9c9eMJx03AbZgEc9ZyLe08aNBR/CRn gEUDvPZJ19Gx63EvcNB4tMIB5kZHkMfz6CO8+J0Ss3LsRL8cr6oFwiJ2dbXpFTHi7enT tGwu9cOXFQmAHinwhGahaSsENDbxIrwXf1/q4= 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=tKHQBt+i1Swu2hNAvhwfy56Td+jl2YC668MLnKfInEJhG9eA9WSER78eiiV+JczV/W GAxOMSzOm0ngjpYRM/oSb9BS69X2N1YYnXBx+f+xl4skw8ZgO5m1H//WeMQ2zfnKpNxL q3Hy+J2BN5mOt2M0Gi+MJX+6oZenXUk5nUdtn/vGdKuJAs0s745QMS5YEFrrDlnRfeBM ds46yWWNKIdNnDcNjDL5yfZAuJZjChdcLfBYNEcFiZNZ23WnsILTjo3jzDYmNbVB3FWs YNe6qzxVGEljNSy8y50id0Fvk11F59WbSJmi7mZkiUBOl7sjTsFO1uDWvxPVblZGXklG ZqxQ== X-Gm-Message-State: AOJu0Yx1v2mudW+nbzWwN9H7vjbZjgQCPkI6sfuMgzop3urnZk15zdHQ VH3GFJVLEzV55kfilheiE92ZmDfhgIw0tiRISFxMumUzNraS2ugHzxBnFHy9kA== X-Gm-Gg: ASbGnctTqrYbTKj22hFISVv5K3RcrBbngN8QyIP+VQLKPV4BN8PcX7UswFLR4PJVqA9 mQD1bESMbdQLQ0H3muSGUPH+suRG9vHfJHDprCcZnM4Gqd1F2jUsLV42K44UllDwe4F9jx+wtkf YyB1fG+dwHlGcPMqvHQsBWoFBzV6NArMIKFtjBmONWL68F2zmRg/79j6wPTXjwS3gObodAIUspe c+y0vF1xpTHnSUm+ivJYSXvcpWi+GZ75hf+6w22v2Wp0gSb7oYTWSQDUOuXHhFBlF3fNyUKmn6m 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13908220 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 915B116419 for ; Sat, 14 Dec 2024 00:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137593; cv=none; b=HjaUvmKxi34bbM3th694LZ84q95wXrMB5ARD0/iXk7DqBMgF4TrGUtbGAZk+emzcmXc+UdcT0oC5NxPDpvHe+gfqz54mrB1zR6mW0AmF3Zaf/n09c+1sEAt+d3dmMYkfgAowb4atdp0Z3L8O4v26u8SknoPnJzZEal5hZK1UwN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137593; c=relaxed/simple; bh=XJYoVV8JvXnn2NiRA98wpV2UEbpgwE4/KHVxl3uEyMQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HPsDje0CF1FpeEHZnAiPrVYc/MZrbDYIA+nWI9mZL+n7eXn+0qeShIoUA16nKM2BElKCMFdq8+HW4Rm/oqhsfEn0qG6nDVVNux+8yq8BsHryhXr6u7Qa35oCYEfz7pC6mb7BQvXnxK4lF9+wOrVpr5/LSpvfzU87mPKOnIQGk3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=YMpYUjip; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YMpYUjip" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ee51f8c47dso1623025a91.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=vger.kernel.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=YMpYUjipeqgd3d+86PYmi/8aaRdHXrJB+kDlh/kGvDKOI/oPhe4BawB4oowi4YjciO Mwn1u117Ukt3WScrLoOAJgIMDqV1UhKg+GNTWqkR+KvpHpY8NqHfWycYGfAm20Z9ggmu ECbKxBttSkpIpTheg8qAdzhT7MQGmSNqwD5lg= 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=Wvk+9/bzGuXDJOgweMobvrUZQNGbafIgie+dskXEScFqQyEaPBpp+2Wmxwtvcmcr9j YB96der4ouH7OxZCmAqa0lf3rm7gmRjpKHEkbTrdUUwxPpKQePaEf5S0b7CnBMXYiKxv TExuZCkPw1xJnroIzEpoEoaa5+fLp6hQi7P5jsnIU73GPhdF1dYotV19Rplw3PTAaRpy qJ9XNo1WiDRWdimzcY1fisK6iAVLQD69cmH1ViFpyyGIn9BG69+ACovOQY3YKhc/YOHj IJ9ZOrUqmAnnRYictw0gjTMYLSglPCT2RVsmMHhevxp494B3tATVjFRjFWeemqTjABel aTAw== X-Gm-Message-State: AOJu0YwDp8L2wCMh7j0BR2HQYaRixPk1P5jDUqW9ORDfcElIp16LpqAI eFxBC/BOEWwg3635YC3Nc/bXb5UFzOeFz1WmQveUo63g5BVE+L9gawnc9AfXjg== X-Gm-Gg: ASbGncs33FYZmHk2kv/iaaYcCXydlSnOKsw+Zhps66HNy2UPXRzPpQtXMU+2NY5MEUS PVBMrt3fqqHLLxyJsQzVDxAnrYLbFqAimqvYkRXoPhik6IfTqs323/MU4/9jsRXSpBveVblCpx2 SMR1ulPlDFtODOknunrjbRgycgKWhf7GIgyPtiU/VOJAU9bRp8qBvqYbJKpPHXBf7j9zIFRknHy 0QNyO1UVUcp/ZUvW22ia/r+jnQEejLa6kU57U91KSayH4BxAUgVtdd3njlBdlXk4Y3krooZU1Qn 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13908221 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF064219E0 for ; Sat, 14 Dec 2024 00:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137595; cv=none; b=iBcEHvDxMZJ9/NPJTD3hVld4zjrLrMqJXhKjMGiufbOs/BnUjV5U8o7BcLiTFidJLerLfLSEE0DuqFU2UhmGFMOsf01qyEWFcztg8M5OOFIEmz6YQumU5uDDhgJZJnX8IqkZ0jFsg07FbCAp8V5xwDqtx4q7X1yQz0uOxw1HTvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137595; c=relaxed/simple; bh=V7gKntkQ8bwv+lZaockCmjTF5uEC8vW5YtYKvCaU2Ck=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CZubHULUU9+pMF3a5CwOqkOnAE7TX/YjTUHnE8PbYS2QtrjnJlVv8qt+YB896uN4SApBffpFBJkPKkeRE37z+pqBF/EIGjKOBhLm00yVJTd6mn7hpcf2s4sk/OQUe3UaH39qFkc2U7w+dOOEJxCfMYEJS9KhrZtRBDTJpIhTCMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=oYcM4koi; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="oYcM4koi" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2ee8e8e29f6so1784082a91.0 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=vger.kernel.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=oYcM4koiQzAZLEfY3lLfB8Eg/+jZLKhC+RDOkk0iMvD1IZ4szKZz7VsKMcxvQFEoMi 8SjDmFAT7VHHLV14kp9igz74bRjd2zw3H4vr0pZAtavzuSmwLFR7M0DgODsqdji9NfhN Bq8wYqP4cKeQFMpZ1sz0iVdaLhQs2PenGONpI= 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=OtyJZ7PtZ5pgegi6x+ka+tzG98WsP7YvTdX5DzWwwOiB9+H8ILzu76KVnIJdfzcV2o uxNkCRrYr1wNgoTwwPF81dNd2SSuWZOPoIp2NorcnPfYw56NpJakJtk9VmfK4jfbQPL/ 7XQaweoHKZ9H1nFDZM3lk7d5V2BPGtmSLGUM57CUHHwxGC69XnF71pjWUogVP/HKNYNL Wu9x0/tHiI1jewnpYAxqlIdhraI15fsv2aVcsz/klT+CPfNeN2vz7x+VMs7gs84W9qv4 hhJlB92Tekt2LynPE7v4ffRULMaABGLBZWppTniI5Lq1x6vs+8fDYCnoZZxpFQPG+WKx XHFw== X-Gm-Message-State: AOJu0Ywrwg3W/NVDowx6OcNOgqFKUCJmNWaDOzbhENpTK2y+jmJ0YfSM SpbUd8XiEB4QZY9MDsXlvqcFuLtVUvXtHbo/pdDienP9ViTLn4sfknDFuyIYiQ== X-Gm-Gg: ASbGncsxZiMQhhIivmyCKkIDW4JvbmIuxGGkOMF0CAjsYAZHU1mA/BjHcosxYbp1ykn /CoPXzcakxs2QV9iRWjYRI5oEU7nkupKXdehvZRtwy0+zLTGQOPFJ89EpiGxc2LmqGsqQinpi0y XmXDmXyfngTIJ/+bxr84xSUbuGC0OAgJIvDb58JOM5krgqfGxinOrtXkWBlFnLQVosWxH7Hb3d6 E9L+5Dy//8SrAenURCPgCCrW3PLF0fw4IIz2s5Uvg3V49QNbyG9C980K2aSR1Rw22nhRxyecrCI 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13908222 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DD963A268 for ; Sat, 14 Dec 2024 00:53:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137597; cv=none; b=gfSdwmk1GNKNT8R64AcZRthGN1rsAK8Rs3/uJfaWsJYO84YwLSZ8KDK8FpcXIYFSQfGdc0dGOkFwy+v1p6MRgkxGoux4WbqkW4lwdgvjcQPwzSZo0ZUToVW5+NsD4RKPnSd+G7+efTuPLHXh5zU6K2bp+keM6xe0lovYNhRSnvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137597; c=relaxed/simple; bh=DRY0q/4lkC+b+1JUfhPJH5/uaKyj3aTDNMkw3d4TEtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8cfCtHzEtcv8EHjH8bKOvTCn4XuWA0yjEg053r9FPZSEA+c89gpczNaZ69qMoLKeBjV6FCxhK5JALLEvAWtQWAm/pS6RjZGuBZVZgUo3nVXvKTYKNQfng5ufgephaQBVZAR2HsvNhI6ya1xvkipgmva8wWsrwGNBxGIjHrSXe8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=GHL4kUZj; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GHL4kUZj" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ee709715d9so1578728a91.3 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=vger.kernel.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=GHL4kUZjkPzxKX1jDExTn8dwjkfBeXQlCWHpgGr0ReFoOfNeVe6FmegXcR7b4eZEn+ oZw0cYSWuW5TtTdSZLsEMEC29biGthIEZPi6iu2z1rTty6sskaE8S/AJVmpSxFEZPluV YfzD/h2JNRDR4y6yccpfDsbdqTGuK0bHta9dI= 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=FCGKeFrcvLyoI/JfnGbbUCeKBDgBJlsBbDrARVroWxKQ06BFZ0pZOHoCOi9kPQx3Np lZCO0PksuKbtpbmHt0N79yCzlhxD9QV4BMORLvcRUrco4DPyKs7Qg3DvTULM3NfAsx3r FpVwmDBEJrZpeMAuRQuo+2E63Cm3/cHNuxyxlO0RjHAoyGlDXJOemhE9SgzUTMVHnuyT /KdBzbGW3+60SJ+WKd+4GkKWumdV9jaJ5J3sRPi5YOQv8s+ST/nMG/Zp/NuL32be7wZ9 m1GyBaKzmnFLITfqlwNSJn1RoXIJf+GxndLh+722UFI1MY6AIRrHvhvhtbdn76jAXcB3 v16Q== X-Gm-Message-State: AOJu0Yye3RnYg78mBZqK/sE879kAHkT9pwzZJbVg8Ei0PVKRnMuQy9mx jA6RCpAcvPdtqwdbEtrCUab6AtnxFMbp/N/sP+7QOWvUxzrbrUlUoT0bLU0wVg== X-Gm-Gg: ASbGncuVr8URlkV/bmZVQ1EkJzS5JqNVoFUeQUGEH8CdUEK8dlhM6rQRn0jtos/pGO2 aP4NYJKn2GOwk7S+nzdt9hqE/8fbpDIzDzercZEuqiznfR5Gc/BPQyxCgh/1Wxc8dSYQ7onFYKZ z+ERi5CbTY4yqcEOYKWw09Hy0wyRWUJ2ytgVxDQr8tf8xLTc1+i2bZhFudRKtOOiNYqgYu+5TK6 aLh+kMwsEJQYDmC4NhdowIgLZ4l6L1LXDXwXkdDIh6uZihNiRt0+1ozK74ztBG8gjxi0Aebx5yH 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13908223 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D49B474E09 for ; Sat, 14 Dec 2024 00:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137600; cv=none; b=bot7o27gLOlPJoBtIu/kU7RxvKFejHoEZ0Tjja5fdTv5QC3/GBU/ADNfC2MQYepM9XxfwS2Si86yAbsRuDjOf0UjkFBMyITPcbh63H97Xbta7RWh/fpGdqTgZnwonA+rPoC72IdlPSQkUCBeH1+7OuGAjzJ+SMuIzGdXGHbiPaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137600; c=relaxed/simple; bh=wtOPnKbsorF7XJRH1GXzXj2KmpV4JSzbTQjjrqjiA1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u7AlJk7m/Mj+ff4q5lgC0zmOhFAmh5KjjUSEzKc5tDK8HNwdLdYBfMhsureDNaDXM2sryY8rR3e0d/2uktUXXgOxZ19FLt6dO7pjdYXqPx+0yRE81AhzJYtxCIuJ7WA5lHyPDw289TdjJH8r2LwLFt/tcWEBHu52tTkRPoyIThk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dnexty68; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dnexty68" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2ee46851b5eso1581875a91.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=vger.kernel.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=dnexty68MmZaR2XUnmm8HfrxZKDViRGTfHbMiwe8Du5vrjkrHxU2BiyoSs4MR2U1LT eK6VvUTg30WllBGRgxU4qJfL1G4jyZq1W/2+daHbUWuztmkSoe0xgMrOExMZwLA6WGIJ CCHPcvCsY7eVFf6q/M++P0NBfDvhlzS9kRSTo= 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=X/8xmDbHe8GhLLct1Q2llKxvoHbKy6QCAhyxQkBR2JvaxTcblWx0Lfl4yiiTrzyQyd fgjeP0hOWGbd8bUvswW3QWWLIGACBAgMr2TaSi+F4mAPEFyyC37Xt7YoZKu4oEr0Ew7B 4zhdHIS5RpdkaA3P6DY08MNsr6EVt1Xmwk+e3tTNsqQPzFocCRoEY9xpB9x9+3U3/aov VY6XcOlirHBXs8bO+skVcp/M2yJwSgoyx8xbWD7jzcRjvNDJgM00igMcc8JwwVLt9EQ7 mBJLzQzprHYQ3BN5IVhUm20dqlx4/9O2qS1Ip4UBwVuE5SB5cFd4oXe9JAwu6FPDNV7l ChmQ== X-Gm-Message-State: AOJu0YwJ0sqjCAsivc/kbjbO1vdgkv7m70Uc4XWCOpQBcLtZ8WxotHwM 1C410FmlZ887JJRLKHif4NJ7gBTcG6kCKIfW9beLtubR8RQseLdKiADywbQdEg== X-Gm-Gg: ASbGncssmEprUpHiH+hMtXiqs5UJIo/F1IaS03OIDXiC7DQt14+/Tt+qjVWHGnHqeOu 6VtVeQB7O3delWThXbqe9ewvfhYlqk/urhITWgqtv19hQBaRqq81HIiEaSiS4SLs0Wxhh6f8oCq dnr2KTISIIUtGrLnst/4qNhTmgjo9r5yOMxEXs0XRam32R/Olpe+lGNGELfIdHFy1n8jgOpe1T7 Evr0wYgK+XolabST1VRBQKkV6iUdqZszlBaPtUGO2UY3MVjfU/jpRy1ngrLk2LWFbCycQnJV9yq 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13908224 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 177D47DA9C for ; Sat, 14 Dec 2024 00:53:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137603; cv=none; b=adH3QcA4VBzrTJxP9uSprGRjUQwk9je3FaDnXmPMyhwWU3noyr4jYnk6t7NJBrjg3kr9hQeeU3alBiihFB6MobN2LPhP6Nlf51jfSurIRNJwbG0ycMWRmStI7XVJEffBJJePskghgy8h73UgqUQS4P+ydJ4lujZ4nvukorzSG+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734137603; c=relaxed/simple; bh=0U4zcnqAM+KNnaDs1qdzfHSYLMjiJX0a1xgu5GDyZrc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mNd0pSWrUzHlIYenDDNIKy144KzCxlL2VdfcUkQZdRFV27zDNdIjWUmNITBd6ne9Lo9EIHcZoTEOwo0SnwHTJV/vvFMawFleIiqAWI+d9eQooCLXZEiS+jm4SgA3VuFKF7EyfSwpq21MCT9pxwHT7jy98Bf2IWwbh7VHEaTCumU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=PS/SVhCA; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PS/SVhCA" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7fd4998b0dbso1988459a12.0 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=vger.kernel.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=PS/SVhCAkcmyNf6MBKpLf1h38taoACTzmNvKUhpMesqWOGCxLxpXfR7eUps1YtNyFV jwl8eKpVozbME8IoVWETe4yt9Z2sH99+YS/Oo+oxjZgWTt4LRZQCtGIsDLpgddeqhnsr jEvKuSICPqgOK/N+X9fvr5EglnS8aRiiZ9Z5w= 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=VODXnpYtkHRyvKTjuV87yPSDK4xNCxxpeZ78DlG/tdkXxchJ5gxs+uyg2Qxe5OXwpT z35zPYa+DMUS3kAOB3/qKdz/NHIubksAZUFdDpPpdGs8WxT4Tx+Qxdizv6s5twwDrDVy vJK/sZhQJaP4Wr/v1ySJuEzi2aCJSV/Ylmq0rjMAwLcd0WTvjaypDDY07FvBNztPvrTK 2KlYG3rCCKZnJVlD5CTLyEVBfM1g6aSREmDd51nqbZl550cZF2IJ6PFXpLN0dgWUgaNn vlVqJDhDSBPQfOxK7EEkbMtu0qfh1DzsAfKXx7y2WS1FXCcKxyqZIUvrBSQ4NMMOZYDp LPaQ== X-Gm-Message-State: AOJu0YxABjw9uP3P+cxuHKfSKZMGg6/Q4vNnnM81TN85KqXdHXqQM9B4 jDBXIetqoYBG+5cWkA87Z+Bc7K1PU0TmOQBH/iLRG8JnuSd84nFna8EmzcIwQw== X-Gm-Gg: ASbGncut/9vY9EjKZyVA3bCiLOlUdsMPBCZQytxHv/q3ujv8IwoGYS4wbTc6gX6dxA+ iw0yDzv0i7VHAcX29vN+/ZvNrmSP5iOu5wNOOBtLcPf9zY4+k/gso2NOtPA0BjO2TpmvxWMK8Cn mSY8gmzPYdrUOqUOQML79RXeCgndFOKtBeg1cWAEMVCVlctjh6ygM/kUeQgZyZiP+NOicGVrPK+ FzkdItHmCxet9viZ4tCMLHyDXmorAOt0tLEJ1ENxwUtM8TDoMiJEW/2eG/G8iHsjs8XomC2b58V 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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), {}, };