Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch/arm: Fix error in cache ops #8125

Merged
merged 6 commits into from
Jan 16, 2023
Merged

Conversation

zyfeier
Copy link
Contributor

@zyfeier zyfeier commented Jan 16, 2023

Summary

  1. Cache function should depends on CONFIG_ARCH_XCACHE;
  2. Add invalidate icache function for armv7ar;
  3. Add cp15_invalidate_icache for invalidate the instruction cache within the specified region;
  4. Fix typo error in cp15_cacheops.h;
  5. Add barrier instruction for cache ops;
  6. Flush dcache when addr is not aligned with cache line;

Impact

cache ops

Testing

bes2003

@masayuki2009
Copy link
Contributor

@zyfeier

In file included from armv7-a/arm_cache.c:29:
Error: armv7-a/cp15_cacheops.h:951:6: error: conflicting types for 'cp15_invalidate_icache'; have 'void(uintptr_t,  uintptr_t)' {aka 'void(unsigned int,  unsigned int)'}
  951 | void cp15_invalidate_icache(uintptr_t start, uintptr_t end);
      |      ^~~~~~~~~~~~~~~~~~~~~~
armv7-a/cp15_cacheops.h:705:20: note: previous definition of 'cp15_invalidate_icache' with type 'void(void)'
  705 | static inline void cp15_invalidate_icache(void)
      |                    ^~~~~~~~~~~~~~~~~~~~~~
armv7-a/arm_cache.c: In function 'up_invalidate_icache_all':
Error: armv7-a/arm_cache.c:111:3: error: too few arguments to function 'cp15_invalidate_icache'
  111 |   cp15_invalidate_icache();
      |   ^~~~~~~~~~~~~~~~~~~~~~
In file included from armv7-a/arm_cache.c:29:
armv7-a/cp15_cacheops.h:951:6: note: declared here
  951 | void cp15_invalidate_icache(uintptr_t start, uintptr_t end);
      |      ^~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:144: arm_cache.o] Error 1
In file included from armv7-a/arm_mmu.c:29:
Error: armv7-a/cp15_cacheops.h:951:6: error: conflicting types for 'cp15_invalidate_icache'; have 'void(uintptr_t,  uintptr_t)' {aka 'void(unsigned int,  unsigned int)'}
  951 | void cp15_invalidate_icache(uintptr_t start, uintptr_t end);
      |      ^~~~~~~~~~~~~~~~~~~~~~
armv7-a/cp15_cacheops.h:705:20: note: previous definition of 'cp15_invalidate_icache' with type 'void(void)'
  705 | static inline void cp15_invalidate_icache(void)
      |                    ^~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:144: arm_mmu.o] Error 1
In file included from armv7-a/cp15_cacheops.c:29:
Error: armv7-a/cp15_cacheops.h:951:6: error: conflicting types for 'cp15_invalidate_icache'; have 'void(uintptr_t,  uintptr_t)' {aka 'void(unsigned int,  unsigned int)'}
  951 | void cp15_invalidate_icache(uintptr_t start, uintptr_t end);
      |      ^~~~~~~~~~~~~~~~~~~~~~
armv7-a/cp15_cacheops.h:705:20: note: previous definition of 'cp15_invalidate_icache' with type 'void(void)'
  705 | static inline void cp15_invalidate_icache(void)
      |                    ^~~~~~~~~~~~~~~~~~~~~~
armv7-a/cp15_cacheops.c: In function 'cp15_coherent_dcache':
Error: armv7-a/cp15_cacheops.c:195:3: error: too few arguments to function 'cp15_invalidate_icache'
  195 |   cp15_invalidate_icache();
      |   ^~~~~~~~~~~~~~~~~~~~~~
In file included from armv7-a/cp15_cacheops.c:29:
armv7-a/cp15_cacheops.h:951:6: note: declared here
  951 | void cp15_invalidate_icache(uintptr_t start, uintptr_t end);
      |      ^~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:144: cp15_cacheops.o] Error 1
make[1]: Target 'libarch.a' not remade because of errors.
make: *** [tools/LibTargets.mk:158: arch/arm/src/libarch.a] Error

GUIDINGLI and others added 6 commits January 16, 2023 14:24
Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
… did you mean 'cp15_invalidate_dcache'?

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
When invalidate address is not aligned with cache line,
must align address and flush the cache line.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants