Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
85dd0c9c
Commit
85dd0c9c
authored
May 28, 2020
by
Olivier Deprez
Committed by
TrustedFirmware Code Review
May 28, 2020
Browse files
Merge "TF-A: Fix wrong register read for MPAM extension" into integration
parents
343580e5
dbcc44a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/arch/aarch64/arch.h
View file @
85dd0c9c
...
...
@@ -259,6 +259,9 @@
#define MTE_IMPLEMENTED_EL0 ULL(1)
/* MTE is only implemented at EL0 */
#define MTE_IMPLEMENTED_ELX ULL(2)
/* MTE is implemented at all ELs */
#define ID_AA64PFR1_MPAM_FRAC_SHIFT ULL(16)
#define ID_AA64PFR1_MPAM_FRAC_MASK ULL(0xf)
/* ID_PFR1_EL1 definitions */
#define ID_PFR1_VIRTEXT_SHIFT U(12)
#define ID_PFR1_VIRTEXT_MASK U(0xf)
...
...
include/arch/aarch64/arch_features.h
View file @
85dd0c9c
...
...
@@ -64,4 +64,21 @@ static inline bool is_armv8_6_twed_present(void)
ID_AA64MMFR1_EL1_TWED_MASK
)
==
ID_AA64MMFR1_EL1_TWED_SUPPORTED
);
}
/*
* Return MPAM version:
*
* 0x00: None Armv8.0 or later
* 0x01: v0.1 Armv8.4 or later
* 0x10: v1.0 Armv8.2 or later
* 0x11: v1.1 Armv8.4 or later
*
*/
static
inline
unsigned
int
get_mpam_version
(
void
)
{
return
(
unsigned
int
)((((
read_id_aa64pfr0_el1
()
>>
ID_AA64PFR0_MPAM_SHIFT
)
&
ID_AA64PFR0_MPAM_MASK
)
<<
4
)
|
((
read_id_aa64pfr1_el1
()
>>
ID_AA64PFR1_MPAM_FRAC_SHIFT
)
&
ID_AA64PFR1_MPAM_FRAC_MASK
));
}
#endif
/* ARCH_FEATURES_H */
lib/extensions/mpam/mpam.c
View file @
85dd0c9c
/*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2018
-2020
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -7,20 +7,16 @@
#include <stdbool.h>
#include <arch.h>
#include <arch_features.h>
#include <arch_helpers.h>
#include <lib/extensions/mpam.h>
bool
mpam_supported
(
void
)
{
uint64_t
features
=
read_id_aa64dfr0_el1
()
>>
ID_AA64PFR0_MPAM_SHIFT
;
return
((
features
&
ID_AA64PFR0_MPAM_MASK
)
!=
0U
);
}
void
mpam_enable
(
bool
el2_unused
)
{
if
(
!
mpam_supported
())
/* Check if MPAM is implemented */
if
(
get_mpam_version
()
==
0U
)
{
return
;
}
/*
* Enable MPAM, and disable trapping to EL3 when lower ELs access their
...
...
@@ -34,10 +30,11 @@ void mpam_enable(bool el2_unused)
* If EL2 is implemented and used, enable trapping to EL2.
*/
if
(
el2_unused
)
{
write_mpam2_el2
(
0
);
write_mpam2_el2
(
0
ULL
);
if
((
read_mpamidr_el1
()
&
MPAMIDR_HAS_HCR_BIT
)
!=
0U
)
write_mpamhcr_el2
(
0
);
if
((
read_mpamidr_el1
()
&
MPAMIDR_HAS_HCR_BIT
)
!=
0U
)
{
write_mpamhcr_el2
(
0ULL
);
}
}
else
{
write_mpam2_el2
(
MPAM2_EL2_TRAPMPAM0EL1
|
MPAM2_EL2_TRAPMPAM1EL1
);
...
...
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