~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/include/asm/errata_list.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2021 Sifive.
  4  */
  5 #ifndef ASM_ERRATA_LIST_H
  6 #define ASM_ERRATA_LIST_H
  7 
  8 #include <asm/alternative.h>
  9 #include <asm/csr.h>
 10 #include <asm/insn-def.h>
 11 #include <asm/hwcap.h>
 12 #include <asm/vendorid_list.h>
 13 
 14 #ifdef CONFIG_ERRATA_ANDES
 15 #define ERRATA_ANDES_NO_IOCP 0
 16 #define ERRATA_ANDES_NUMBER 1
 17 #endif
 18 
 19 #ifdef CONFIG_ERRATA_SIFIVE
 20 #define ERRATA_SIFIVE_CIP_453 0
 21 #define ERRATA_SIFIVE_CIP_1200 1
 22 #define ERRATA_SIFIVE_NUMBER 2
 23 #endif
 24 
 25 #ifdef CONFIG_ERRATA_THEAD
 26 #define ERRATA_THEAD_MAE 0
 27 #define ERRATA_THEAD_PMU 1
 28 #define ERRATA_THEAD_NUMBER 2
 29 #endif
 30 
 31 #ifdef __ASSEMBLY__
 32 
 33 #define ALT_INSN_FAULT(x)                                               \
 34 ALTERNATIVE(__stringify(RISCV_PTR do_trap_insn_fault),                  \
 35             __stringify(RISCV_PTR sifive_cip_453_insn_fault_trp),       \
 36             SIFIVE_VENDOR_ID, ERRATA_SIFIVE_CIP_453,                    \
 37             CONFIG_ERRATA_SIFIVE_CIP_453)
 38 
 39 #define ALT_PAGE_FAULT(x)                                               \
 40 ALTERNATIVE(__stringify(RISCV_PTR do_page_fault),                       \
 41             __stringify(RISCV_PTR sifive_cip_453_page_fault_trp),       \
 42             SIFIVE_VENDOR_ID, ERRATA_SIFIVE_CIP_453,                    \
 43             CONFIG_ERRATA_SIFIVE_CIP_453)
 44 #else /* !__ASSEMBLY__ */
 45 
 46 #define ALT_SFENCE_VMA_ASID(asid)                                       \
 47 asm(ALTERNATIVE("sfence.vma x0, %0", "sfence.vma", SIFIVE_VENDOR_ID,    \
 48                 ERRATA_SIFIVE_CIP_1200, CONFIG_ERRATA_SIFIVE_CIP_1200)  \
 49                 : : "r" (asid) : "memory")
 50 
 51 #define ALT_SFENCE_VMA_ADDR(addr)                                       \
 52 asm(ALTERNATIVE("sfence.vma %0", "sfence.vma", SIFIVE_VENDOR_ID,        \
 53                 ERRATA_SIFIVE_CIP_1200, CONFIG_ERRATA_SIFIVE_CIP_1200)  \
 54                 : : "r" (addr) : "memory")
 55 
 56 #define ALT_SFENCE_VMA_ADDR_ASID(addr, asid)                            \
 57 asm(ALTERNATIVE("sfence.vma %0, %1", "sfence.vma", SIFIVE_VENDOR_ID,    \
 58                 ERRATA_SIFIVE_CIP_1200, CONFIG_ERRATA_SIFIVE_CIP_1200)  \
 59                 : : "r" (addr), "r" (asid) : "memory")
 60 
 61 /*
 62  * _val is marked as "will be overwritten", so need to set it to 0
 63  * in the default case.
 64  */
 65 #define ALT_SVPBMT_SHIFT 61
 66 #define ALT_THEAD_MAE_SHIFT 59
 67 #define ALT_SVPBMT(_val, prot)                                          \
 68 asm(ALTERNATIVE_2("li %0, 0\t\nnop",                                    \
 69                   "li %0, %1\t\nslli %0,%0,%3", 0,                      \
 70                         RISCV_ISA_EXT_SVPBMT, CONFIG_RISCV_ISA_SVPBMT,  \
 71                   "li %0, %2\t\nslli %0,%0,%4", THEAD_VENDOR_ID,        \
 72                         ERRATA_THEAD_MAE, CONFIG_ERRATA_THEAD_MAE)      \
 73                 : "=r"(_val)                                            \
 74                 : "I"(prot##_SVPBMT >> ALT_SVPBMT_SHIFT),               \
 75                   "I"(prot##_THEAD >> ALT_THEAD_MAE_SHIFT),             \
 76                   "I"(ALT_SVPBMT_SHIFT),                                \
 77                   "I"(ALT_THEAD_MAE_SHIFT))
 78 
 79 #ifdef CONFIG_ERRATA_THEAD_MAE
 80 /*
 81  * IO/NOCACHE memory types are handled together with svpbmt,
 82  * so on T-Head chips, check if no other memory type is set,
 83  * and set the non-0 PMA type if applicable.
 84  */
 85 #define ALT_THEAD_PMA(_val)                                             \
 86 asm volatile(ALTERNATIVE(                                               \
 87         __nops(7),                                                      \
 88         "li      t3, %1\n\t"                                            \
 89         "slli    t3, t3, %3\n\t"                                        \
 90         "and     t3, %0, t3\n\t"                                        \
 91         "bne     t3, zero, 2f\n\t"                                      \
 92         "li      t3, %2\n\t"                                            \
 93         "slli    t3, t3, %3\n\t"                                        \
 94         "or      %0, %0, t3\n\t"                                        \
 95         "2:",  THEAD_VENDOR_ID,                                         \
 96                 ERRATA_THEAD_MAE, CONFIG_ERRATA_THEAD_MAE)              \
 97         : "+r"(_val)                                                    \
 98         : "I"(_PAGE_MTMASK_THEAD >> ALT_THEAD_MAE_SHIFT),               \
 99           "I"(_PAGE_PMA_THEAD >> ALT_THEAD_MAE_SHIFT),                  \
100           "I"(ALT_THEAD_MAE_SHIFT)                                      \
101         : "t3")
102 #else
103 #define ALT_THEAD_PMA(_val)
104 #endif
105 
106 #define ALT_CMO_OP(_op, _start, _size, _cachesize)                      \
107 asm volatile(ALTERNATIVE(                                               \
108         __nops(5),                                                      \
109         "mv a0, %1\n\t"                                                 \
110         "j 2f\n\t"                                                      \
111         "3:\n\t"                                                        \
112         CBO_##_op(a0)                                                   \
113         "add a0, a0, %0\n\t"                                            \
114         "2:\n\t"                                                        \
115         "bltu a0, %2, 3b\n\t",                                          \
116         0, RISCV_ISA_EXT_ZICBOM, CONFIG_RISCV_ISA_ZICBOM)               \
117         : : "r"(_cachesize),                                            \
118             "r"((unsigned long)(_start) & ~((_cachesize) - 1UL)),       \
119             "r"((unsigned long)(_start) + (_size))                      \
120         : "a0")
121 
122 #define THEAD_C9XX_RV_IRQ_PMU                   17
123 #define THEAD_C9XX_CSR_SCOUNTEROF               0x5c5
124 
125 #endif /* __ASSEMBLY__ */
126 
127 #endif
128 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php