|
53 | 53 | - [6. Customizations & Extensions](#6-customizations--extensions) |
54 | 54 | - [6.1. Extensions Interface](#61-extensions-interface) |
55 | 55 | - [6.1.1. Registering Resource Callbacks](#611-registering-resource-callbacks) |
56 | | - - [6.1.2. Registering Custom Configs](#612-registering-custom-configs) |
| 56 | + - [6.1.2. Fetching Target Information](#612-fetching-target-information) |
| 57 | + - [6.1.3. Registering Custom Configs](#613-registering-custom-configs) |
57 | 58 | - [6.2. Custom Configs](#62-custom-configs) |
58 | 59 | - [6.2.1. Initialization Configs](#621-initialization-configs) |
59 | 60 | - [6.2.2. Resource Configs](#622-resource-configs) |
@@ -1105,8 +1106,41 @@ void resetCustomCpuFreqCustom(void* res) { |
1105 | 1106 | URM_REGISTER_RES_TEAR_CB(0x00010001, resetCustomCpuFreqCustom); |
1106 | 1107 | ``` |
1107 | 1108 |
|
| 1109 | +### 6.1.2. Fetching Target Information |
1108 | 1110 |
|
1109 | | -### 6.1.2. Registering Custom Configs |
| 1111 | +Plugins can fetch target information using the "GET_TARGET_INFO" helper utility provided by URM. The following information can be retrieved: |
| 1112 | +- CPU Masks |
| 1113 | +- Logical to Physical Mappings |
| 1114 | +- Number of cores / clusters on the target |
| 1115 | + |
| 1116 | +```cpp |
| 1117 | +// Utility to fetch target-specific information |
| 1118 | +uint64_t GET_TARGET_INFO(int32_t option, |
| 1119 | + int32_t numArgs, |
| 1120 | + int32_t* args); |
| 1121 | +``` |
| 1122 | + |
| 1123 | +Usage: |
| 1124 | + |
| 1125 | +For example, to get a cpu mask (which can be used, for example, for IRQ affinity use cases): |
| 1126 | +```cpp |
| 1127 | + int32_t args[2] = {0, 0}; |
| 1128 | + uint64_t mask = GET_TARGET_INFO(GET_MASK, 2, args); // all cores in silver cluster |
| 1129 | +``` |
| 1130 | + |
| 1131 | +- The first parameter in the args array, in this case is the logical cluster ID. |
| 1132 | +Here, we use the logical identifier for the silver cluster, using logical identifiers in the code makes it target-architecture independent, hence portable. |
| 1133 | +The clusters logical id's are ordered according to the cluster capacities. Hence: 0 represents silver / little, 1 represents gold / big and 2 represents prime. |
| 1134 | + |
| 1135 | +- The second parameter in the args array, in this case is the number of cores in the cluster to be considered for mask creation. 0 represents all cores within the cluster, a non-zero positive value represents the exact number of cores to be considered. |
| 1136 | + |
| 1137 | +To simply get a mask corresponding to the highest capacity cluster on the target, for all cores, the GET_MAX_CLUSTER query can be used, as follows: |
| 1138 | +```cpp |
| 1139 | + int32_t args[2] = {GET_MAX_CLUSTER, 0}; |
| 1140 | + uint64_t mask = GET_TARGET_INFO(GET_MASK, 2, args); // all cores in the highest capacity cluster |
| 1141 | +``` |
| 1142 | + |
| 1143 | +### 6.1.3. Registering Custom Configs |
1110 | 1144 |
|
1111 | 1145 | Custom config files either can be placed in /etc/urm/custom or Registers a custom configuration (URM_REGISTER_CONFIG) YAML file. This enables target chipset to provide their own config files, i.e. allowing them to provide their own custom resources for example. |
1112 | 1146 |
|
|
0 commit comments