target/arm: Honour MDCR_EL2.HPMD in Secure EL2
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 22 Aug 2022 13:23:53 +0000 (14:23 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 14 Sep 2022 10:19:40 +0000 (11:19 +0100)
commit872d20343de4f1af45a31270f47cc54cc474bf55
tree83d57890dda3247eac95f3b3a6c6bdd91d2c6eaf
parentb57aa7bdc3b4f16b216bd854e86431146729a640
target/arm: Honour MDCR_EL2.HPMD in Secure EL2

The logic in pmu_counter_enabled() for handling the 'prohibit event
counting' bits MDCR_EL2.HPMD and MDCR_EL3.SPME is written in a way
that assumes that EL2 is never Secure.  This used to be true, but the
architecture now permits Secure EL2, and QEMU can emulate this.

Refactor the prohibit logic so that we effectively OR together
the various prohibit bits when they apply, rather than trying to
construct an if-else ladder where any particular state of the CPU
ends up in exactly one branch of the ladder.

This fixes the Secure EL2 case and also is a better structure for
adding the PMUv8.5 bits MDCR_EL2.HCCD and MDCR_EL3.SCCD.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220822132358.3524971-6-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
target/arm/helper.c