Skip to content

Commit 2d70124

Browse files
Fuad TabbaMarc Zyngier
authored andcommitted
KVM: arm64: Add config register bit definitions
Add hardware configuration register bit definitions for HCR_EL2 and MDCR_EL2. Future patches toggle these hyp configuration register bits to trap on certain accesses. No functional change intended. Acked-by: Will Deacon <[email protected]> Signed-off-by: Fuad Tabba <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 95b54c3 commit 2d70124

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

arch/arm64/include/asm/kvm_arm.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
#include <asm/types.h>
1313

1414
/* Hyp Configuration Register (HCR) bits */
15+
16+
#define HCR_TID5 (UL(1) << 58)
17+
#define HCR_DCT (UL(1) << 57)
1518
#define HCR_ATA_SHIFT 56
1619
#define HCR_ATA (UL(1) << HCR_ATA_SHIFT)
20+
#define HCR_AMVOFFEN (UL(1) << 51)
21+
#define HCR_FIEN (UL(1) << 47)
1722
#define HCR_FWB (UL(1) << 46)
1823
#define HCR_API (UL(1) << 41)
1924
#define HCR_APK (UL(1) << 40)
@@ -56,6 +61,7 @@
5661
#define HCR_PTW (UL(1) << 2)
5762
#define HCR_SWIO (UL(1) << 1)
5863
#define HCR_VM (UL(1) << 0)
64+
#define HCR_RES0 ((UL(1) << 48) | (UL(1) << 39))
5965

6066
/*
6167
* The bits we set in HCR:
@@ -277,11 +283,21 @@
277283
#define CPTR_EL2_TZ (1 << 8)
278284
#define CPTR_NVHE_EL2_RES1 0x000032ff /* known RES1 bits in CPTR_EL2 (nVHE) */
279285
#define CPTR_EL2_DEFAULT CPTR_NVHE_EL2_RES1
286+
#define CPTR_NVHE_EL2_RES0 (GENMASK(63, 32) | \
287+
GENMASK(29, 21) | \
288+
GENMASK(19, 14) | \
289+
BIT(11))
280290

281291
/* Hyp Debug Configuration Register bits */
282292
#define MDCR_EL2_E2TB_MASK (UL(0x3))
283293
#define MDCR_EL2_E2TB_SHIFT (UL(24))
294+
#define MDCR_EL2_HPMFZS (UL(1) << 36)
295+
#define MDCR_EL2_HPMFZO (UL(1) << 29)
296+
#define MDCR_EL2_MTPME (UL(1) << 28)
297+
#define MDCR_EL2_TDCC (UL(1) << 27)
298+
#define MDCR_EL2_HCCD (UL(1) << 23)
284299
#define MDCR_EL2_TTRF (UL(1) << 19)
300+
#define MDCR_EL2_HPMD (UL(1) << 17)
285301
#define MDCR_EL2_TPMS (UL(1) << 14)
286302
#define MDCR_EL2_E2PB_MASK (UL(0x3))
287303
#define MDCR_EL2_E2PB_SHIFT (UL(12))
@@ -293,6 +309,12 @@
293309
#define MDCR_EL2_TPM (UL(1) << 6)
294310
#define MDCR_EL2_TPMCR (UL(1) << 5)
295311
#define MDCR_EL2_HPMN_MASK (UL(0x1F))
312+
#define MDCR_EL2_RES0 (GENMASK(63, 37) | \
313+
GENMASK(35, 30) | \
314+
GENMASK(25, 24) | \
315+
GENMASK(22, 20) | \
316+
BIT(18) | \
317+
GENMASK(16, 15))
296318

297319
/* For compatibility with fault code shared with 32-bit */
298320
#define FSC_FAULT ESR_ELx_FSC_FAULT

0 commit comments

Comments
 (0)