From: Hongbo Zhang <hongbo.zh...@linaro.org>

In the default dummy function systemcpu(), only cpu_hz[0] and model_str[0]
are set to dummy values, then in the validation code if iterate each CPU,
cores other than core 0 report failure, this patchs pad all the arrays to
default values to pass validation.

For bug: https://bugs.linaro.org/show_bug.cgi?id=1870

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-by: Ivan Khoronzhuk <ivan.khoronz...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 8bd1584..6a05501 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -358,7 +358,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
 
 static int systemcpu(odp_system_info_t *sysinfo)
 {
-       int ret;
+       int ret, i;
 
        ret = sysconf_cpu_count();
        if (ret == 0) {
@@ -371,10 +371,14 @@ static int systemcpu(odp_system_info_t *sysinfo)
        sysinfo->huge_page_size = huge_page_size();
 
        /* Dummy values */
-       sysinfo->cpu_hz[0]       = 1400000000;
        sysinfo->cache_line_size = 64;
 
-       strncpy(sysinfo->model_str[0], "UNKNOWN", sizeof(sysinfo->model_str));
+       ODP_DBG("Warning: use dummy values for freq and model string\n");
+       ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n";);
+       for (i = 0; i < MAX_CPU_NUMBER; i++) {
+               sysinfo->cpu_hz[i] = 1400000000;
+               strcpy(sysinfo->model_str[i], "UNKNOWN");
+       }
 
        return 0;
 }
-- 
1.9.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to