Skip to content

Commit 3341f5c

Browse files
pm215Michael Tokarev
authored andcommitted
target/arm: Correct encoding of Debug Communications Channel registers
We don't implement the Debug Communications Channel (DCC), but we do attempt to provide dummy versions of its system registers so that software that tries to access them doesn't fall over. However, we got the tx/rx register definitions wrong. These should be: AArch32: DBGDTRTX p14 0 c0 c5 0 (on writes) DBGDTRRX p14 0 c0 c5 0 (on reads) AArch64: DBGDTRTX_EL0 2 3 0 5 0 (on writes) DBGDTRRX_EL0 2 3 0 5 0 (on reads) DBGDTR_EL0 2 3 0 4 0 (reads and writes) where DBGDTRTX and DBGDTRRX are effectively different names for the same 32-bit register, which has tx behaviour on writes and rx behaviour on reads. The AArch64-only DBGDTR_EL0 is a 64-bit wide register whose top and bottom halves map to the DBGDTRRX and DBGDTRTX registers. Currently we have just one cpreg struct, which: * calls itself DBGDTR_EL0 * uses the DBGDTRTX_EL0/DBGDTRRX_EL0 encoding * is marked as ARM_CP_STATE_BOTH but has the wrong opc1 value for AArch32 * is implemented as RAZ/WI Correct the encoding so: * we name the DBGDTRTX/DBGDTRRX register correctly * we split it into AA64 and AA32 versions so we can get the AA32 encoding right * we implement DBGDTR_EL0 at its correct encoding Cc: [email protected] Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2986 Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-id: [email protected] (cherry picked from commit 655659a74a36b63e33d2dc969d3c44beb1b008b3) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 08fa61a commit 3341f5c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

target/arm/debug_helper.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,11 +986,20 @@ static const ARMCPRegInfo debug_cp_reginfo[] = {
986986
.opc0 = 2, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2,
987987
.access = PL1_RW, .accessfn = access_tdcc,
988988
.type = ARM_CP_CONST, .resetvalue = 0 },
989-
/* DBGDTRTX_EL0/DBGDTRRX_EL0 depend on direction */
990-
{ .name = "DBGDTR_EL0", .state = ARM_CP_STATE_BOTH, .cp = 14,
989+
/* Architecturally DBGDTRTX is named DBGDTRRX when used for reads */
990+
{ .name = "DBGDTRTX_EL0", .state = ARM_CP_STATE_AA64,
991991
.opc0 = 2, .opc1 = 3, .crn = 0, .crm = 5, .opc2 = 0,
992992
.access = PL0_RW, .accessfn = access_tdcc,
993993
.type = ARM_CP_CONST, .resetvalue = 0 },
994+
{ .name = "DBGDTRTX", .state = ARM_CP_STATE_AA32, .cp = 14,
995+
.opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0,
996+
.access = PL0_RW, .accessfn = access_tdcc,
997+
.type = ARM_CP_CONST, .resetvalue = 0 },
998+
/* This is AArch64-only and is a combination of DBGDTRTX and DBGDTRRX */
999+
{ .name = "DBGDTR_EL0", .state = ARM_CP_STATE_AA64,
1000+
.opc0 = 2, .opc1 = 3, .crn = 0, .crm = 4, .opc2 = 0,
1001+
.access = PL0_RW, .accessfn = access_tdcc,
1002+
.type = ARM_CP_CONST, .resetvalue = 0 },
9941003
/*
9951004
* OSECCR_EL1 provides a mechanism for an operating system
9961005
* to access the contents of EDECCR. EDECCR is not implemented though,

0 commit comments

Comments
 (0)