target/arm: trap DCC access in user mode emulation
commitf9ac778898cb28307e0f91421aba34d43c34b679
authorZhuojia Shen <chaosdefinition@hotmail.com>
Tue, 6 Jun 2023 09:19:40 +0000 (6 10:19 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 6 Jun 2023 09:19:40 +0000 (6 10:19 +0100)
treebb19b404245559a155a6269198417c6dd633250b
parentc81e4ab370e858550852b052f689a0a721b879d4
target/arm: trap DCC access in user mode emulation

Accessing EL0-accessible Debug Communication Channel (DCC) registers in
user mode emulation is currently enabled.  However, it does not match
Linux behavior as Linux sets MDSCR_EL1.TDCC on startup to disable EL0
access to DCC (see __cpu_setup() in arch/arm64/mm/proc.S).

This patch fixes access_tdcc() to check MDSCR_EL1.TDCC for EL0 and sets
MDSCR_EL1.TDCC for user mode emulation to match Linux.

Signed-off-by: Zhuojia Shen <chaosdefinition@hotmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: DS7PR12MB630905198DD8E69F6817544CAC4EA@DS7PR12MB6309.namprd12.prod.outlook.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/cpu.c
target/arm/debug_helper.c