Skip to content

Commit d18902f

Browse files
widgetiiclaude
andauthored
clocks(v5): annotate HPM with source (chip|board) and svb_version (#170)
Two cheap, useful annotations on the existing v5 hpm output: source -- HPM_STORAGE_REG bit[30] (u_hpm_storage_reg.use_board_hpm in svb.h). When set, HPM_STORAGE_REG bits[9:0] reflect a board-fixture calibration override rather than an in-die measurement averaged by boot software. The "chip" value is the real silicon process bin; the "board" value is whatever the manufacturing line decided to ship. Worth knowing when comparing HPM readings across boards. svb_version -- SVB_VER_REG (SYSCTRL+0x168) bits[5:2] (u_svb_version_reg.svb_type / enum product_type): 1=SVB_10, 2=SVB_20, 3=SVB_00, 4=SVB_608, 0=none. The "binning pass" threshold for "this die is fast enough" depends on the SVB version (CORE_HPM_BOUND_10 / _20 / _10_ESMT in svb.h). On boards where svb_version=none the firmware isn't running SVB at all and the standard hpm_info tri-state classification is informational only. Hi3519DV500 demo board reads source=chip, svb_version=none -- which matches what we observed in the SSMOD/HPM survey (HPM_STORAGE_REG bit[30] clear; SVB_VER_REG=0x00100200 -> svb_type=0). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2052f8b commit d18902f

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

src/hal/hisi/clocks_v5.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,54 @@ static void v5_extra(cJSON *root, bool brief) {
238238
cJSON_AddItemToObject(root, "ssmod", ss);
239239
}
240240

241+
/* HPM annotations layered onto the standard hpm decoder output:
242+
* source -- where HPM_STORAGE_REG bits[9:0] came from.
243+
* bit[30] (u_hpm_storage_reg.use_board_hpm) tells us
244+
* whether the value reflects an in-die measurement
245+
* averaged by boot software ("chip") or a board
246+
* fixture's calibration override ("board"). The
247+
* "chip" value is the real silicon process bin;
248+
* the "board" value is whatever the manufacturing
249+
* line decided to ship.
250+
* svb_version -- SVB_VER_REG bits[5:2] (u_svb_version_reg.svb_type),
251+
* per svb.h's enum product_type. The binning
252+
* threshold for "this die is fast enough" depends
253+
* on the SVB version (CORE_HPM_BOUND_10 / _20 /
254+
* _10_ESMT in svb.h). When this is "none" the
255+
* firmware isn't running SVB at all and the bin
256+
* classification is informational only. */
257+
cJSON *hpm = cJSON_GetObjectItemCaseSensitive(root, "hpm");
258+
if (hpm) {
259+
uint32_t hpm_storage = 0;
260+
uint32_t svb_ver = 0;
261+
bool use_board_hpm = false;
262+
if (mem_reg(V5_SYSCTRL_BASE + 0x340, &hpm_storage, OP_READ))
263+
use_board_hpm = (hpm_storage >> 30) & 0x1;
264+
const char *svb_name = "none";
265+
if (mem_reg(V5_SYSCTRL_BASE + 0x168, &svb_ver, OP_READ)) {
266+
switch ((svb_ver >> 2) & 0xF) {
267+
case 1:
268+
svb_name = "10";
269+
break;
270+
case 2:
271+
svb_name = "20";
272+
break;
273+
case 3:
274+
svb_name = "00";
275+
break;
276+
case 4:
277+
svb_name = "608";
278+
break;
279+
default:
280+
svb_name = "none";
281+
break;
282+
}
283+
}
284+
cJSON *j_inner = hpm;
285+
ADD_PARAM("source", use_board_hpm ? "board" : "chip");
286+
ADD_PARAM("svb_version", svb_name);
287+
}
288+
241289
/* Per-site HPM live readings -- only in full output. The canonical
242290
* core_hpm_value at HPM_STORAGE_REG is already surfaced by the
243291
* generic hpm decoder via v5_hpms[]. */

0 commit comments

Comments
 (0)