Repository navigation
amdvi: the firmware-left actuator invalidates with one INVALIDATE_IOMMU_ALL, and its metal row judges AMD-Vi units - #884
Conversation
|
Review, round 1 (design), at Net lines ( Sources.
The defect's own evidence holds:
BLOCKER
NOTE
DESIGN NEEDS CHANGES: |
|
Design acceptance, by the orchestrator, with the review's named changes (#884 (comment)). The owner's standing rule is that a design follows the manufacturer's documents and the published state of the art. Here that is AMD's 48882 §2.4.8 and Linux's
|
…t reds on an AMD-Vi machine Its judge finds units by ` translating gsts=`, which only vtd prints. An AMD-Vi machine programs no unit and says what it switched off in amdvi's own lines, so once the actuator's ring stops panicking the AMD bench's shared-debug boot, the row reds there on "no unit was programmed". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015xhaydXCVRNscoccHYFUWy
…MU_ALL The actuator wrote one INVALIDATE_DEVTAB_ENTRY for every requester id its unit's IVHD names into a 256-entry ring it never refilled, and asserted once 255 were written. The AMD bench's IVHD names 65,535 ids, so every shared-debug boot there panicked at amdvi/mod.rs:325 before the unit was switched off (#873's run). 0d783ac brought the IVHD walk in (#837); QEMU's IVHD names eight functions, so the guest test never reached the bound. It now sends INVALIDATE_IOMMU_ALL (48882 Table 41: opcode 08h, every other bit reserved) and the existing COMPLETION_WAIT. Per §2.4.8 every cache is empty once it completes, which also drops translations tagged with the BLOCKED entries' DomainID 1 that a per-entry walk left behind (§2.4.2). Linux does the same in amd_iommu_flush_all_caches whenever FEATURE_IA is set. A unit whose EFR IASup (bit 6) is clear is refused by name before anything is written: both units in reach set it, the bench's 0x206d73ef22254ade and QEMU's 0x29d3. The walk, its expect on the device list, the ring bound and leave_on's ivrs and unit parameters go. QEMU 11.1.1's amdvi_inval_all never re-reads a device table entry's mode, so under QEMU the actuator's entries block nothing: amdvi_firmware_left drops its stick-never-binds claim, keeps the register half's negative control, and the gap is filed with its exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015xhaydXCVRNscoccHYFUWy
The judge found units only by VT-d's ` translating gsts=`, so once the actuator stops panicking the AMD bench's shared-debug boot it would red there on "no unit was programmed". It now also takes every `iommu: amdvi unit<N> handed over control=` line as a unit, and requires that unit's CmdBufEn, EventLogEn and IommuEn hand-over lines and its switched-off line; the T14's VT-d units are judged as before. That log is on the stick only if the switch-off let the stick's DMA through, which is the half QEMU cannot show. Closes issues/the-iommu-firmware-left-row-reads-only-vt-d-lines-so-it-reds-on-an-amd-vi-machine.md, filed in this pull request's design round. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015xhaydXCVRNscoccHYFUWy
206ece4 to
f2c537a
Compare
|
Metal results at
Every file is masked and committed whole at evidence commit |
|
Review, round 2 (build), at Round 1's BLOCKERs (design review at
Measurements at this head
Net lines (
BLOCKERNone. NOTE
LAND AFTER NAMED CHANGES |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015xhaydXCVRNscoccHYFUWy
The guest test amdvi_firmware_left and the iommu_firmware_left metal row's judge each spelled the three fields (CmdBufEn, EventLogEn, IommuEn) and the kernel's "was handed over with <field> on; it goes off" line. They now both read common::iommu::amdvi_left_on, so a field the actuator leaves or a wording the kernel changes is written once. Review round 2's NOTE 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015xhaydXCVRNscoccHYFUWy
The
iommu-firmware-leftactuator's AMD-Vi arm overflowed its own 256-entry command ring on the AMD bench, so everyshared-debugboot there panicked atamdvi/mod.rs:325before the unit was switched off. This change makes it invalidate with oneINVALIDATE_IOMMU_ALLand the existingCOMPLETION_WAIT, and refuses by name a unit that cannot take that command. Theiommu_firmware_leftmetal row now judges AMD-Vi units by their own lines.Head
56095b138, onmainatc0cdddf4e. This is the build of the design the orchestrator accepted with the review's named changes. The empty design commit is dropped. Review round 2 (LAND AFTER NAMED CHANGES) named two NOTEs: the AMD-Vi hand-over lines are now one declaration, and this body carries the metal results.The defect
leave_onwrote oneINVALIDATE_DEVTAB_ENTRYinto its 256-entry ring for each requester ID its unit's IVHD names. It never refilled the ring, and it asserted once 255 were written. The AMD bench's IVHD names 65,535 IDs. The panic is in #873's flash log.0d783accc(#837) brought the IVHD walk in. QEMU's IVHD names only eight functions, so the guest test never reached the bound.What changed, per decision
kernel/src/arch/x86_64/amdvi/mod.rs,leave_on: oneINVALIDATE_IOMMU_ALL, then the existingCOMPLETION_WAIT. This follows AMD 48882 and Linux:BLOCKEDentries' DomainID 1. A per-entry walk left those behind (§2.4.2:INVALIDATE_DEVTAB_ENTRY"does not invalidate translation cache entries"), which was the design review's BLOCKER 3.amd_iommu_flush_all_cachessends the same pair wheneverFEATURE_IAis set.assert!naming the EFR and the missing command. IASup is optional (§1.3.3.3, §2.4.8). Both units in reach set it: the bench's0x206d73ef22254adeand QEMU's0x29d3. The refusal states the test machines' feature set. It is not a second path.DeviceEntrymatch, itsexpecton the device list, the ring's overflowassert, thepushclosure, andleave_on'sivrsandunitparameters.tests/common/iommu.rs,amdvi_left_on: what the actuator leaves on an AMD-Vi unit is one declaration. It returns the kernel'swas handed over with <field> on; it goes offline forCmdBufEn,EventLogEnandIommuEn. Both the guest test and the metal row's judge read it, as the judge already readsunit_fields(review round 2, NOTE 1).tests/common/iommu.rs,amdvi_firmware_left: the stick-never-binds claim is dropped.amdvi_left_on.controlreading back zero. It also says the stick still binds there under QEMU 11.1.1, and that the AMD bench holds the DMA half.issues/qemus-invalidate-iommu-all-leaves-every-function-untranslated.md, filed.amdvi_inval_allnever reads a device table entry's mode. A function therefore stays oniommu_nodmaunder a blocking entry.amdvi_firmware_leftwithswitch_offskipping every field reds onusb-storage: 1 device(s)under the QEMU thatbuild/ci/qemu-versionnames.control=0x…1005left on.tests/toyos.rs, theiommu_firmware_leftrow's judge, also reads AMD-Vi units.iommu: amdvi unit<N> handed over control=line as a unit.amdvi_left_onlines and its@<base> switched off control=line.issues/the-iommu-firmware-left-row-reads-only-vt-d-lines-so-it-reds-on-an-amd-vi-machine.md, filed in the design round, closes here. Its exit has three parts:containsthat returnsErr, which reading shows.issues/a-metal-row-names-no-hardware-and-a-bench-without-it-reds.md: the actuator has an AMD-Vi arm that runs on the bench, and this row is the only reader of its DMA half.Checks
Every row ran at
56095b138from one script, which printed an emptygit status --porcelain --ignore-submodules=nonebefore, after the mutation and at the end (gates.log). The one-minute load average read 37.3 to 55.3 across the run; the volume was 82% full.cargo run -- --ci host: 76 steps, "all green"cargo run -- --build-only --arch x86_64cargo run -- --build-only --arch aarch64cargo test --test toyos-build -- amdvi_firmware_left, the green arm. Under the actuator the unit is handed over atcontrol=0x0000000000001005 status=0x00000018: the completion wait behindINVALIDATE_IOMMU_ALLstored.git apply --checkand restored withgit apply -R. It reds onswitched off control=0x0000000000000000. The boot's own lines show the unit left at0x…1005and the stick bound (usb-storage: 1 device(s)), which is the QEMU gap. The supervisor reports56095b138… dirty.cargo test --test toyos-build -- --metal --metal-readback <dir> --metal-host '<user>@<amd-bench>' iommu_firmware_left, the staging words, against the readback the metal run left there. No machine was touched. One unit.--metal-host. Four VT-d units.Metal
The four boots ran at
f2c537a51(the results). Each image's sha256 matched images.sha256 before its flash. Fromf2c537a51to this head,git diff --stat f2c537a51 HEAD -- kernel/src loader system sdk lib appsis empty: the merge broughtbuild/, the host simulatorkernel/sim/, two issue files and a prompt, and this round changed onlytests/.Boot: complete (1333ms)(kernel L290). unit0 is handed over atstatus=0x00000018, then itsCmdBufEn,EventLogEnandIommuEnlines, thenswitched off(L118-L122). The completion wait behindINVALIDATE_IOMMU_ALLstored on the silicon, so the encoding holds. Theiommu_firmware_leftjudge exited 0 (flash, judge).main867ec23ed), the whole fix revertedamdvi/mod.rs:325:9, "the unit's requesters overflow the actuator's 256-entry ring" (L72-L78); noBoot: complete(L217)Boot: completeon the log partition (L106). The black-box tail countsxhci=0on every one of the eight CPUs (L78-L86); the head's cpu0 countsxhci=232(L89). It did not hang: the loader read the black box as DONE, so the boot handed the machine back on purpose, and its last record is the kernel'sRebooting.at 20.919 s (L71-L73).Every file is masked and committed whole at evidence commit
7b6ac575cf12e4afb2adda3bd2ec80d76896a06f.Why a guest test
No type or host test reaches the unit's register sequence. The T14 is an Intel machine, and QEMU's
amd-iommuis the only AMD-Vi unit the merge queue runs. It is third-party, and it executes the hand-over's register writes and reads them back. Under 11.1.1 it no longer shows the DMA half, so that half is the AMD bench's: the metal table's head and switch-off-reverted arms.Independent oracles
amd_iommu_flush_all_caches, the published state of the art.amd-iommu, a differential implementation of the register sequence.Growth
git diff --shortstat origin/main...56095b138: 4 files, +102 −46.amdvi/mod.rs: +20 −31.tests/toyos.rs+31 −8, andtests/common/iommu.rs+18 −7.Unsure
🤖 Generated with Claude Code
https://claude.ai/code/session_015xhaydXCVRNscoccHYFUWy