aboutsummaryrefslogtreecommitdiff
path: root/module/cmn600
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2020-06-15 12:11:12 +0100
committerChris Kay <chris@cjkay.com>2020-06-15 15:04:10 +0100
commit16e65616fe0168ad0902c1aef51a77d21474b003 (patch)
tree1ee2790138090581b3ede3802ebb5d9329b30f42 /module/cmn600
parent6c211267850d452d342d4dad5892c1bacfd040b5 (diff)
cmn600: Fix incorrect cache group count calculation
The CMN-600 module currently incorrectly calculates the HN-F cache group count for HN-F counts less than the number of HN-F entries per HN-F cache group. Change-Id: If840a78b8b70b1eb8b2b77768f4e95c0d8c369b3 Signed-off-by: Chris Kay <chris.kay@arm.com>
Diffstat (limited to 'module/cmn600')
-rw-r--r--module/cmn600/src/mod_cmn600.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/module/cmn600/src/mod_cmn600.c b/module/cmn600/src/mod_cmn600.c
index dcd8ca54..12a461e7 100644
--- a/module/cmn600/src/mod_cmn600.c
+++ b/module/cmn600/src/mod_cmn600.c
@@ -32,6 +32,12 @@
#define MOD_NAME "[CMN600] "
+static inline size_t cmn600_hnf_cache_group_count(size_t hnf_count)
+{
+ return (hnf_count + CMN600_HNF_CACHE_GROUP_ENTRIES_PER_GROUP - 1) /
+ CMN600_HNF_CACHE_GROUP_ENTRIES_PER_GROUP;
+}
+
struct cmn600_ctx *ctx;
/* Chip information API */
@@ -521,7 +527,7 @@ int cmn600_setup_sam(struct cmn600_rnsam_reg *rnsam)
}
}
- group_count = ctx->hnf_count / CMN600_HNF_CACHE_GROUP_ENTRIES_PER_GROUP;
+ group_count = cmn600_hnf_cache_group_count(ctx->hnf_count);
for (group = 0; group < group_count; group++)
rnsam->SYS_CACHE_GRP_HN_NODEID[group] = ctx->hnf_cache_group[group];
@@ -575,7 +581,7 @@ static int cmn600_setup(void)
* HN-F nodes in the system.
*/
ctx->hnf_cache_group = fwk_mm_calloc(
- ctx->hnf_count / CMN600_HNF_CACHE_GROUP_ENTRIES_PER_GROUP,
+ cmn600_hnf_cache_group_count(ctx->hnf_count),
sizeof(*ctx->hnf_cache_group));
}
}