From 47bf915b7cf3e0e6199d3971a367b302ed058dab Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Wed, 16 Dec 2015 17:19:40 +0000 Subject: [PATCH] platform: smarter detection of big cores If big_core is not explicitly specified by the user, it is populated by Platform (provided the target has exactly two clusters). Perviously this was done bu assuming that the target boots on little cluster and that the last CPU is big. This is still used as a fallback, but now Platform is ware of the names of big CPUs in currently existing big.LITTLE configurations and uses that first to identify the big. --- devlib/platform/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/devlib/platform/__init__.py b/devlib/platform/__init__.py index cd92479..beda557 100644 --- a/devlib/platform/__init__.py +++ b/devlib/platform/__init__.py @@ -1,6 +1,9 @@ import logging +BIG_CPUS = ['A15', 'A57', 'A72'] + + class Platform(object): @property @@ -36,8 +39,7 @@ class Platform(object): self.core_names = target.cpuinfo.cpu_names self._set_core_clusters_from_core_names() if not self.big_core and self.number_of_clusters == 2: - big_idx = self.core_clusters.index(max(self.core_clusters)) - self.big_core = self.core_names[big_idx] + self.big_core = self._identify_big_core() if not self.core_clusters and self.core_names: self._set_core_clusters_from_core_names() if not self.model: @@ -64,6 +66,13 @@ class Platform(object): except Exception: # pylint: disable=broad-except pass # this is best-effort + def _identify_big_core(self): + for core in self.core_names: + if core.upper() in BIG_CPUS: + return core + big_idx = self.core_clusters.index(max(self.core_clusters)) + return self.core_names[big_idx] + def _validate(self): if len(self.core_names) != len(self.core_clusters): raise ValueError('core_names and core_clusters are of different lengths.')