Files
2026-11-18 01:39:26 +09:00

83 lines
5.1 KiB
Markdown

# Command-engine initialization comparison
Investigation checkpoint: 2026-11-13. The last live command reached BAM EOT
but did not change the DMA target. No command-engine or Internet success is
established. The additional global-register observations below are prepared
in source; they have not yet been compiled or sampled on the phone.
The reference is Xiaomi `platina-o-oss`, commit
`0bb2780bccb9c7e05f0edf5db8860e779179b5f9`. Paths below are relative to that
tree. Register offsets are relative to the corrected IPA or BAM aperture,
not the original wrapper address.
| Item | Pinned Android behavior | Current experiment / evidence |
|---|---|---|
| IPA reset | `ipa_v2/ipa_utils.c:ipa_init_hw()` asserts then deasserts IPA soft reset at `0x3c` | No global reset; reset ownership remains unresolved |
| IPA enable / BCR | Configuration `0x11`, then v2.6L BCR `0x001fff7f` | Already tried; BCR reads back `0x001fef7f`, SRAM writeback still fails |
| BAM reset | `sps/bam.c:bam_init()` resets and enables BAM | No global reset; AP pipe checks do not establish Q6 pipe idleness |
| BAM local clock gating | IPA sets `SPS_BAM_NO_LOCAL_CLK_GATING`; SPS clears control bits 18:17 | Previous control `0x20002` has field value 1; source now records it explicitly |
| BAM configuration | SPS writes `0xfffff7ff` unless the separate no-external-pipe-reset option is used | No write by the diagnostic; new read at BAM `0x7c` is pending |
| BAM summing threshold | IPA explicitly supplies `IPA_SUMMING_THRESHOLD = 0x10` | New read at BAM `0x8` is pending; do not confuse this with the per-pipe event threshold or SPS's fallback of 4 |
| Initial core vote | `ipa_v2/ipa.c` starts at turbo, 200 MHz | Existing diagnostic requests 75 MHz after preparing the clock; new JSON records the provider's cached request |
| SMMU clock / bus votes | Vendor DT names `AGGR2_NOC_SMMU_CLK` and supplies two bus paths | Need to compare matching mainline SMMU/interconnect ownership before adding duplicate votes |
| Command EP configuration | `ipa_setup_apps_pipes()` requests DMA mode but sets `skip_ep_cfg=true` | EP control/mode both read 0; requested mode alone does not justify a register write |
| Addressing | Vendor supports both bypass and translated SPS allocations | Both 32-bit and below-1-GiB translated tests failed; preserve the strict DMA domain |
The constants for the older IPA-specific BAM configuration path are not the
v2.6L initialization value. In `ipa_setup_bam_cfg()`, the write is conditional
on hardware older than v2.5, even though the switch also selects a constant
for v2.6L. Preserve that condition when reading the code.
## Next observation
Build `platina_ipa_v2_cmd_test.ko` with the same prepared source, configuration,
Clang and symbol table used for the existing diagnostic. A previous `.ko`
does not contain the new fields. Record the new source and binary hashes
before copying or loading it. Normal modpost and module checks are required.
Use the established opt-in boot procedure to keep MSS offline from startup;
do not stop an already running modem. Verify the corrected ANOC2 context IRQs,
strict DMA domain, battery guard and USB recovery access first. In that test
boot, load only the inspection mode:
```sh
sudo insmod ./platina_ipa_v2_cmd_test.ko inspect=1
sudo cat /sys/module/platina_ipa_v2_cmd_test/parameters/snapshot
sudo rmmod platina_ipa_v2_cmd_test
```
Retain the complete kernel log as well as JSON. New fields are
`bam_config_sampled`, `bam_control`, `bam_cfg_bits`, `bam_desc_threshold` and
`core_cached_hz`. Numbers in JSON are decimal. An early probe rejection can
leave fields zero; only `bam_config_sampled=true` establishes that all three
BAM global reads finished. The cached clock value is not a measured hardware
frequency. Inspection success still has `command_completed=false` and
`datapath_ready=false`.
The new source adds reads only to the BAM global configuration sequence.
It does not change global reset, clock rate, BAM configuration, thresholds,
command bytes or completion rules. The existing command test's per-pipe
writes remain available only with `run=1`.
Compare the inherited state before selecting a single additional experiment.
Do not write the whole vendor initialization sequence merely because one
read differs. Q6/WLAN register reads remain excluded, and an unchanged DMA
target after a submitted command still requires retaining resources until
reboot. Restore the checked original DSP/RMTFS service files and normal boot
after the inspection session.
## Supplementary upstream review
The September 2021 RFC pages for BAM transport and v2 commands are authored
by Sireesh Kodali (the command patch also credits Vladimir Lypak). They are
useful cross-checks, not a qualified driver for this board:
- `https://lists.openwall.net/linux-kernel/2021/09/20/40`
- `https://lkml.iu.edu/2109.2/04407.html`
Their transport path uses a dedicated immediate-command flag and places the
opcode in the descriptor length. Do not copy the RFC command layout without
checking the vendor's v2 bitfields: the pinned shared-memory command puts
direction at word 2 bit 16, followed by `skip_pipeline_clear` at bit 17.
The current encoder and golden-byte test retain that vendor format.