Files

IPA v2.6L Android bring-up

This directory is an opt-in kernel investigation, not an Internet driver. It is not installed by the runtime overlay and has no automatic service.

As of 2026-11-13, strict DMA mapping and the corrected DT context IRQs have been verified. A BAM descriptor reached EOT, but the SRAM read did not update its DMA target. Cellular Internet and command-engine execution remain unverified. See docs/CELLULAR.md in the repository for measured results.

The reference is MiCode/Xiaomi_Kernel_OpenSource, branch platina-o-oss, commit 0bb2780bccb9c7e05f0edf5db8860e779179b5f9:

Source What it establishes
arch/arm/boot/dts/qcom/sdm660.dtsi Raw IPA/BAM resources, clocks and AP SMMU stream ID
drivers/platform/msm/ipa/ipa_v2/ipa_reg.h Register offset 0x40000 within the wrapper
drivers/platform/msm/ipa/ipa_v2/ipa_utils.c v2.6L endpoints, register setup and memory partition selection
drivers/platform/msm/ipa/ipa_v2/ipa.c BAM registration, command pipe and table initialization order
drivers/platform/msm/ipa/ipa_v2/ipa_ram_mmap.h v2.6L SRAM layout; it differs from the experimental GSI data
drivers/platform/msm/ipa/ipa_v2/ipa_dp.c Immediate-command descriptor length contains the opcode
include/linux/msm-sps.h IPA immediate flag 0x0100; ordinary BAM command flag 0x0800
drivers/platform/msm/sps/bam.c NDP 4K BAM register layout and pipe ownership
drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c Q6 SRAM initialization precedes IPA QMI service startup
drivers/platform/msm/ipa/ipa_v2/ipa_qmi_service.c QMI initialization advertises real table offsets and WAN RX endpoint

Read-only diagnostic

Build with a fully prepared matching kernel source/configuration and symbol table, using the same toolchain as that kernel:

make -C /path/to/kernel ARCH=arm64 LLVM=1 \
    M=/path/to/mi8-platina-linux/project/cellular/ipa-v2 \
    CONFIG_DEBUG_INFO_BTF_MODULES= modules

The probe does not need split BTF debug information. Omitting it avoids referencing the rebuilt kernel's BTF type IDs when inspecting the currently running kernel. This does not disable CFI or relax module loading checks.

platina_ipa_v2_probe.ko accepts only the platina machine and the existing SDM660 IPA platform device. It refuses a bound driver and reserves both MMIO ranges while sampling. It prepares the core clock before requesting the original driver's 75 MHz SVS vote, then restores the old cached request while the clock is still prepared and releases it. This order matters: the matching clk-smd-rpm.c ignores rate changes while unprepared. core_cached_hz is the provider's cached request, not a measured hardware frequency. It reads version/configuration, SRAM bounds, BAM execution-environment ownership and the four AP pipe states. It does not reset IPA/BAM, write IPA/BAM registers, allocate DMA descriptors, acknowledge interrupts or send QMI.

There is no device alias: module loading must be explicit. With the reviewed matching module placed on the device, one snapshot is:

sudo insmod ./platina_ipa_v2_probe.ko
sudo cat /sys/module/platina_ipa_v2_probe/parameters/snapshot
sudo rmmod platina_ipa_v2_probe

The JSON always says datapath_ready: false. Readable registers, enabled pipes, or an IPA QMI reply do not establish public packet delivery. The IPA register named ENABLED_PIPES contains the available pipe count on v2.6L; ipa_num_pipes is not an enabled-pipe bitmap. Each BAM pipe's control bit 1 indicates whether that pipe is enabled.

DMA mapping and command diagnostics

The same Makefile builds platina_ipa_v2_dma_test.ko and platina_ipa_v2_cmd_test.ko. Neither has a device alias or automatic loader. scripts/phone-cellular-bam-overlay.py generates a temporary, separately named device for the mapping test; it does not replace the production node. The test checks each allocation against actual CPU backing pages. It does not submit DMA or prove that hardware uses those translations.

The command module binds only the corrected IPA platform device. It requires the strict DMA domain and context fault handlers, a private IOMMU group, MSS offline with no startup references, and initially disabled IPA plus idle AP/USB pipes. It serializes against MSS startup during the experiment. Do not stop a running modem to prepare this test: that earlier approach was followed by an unexplained reboot. The opt-in DSP/RMTFS boot configuration holds MSS offline only with the exact token platina.ipa_bringup=1; ordinary boots retain their original modem startup behavior. Live service changes must be restored from checked backups after testing.

inspect=1 performs only the idle-register checks, without enabling IPA, accessing SRAM or submitting descriptors. run=1 instead submits one 16-byte SRAM read on command pipe 3. Exactly one mode must be selected. The optional dma_bits=30 diagnostic bounds IOVA allocation below 1 GiB; the default is 32, and both retain strict IOMMU translation. The low-address experiment did not fix missing writeback and establishes no new hardware address limit.

The hardware EE0 attribute bitmap includes Q6 DECOMP pipe 11, but reading its control register while MSS was offline was immediately followed by reset. The diagnostic therefore reads only the vendor AP/USB endpoints 0–5. It does not claim to inspect all global pipe state or permit a global reset. It also uses the actual vendor BCR constant, enables IPA before SRAM access, and reads SRAM with explicit 32-bit transactions.

Success requires result=0, bam_eot_seen=true, command_completed=true, sram_bytes_match=true and resources_pinned=false. Module insertion or EOT alone is not success. The latest real result is result=-5, EOT seen, target unchanged, command incomplete and resources pinned. A failed memory comparison waits an additional second after EOT, then retains the driver, module, clock and mappings until reboot. Do not unload it or start MSS in that state. After a normal reboot the test resources are gone and the original boot image and service configuration should be verified.

The C command encoder has a native golden-byte and bounds test, including opcode 19 in the descriptor's size field and IMME|EOT = 0x4100. The tests exercise the actual shared encoder, but cannot qualify hardware execution.

The next source revision adds read-only BAM global configuration/threshold and cached core-clock observations. It is not yet compiled or live-tested; the earlier .ko files do not contain these fields. The pinned Android comparison and inspection procedure are in INITIALIZATION.md.

Dependencies for the real port

  1. Correct register aperture, clock/interconnect votes, AP DMA addressing and SMMU ownership. The historical ipa-shared region is actually BAM. The running snapshot already shows BAM enabled with EE ownership assigned. An active modem must be coordinated before any global IPA/BAM reset; do not reuse a DMA controller driver's unconditional global-reset probe.
  2. A BAM command producer at endpoint 3, with IMME, not DMA_PREP_CMD. Keep the DMA-mapped payload size separate from the descriptor's opcode. Reclaim mappings only after hardware completion or a confirmed DMA stop.
  3. v2.6L SRAM canaries, header/route/filter tables and modem memory, initialized through that functioning command pipe. Do not copy the v3.1 memory map.
  4. AP RX descriptors, refill/completion and endpoint configuration, including WAN RX endpoint 5, before starting data traffic. The vendor advertises the reserved WAN endpoint in INIT_MODEM_DRIVER; QMI service startup precedes the network interface's later data-pipe setup.
  5. The modem/uC handshake, RMNET/MAP mux configuration, packet delivery and modem restart cleanup. Only then qualify WDS calls and public DNS/TCP.

The original firmware assertion identifies an uninitialized immediate-command client in modem firmware. The missing AP initialization is a supported working hypothesis, not proof that one QMI request will restore PPP downlink.

Verified v2.6L memory partition

Evaluating the pinned vendor ipa_ram_mmap.h gives these logical SRAM offsets. The phone reports 8192 bytes and zero restricted bytes. The vendor adds the restricted-byte count when forming table addresses for immediate commands and QMI; these are not system DMA addresses.

Region Offset Size
uC information 0x0080 0x0200
IPv4 filter header 0x0288 0x0058
IPv6 filter header 0x02e8 0x0058
IPv4 route header 0x0348 0x003c
IPv6 route header 0x0388 0x003c
Modem header 0x03c8 0x0140
Modem compression/decompression 0x0510 0x0200
Modem memory 0x0714 0x18e8
End, including final canary 0x2000 —

The gaps contain the vendor's canaries. Do not fill an apparent gap or replace these offsets with the scaffold's v3.1 memory partitions. AP route indices are 7 through 14; modem indices are 0 through 6. The zero-sized AP SRAM header and filter regions do not remove their required DMA-backed tables or initialization.