diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2023-01-12 05:38:49 +0300 |
---|---|---|
committer | Oliver Upton <oliver.upton@linux.dev> | 2023-01-13 00:07:43 +0300 |
commit | 805e6ec1c5e0ba4919a569535d63d2113dc17fed (patch) | |
tree | 57cb981d70dd0d8aa9c7fbf9a460f59d3d711877 /arch/arm64/include/asm/cache.h | |
parent | 8f407d6a15f338458a01926dbe5e0bed14ca4267 (diff) | |
download | linux-805e6ec1c5e0ba4919a569535d63d2113dc17fed.tar.xz |
arm64/cache: Move CLIDR macro definitions
The macros are useful for KVM which needs to manage how CLIDR is exposed
to vcpu so move them to include/asm/cache.h, which KVM can refer to.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Link: https://lore.kernel.org/r/20230112023852.42012-5-akihiko.odaki@daynix.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64/include/asm/cache.h')
-rw-r--r-- | arch/arm64/include/asm/cache.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index c0b178d1bb4f..ab7133654a72 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -16,6 +16,12 @@ #define CLIDR_LOC(clidr) (((clidr) >> CLIDR_LOC_SHIFT) & 0x7) #define CLIDR_LOUIS(clidr) (((clidr) >> CLIDR_LOUIS_SHIFT) & 0x7) +/* Ctypen, bits[3(n - 1) + 2 : 3(n - 1)], for n = 1 to 7 */ +#define CLIDR_CTYPE_SHIFT(level) (3 * (level - 1)) +#define CLIDR_CTYPE_MASK(level) (7 << CLIDR_CTYPE_SHIFT(level)) +#define CLIDR_CTYPE(clidr, level) \ + (((clidr) & CLIDR_CTYPE_MASK(level)) >> CLIDR_CTYPE_SHIFT(level)) + /* * Memory returned by kmalloc() may be used for DMA, so we must make * sure that all such allocations are cache aligned. Otherwise, |