Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ hashes are given where a change is easiest to understand by reading the commit.

## November 2026

### Volume headers

- `mkvh build` splits an ELF executable's segments larger than 512 KB, so the
Octane's PROM can load a Linux kernel from the disk's volume header; an
11 MB `vmlinux` made it time out or panic. `--no-split` keeps files as
they are.

### virtio

- virtio-serial and virtio-9p on PCI (Octane, Tezro) offer
Expand Down
4 changes: 2 additions & 2 deletions clanker/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ Non-graphics devices: MC/MEMCFG and RAM banks, HPC3, VDMA, EEPROMs and NVRAM, PS
| [ip30-module-name-must-match-active-cpus.md](devices/ip30-module-name-must-match-active-cpus.md) | rule | Octane: the module record must say PM10 for one CPU and PM20 for two, or the PROM fails its NIC diagnostic |
| [ip30-low-memory-aliases-sdram.md](devices/ip30-low-memory-aliases-sdram.md) | rule | Octane: the 16 KiB at physical 0 is the first 16 KiB of SDRAM, which the processor reaches only there (0x2000_0000..+16 KiB bus-errors, as the stock IDE memory diagnostics expect); shares its JIT page generations; the guard holds on the table path only (the ppmem window maps whole units); DMA reach unknown |
| [ip30-prom-stores-into-flash-stay-in-cache.md](devices/ip30-prom-stores-into-flash-stay-in-cache.md) | rule | Octane: the PROM's cached stores into its own flash never reach the Bridge; `CachedFlashLines` holds them (approximation: no write-back) |
| [ip30-prom-disk-load-of-a-large-elf-overruns-a-dma-list.md](devices/ip30-prom-disk-load-of-a-large-elf-overruns-a-dma-list.md) | open | Octane: the PROM loading an 11 MB ELF (Linux vmlinux) from the volume header writes its 16 KB-page DMA list over its adapter list and panics; TFTP boot works |
| [ip30-linux-7.3-guest.md](devices/ip30-linux-7.3-guest.md) | howto | Octane: mainline Linux 7.3 config, the PROM/Linux PCI window mismatch and the root-bus scan past device 7 (kernel patch), TFTP boot, no power-off |
| [ip30-prom-disk-load-of-a-large-elf-overruns-a-dma-list.md](devices/ip30-prom-disk-load-of-a-large-elf-overruns-a-dma-list.md) | rule | Octane PROM 4.17 reads a volume-header ELF segment in one SCSI command; over ~720 KB it times out (8-entry ring), over ~1.1 MB its page list overruns the adapter array and it panics. `mkvh` splits segments to 512 KB |
| [ip30-linux-7.3-guest.md](devices/ip30-linux-7.3-guest.md) | howto | Octane: mainline Linux 7.3 config, the PROM/Linux PCI window mismatch and the root-bus scan past device 7 (kernel patch), TFTP or volume-header boot, no power-off |
| [ip30-device-timing-on-hptimer.md](devices/ip30-device-timing-on-hptimer.md) | design | Octane: IOC3, RAD1 and ISP1040 pace themselves on `hptimer` one-shots, with threads only where something blocks (the ISP1040 ring, serial receive, NVRAM writer) |
| [ip30-openbsd-needs-64gb-window-and-slot-4-empty.md](devices/ip30-openbsd-needs-64gb-window-and-slot-4-empty.md) | rule | Octane: OpenBSD 6.9 reaches PCI through the Bridges' 64 GB windows (IOC3 at 0xF0_4050_0000) and takes the SuperIO interrupt from the first empty Bridge slot, so virtio goes in slots 6 and 7 (`bridge_slot`); what it attaches |
| [ip30-ps2-keyboard-runs-set-3.md](devices/ip30-ps2-keyboard-runs-set-3.md) | rule | Octane: PROM 4.17 and IRIX's `ioc3_pckm` put the PS/2 keyboard in scan code set 3 (Linux/OpenBSD use 2); K_RD slot order, CLAMP_THREE, role by F2 answer; how the PROM's keyboard sequence was traced |
Expand Down
5 changes: 3 additions & 2 deletions clanker/devices/ip30-linux-7.3-guest.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Bridge driver defers its probe for ever until it can read each board's
part number from the one-wire NIC); RTC_DRV_DS1685_FAMILY; DEVTMPFS;
`qlogic/1040.bin` built in for qla1280 (it calls request_firmware before any
root exists); qla2xxx wants `ql2200_fw.bin`. The PROM loads the ELF64
`vmlinux` (load address 0xa800000020004000) from `bootp()` but not from the
volume header (`ip30-prom-disk-load-of-a-large-elf-overruns-a-dma-list.md`).
`vmlinux` (load address 0xa800000020004000) from `bootp()`, and from the
volume header (`dksc(0,1,8)vmlinux`) once `mkvh build` has split its segment
into 512 KB pieces (`ip30-prom-disk-load-of-a-large-elf-overruns-a-dma-list.md`).

**Kernel-side problems, not iris's** (fixed with a patch to
`arch/mips/pci/pci-xtalk-bridge.c`):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
# Octane PROM: loading an 11 MB ELF from the volume header overruns a DMA list
# Octane PROM: a volume-header ELF segment over ~720 KB cannot be loaded

Status: open (PROM 4.17 as iris runs it, 2026-11-15). Not established whether
real hardware does the same; network boot is the workaround.
Status: rule (PROM 4.17, 2026-11-19). Not an iris bug: the limit is in the
PROM's code. `mkvh build` splits large segments (`PROM_SEGMENT_BYTES`,
512 KB) and the 11.5 MB Linux 7.3 kernel then boots from the volume header.
The first version of this note (2026-11-15) left the cause open.

**Symptom.** `boot -f dksc(0,1,8)vmlinux` with a Linux 7.3 kernel of 11.5 MB
(one PT_LOAD of 0xaf3e30 bytes at 0xa800000020004000) prints the size and
then `Read address error exception, bad address: 0x40001f400008` at PROM PC
0x9fc422a4, followed by `PANIC: driver_acquire: io_state.active deadlock`
for ever. The same file loads and runs from `bootp()vmlinux` (iris's NAT
TFTP). The SCSI trace ends with READ(10) of the ELF header (block 8, one
block): the crash comes while the PROM issues the segment's read.
**Symptom.** `boot -f dksc(0,1,8)vmlinux` with a Linux kernel of one 11 MB
PT_LOAD prints the size, then `Read address error exception, bad address:
0x40001f400008` at PROM PC 0x9fc422a4 and `PANIC: driver_acquire:
io_state.active deadlock` for ever. With the segment split into 1 MB
pieces it prints 1048576 and then `timeout on adapter 0 target 1`. With
512 KB pieces it loads and Linux runs. `bootp()vmlinux` always worked.

**What was found.** The PROM polls its SCSI adapters through a list whose
head is at 0xa800000020f17e40; the node for controller 1 at 0x20f0e9a0 had
next = 0x...20f0dfc0, base = 0x900000001f400000 before the boot and read
`0x00000000a0128000, 0x000040001f400000, 0x00000000a012c000,
0x0000400000050000` after it. Those are 16-byte records `(0, PCI address,
0x4000)` whose PCI addresses are the Bridge's direct window (0x8000_0000 +
physical 0x2012_8000, +0x4000, ...): a DMA page list for the 11 MB segment,
one record per 16 KB page, written past its buffer into the adapter node.
No CPU store to the node hit a physical write breakpoint, and iris's cache
model here is the shadow model (no dirty lines to lose), so the list is
written by the PROM (through the fast store path) or by a DMA.
**Cause.** The chain, PROM 4.17 addresses:

**Open.** What sizes that list on real hardware, i.e. whether the PROM
splits a large read by something iris answers (INQUIRY, MODE SENSE pages,
the ISP1040 firmware's limits) or real Octanes cannot load a kernel this
large from the volume header either.
- The volume-header file system (around 0x9fc77d00) reads all whole blocks
of a request straight into the destination in one call to the disk
driver; the ELF loader asks for a whole segment. dksc builds one READ(10)
for it (0x9fc733cc, 16-bit block count). Nothing splits the transfer.
- The ISP1040 driver (0x9fc42900) builds the DMA list with 0x9fc4400c: one
`{u64 PCI address, u32 length}` entry per 16 KB page, in an array at
+0x548 of its per-adapter state. Those states are a static array of 2528
bytes each (0x9fc414d8: base 0x20f0dfc0, stride 0x9e0), so there is room
for about 73 entries; entry 74 on lands on controller 1's state (next
pointer, register base), and the adapter poll at 0x9fc422a4 dereferences
the garbage. The builder has no bound.
- Before that matters, the request ring has 8 entries (7 free when empty)
and the driver queues only if `(entries - 4) / 7 + 1 < free`: 4 data
segments in the command entry, 7 per continuation. More than 45 pages
(~720 KB) never fits, the driver waits for ring space that never comes,
and the command times out.

IRIX's volume-header files stay under this: `sash` is a 267 KB ET_REL,
`IP30prom` 880 KB of raw flash image that the PROM does not ELF-load.

**Rule.** A file the Octane PROM loads from a volume header needs every
PT_LOAD at or below ~720 KB of file data (512 KB plus a page of slack is what
`mkvh` uses). Splitting a segment into consecutive PT_LOADs at the same
offsets and addresses is transparent to the PROM's loader and to Linux.
`split_load_segments` in `src/sgi_vh.rs` does it; it rewrites the program
header table in place when the bytes after it are free (as in a vmlinux,
whose first segment starts at 0x1000), so the file keeps its size.

**Debugging note.** A `lightning` build compiles out data breakpoints (`bp
add ... w`/`pw` never hit). Use a default build to catch a PROM store.
6 changes: 6 additions & 0 deletions docs/cpu-test-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ partition is type 5 (`PT_SYSV`)**, not 7 — see

From the PROM: `boot -f dksc(0,<scsi-id>,8)<name>`.

An ELF executable with a segment of more than 512 KB is written with that
segment split into 512 KB segments, because the PROM reads a segment from the
volume header in one SCSI command and the Octane's PROM cannot read more than
about 720 KB in one (see [octane-ip30.md](octane-ip30.md#disks)). `--no-split`
copies every file unchanged.

## B — `--load-elf` / monitor `loadelf`

Load a static ELF32 MSB `ET_EXEC` for `EM_MIPS` straight into RAM and jump to
Expand Down
11 changes: 11 additions & 0 deletions docs/octane-ip30.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ stored and never run; SCSI commands go to iris's shared target model. The
monitor's `scsi` and `cow` commands reach controller 0 (`scsi1`, `cow1` the
external bus).

The PROM loads a file from a disk's volume header
(`boot -f dksc(0,1,8)vmlinux`) one ELF segment per SCSI read, and its
ISP1040 driver cannot issue a read of more than about 720 KB: a larger one
times out, and one over about 1.1 MB also corrupts the PROM's adapter state
and panics it. This is the PROM's own limit, not the emulator's. IRIX's
volume-header files are small enough; an 11 MB Linux `vmlinux` is not.
`mkvh build` splits each larger segment of an ELF executable into 512 KB
segments, which the PROM loads one after another, so a Linux kernel put in
the volume header with `mkvh` boots from disk (`--no-split` copies a file
unchanged). Loading over the network (`bootp()vmlinux`) has no such limit.

More storage goes on an option board in a spare XIO slot (`[[xio_board]]`, a
PCI shoehorn or the PCI module; see [pci.md](pci.md#option-boards-in-xio-slots)):
an [NVMe controller](nvme.md) with `[nvme]`, or a
Expand Down
21 changes: 18 additions & 3 deletions src/bin/mkvh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
//! boot -f dksc(0,<scsi-id>,8)<name>
//! ```
//!
//! An ELF executable whose segments are larger than the PROM can read in one
//! command (an 11 MB Linux vmlinux) is written with its segments split into
//! 512 KB pieces unless `--no-split` is given; see `PROM_SEGMENT_BYTES`.
//!
//! Dump mode is the layout check: run it on an original SGI CD and the voldir
//! should list sashARCS and friends with a valid checksum.

use std::path::PathBuf;
use std::process::exit;

use iris::sgi_vh::{build_image, ImageSpec, PartitionSpec, VolumeHeader};
use iris::sgi_vh::{build_image_with_splits, ImageSpec, PartitionSpec, VolumeHeader, PROM_SEGMENT_BYTES};

const USAGE: &str = "\
usage:
Expand All @@ -33,6 +37,10 @@ build options:
e.g. --part 7:5:+:1283016=efs.img
NB: SGI ships an EFS filesystem as type 5 (PT_SYSV), not
type 7 — that is what the 6.5.22 install CD emits.
--no-split copy ELF files unchanged; by default an ELF executable
with a segment over 512 KB is written with that segment
split into 512 KB pieces, which the PROM can load (the
Octane's PROM panics or times out on a larger one)
";

fn main() {
Expand All @@ -50,14 +58,15 @@ fn main() {

fn build(args: &[String]) -> Result<(), String> {
let mut out: Option<PathBuf> = None;
let mut spec = ImageSpec::default();
let mut spec = ImageSpec { max_segment: PROM_SEGMENT_BYTES, ..ImageSpec::default() };
let mut i = 0;
while i < args.len() {
let a = &args[i];
match a.as_str() {
"--size" => { spec.total_bytes = parse_size(next(args, &mut i, "--size")?)?; }
"--bootfile" => { spec.bootfile = Some(next(args, &mut i, "--bootfile")?.to_string()); }
"--part" => { spec.partitions.push(parse_part(next(args, &mut i, "--part")?)?); }
"--no-split" => { spec.max_segment = 0; }
_ if a.starts_with("--") => return Err(format!("unknown option '{}'\n{}", a, USAGE)),
_ if out.is_none() => out = Some(PathBuf::from(a)),
_ => {
Expand All @@ -73,12 +82,18 @@ fn build(args: &[String]) -> Result<(), String> {
return Err(format!("nothing to write\n{}", USAGE));
}

let placed = build_image(&out, &spec).map_err(|e| e.to_string())?;
let (placed, splits) = build_image_with_splits(&out, &spec).map_err(|e| e.to_string())?;
let size = std::fs::metadata(&out).map(|m| m.len()).unwrap_or(0);
println!("wrote {} ({} bytes)", out.display(), size);
for f in &placed {
println!(" {:<8} lbn {:>8} {:>10} bytes", f.name, f.lbn, f.nbytes);
}
for (name, s) in &splits {
println!(
" {}: {} PT_LOAD segment(s), the largest {} bytes, written as {} of at most {} bytes so the PROM can load it (--no-split keeps it as it is)",
name, s.loads_before, s.largest, s.loads_after, spec.max_segment
);
}
Ok(())
}

Expand Down
Loading