arm64: Remove checks for broken Cavium HW from the PI code
Marc Zyngier
maintainerPATCH 1/1 arm64: Remove checks for broken Cavium HW from the PI code
Calling into the MIDR checking framework from the PI code has recently become much harder, due to the new fancy "multi-MIDR" support that relies on tables being populated at boot time, but not that early that they are available to the PI code. There are additional issues with this framework, as the code really isn't position independend *at all*.
This leads to some ugly breakages, as reported by Ada.
It so appears that the only reason for the PI code to call into the MIDR checking code is to cope with The Most Broken ARM64 System Ever, aka Cavium ThunderX, which cannot deal with nG attributes that result of the combination of KASLR and KPTI as a consequence of Erratum 27456.
Rather than adding extra complexity for something that is actually a very dead horse, let's simply drop that check. On my own machine, the firmware doesn't provide a KASLR seed, preventing the pathological case to show up.
And if someone does have a broken box that passes a seed to the kernel, "nokaslr" on the command-line is an easy enough workaround.
--- arch/arm64/include/asm/mmu.h | 11 ----------- arch/arm64/kernel/cpu_errata.c | 2 +- arch/arm64/kernel/image-vars.h | 4 ---- 3 files changed, 1 insertion(+), 16 deletions(-)
arch/arm64/include/asm/mmu.h +0 -11
@@ -94,17 +94,6 @@ static inline bool kaslr_requires_kpti(void)return false; } -/* -* Systems affected by Cavium erratum 24756 are incompatible -* with KPTI. -*/ -if (IS_ENABLED (CONFIG_CAVIUM_ERRATUM_27456 )) { -extern const struct midr_range cavium_erratum_27456_cpus[]; - -if (is_midr_in_range_list (cavium_erratum_27456_cpus)) -return false; - } -return true; }
arch/arm64/kernel/cpu_errata.c +1 -1
@@ -335,7 +335,7 @@ static const struct midr_range cavium_erratum_23154_cpus[] = {#endif #ifdef CONFIG_CAVIUM_ERRATUM_27456 -const struct midr_range cavium_erratum_27456_cpus[] = { +static const struct midr_range cavium_erratum_27456_cpus[] = {/* Cavium ThunderX, T88 pass 1.x - 2.1 */ MIDR_RANGE (MIDR_THUNDERX ,0 ,0 ,1 ,1 ), /* Cavium ThunderX, T81 pass 1.0 */
arch/arm64/kernel/image-vars.h +0 -4
@@ -47,10 +47,6 @@ PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override);PROVIDE (__pi_id_aa64zfr0_override = id_aa64zfr0_override);PROVIDE (__pi_arm64_sw_feature_override = arm64_sw_feature_override);PROVIDE (__pi_arm64_use_ng_mappings = arm64_use_ng_mappings); -#ifdef CONFIG_CAVIUM_ERRATUM_27456 -PROVIDE (__pi_cavium_erratum_27456_cpus = cavium_erratum_27456_cpus); -PROVIDE (__pi_is_midr_in_range_list = is_midr_in_range_list); -#endif PROVIDE (__pi__ctype = _ctype);PROVIDE (__pi_memstart_offset_seed = memstart_offset_seed);
Signature · 1 line
2.39.2
Quoted 21 lines · Marc Zyngier
Calling into the MIDR checking framework from the PI code has recently become much harder, due to the new fancy "multi-MIDR" support that relies on tables being populated at boot time, but not that early that they are available to the PI code. There are additional issues with this framework, as the code really isn't position independend *at all*.
This leads to some ugly breakages, as reported by Ada.
It so appears that the only reason for the PI code to call into the MIDR checking code is to cope with The Most Broken ARM64 System Ever, aka Cavium ThunderX, which cannot deal with nG attributes that result of the combination of KASLR and KPTI as a consequence of Erratum 27456.
Rather than adding extra complexity for something that is actually a very dead horse, let's simply drop that check. On my own machine, the firmware doesn't provide a KASLR seed, preventing the pathological case to show up.
And if someone does have a broken box that passes a seed to the kernel, "nokaslr" on the command-line is an easy enough workaround.
Quoted 8 lines
Fixes c8c2647e69bed ("arm64: Make _midr_in_range_list() an exported function")Reported-by Ada Couprie Diaz <[email protected]>Signed-off-by Marc Zyngier <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Shameer Kolothum <[email protected]>Cc Oliver Upton <[email protected]>
The fixed commit went in via the KVM tree. Oliver, Marc, let me know if you'd like me to take this as a fix via the arm64 tree (either way is fine by me).
Thanks.
Signature · 1 line
Catalin
Quoted 21 lines · Marc Zyngier
Calling into the MIDR checking framework from the PI code has recently become much harder, due to the new fancy "multi-MIDR" support that relies on tables being populated at boot time, but not that early that they are available to the PI code. There are additional issues with this framework, as the code really isn't position independend *at all*.
This leads to some ugly breakages, as reported by Ada.
It so appears that the only reason for the PI code to call into the MIDR checking code is to cope with The Most Broken ARM64 System Ever, aka Cavium ThunderX, which cannot deal with nG attributes that result of the combination of KASLR and KPTI as a consequence of Erratum 27456.
Rather than adding extra complexity for something that is actually a very dead horse, let's simply drop that check. On my own machine, the firmware doesn't provide a KASLR seed, preventing the pathological case to show up.
And if someone does have a broken box that passes a seed to the kernel, "nokaslr" on the command-line is an easy enough workaround.
Quoted 8 lines
Fixes c8c2647e69bed ("arm64: Make _midr_in_range_list() an exported function")Reported-by Ada Couprie Diaz <[email protected]>Signed-off-by Marc Zyngier <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Shameer Kolothum <[email protected]>Cc Oliver Upton <[email protected]>
Thanks for the fix ! I can confirm that it resolves all boot failures I was observing previously. No instances of firmware seeding KASRL in the couple of machines I am testing either.
Regards,
Ada
Will Deacon
maintainerQuoted 75 lines · Marc Zyngier
Calling into the MIDR checking framework from the PI code has recently become much harder, due to the new fancy "multi-MIDR" support that relies on tables being populated at boot time, but not that early that they are available to the PI code. There are additional issues with this framework, as the code really isn't position independend *at all*.
This leads to some ugly breakages, as reported by Ada.
It so appears that the only reason for the PI code to call into the MIDR checking code is to cope with The Most Broken ARM64 System Ever, aka Cavium ThunderX, which cannot deal with nG attributes that result of the combination of KASLR and KPTI as a consequence of Erratum 27456.
Rather than adding extra complexity for something that is actually a very dead horse, let's simply drop that check. On my own machine, the firmware doesn't provide a KASLR seed, preventing the pathological case to show up.
And if someone does have a broken box that passes a seed to the kernel, "nokaslr" on the command-line is an easy enough workaround.
Fixes c8c2647e69bed ("arm64: Make _midr_in_range_list() an exported function")Reported-by Ada Couprie Diaz <[email protected]>Signed-off-by Marc Zyngier <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Shameer Kolothum <[email protected]>Cc Oliver Upton <[email protected]>--- arch/arm64/include/asm/mmu.h | 11 ----------- arch/arm64/kernel/cpu_errata.c | 2 +- arch/arm64/kernel/image-vars.h | 4 ---- 3 files changed, 1 insertion(+), 16 deletions(-)arch/arm64/include/asm/mmu.h +0
-11@@ -94,17 +94,6 @@ static inline bool kaslr_requires_kpti(void)return false; } -/* -* Systems affected by Cavium erratum 24756 are incompatible -* with KPTI. -*/ -if (IS_ENABLED (CONFIG_CAVIUM_ERRATUM_27456 )) { -extern const struct midr_range cavium_erratum_27456_cpus[]; - -if (is_midr_in_range_list (cavium_erratum_27456_cpus)) -return false; - } -return true; }arch/arm64/kernel/cpu_errata.c +1
-1@@ -335,7 +335,7 @@ static const struct midr_range cavium_erratum_23154_cpus[] = {#endif #ifdef CONFIG_CAVIUM_ERRATUM_27456 -const struct midr_range cavium_erratum_27456_cpus[] = { +static const struct midr_range cavium_erratum_27456_cpus[] = {/* Cavium ThunderX, T88 pass 1.x - 2.1 */ MIDR_RANGE (MIDR_THUNDERX ,0 ,0 ,1 ,1 ), /* Cavium ThunderX, T81 pass 1.0 */arch/arm64/kernel/image-vars.h +0
-0
arch/arm64/kernel/image-vars.h PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override); · line 53
Quoted 7 lines
arch/arm64/kernel/image-vars.h +0
-4@@ -47,10 +47,6 @@ PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override);PROVIDE (__pi_id_aa64zfr0_override = id_aa64zfr0_override);PROVIDE (__pi_arm64_sw_feature_override = arm64_sw_feature_override);PROVIDE (__pi_arm64_use_ng_mappings = arm64_use_ng_mappings); -#ifdef CONFIG_CAVIUM_ERRATUM_27456 -PROVIDE (__pi_cavium_erratum_27456_cpus = cavium_erratum_27456_cpus); -PROVIDE (__pi_is_midr_in_range_list = is_midr_in_range_list); -#endif
Hmm, I'm not really sure about this as it seems to be punishing the poor user of the box who really hasn't done anything wrong. The firmware might not be passing a KASLR seed to the host, but what about guest VMs? It's pretty easy for the VMM to stuff a seed into the DT, so if somebody was running VMs on TX1 with kaslr before c8c2647e69bed ("arm64: Make _midr_in_range_list() an exported function") and things worked, I don't think we should be breaking that so that it crashes in weird ways.
Could we just read MIDR_EL1 (read_cpuid_id()) in the PI code to detect ThunderX that way? I'm less fussed about the multi-MIDR code working on this machine as it's a new feature (and we could disable the new hypercalls here if we really cared).
Alternatively, we could properly rip out the TX1 support and fail to boot if we detect it. At least that's deterministic and we could have a useful error message about the thing being unsupported.
Will
Marc Zyngier
maintainerQuoted 8 lines · Will Deacon
Hmm, I'm not really sure about this as it seems to be punishing the poor user of the box who really hasn't done anything wrong. The firmware might not be passing a KASLR seed to the host, but what about guest VMs? It's pretty easy for the VMM to stuff a seed into the DT, so if somebody was running VMs on TX1 with kaslr before
c8c2647e69bed("arm64: Make_midr_in_range_list()an exported function") and things worked, I don't think we should be breaking that so that it crashes in weird ways.
That's a good point, and I should have thought of that.
Quoted 4 lines
Could we just read
MIDR_EL1(read_cpuid_id()) in the PI code to detect ThunderX that way? I'm less fussed about the multi-MIDR code working on this machine as it's a new feature (and we could disable the new hypercalls here if we really cared).
Yeah, probably. Let me have a play with this thing again.
Quoted 3 lines
Alternatively, we could properly rip out the TX1 support and fail to boot if we detect it. At least that's deterministic and we could have a useful error message about the thing being unsupported.
That'd be the last resort, and I'd rather keep this machine alive as this is the only v8.0 box I have with 16kB page support.
Thanks,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.