Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,11 @@ IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_MOCK_TESTS)
TARGET_LINK_LIBRARIES(pixel-2-xl-test PRIVATE cpuinfo_mock gtest)
ADD_TEST(NAME pixel-2-xl-test COMMAND pixel-2-xl-test)

ADD_EXECUTABLE(pixel-8-test test/mock/pixel-8.cc)
TARGET_INCLUDE_DIRECTORIES(pixel-8-test BEFORE PRIVATE test/mock)
TARGET_LINK_LIBRARIES(pixel-8-test PRIVATE cpuinfo_mock gtest)
ADD_TEST(NAME pixel-8-test COMMAND pixel-8-test)

ADD_EXECUTABLE(xiaomi-mi-5c-test test/mock/xiaomi-mi-5c.cc)
TARGET_INCLUDE_DIRECTORIES(xiaomi-mi-5c-test BEFORE PRIVATE test/mock)
TARGET_LINK_LIBRARIES(xiaomi-mi-5c-test PRIVATE cpuinfo_mock gtest)
Expand Down
2 changes: 2 additions & 0 deletions scripts/android-arm64-mock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ adb push build/android/arm64-v8a/pixel-c-test /data/local/tmp/pixel-c-test
adb push build/android/arm64-v8a/pixel-xl-test /data/local/tmp/pixel-xl-test
adb push build/android/arm64-v8a/pixel-test /data/local/tmp/pixel-test
adb push build/android/arm64-v8a/pixel-2-xl-test /data/local/tmp/pixel-2-xl-test
adb push build/android/arm64-v8a/pixel-8-test /data/local/tmp/pixel-8-test
adb push build/android/arm64-v8a/xiaomi-mi-5c-test /data/local/tmp/xiaomi-mi-5c-test
adb push build/android/arm64-v8a/xiaomi-redmi-note-3-test /data/local/tmp/xiaomi-redmi-note-3-test
adb push build/android/arm64-v8a/xiaomi-redmi-note-4-test /data/local/tmp/xiaomi-redmi-note-4-test
Expand Down Expand Up @@ -75,6 +76,7 @@ adb shell "/data/local/tmp/pixel-c-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-xl-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-2-xl-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-8-test --gtest_color=yes"
adb shell "/data/local/tmp/xiaomi-mi-5c-test --gtest_color=yes"
adb shell "/data/local/tmp/xiaomi-redmi-note-3-test --gtest_color=yes"
adb shell "/data/local/tmp/xiaomi-redmi-note-4-test --gtest_color=yes"
Expand Down
2 changes: 2 additions & 0 deletions scripts/android-armv7-mock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ adb push build/android/armeabi-v7a/pixel-c-test /data/local/tmp/pixel-c-test
adb push build/android/armeabi-v7a/pixel-xl-test /data/local/tmp/pixel-xl-test
adb push build/android/armeabi-v7a/pixel-test /data/local/tmp/pixel-test
adb push build/android/armeabi-v7a/pixel-2-xl-test /data/local/tmp/pixel-2-xl-test
adb push build/android/armeabi-v7a/pixel-8-test /data/local/tmp/pixel-8-test
adb push build/android/armeabi-v7a/xiaomi-mi-5c-test /data/local/tmp/xiaomi-mi-5c-test
adb push build/android/armeabi-v7a/xiaomi-redmi-2a-test /data/local/tmp/xiaomi-redmi-2a-test
adb push build/android/armeabi-v7a/xiaomi-redmi-note-3-test /data/local/tmp/xiaomi-redmi-note-3-test
Expand Down Expand Up @@ -145,6 +146,7 @@ adb shell "/data/local/tmp/pixel-c-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-xl-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-2-xl-test --gtest_color=yes"
adb shell "/data/local/tmp/pixel-8-test --gtest_color=yes"
adb shell "/data/local/tmp/xiaomi-mi-5c-test --gtest_color=yes"
adb shell "/data/local/tmp/xiaomi-redmi-2a-test --gtest_color=yes"
adb shell "/data/local/tmp/xiaomi-redmi-note-3-test --gtest_color=yes"
Expand Down
36 changes: 35 additions & 1 deletion src/arm/linux/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,52 @@ void cpuinfo_arm_linux_init(void) {
}

/* Propagate topology group IDs among siblings */
bool detected_core_siblings_list_node = false;
bool detected_cluster_cpus_list_node = false;
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
if (!bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
continue;
}

if (arm_linux_processors[i].flags & CPUINFO_LINUX_FLAG_PACKAGE_ID) {
if (!bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_PACKAGE_ID)) {
continue;
}

/* Use the cluster_cpus_list topology node if available. If not
* found, cache the result to avoid repeatedly attempting to
* read the non-existent paths.
* */
if (!detected_core_siblings_list_node && !detected_cluster_cpus_list_node) {
if (cpuinfo_linux_detect_cluster_cpus(
arm_linux_processors_count,
i,
(cpuinfo_siblings_callback)cluster_siblings_parser,
arm_linux_processors)) {
detected_cluster_cpus_list_node = true;
continue;
} else {
detected_core_siblings_list_node = true;
}
}

/* The cached result above will guarantee only one of the blocks
* below will execute, with a bias towards cluster_cpus_list.
**/
if (detected_core_siblings_list_node) {
cpuinfo_linux_detect_core_siblings(
arm_linux_processors_count,
i,
(cpuinfo_siblings_callback)cluster_siblings_parser,
arm_linux_processors);
}

if (detected_cluster_cpus_list_node) {
cpuinfo_linux_detect_cluster_cpus(
arm_linux_processors_count,
i,
(cpuinfo_siblings_callback)cluster_siblings_parser,
arm_linux_processors);
}
}

/* Propagate all cluster IDs */
Expand Down
Loading