Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ae4bffb5
Commit
ae4bffb5
authored
Jul 07, 2020
by
Marc Zyngier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kvm-arm64/ttl-for-arm64' into HEAD
Signed-off-by:
Marc Zyngier
<
maz@kernel.org
>
parents
f9a026e3
c10bc62a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
1 deletion
+70
-1
arch/arm64/include/asm/cpucaps.h
arch/arm64/include/asm/cpucaps.h
+2
-1
arch/arm64/include/asm/pgtable-hwdef.h
arch/arm64/include/asm/pgtable-hwdef.h
+2
-0
arch/arm64/include/asm/stage2_pgtable.h
arch/arm64/include/asm/stage2_pgtable.h
+9
-0
arch/arm64/include/asm/sysreg.h
arch/arm64/include/asm/sysreg.h
+1
-0
arch/arm64/include/asm/tlbflush.h
arch/arm64/include/asm/tlbflush.h
+45
-0
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/cpufeature.c
+11
-0
No files found.
arch/arm64/include/asm/cpucaps.h
View file @
ae4bffb5
...
@@ -62,7 +62,8 @@
...
@@ -62,7 +62,8 @@
#define ARM64_HAS_GENERIC_AUTH 52
#define ARM64_HAS_GENERIC_AUTH 52
#define ARM64_HAS_32BIT_EL1 53
#define ARM64_HAS_32BIT_EL1 53
#define ARM64_BTI 54
#define ARM64_BTI 54
#define ARM64_HAS_ARMv8_4_TTL 55
#define ARM64_NCAPS 5
5
#define ARM64_NCAPS 5
6
#endif
/* __ASM_CPUCAPS_H */
#endif
/* __ASM_CPUCAPS_H */
arch/arm64/include/asm/pgtable-hwdef.h
View file @
ae4bffb5
...
@@ -178,10 +178,12 @@
...
@@ -178,10 +178,12 @@
#define PTE_S2_RDONLY (_AT(pteval_t, 1) << 6)
/* HAP[2:1] */
#define PTE_S2_RDONLY (_AT(pteval_t, 1) << 6)
/* HAP[2:1] */
#define PTE_S2_RDWR (_AT(pteval_t, 3) << 6)
/* HAP[2:1] */
#define PTE_S2_RDWR (_AT(pteval_t, 3) << 6)
/* HAP[2:1] */
#define PTE_S2_XN (_AT(pteval_t, 2) << 53)
/* XN[1:0] */
#define PTE_S2_XN (_AT(pteval_t, 2) << 53)
/* XN[1:0] */
#define PTE_S2_SW_RESVD (_AT(pteval_t, 15) << 55)
/* Reserved for SW */
#define PMD_S2_RDONLY (_AT(pmdval_t, 1) << 6)
/* HAP[2:1] */
#define PMD_S2_RDONLY (_AT(pmdval_t, 1) << 6)
/* HAP[2:1] */
#define PMD_S2_RDWR (_AT(pmdval_t, 3) << 6)
/* HAP[2:1] */
#define PMD_S2_RDWR (_AT(pmdval_t, 3) << 6)
/* HAP[2:1] */
#define PMD_S2_XN (_AT(pmdval_t, 2) << 53)
/* XN[1:0] */
#define PMD_S2_XN (_AT(pmdval_t, 2) << 53)
/* XN[1:0] */
#define PMD_S2_SW_RESVD (_AT(pmdval_t, 15) << 55)
/* Reserved for SW */
#define PUD_S2_RDONLY (_AT(pudval_t, 1) << 6)
/* HAP[2:1] */
#define PUD_S2_RDONLY (_AT(pudval_t, 1) << 6)
/* HAP[2:1] */
#define PUD_S2_RDWR (_AT(pudval_t, 3) << 6)
/* HAP[2:1] */
#define PUD_S2_RDWR (_AT(pudval_t, 3) << 6)
/* HAP[2:1] */
...
...
arch/arm64/include/asm/stage2_pgtable.h
View file @
ae4bffb5
...
@@ -256,4 +256,13 @@ stage2_pgd_addr_end(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
...
@@ -256,4 +256,13 @@ stage2_pgd_addr_end(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
return
(
boundary
-
1
<
end
-
1
)
?
boundary
:
end
;
return
(
boundary
-
1
<
end
-
1
)
?
boundary
:
end
;
}
}
/*
* Level values for the ARMv8.4-TTL extension, mapping PUD/PMD/PTE and
* the architectural page-table level.
*/
#define S2_NO_LEVEL_HINT 0
#define S2_PUD_LEVEL 1
#define S2_PMD_LEVEL 2
#define S2_PTE_LEVEL 3
#endif
/* __ARM64_S2_PGTABLE_H_ */
#endif
/* __ARM64_S2_PGTABLE_H_ */
arch/arm64/include/asm/sysreg.h
View file @
ae4bffb5
...
@@ -746,6 +746,7 @@
...
@@ -746,6 +746,7 @@
/* id_aa64mmfr2 */
/* id_aa64mmfr2 */
#define ID_AA64MMFR2_E0PD_SHIFT 60
#define ID_AA64MMFR2_E0PD_SHIFT 60
#define ID_AA64MMFR2_TTL_SHIFT 48
#define ID_AA64MMFR2_FWB_SHIFT 40
#define ID_AA64MMFR2_FWB_SHIFT 40
#define ID_AA64MMFR2_AT_SHIFT 32
#define ID_AA64MMFR2_AT_SHIFT 32
#define ID_AA64MMFR2_LVA_SHIFT 16
#define ID_AA64MMFR2_LVA_SHIFT 16
...
...
arch/arm64/include/asm/tlbflush.h
View file @
ae4bffb5
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#ifndef __ASSEMBLY__
#ifndef __ASSEMBLY__
#include <linux/bitfield.h>
#include <linux/mm_types.h>
#include <linux/mm_types.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <asm/cputype.h>
#include <asm/cputype.h>
...
@@ -59,6 +60,50 @@
...
@@ -59,6 +60,50 @@
__ta; \
__ta; \
})
})
/*
* Level-based TLBI operations.
*
* When ARMv8.4-TTL exists, TLBI operations take an additional hint for
* the level at which the invalidation must take place. If the level is
* wrong, no invalidation may take place. In the case where the level
* cannot be easily determined, a 0 value for the level parameter will
* perform a non-hinted invalidation.
*
* For Stage-2 invalidation, use the level values provided to that effect
* in asm/stage2_pgtable.h.
*/
#define TLBI_TTL_MASK GENMASK_ULL(47, 44)
#define TLBI_TTL_TG_4K 1
#define TLBI_TTL_TG_16K 2
#define TLBI_TTL_TG_64K 3
#define __tlbi_level(op, addr, level) \
do { \
u64 arg = addr; \
\
if (cpus_have_const_cap(ARM64_HAS_ARMv8_4_TTL) && \
level) { \
u64 ttl = level & 3; \
\
switch (PAGE_SIZE) { \
case SZ_4K: \
ttl |= TLBI_TTL_TG_4K << 2; \
break; \
case SZ_16K: \
ttl |= TLBI_TTL_TG_16K << 2; \
break; \
case SZ_64K: \
ttl |= TLBI_TTL_TG_64K << 2; \
break; \
} \
\
arg &= ~TLBI_TTL_MASK; \
arg |= FIELD_PREP(TLBI_TTL_MASK, ttl); \
} \
\
__tlbi(op, arg); \
} while(0)
/*
/*
* TLB Invalidation
* TLB Invalidation
* ================
* ================
...
...
arch/arm64/kernel/cpufeature.c
View file @
ae4bffb5
...
@@ -323,6 +323,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
...
@@ -323,6 +323,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
static
const
struct
arm64_ftr_bits
ftr_id_aa64mmfr2
[]
=
{
static
const
struct
arm64_ftr_bits
ftr_id_aa64mmfr2
[]
=
{
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_NONSTRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_E0PD_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_NONSTRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_E0PD_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_TTL_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_FWB_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_FWB_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_VISIBLE
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_AT_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_VISIBLE
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_AT_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_LVA_SHIFT
,
4
,
0
),
ARM64_FTR_BITS
(
FTR_HIDDEN
,
FTR_STRICT
,
FTR_LOWER_SAFE
,
ID_AA64MMFR2_LVA_SHIFT
,
4
,
0
),
...
@@ -1882,6 +1883,16 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
...
@@ -1882,6 +1883,16 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
.
matches
=
has_cpuid_feature
,
.
matches
=
has_cpuid_feature
,
.
cpu_enable
=
cpu_has_fwb
,
.
cpu_enable
=
cpu_has_fwb
,
},
},
{
.
desc
=
"ARMv8.4 Translation Table Level"
,
.
type
=
ARM64_CPUCAP_SYSTEM_FEATURE
,
.
capability
=
ARM64_HAS_ARMv8_4_TTL
,
.
sys_reg
=
SYS_ID_AA64MMFR2_EL1
,
.
sign
=
FTR_UNSIGNED
,
.
field_pos
=
ID_AA64MMFR2_TTL_SHIFT
,
.
min_field_value
=
1
,
.
matches
=
has_cpuid_feature
,
},
#ifdef CONFIG_ARM64_HW_AFDBM
#ifdef CONFIG_ARM64_HW_AFDBM
{
{
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment