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
c8b96e4a
Unverified
Commit
c8b96e4a
authored
Feb 27, 2019
by
Antonio Niño Díaz
Committed by
GitHub
Feb 27, 2019
Browse files
Merge pull request #1831 from antonio-nino-diaz-arm/an/sccd
Disable processor Cycle Counting in Secure state
parents
65954be7
ed4fc6f0
Changes
4
Show whitespace changes
Inline
Side-by-side
include/arch/aarch32/arch.h
View file @
c8b96e4a
...
@@ -153,6 +153,7 @@
...
@@ -153,6 +153,7 @@
#define SDCR_SPD_LEGACY U(0x0)
#define SDCR_SPD_LEGACY U(0x0)
#define SDCR_SPD_DISABLE U(0x2)
#define SDCR_SPD_DISABLE U(0x2)
#define SDCR_SPD_ENABLE U(0x3)
#define SDCR_SPD_ENABLE U(0x3)
#define SDCR_SCCD_BIT (U(1) << 23)
#define SDCR_RESET_VAL U(0x0)
#define SDCR_RESET_VAL U(0x0)
/* HSCTLR definitions */
/* HSCTLR definitions */
...
...
include/arch/aarch32/el3_common_macros.S
View file @
c8b96e4a
/*
/*
*
Copyright
(
c
)
2016
-
201
8
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2016
-
201
9
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
*/
...
@@ -106,9 +106,14 @@
...
@@ -106,9 +106,14 @@
*
*
*
SDCR
.
SPD
:
Disable
AArch32
privileged
debug
.
Debug
exceptions
from
*
SDCR
.
SPD
:
Disable
AArch32
privileged
debug
.
Debug
exceptions
from
*
Secure
EL1
are
disabled
.
*
Secure
EL1
are
disabled
.
*
*
SDCR
:
Set
to
one
so
that
cycle
counting
by
PMCCNTR
is
prohibited
in
*
Secure
state
.
This
bit
is
RES0
in
versions
of
the
architecture
*
earlier
than
ARMv8
.5
,
setting
it
to
1
doesn
't have any effect on
*
them
.
*
---------------------------------------------------------------------
*
---------------------------------------------------------------------
*/
*/
ldr
r0
,
=(
SDCR_RESET_VAL
|
SDCR_SPD
(
SDCR_SPD_DISABLE
))
ldr
r0
,
=(
SDCR_RESET_VAL
| SDCR_SPD(SDCR_SPD_DISABLE)
|
SDCR_SCCD_BIT
)
stcopr
r0
,
SDCR
stcopr
r0
,
SDCR
#endif
#endif
...
...
include/arch/aarch64/arch.h
View file @
c8b96e4a
...
@@ -291,16 +291,17 @@
...
@@ -291,16 +291,17 @@
/* MDCR_EL3 definitions */
/* MDCR_EL3 definitions */
#define MDCR_SPD32(x) ((x) << 14)
#define MDCR_SPD32(x) ((x) << 14)
#define MDCR_SPD32_LEGACY U(0x0)
#define MDCR_SPD32_LEGACY U
LL
(0x0)
#define MDCR_SPD32_DISABLE U(0x2)
#define MDCR_SPD32_DISABLE U
LL
(0x2)
#define MDCR_SPD32_ENABLE U(0x3)
#define MDCR_SPD32_ENABLE U
LL
(0x3)
#define MDCR_SDD_BIT (U(1) << 16)
#define MDCR_SDD_BIT (U
LL
(1) << 16)
#define MDCR_NSPB(x) ((x) << 12)
#define MDCR_NSPB(x) ((x) << 12)
#define MDCR_NSPB_EL1 U(0x3)
#define MDCR_NSPB_EL1 ULL(0x3)
#define MDCR_TDOSA_BIT (U(1) << 10)
#define MDCR_TDOSA_BIT (ULL(1) << 10)
#define MDCR_TDA_BIT (U(1) << 9)
#define MDCR_TDA_BIT (ULL(1) << 9)
#define MDCR_TPM_BIT (U(1) << 6)
#define MDCR_TPM_BIT (ULL(1) << 6)
#define MDCR_EL3_RESET_VAL U(0x0)
#define MDCR_SCCD_BIT (ULL(1) << 23)
#define MDCR_EL3_RESET_VAL ULL(0x0)
/* MDCR_EL2 definitions */
/* MDCR_EL2 definitions */
#define MDCR_EL2_TPMS (U(1) << 14)
#define MDCR_EL2_TPMS (U(1) << 14)
...
...
include/arch/aarch64/el3_common_macros.S
View file @
c8b96e4a
/*
/*
*
Copyright
(
c
)
2015
-
201
8
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2015
-
201
9
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
*/
...
@@ -101,10 +101,17 @@
...
@@ -101,10 +101,17 @@
*
*
*
MDCR_EL3
.
TPM
:
Set
to
zero
so
that
EL0
,
EL1
,
and
EL2
System
register
*
MDCR_EL3
.
TPM
:
Set
to
zero
so
that
EL0
,
EL1
,
and
EL2
System
register
*
accesses
to
all
Performance
Monitors
registers
do
not
trap
to
EL3
.
*
accesses
to
all
Performance
Monitors
registers
do
not
trap
to
EL3
.
*
*
MDCR_EL3
.
SCCD
:
Set
to
one
so
that
cycle
counting
by
PMCCNTR_EL0
is
*
prohibited
in
Secure
state
.
This
bit
is
RES0
in
versions
of
the
*
architecture
earlier
than
ARMv8
.5
,
setting
it
to
1
doesn
't have any
*
effect
on
them
.
*
---------------------------------------------------------------------
*
---------------------------------------------------------------------
*/
*/
mov_imm
x0
,
((
MDCR_EL3_RESET_VAL
| MDCR_SDD_BIT |
MDCR_SPD32
(
MDCR_SPD32_DISABLE
))
\
mov_imm
x0
,
((
MDCR_EL3_RESET_VAL
| MDCR_SDD_BIT |
\
MDCR_SPD32
(
MDCR_SPD32_DISABLE
)
|
MDCR_SCCD_BIT
)
\
&
~
(
MDCR_TDOSA_BIT
| MDCR_TDA_BIT |
MDCR_TPM_BIT
))
&
~
(
MDCR_TDOSA_BIT
| MDCR_TDA_BIT |
MDCR_TPM_BIT
))
msr
mdcr_el3
,
x0
msr
mdcr_el3
,
x0
/
*
---------------------------------------------------------------------
/
*
---------------------------------------------------------------------
...
...
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