Repository navigation
sptm_virt: keep cpu-ids 32 to 34 in the S2R core masks and the DCC transport's per-core state - #407
Conversation
…ansport's per-core state MAX_CPUS is 64 since 0f5f939, for the M5 Ultra (J775D), whose cpu-ids run to 34. Some SPTM-virt per-core state is still sized for 32: - s2r_twi_mask, s2r_parked_mask and s2r_crumb_wfi are u32, so BIT(cpu) for a cpu-id of 32 or more is lost there: such a core never counts as armed, parked or at its deep-sleep WFI. - s2r_trace_cpus() refuses a cpu-id of 32 or more, so the T6050 timer-only trace setup fails on a tree with such cpu-ids. - The DCC transport keeps its errno and presented cookie in 32 per-core slots, and cpu-ids 31 and up share the last one, so a doorbell on one of those cores can take the cookie another presented, or read its errno. Widen the masks to u64 and size the rest by MAX_CPUS. The PMU scratch crumb still records cores 0 to 15 in its two bytes, as before. Only SPTM-virt builds run this code, and no T6050 runs S2R today. On a SoC whose cpu-ids stay below 32 the masks hold the same bits and the DCC slots are the same. Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
|
Thanks for widening these. The u64 masks and the MAX_CPUS-sized DCC slots look right, and the build/size checks are helpful. One thing before this can go in: the second commit ("gfya") deletes |
|
Besides the S2R core-mask change, this branch deletes Assisted-by: LLM (Claude:Opus 5.5) |
c3d072e to
844860c
Compare
|
Thanks for catching that. The deletion wasn't in our commit: our fork had the repository's instruction-file policy workflow enabled, and on the push it healed the branch against the fork's stale default branch, adding a |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed 844860c, now down to the one src/sptm_virt_* commit. Thanks for clearing the bot commit that deleted the policy files.
Correct:
- The three masks are
u64and every user handles that:BIT()is1UL <<, the atomics__atomic_fetch_orand__atomic_or_fetchwork on the variable itself, ands2r_cleanusessizeof. - The stop-mode messages print
%lx. s2r_trace_cpus()bounds byMAX_CPUSagainst its u64seen.- The DCC slots are
MAX_CPUS.
Below cpu-id 32 the bits and slots are identical. The code is only in SPTM-virt development builds, not release images.
Hardware gate: the only machine where the behaviour changes (J775D, cpu-ids 32-34) can't run SPTM-virt yet, and every other machine gets identical state, so I'm not asking for a row. Merging once the queued CI finishes green on this head.
Assisted-by: Claude Opus 5.5
…50 handoff bounds Three merged changes had no test in the tree. Each gets a host test that builds the code unchanged, with the registers, the ADT and the device tree as stand-ins: - test_mmu_ctrr_l3.py (aurora-silicon#411): the page-table builder of memory.c and ctxr_range() run on host memory with 16K pages. An L2 block whose output range holds an armed CTRR_C or CTRR_D is built from L3 pages, in every alias of the RAM, and no other block is. The ranges are read once, and not at all with unlocked Apple system registers, off EL2 or for an unmapping; a register that faults under the guard changes nothing. Seeded layouts are compared with a model of the mapping rule. - test_sptm_virt_cpu_ids.py (aurora-silicon#407): the S2R trace's walk of /cpus, the stop-mode and go-mode core masks and the DCC transport's per-core cookie and errno, each driven with cpu-ids on both sides of 32, up to MAX_CPUS - 1. - test_t6050_handoff_bounds.py (aurora-silicon#408): a panel-less board through dt_set_display_handoff(), and the panel path's ADT checks. A boot framebuffer that starts at or past the end of /vram, and a bandwidth scratch in a PMC metadata block of under 4 bytes, are refused and the device tree is left as it was; the edges on the allowed side are still handed off. Seeded cases are compared with the rule in whole numbers, which cannot wrap. Each test takes another source through an environment variable (AURA_MMU_SOURCE, AURA_SPTM_SOURCE, AURA_T6050_SOURCE), so the same file can be run against a changed copy as a negative control. No production code changes. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
What is missing
dj's review of #262:
s2r_twi_mask,s2r_parked_maskands2r_crumb_wfi(src/sptm_virt_s2r.c) areu32, notu64 as #262's description said, so
BIT(cpu)for cpu-ids 32 to 34 is lost there: such a core never counts as armed,parked or at its deep-sleep WFI.
Two more places in SPTM-virt are sized for 32 cpu-ids, from before MAX_CPUS went to 64:
s2r_trace_cpus()(src/sptm_virt_s2r_soc.c) refuses a cpu-id of 32 or more, so the T6050 timer-only tracesetup fails on a tree whose cpu-ids reach 32, as the M5 Ultra's (J775D) do.
src/sptm_virt_ctl.c) keeps its errno and presented cookie in 32 per-core slots and clampssmp_id()to the last one, so cpu-ids 31 to 34 share a slot: a doorbell on one of those cores can take thecookie another core presented, or read its errno.
What this changes
u64, and the two stop-mode messages that print them use%lx.s2r_trace_cpus()takes cpu-ids below MAX_CPUS; itsseenmask is already u64.ctl_dcc_errno[]andctl_dcc_presented[]get MAX_CPUS slots. The clamp stays.after it.
Other per-CPU state indexed by
smp_id()in hv, nv2 and sptm_virt is already sized by MAX_CPUS or held in u64 masks.world_hist(sptm_virt_cl4.c) keeps 12 cores on purpose, for .bss, and skips the others.Who runs the changed code
Only SPTM-virt development builds (
SPTM_VIRT=1; the DCC transport withAURACTL=1), and no T6050 runs S2R today.On a SoC whose cpu-ids stay below 32, the masks hold the same bits, the messages print the same values, and each core
keeps its own DCC slot. A release build does not contain these files.
Validation
On main at 3efa4a8, with clang/lld 23.1.4:
RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1: main's 13 warnings;aura.bin3997696 bytes, every section and_file_vital_end(0x11be50) as on main.CHAINLOADING=1 ESP_STAGE2=1 SPTM_VIRT=1 AURACTL=1 SPTM_VIRT_ESP=1, which compiles the three files: main'swarnings. The .bss objects grow by 396 bytes (the masks 12, the DCC slots 384), inside the padding:
_bss_end0x390000 and
aura.bin3801088 bytes, as on main.tests/pythonand the two T8122 GPU tests, pytest 9.1.1): 798 passed,57 skipped, as on main.
Hardware
Not run on hardware: no SPTM-virt build boots on a T6050 yet, and the release image does not contain these files.