@@ -2748,6 +2748,54 @@ hwloc__get_dmi_id_info(struct hwloc_linux_backend_data_s *data, hwloc_obj_t obj)
2748
2748
hwloc__get_dmi_id_one_info (data , obj , path , pathlen , "sys_vendor" , "DMISysVendor" );
2749
2749
}
2750
2750
2751
+ static void
2752
+ hwloc__get_soc_one_info (struct hwloc_linux_backend_data_s * data ,
2753
+ hwloc_obj_t obj ,
2754
+ char * path , int n , const char * info_suffix )
2755
+ {
2756
+ char soc_line [64 ];
2757
+ char infoname [64 ];
2758
+
2759
+ if (hwloc_read_path_by_length (path , soc_line , sizeof (soc_line ), data -> root_fd ) <= 0 )
2760
+ return ;
2761
+
2762
+ if (soc_line [0 ] != '\0' ) {
2763
+ char * tmp = strchr (soc_line , '\n' );
2764
+ if (tmp )
2765
+ * tmp = '\0' ;
2766
+ snprintf (infoname , sizeof (infoname ), "SoC%d%s" , n , info_suffix );
2767
+ hwloc_obj_add_info (obj , infoname , soc_line );
2768
+ }
2769
+ }
2770
+
2771
+ static void
2772
+ hwloc__get_soc_info (struct hwloc_linux_backend_data_s * data , hwloc_obj_t obj )
2773
+ {
2774
+ char path [128 ];
2775
+ struct dirent * dirent ;
2776
+ DIR * dir ;
2777
+
2778
+ /* single SoC, add topology info */
2779
+ strcpy (path , "/sys/bus/soc/devices" );
2780
+ dir = hwloc_opendir (path , data -> root_fd );
2781
+ if (!dir )
2782
+ return ;
2783
+
2784
+ while ((dirent = readdir (dir )) != NULL ) {
2785
+ int i ;
2786
+ if (sscanf (dirent -> d_name , "soc%d" , & i ) != 1 )
2787
+ continue ;
2788
+
2789
+ snprintf (path , sizeof (path ), "/sys/bus/soc/devices/soc%d/soc_id" , i );
2790
+ hwloc__get_soc_one_info (data , obj , path , i , "ID" );
2791
+ snprintf (path , sizeof (path ), "/sys/bus/soc/devices/soc%d/family" , i );
2792
+ hwloc__get_soc_one_info (data , obj , path , i , "Family" );
2793
+ snprintf (path , sizeof (path ), "/sys/bus/soc/devices/soc%d/revision" , i );
2794
+ hwloc__get_soc_one_info (data , obj , path , i , "Revision" );
2795
+ }
2796
+ closedir (dir );
2797
+ }
2798
+
2751
2799
2752
2800
/***************************************
2753
2801
* KNL NUMA quirks
@@ -7479,6 +7527,8 @@ hwloc_look_linuxfs(struct hwloc_backend *backend, struct hwloc_disc_status *dsta
7479
7527
if (data -> need_global_infos ) {
7480
7528
hwloc_gather_system_info (topology , data );
7481
7529
hwloc_linuxfs_check_kernel_cmdline (data );
7530
+ /* soc info needed for cpukinds quirks in hwloc_linuxfs_look_cpu() */
7531
+ hwloc__get_soc_info (data , topology -> levels [0 ][0 ]);
7482
7532
}
7483
7533
7484
7534
if (dstatus -> phase == HWLOC_DISC_PHASE_CPU ) {
0 commit comments