Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc10bc62

Browse files
author
Marc Zyngier
committed
arm64: Add level-hinted TLB invalidation helper
Add a level-hinted TLB invalidation helper that only gets used ifARMv8.4-TTL gets detected.Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent6fcfdf6 commitc10bc62

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

‎arch/arm64/include/asm/stage2_pgtable.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,13 @@ stage2_pgd_addr_end(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
256256
return (boundary-1<end-1) ?boundary :end;
257257
}
258258

259+
/*
260+
* Level values for the ARMv8.4-TTL extension, mapping PUD/PMD/PTE and
261+
* the architectural page-table level.
262+
*/
263+
#defineS2_NO_LEVEL_HINT0
264+
#defineS2_PUD_LEVEL1
265+
#defineS2_PMD_LEVEL2
266+
#defineS2_PTE_LEVEL3
267+
259268
#endif/* __ARM64_S2_PGTABLE_H_ */

‎arch/arm64/include/asm/tlbflush.h‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#ifndef__ASSEMBLY__
1212

13+
#include<linux/bitfield.h>
1314
#include<linux/mm_types.h>
1415
#include<linux/sched.h>
1516
#include<asm/cputype.h>
@@ -59,6 +60,50 @@
5960
__ta;\
6061
})
6162

63+
/*
64+
* Level-based TLBI operations.
65+
*
66+
* When ARMv8.4-TTL exists, TLBI operations take an additional hint for
67+
* the level at which the invalidation must take place. If the level is
68+
* wrong, no invalidation may take place. In the case where the level
69+
* cannot be easily determined, a 0 value for the level parameter will
70+
* perform a non-hinted invalidation.
71+
*
72+
* For Stage-2 invalidation, use the level values provided to that effect
73+
* in asm/stage2_pgtable.h.
74+
*/
75+
#defineTLBI_TTL_MASKGENMASK_ULL(47, 44)
76+
#defineTLBI_TTL_TG_4K1
77+
#defineTLBI_TTL_TG_16K2
78+
#defineTLBI_TTL_TG_64K3
79+
80+
#define__tlbi_level(op,addr,level)\
81+
do {\
82+
u64 arg = addr;\
83+
\
84+
if (cpus_have_const_cap(ARM64_HAS_ARMv8_4_TTL) &&\
85+
level) {\
86+
u64 ttl = level & 3;\
87+
\
88+
switch (PAGE_SIZE) {\
89+
case SZ_4K:\
90+
ttl |= TLBI_TTL_TG_4K << 2;\
91+
break;\
92+
case SZ_16K:\
93+
ttl |= TLBI_TTL_TG_16K << 2;\
94+
break;\
95+
case SZ_64K:\
96+
ttl |= TLBI_TTL_TG_64K << 2;\
97+
break;\
98+
}\
99+
\
100+
arg &= ~TLBI_TTL_MASK;\
101+
arg |= FIELD_PREP(TLBI_TTL_MASK, ttl);\
102+
}\
103+
\
104+
__tlbi(op, arg);\
105+
} while(0)
106+
62107
/*
63108
*TLB Invalidation
64109
*================

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp