openocd: src/target: Correctly handle CCSIDR_EL1.Associativity=0
commitee96a95d44322aa109847e35b86aed5ad3066cf8
authorPeter Collingbourne <pcc@google.com>
Thu, 28 Sep 2023 00:02:03 +0000 (27 17:02 -0700)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 18 Nov 2023 11:20:56 +0000 (18 11:20 +0000)
tree4ddab1ee185ef8725d65cdd97f3e378a5e7558e9
parent851d1ad87a6e9f1ae1b44b8ac395138031290488
openocd: src/target: Correctly handle CCSIDR_EL1.Associativity=0

Associativity=0 means that only one CMO is needed for all ways.
It could also mean that the cache is 1-way, but this is less likely.

Currently Associativity=0 causes us to hang in the while loop in
decode_cache_reg. Fix it by skipping the loop in this case. We can let
way_shift be set to the arbitrary value of 0 because in the case where
Associativity=0 we only ever shift 0 by it before ORing it into the
CMO operand.

Change-Id: I7c1de68d33f6b3ed627cbb1e2401d43185e4c1e3
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7916
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/armv8_cache.c