errata.c (a8e910168bbad5c901202727470e601eb2489ec1) | errata.c (a35707c3d850dda0ceefb75b1b3bd191921d5765) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2021 Sifive. 4 */ 5 6#include <linux/kernel.h> 7#include <linux/module.h> 8#include <linux/string.h> --- 74 unchanged lines hidden (view full) --- 83 84void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, 85 struct alt_entry *end, 86 unsigned long archid, 87 unsigned long impid, 88 unsigned int stage) 89{ 90 struct alt_entry *alt; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2021 Sifive. 4 */ 5 6#include <linux/kernel.h> 7#include <linux/module.h> 8#include <linux/string.h> --- 74 unchanged lines hidden (view full) --- 83 84void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, 85 struct alt_entry *end, 86 unsigned long archid, 87 unsigned long impid, 88 unsigned int stage) 89{ 90 struct alt_entry *alt; |
91 u32 cpu_req_errata = sifive_errata_probe(archid, impid); | 91 u32 cpu_req_errata; |
92 u32 cpu_apply_errata = 0; 93 u32 tmp; 94 | 92 u32 cpu_apply_errata = 0; 93 u32 tmp; 94 |
95 if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) 96 return; 97 98 cpu_req_errata = sifive_errata_probe(archid, impid); 99 |
|
95 for (alt = begin; alt < end; alt++) { 96 if (alt->vendor_id != SIFIVE_VENDOR_ID) 97 continue; 98 if (alt->errata_id >= ERRATA_SIFIVE_NUMBER) { 99 WARN(1, "This errata id:%d is not in kernel errata list", alt->errata_id); 100 continue; 101 } 102 103 tmp = (1U << alt->errata_id); 104 if (cpu_req_errata & tmp) { 105 patch_text_nosync(alt->old_ptr, alt->alt_ptr, alt->alt_len); 106 cpu_apply_errata |= tmp; 107 } 108 } 109 if (cpu_apply_errata != cpu_req_errata) 110 warn_miss_errata(cpu_req_errata - cpu_apply_errata); 111} | 100 for (alt = begin; alt < end; alt++) { 101 if (alt->vendor_id != SIFIVE_VENDOR_ID) 102 continue; 103 if (alt->errata_id >= ERRATA_SIFIVE_NUMBER) { 104 WARN(1, "This errata id:%d is not in kernel errata list", alt->errata_id); 105 continue; 106 } 107 108 tmp = (1U << alt->errata_id); 109 if (cpu_req_errata & tmp) { 110 patch_text_nosync(alt->old_ptr, alt->alt_ptr, alt->alt_len); 111 cpu_apply_errata |= tmp; 112 } 113 } 114 if (cpu_apply_errata != cpu_req_errata) 115 warn_miss_errata(cpu_req_errata - cpu_apply_errata); 116} |