Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "xtensa: cache inquiry and unaligned cache handling functions"

Drop unaligned dcache management functions as they are no longer used.
This reverts commit bd974240c9a7 ("xtensa: cache inquiry and
unaligned cache handling functions").

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

-95
-95
arch/xtensa/include/asm/cacheflush.h
··· 174 174 175 175 #endif 176 176 177 - #define XTENSA_CACHEBLK_LOG2 29 178 - #define XTENSA_CACHEBLK_SIZE (1 << XTENSA_CACHEBLK_LOG2) 179 - #define XTENSA_CACHEBLK_MASK (7 << XTENSA_CACHEBLK_LOG2) 180 - 181 - #if XCHAL_HAVE_CACHEATTR 182 - static inline u32 xtensa_get_cacheattr(void) 183 - { 184 - u32 r; 185 - asm volatile(" rsr %0, cacheattr" : "=a"(r)); 186 - return r; 187 - } 188 - 189 - static inline u32 xtensa_get_dtlb1(u32 addr) 190 - { 191 - u32 r = addr & XTENSA_CACHEBLK_MASK; 192 - return r | ((xtensa_get_cacheattr() >> (r >> (XTENSA_CACHEBLK_LOG2-2))) 193 - & 0xF); 194 - } 195 - #else 196 - static inline u32 xtensa_get_dtlb1(u32 addr) 197 - { 198 - u32 r; 199 - asm volatile(" rdtlb1 %0, %1" : "=a"(r) : "a"(addr)); 200 - asm volatile(" dsync"); 201 - return r; 202 - } 203 - 204 - static inline u32 xtensa_get_cacheattr(void) 205 - { 206 - u32 r = 0; 207 - u32 a = 0; 208 - do { 209 - a -= XTENSA_CACHEBLK_SIZE; 210 - r = (r << 4) | (xtensa_get_dtlb1(a) & 0xF); 211 - } while (a); 212 - return r; 213 - } 214 - #endif 215 - 216 - static inline int xtensa_need_flush_dma_source(u32 addr) 217 - { 218 - return (xtensa_get_dtlb1(addr) & ((1 << XCHAL_CA_BITS) - 1)) >= 4; 219 - } 220 - 221 - static inline int xtensa_need_invalidate_dma_destination(u32 addr) 222 - { 223 - return (xtensa_get_dtlb1(addr) & ((1 << XCHAL_CA_BITS) - 1)) != 2; 224 - } 225 - 226 - static inline void flush_dcache_unaligned(u32 addr, u32 size) 227 - { 228 - u32 cnt; 229 - if (size) { 230 - cnt = (size + ((XCHAL_DCACHE_LINESIZE - 1) & addr) 231 - + XCHAL_DCACHE_LINESIZE - 1) / XCHAL_DCACHE_LINESIZE; 232 - while (cnt--) { 233 - asm volatile(" dhwb %0, 0" : : "a"(addr)); 234 - addr += XCHAL_DCACHE_LINESIZE; 235 - } 236 - asm volatile(" dsync"); 237 - } 238 - } 239 - 240 - static inline void invalidate_dcache_unaligned(u32 addr, u32 size) 241 - { 242 - int cnt; 243 - if (size) { 244 - asm volatile(" dhwbi %0, 0 ;" : : "a"(addr)); 245 - cnt = (size + ((XCHAL_DCACHE_LINESIZE - 1) & addr) 246 - - XCHAL_DCACHE_LINESIZE - 1) / XCHAL_DCACHE_LINESIZE; 247 - while (cnt-- > 0) { 248 - asm volatile(" dhi %0, %1" : : "a"(addr), 249 - "n"(XCHAL_DCACHE_LINESIZE)); 250 - addr += XCHAL_DCACHE_LINESIZE; 251 - } 252 - asm volatile(" dhwbi %0, %1" : : "a"(addr), 253 - "n"(XCHAL_DCACHE_LINESIZE)); 254 - asm volatile(" dsync"); 255 - } 256 - } 257 - 258 - static inline void flush_invalidate_dcache_unaligned(u32 addr, u32 size) 259 - { 260 - u32 cnt; 261 - if (size) { 262 - cnt = (size + ((XCHAL_DCACHE_LINESIZE - 1) & addr) 263 - + XCHAL_DCACHE_LINESIZE - 1) / XCHAL_DCACHE_LINESIZE; 264 - while (cnt--) { 265 - asm volatile(" dhwbi %0, 0" : : "a"(addr)); 266 - addr += XCHAL_DCACHE_LINESIZE; 267 - } 268 - asm volatile(" dsync"); 269 - } 270 - } 271 - 272 177 #endif /* _XTENSA_CACHEFLUSH_H */