Skip to contentSkip to conversation

arm64: Add KRYO{3,4}XX CPU cores to spectre-v2 safe list

PATCH Superseded Sai Prakash Ranjan 4 participants 8 messages Jan 16, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: Add KRYO{3,4}XX CPU cores to spectre-v2 safe list

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
 arch/arm64/include/asm/cputype.h | 6 ++++++
 arch/arm64/kernel/cpu_errata.c   | 3 +++
 2 files changed, 9 insertions(+)
arch/arm64/include/asm/cputype.h +6 -0
index aca07c2f6e6e..7219cddeba66 100644
@@ -85,6 +85,9 @@
 #define QCOM_CPU_PART_FALKOR_V1		0x800
 #define QCOM_CPU_PART_FALKOR		0xC00
 #define QCOM_CPU_PART_KRYO		0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER	0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD	0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER	0x805
 
 #define NVIDIA_CPU_PART_DENVER		0x003
 #define NVIDIA_CPU_PART_CARMEL		0x004
@@ -111,6 +114,9 @@
 #define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1)
 #define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR)
 #define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)
+#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)
 #define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
 #define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
 #define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)
arch/arm64/kernel/cpu_errata.c +3 -0
index 85f4bec22f6d..58ba2d1c66a3 100644
@@ -548,6 +548,9 @@ static const struct midr_range spectre_v2_safe_list[] = {
 	MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
 	MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53),
 	MIDR_ALL_VERSIONS(MIDR_HISI_TSV110),
+	MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_SILVER),
+	MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD),
+	MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER),
 	{ /* sentinel */ }
 };
 
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
maintainer
#1 lore raw

[+Jeffrey]

Quoted 16 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
 arch/arm64/include/asm/cputype.h | 6 ++++++
 arch/arm64/kernel/cpu_errata.c   | 3 +++
 2 files changed, 9 insertions(+)
arch/arm64/include/asm/cputype.h +0 -0
index aca07c2f6e6e..7219cddeba66 100644

arch/arm64/include/asm/cputype.h line 90

Quoted 6 lines
arch/arm64/include/asm/cputype.h +3 -0
@@ -85,6 +85,9 @@
 #define QCOM_CPU_PART_FALKOR_V1		0x800
 #define QCOM_CPU_PART_FALKOR		0xC00
 #define QCOM_CPU_PART_KRYO		0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER	0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD	0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER	0x805

Jeffrey is the only person I know who understands the CPU naming here, so I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

That said, the internet claims that KRYO4XX gold is based on Cortex-A76, and so CSV2 should be set...

Will

#2 lore raw
Quoted 14 lines · Will Deacon

[+Jeffrey]

Quoted 11 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
  arch/arm64/include/asm/cputype.h | 6 ++++++
  arch/arm64/kernel/cpu_errata.c   | 3 +++
  2 files changed, 9 insertions(+)
Quoted 16 lines

arch/arm64/include/asm/cputype.h line 90

Quoted 11 lines
arch/arm64/include/asm/cputype.h +3 -0
index aca07c2f6e6e..7219cddeba66 100644
@@ -85,6 +85,9 @@
  #define QCOM_CPU_PART_FALKOR_V1		0x800
  #define QCOM_CPU_PART_FALKOR		0xC00
  #define QCOM_CPU_PART_KRYO		0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER	0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD	0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER	0x805

Jeffrey is the only person I know who understands the CPU naming here, so I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

The added lines look sane to me, from a naming and MIDR perspective. I don't know off hand if these CPUs are really fixed or not.

I wonder why a "KRYO_3XX_GOLD 0x802" line is not being added. Sai?

Quoted 11 lines

That said, the internet claims that KRYO4XX gold is based on Cortex-A76, and so CSV2 should be set...

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 3 lines
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#3 lore raw

Hi Jeffrey,

Quoted 32 lines · Jeffrey Hugo
Quoted 14 lines · Will Deacon

[+Jeffrey]

Quoted 11 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
  arch/arm64/include/asm/cputype.h | 6 ++++++
  arch/arm64/kernel/cpu_errata.c   | 3 +++
  2 files changed, 9 insertions(+)
Quoted 16 lines

arch/arm64/include/asm/cputype.h line 90

Quoted 11 lines
arch/arm64/include/asm/cputype.h +3 -0
index aca07c2f6e6e..7219cddeba66 100644
@@ -85,6 +85,9 @@
  #define QCOM_CPU_PART_FALKOR_V1		0x800
  #define QCOM_CPU_PART_FALKOR		0xC00
  #define QCOM_CPU_PART_KRYO		0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER	0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD	0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER	0x805

Jeffrey is the only person I know who understands the CPU naming here, so I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

Quoted 5 lines

The added lines look sane to me, from a naming and MIDR perspective. I don't know off hand if these CPUs are really fixed or not.

I wonder why a "KRYO_3XX_GOLD 0x802" line is not being added. Sai?

KRYO_3XX_GOLD is based on Cortex-A75 which is not spectre v2 safe.

Thanks,
Sai

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#4 lore raw
In reply to Will Deacon

Hi Will,

Quoted 31 lines · Will Deacon

[+Jeffrey]

Quoted 16 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
 arch/arm64/include/asm/cputype.h | 6 ++++++
 arch/arm64/kernel/cpu_errata.c   | 3 +++
 2 files changed, 9 insertions(+)
arch/arm64/include/asm/cputype.h +0 -0
index aca07c2f6e6e..7219cddeba66 100644

arch/arm64/include/asm/cputype.h line 90

Quoted 6 lines
arch/arm64/include/asm/cputype.h +3 -0
@@ -85,6 +85,9 @@
 #define QCOM_CPU_PART_FALKOR_V1		0x800
 #define QCOM_CPU_PART_FALKOR		0xC00
 #define QCOM_CPU_PART_KRYO		0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER	0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD	0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER	0x805

Jeffrey is the only person I know who understands the CPU naming here, so I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

Quoted 3 lines

That said, the internet claims that KRYO4XX gold is based on Cortex-A76, and so CSV2 should be set...

Yes the internet claims are true and CSV2 is set. SANITY check logs in here show ID_PFR0_EL1 - https://lore.kernel.org/patchwork/patch/1138457/

Thanks,
Sai

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#5 lore raw

Hi,

Quoted 37 lines · Sai Prakash Ranjan

Hi Will,

Quoted 33 lines · Will Deacon

[+Jeffrey]

Quoted 17 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
 arch/arm64/include/asm/cputype.h | 6 ++++++
 arch/arm64/kernel/cpu_errata.c   | 3 +++
 2 files changed, 9 insertions(+)
arch/arm64/include/asm/cputype.h +0 -0
index aca07c2f6e6e..7219cddeba66 100644

arch/arm64/include/asm/cputype.h line 90

Quoted 6 lines
arch/arm64/include/asm/cputype.h +3 -0
@@ -85,6 +85,9 @@
 #define QCOM_CPU_PART_FALKOR_V1             0x800
 #define QCOM_CPU_PART_FALKOR                0xC00
 #define QCOM_CPU_PART_KRYO          0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER       0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER       0x805

Jeffrey is the only person I know who understands the CPU naming here, so
I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

Quoted 7 lines
Quoted 4 lines

That said, the internet claims that KRYO4XX gold is based on Cortex-A76,
and so CSV2 should be set...

Yes the internet claims are true and CSV2 is set. SANITY check logs in here show ID_PFR0_EL1 - https://lore.kernel.org/patchwork/patch/1138457/

I'm probably just being a noob here and am confused, but if CSV2 is set then why do you need your patch at all? The code I see says that if CSV2 is set then we don't even check the spectre_v2_safe_list().

-Doug

maintainer
#6 lore raw
Quoted 39 lines · Doug Anderson
Quoted 37 lines · Sai Prakash Ranjan
Quoted 35 lines · Will Deacon
Quoted 17 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
 arch/arm64/include/asm/cputype.h | 6 ++++++
 arch/arm64/kernel/cpu_errata.c   | 3 +++
 2 files changed, 9 insertions(+)
arch/arm64/include/asm/cputype.h +0 -0
index aca07c2f6e6e..7219cddeba66 100644

arch/arm64/include/asm/cputype.h line 90

Quoted 6 lines
arch/arm64/include/asm/cputype.h +3 -0
@@ -85,6 +85,9 @@
 #define QCOM_CPU_PART_FALKOR_V1             0x800
 #define QCOM_CPU_PART_FALKOR                0xC00
 #define QCOM_CPU_PART_KRYO          0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER       0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER       0x805

Jeffrey is the only person I know who understands the CPU naming here, so
I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

That said, the internet claims that KRYO4XX gold is based on Cortex-A76,
and so CSV2 should be set...

Quoted 6 lines
Quoted 2 lines

Yes the internet claims are true and CSV2 is set. SANITY check logs in here show ID_PFR0_EL1 - https://lore.kernel.org/patchwork/patch/1138457/

I'm probably just being a noob here and am confused, but if CSV2 is set then why do you need your patch at all? The code I see says that if CSV2 is set then we don't even check the spectre_v2_safe_list().

You're not being a noob at all -- you're making the same point that I was trying to make :)

So I think we can take this patch with the KRYO_4XX_GOLD part dropped.

Will

#7 lore raw
In reply to Doug Anderson

Hi,

Quoted 46 lines · Doug Anderson

Hi,

Quoted 42 lines · Sai Prakash Ranjan

Hi Will,

Quoted 37 lines · Will Deacon

[+Jeffrey]

Quoted 17 lines · Sai Prakash Ranjan

KRYO3XX silver CPU cores and KRYO4XX silver, gold CPU cores are not affected by Spectre variant 2. Add them to spectre_v2 safe list to correct ARM_SMCCC_ARCH_WORKAROUND_1 warning and vulnerability sysfs value.

---
 arch/arm64/include/asm/cputype.h | 6 ++++++
 arch/arm64/kernel/cpu_errata.c   | 3 +++
 2 files changed, 9 insertions(+)
arch/arm64/include/asm/cputype.h +0 -0
index aca07c2f6e6e..7219cddeba66 100644

arch/arm64/include/asm/cputype.h line 90

Quoted 6 lines
arch/arm64/include/asm/cputype.h +3 -0
@@ -85,6 +85,9 @@
 #define QCOM_CPU_PART_FALKOR_V1             0x800
 #define QCOM_CPU_PART_FALKOR                0xC00
 #define QCOM_CPU_PART_KRYO          0x200
+#define QCOM_CPU_PART_KRYO_3XX_SILVER       0x803
+#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
+#define QCOM_CPU_PART_KRYO_4XX_SILVER       0x805

Jeffrey is the only person I know who understands the CPU naming here, so
I've added him in case this needs either renaming or extending to cover other CPUs. I wouldn't be at all surprised if we need a function call rather than a bunch of table entries...

That said, the internet claims that KRYO4XX gold is based on Cortex-A76,
and so CSV2 should be set...

Quoted 7 lines
Quoted 2 lines

Yes the internet claims are true and CSV2 is set. SANITY check logs in here show ID_PFR0_EL1 - https://lore.kernel.org/patchwork/patch/1138457/

I'm probably just being a noob here and am confused, but if CSV2 is set then why do you need your patch at all? The code I see says that if CSV2 is set then we don't even check the spectre_v2_safe_list().

I am a noob here and didn't understand what Will meant ;). V2 posted now.

Thanks,
Sai

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation