The acpid `_OSI` interceptor was incomplete: firmware that
calls `_OSI("Windows 2015")` or `_OSI("Windows 2020")`
would fall through to the AML interpreter and return 1 (true)
even on systems with `OSI_DISABLE_*` flags set, because
the interceptor only knew about Vista/7/8 strings.
- redox-driver-sys::quirks::AcpiQuirkFlags gains
OSI_DISABLE_WIN10 (bit 14) and OSI_DISABLE_WIN11 (bit 15)
with explicit no-collision guard against the existing
R11/R21 bits (0-13).
- ACPI_FLAG_NAMES in toml_loader.rs maps
`osi_disable_win10` and `osi_disable_win11` to the
new bitflag constants.
- acpid::acpi::AcpiContext::try_intercept_osi now matches
"Windows 2015" → OSI_DISABLE_WIN10 and "Windows 2020"
→ OSI_DISABLE_WIN11, alongside the existing Vista/7/8
string matches.
Source: linux-7.1 drivers/acpi/osi.c (dmi_system_id[] for
Win10/11 laptops that need the kernel to lie about the
host OS to keep ACPI firmware from misbehaving).
cargo test --package redox-driver-sys: 132 passed; 0 failed.
Two findings from the R7 comprehensive review:
1. Boot order race (CRITICAL)
00_driver_manager.service and 00_acpid.service both have the
00_ prefix and no explicit dependency. If driver-manager
enumerates PCI before acpid publishes /scheme/acpi/dmi, every
device gets empty quirk_flags because
redox_driver_sys::quirks::dmi::read_dmi_info() returns Err(())
when the file doesn't exist yet. The OR-accumulation is frozen
at enumeration time so hotplug won't pick up later-published
DMI data.
Fix: add 00_acpid.service to requires_weak for both
00_driver_manager.service (redbear-device-services.toml) and
13_iommu.service (redbear-mini.toml + redbear-full.toml).
2. xHCI typo (CRITICAL)
quirks.d/25-xhci.toml:38 has 'broken_port_pec' which doesn't
exist in the flag name table. The correct flag is
'broken_port_ped' (Port Enabled/Disabled, bit 25 in
XhciControllerQuirkFlags). The typo causes the flag to be
silently dropped at runtime, leaving Intel ICH6 xHCI
(vendor=0x8086, device=0x1E31) without the intended
BROKEN_PORT_PED quirk.
Fix: corrected typo to 'broken_port_ped'.
R12: All 5 ConnectorInfo construction sites (kms/connector.rs
synthetic_displayport, intel/display.rs, intel/mod.rs ..connector
inheritance, virtio/mod.rs both sites, amd/display.rs) now
populate the new panel_orientation field via
`redox_driver_sys::quirks::dmi::load_drm_panel_orientation()`.
The 36 panel orientation rules from 50-drm-panel.toml (Linux
7.1 drm_panel_orientation_quirks.c: Jupiter 0x0B57, Galileo
0x0B47, etc.) now apply to every connector detected.
R13: main.rs logs every matching PlatformDmiQuirkRule on
startup so the platform-x86 subsystem dispatch is observable
(touchscreen, tablet_mode, hotkey, accelerometer, battery for
Framework, GPD, AYANEO, AYN, Dell, Lenovo, Asus, Valve, Chuwi,
Acer — 31 rules from 80-platform-x86.toml).
R21: main.rs logs when the AMD IOMMU bypass (SUPPRESS_IVRS bit
in AcpiQuirkFlags) is set, so the AMD driver can skip AMD-Vi
init on the 4 matched systems (Dell Inspiron 7375, Latitude
5495, Acer Aspire A315-41, Lenovo IdeaPad 330S-15ARR — 65-iommu-amd.toml).
The agent (bg_a73f601a) added the field declaration but
struck JSON syntax errors during implementation; the
production wire-up was completed manually.
cargo check: builds clean (pre-existing E0382 in drivers/fence.rs
test is unrelated).
The R21 AMD IOMMU bypass rules in 65-iommu-amd.toml were missing
the flags line on each entry, so the AcpiQuirkFlags returned
by apply_dmi_acpi_quirk_rules was always empty and the iommu
daemon's check_dmi_ivrs_bypass() never triggered.
Add flags = ["suppress_ivrs"] to all 4 entries (Dell Inspiron
7375, Dell Latitude 5495, Acer Aspire A315-41, Lenovo IdeaPad
330S-15ARR) so the bypass logic actually fires on the matched
systems.
Without this fix, the iommu daemon would attempt to initialize
the broken AMD-Vi silicon and hang the boot on those specific
laptops — the very regression the R21 data file was meant to
prevent.
When /etc/quirks.d/65-iommu-amd.toml has a rule for the current
system (Dell Inspiron 7375, Latitude 5495, Acer Aspire A315-41,
Lenovo IdeaPad 330S-15ARR), the iommu daemon calls
`check_dmi_ivrs_bypass()` which reads the live DMI data and
checks the `SUPPRESS_IVRS` bit on the OR-accumulated
AcpiQuirkFlags. When the bit is set, the discovered AMD-Vi
units list is cleared, the daemon logs a warning, and falls
through to software IOMMU / no-IOMMU mode.
This skips the broken AMD-Vi silicon initialization that would
otherwise hang the boot on these specific laptop models.
Source: linux-7.1 drivers/iommu/amd/init.c (DMI matching
pattern, `acpi_ivrs` DMI table).
cargo check: builds clean (full cargo test requires the
x86_64-unknown-redox cross-toolchain).
Two findings from the R7 audit of the quirks-and-bugs subsystem.
1. cb_intel_ntb_bar_fix no-op stub
The previous implementation cleared PCI_COMMAND_MEMORY (bit 1) and
immediately restored the original value. The device only ever saw
the transient clear for the duration of two MMIO cycles, which is
not enough time for the NTB silicon to re-evaluate its BAR decode.
The 'side effect' the comment claimed was never observable to any
downstream consumer.
Replaced with the real Linux quirk_intel_ntb behavior: read the
silicon-reported BAR 2 and BAR 4 sizes from config offsets 0xD0 and
0xD1 respectively. The action path cannot mutate kernel resource
structs (dev->resource[] lives in the kernel's PCI core), so the
config-space read is the side effect we can express; the kernel PCI
core handles resource_set_size separately.
Source: linux-7.1/drivers/pci/quirks.c:3526-3542.
2. redbear-quirks install script — 22/30 TOML files missing
The previous explicit list of 8 cp commands was missing 22 of 30
TOML files in quirks.d/. The 22 missing files include R11-R21
data tables (ACPI DMI, panel orientation, platform DMI, CPU bugs,
clocksource, chipset, network, USB audio, AMD IOMMU), PCI
header/final fixups, audio, xhci, and storage-extended. Replaced
the explicit list with a glob so every .toml in quirks.d/ ships —
future additions are picked up automatically.
Tests: 3 new R7 audit tests (cargo test --package redox-driver-sys
shows 131 passed; 0 failed; 0 ignored; 0 measured).
R16 (memory configuration) and R22 (boot parameters)
are documented in QUIRKS-SYSTEM.md as deferred because
their Linux 7.1 source surface is entirely imperative
handler code, not data tables.
R16: drivers/pci/quirks.c MTRR section +
arch/x86/kernel/cpu/mtrr/amd.c + arch/x86/kernel/
amd_gart_64.c gart_fixup_northbridges() +
arch/x86/mm/numa.c numa_emulation[]. All imperative.
R22: arch/x86/kernel/tsc.c + arch/x86/kernel/hpet.c +
arch/x86/kernel/cpu/bugs.c + ~47 files with __setup /
early_param declarations (125 total entries). All
imperative (string, handler_fn) registrations.
This commit lands empty landing-pad TOML files
(95-mtrr-deferred.toml, 99-bootparams-deferred.toml)
that document why no data table is feasible and
reference the QUIRKS-SYSTEM.md follow-up plans. The
compiled-in tables (mtrr_quirk_table, bootparam_quirk_table)
are empty; runtime TOML is reserved for future rules
that do fit a data model.
Audit status as of 2026-06-07:
- R11, R12, R13, R14, R15, R17, R18, R19, R20, R21
RESOLVED (data side lands; consumer wiring is
follow-up per phase)
- R16, R22 DEFERRED (algorithmic / imperative; data-
driven approach does not fit)
Phase R21 (2026-06-07) — AMD IOMMU quirks. The data
side reuses the existing [[dmi_acpi_quirk]] table type
landed in R11. Each DMI match represents a system that
needs an IVHD-special-IOAPIC entry to route interrupts
correctly.
Data sourced from Linux 7.1
drivers/iommu/amd/quirks.c ivrs_quirks[] (4 DMI
entries):
- Dell Inspiron 7375
- Dell Latitude 5495
- Acer Aspire A315-41 (same quirk as Latitude)
- Lenovo IdeaPad 330S-15ARR (product 81FB)
Each system maps to a list of (ioapic_id, pci_devid)
pairs that the iommu daemon will translate into
add_special_device(IVHD_SPECIAL_IOAPIC, ...) calls
at boot. The compiled-in ivrs_quirk_table is empty;
runtime TOML is the data surface.
Note: this commit lands only the DMI match table. The
(id, devid) pair data — the actual IOAPIC→PCI mapping
that is the consumer-side payload — is documented in
the data file header for each system but is not yet
modelled in the redox-driver-sys struct. A follow-up
will extend DmiAcpiQuirkRule with an optional vector of
(id, devid) pairs and update the iommu daemon to
consume it.
Phase R17 (2026-06-07) — Early-boot chipset quirks. The
data side lands now; the kernel-side consumer walks
the table at boot and dispatches to the imperative
handlers (nvidia_bugs, via_bugs, fix_hypertransport_config,
ati_bugs, intel_remapping_check, intel_graphics_quirks,
force_disable_hpet, apple_airport_reset).
Changes:
1. ChipsetQuirkFlags (mod.rs:483) with 10 bits, one
per Linux 7.1 early_qrk[] callback:
QFLAG_APPLY_ONCE, NVIDIA_BUGS, VIA_BUGS,
AMD_K8_NB_FIXUP, ATI_BUGS, ATI_BUGS_CONTD,
INTEL_REMAPPING_CHECK, INTEL_GRAPHICS_QUIRKS,
FORCE_DISABLE_HPET, APPLE_AIRPORT_RESET.
2. ChipsetQuirkEntry (mod.rs:509) — vendor (0xFFFF
any) + device (0xFFFF any) + class + class_mask.
matches() honours the class-mask semantics from
Linux's early-quirks.c (the (class ^ target) & mask
test).
3. CHIPSET FLAG_NAMES + parse_chipset_toml +
load_chipset_flags (toml_loader.rs) — new
[[chipset_quirk]] TOML table type with vendor +
device + class + class_mask + flags.
4. 1 new unit test: phase_r17_chipset_quirk_entry_matches
exercises NVIDIA + AMD K8 class-mask semantics +
5 match / mismatch combinations.
127/127 tests pass.
5. quirks.d/55-chipset-early.toml (110 lines) — 11 entries
sourced from Linux 7.1
arch/x86/kernel/early-quirks.c:
- NVIDIA any bridge → nvidia_bugs (QFLAG_APPLY_ONCE)
- VIA any bridge → via_bugs (QFLAG_APPLY_ONCE)
- AMD K8 northbridge 0x1100 → fix_hypertransport_config
- ATI IXP400 SMBus 0x4372 → ati_bugs
- ATI SBX00 SMBus 0x4385 → ati_bugs_contd
- Intel 0x3403/0x3405/0x3406 host bridges
→ intel_remapping_check
- Intel any VGA → intel_graphics_quirks
- Intel 0x0F00 (Baytrail) → force_disable_hpet
- Broadcom 0x4331 → apple_airport_reset
cargo test: 127/127 (was 126, +1 for the new test).
cargo check: clean.
The kernel early-pci-scan path will call
load_chipset_flags() for each PCI device it walks and
invoke the named handler before any Rust user code.
Compiled-in chipset_table is empty (handler bodies
are imperative and don't fit a data-driven table).
Phase R15 (2026-06-07) — timekeeping / TSC sync. The
data side lands now; TSC sync itself is algorithmic
(mark_tsc_unstable in the kernel) and is not represented.
Changes:
1. ClocksourceQuirkFlags (mod.rs:415) with 4 bits:
PMTMR_BLACKLIST, PMTMR_GRAYLIST, TSC_UNSTABLE,
HPET_BROKEN. Only PMTMR bits fire today; TSC_UNSTABLE
and HPET_BROKEN are reserved for future kernel-side
use.
2. ClocksourceQuirkEntry (mod.rs:445) — vendor / device /
revision_lo / revision_hi / flags. matches() handles
vendor / device wildcards (0xFFFF) and revision range
(lo..=hi, with lo=0, hi=0xFF as the wildcard).
3. CLOCKSOURCE_FLAG_NAMES + parse_clocksource_toml +
load_clocksource_flags (toml_loader.rs) — new
[[clocksource_quirk]] TOML table type with vendor +
device + revision_lo + revision_hi + flags.
4. 1 new unit test: phase_r15_clocksource_quirk_entry_matches
exercises the range match + 4 wildcard combinations
(vendor, device, revision out of range, revision
wildcard). 126/126 tests pass.
5. quirks.d/35-clocksource.toml (44 lines) — 3 entries
sourced from Linux 7.1
drivers/clocksource/acpi_pm.c:
- Intel 82371AB_3 (PIIX4) 0x7113 rev 0..=2 → blacklist
- Intel 82801DB_0 (ICH4) 0x24C0 → graylist
- ServerWorks LE 0x0009 → graylist
cargo test: 126/126 (was 125, +1 for the new test).
cargo check: clean.
The kernel-side clocksource engine (R15 consumer) will
call load_clocksource_flags() at PMTMR probe time and
select / reject the PMTMR clocksource accordingly.
Phase R14 (2026-06-07) — CPU bug mitigation. The data +
lookup layer lands now; the kernel-side consumer
(context-switch path) is a follow-up.
Changes:
1. CpuBugFlags (mod.rs:286) with 27 bits, mapping the
22+ X86_BUG_* macros from Linux 7.1
arch/x86/include/asm/cpufeatures.h. Bit positions
match Linux 0-26.
2. CpuId struct (mod.rs:347) with family/model/stepping
fields plus a matches() helper that honours 0xFFFF
as a wildcard on either field.
3. CpuBugQuirkEntry (mod.rs:362) — vendor (0x8086
Intel, 0x1022 AMD, 0xFFFF any) + family + model +
flags. matches() combines vendor + CPUID match.
4. lookup_cpu_bug_flags() (mod.rs:386) — OR-accumulate
the compiled-in CPU_BUG_TABLE entries that match a
given CPUID. Returns empty set if nothing matches.
5. cpu_bug_table.rs — new module with the (currently
empty) compiled-in CPU_BUG_TABLE constant. Runtime
TOML is the data surface (90-cpu-bugs.toml).
6. CPU_BUG_FLAG_NAMES + parse_cpu_bug_toml +
load_cpu_bug_flags (toml_loader.rs) — new
[[cpu_bug_quirk]] TOML table type with vendor +
family + model + flags. Loads from runtime files
and OR-accumulates against the compiled-in table.
7. 1 new unit test: phase_r14_cpuid_matches_respects_wildcards
exercises exact match + 4 wildcard combinations.
125/125 tests pass.
8. quirks.d/90-cpu-bugs.toml (136 lines) — 14 vendor/
family/flag combinations sourced from Linux 7.1
arch/x86/kernel/cpu/bugs.c. Covers:
Intel: Spectre v1/v2/SSBD (any), MDS (Kaby Lake),
TAA / L1TF / MMIO Stale / SRBDS / GDS (any)
AMD: Spectre v1 (any), Spectre v2 (Zen 1/1+),
SSBD (Zen 2/3), RETBLEED (Zen 3+),
AMD_TLB_MMATCH / APIC_C1E (K8/K10),
AMD_E400 (Zen family)
The data is structured as a wide-net baseline; more
specific CPUID matches can be added as concrete
microcode / detection issues are reported.
cargo test: 125/125 (was 124, +1 for the new test).
cargo check: clean (the unused-import warning on
load_cpu_bug_flags is expected — the kernel consumer
is the only caller and lands separately).
The kernel-side mitigation engine will:
1. Read CPUID at boot (vendor + family + model).
2. Call lookup_cpu_bug_flags() + load_cpu_bug_flags().
3. Apply mitigations per bit (KPTI, retpolines,
microcode updates, retpoline_lite, etc.) on the
next context switch.
Phase R13 (2026-06-07) — Laptop/Embedded DMI quirks. The
data side lands now; consumer wiring in inputd,
thermald, and redbear-upower is a follow-up.
Changes:
1. PlatformDmiQuirkFlags (mod.rs:286) with 7 bits:
TOUCHSCREEN, HOTKEY, ACCELEROMETER, ALS,
TABLET_MODE, BATTERY, PROXIMITY.
2. PlatformSubsystem enum (mod.rs:316) — dispatch label
for TOML and consumers. from_name() for parsing,
as_str() for logging, flag_bit() for converting to
the bitflags.
3. PlatformDmiQuirkRule (dmi.rs:566) — DMI match +
subsystem. Each entry fires one subsystem.
4. load_platform_dmi_quirks() (dmi.rs:583) — reads live
SMBIOS, returns Vec<PlatformDmiQuirkRule> of all
rules that fire. Falls back to empty vector if DMI
data is unavailable.
5. read_toml_platform_dmi_entries + parse_platform_dmi_toml
(toml_loader.rs) — new [[platform_dmi_quirk]] TOML
table with sub-table + string.
Unknown subsystem names log a warning and skip.
6. 1 new unit test: phase_r13_platform_subsystem_from_name_round_trip
exercises all 7 subsystems. 124/124 tests pass.
7. quirks.d/80-platform-x86.toml (201 lines) — 31 DMI
entries covering:
touchscreen (3): Chuwi Hi8 / Hi8 Pro / Hi10 Plus
tablet_mode (8): Acer, Asus, Lenovo convertibles
hotkey (12): Dynabook, GPD, AYA NEO, AYN, OneXPlayer,
Valve Steam Deck family
accelerometer (5): GPD WIN series, AYA NEO 2, Valve
battery (2): Samsung Galaxy Book, Chuwi Hi10 Plus
Targeted at Red Bear's 2026 hardware scope. The full
Linux 7.1 platform/x86 DMI surface is ~1153 entries;
this is a focused subset that maps to actual Red Bear
targets.
cargo test: 124/124 (was 123, +1 for the new test).
cargo check: clean.
Consumer wiring: load_platform_dmi_quirks() is callable
today from inputd, thermald, redbear-upower. Each
consumer can filter on rule.subsystem to dispatch the
appropriate behavior. This is a follow-up commit.
Phase R12 (2026-06-07) — DRM panel orientation quirks.
The data side lands now; consumer wiring in redox-drm is
deferred until compositor rotation lands (Phase 4 KDE).
Changes:
1. DrmPanelOrientation enum (mod.rs:225) with four
values: Normal, RightUp, LeftUp, BottomUp. Sourced
from Linux 7.1 include/drm/drm_panel_orientation.h.
Provides from_name() for TOML parsing and as_str()
for logging.
2. DmiDrmPanelQuirkRule (dmi.rs:517) — DMI match + panel
orientation, mirrors the existing DmiAcpiQuirkRule
shape from R11.
3. DMI_DRM_PANEL_QUIRK_RULES (dmi.rs:531) — empty
compiled-in table; runtime TOML is the data surface
(see 50-drm-panel.toml).
4. load_drm_panel_orientation() (dmi.rs:537) — reads
live SMBIOS via read_dmi_info, applies the
compiled-in + TOML rules, returns the orientation.
Falls back to Normal if DMI data is unavailable or
no rule matches.
5. read_toml_drm_panel_entries + parse_drm_panel_toml
(toml_loader.rs) — new [[drm_panel_quirk]] TOML
table type with sub-table +
string. Unknown orientation names log a warning
and skip the entry.
6. load_drm_panel_orientation (toml_loader) — applies
the first matching TOML rule, returns Normal if
none match.
7. 1 new unit test: phase_r12_drm_panel_orientation_from_name_round_trip
exercises all four orientation values + a bogus
name. 123/123 redox-driver-sys tests pass.
8. quirks.d/50-drm-panel.toml (234 lines) — 36 DMI
entries sourced from Linux 7.1
drivers/gpu/drm/drm_panel_orientation_quirks.c.
Covers Acer, Anbernic, Asus, AYA NEO (full range
including 2/2S, 2021, AIR, FLIP, Founder, GEEK,
NEXT, KUN, SLIDE), AYN (Loki Max, Loki Zero),
Chuwi, Dynabook, GPD (MicroPC, WIN Max, Pocket 2/3,
WIN2/3/4, WIN Max 2), Lenovo, OneXPlayer, OrangePi,
Samsung Galaxy Book, Valve Jupiter/Galileo
(Steam Deck family), ZOTAC. The data spans
laptop, tablet, and handheld form factors.
cargo test: 123/123 (was 122, +1 for the new test).
cargo check: clean.
cargo clippy: no new warnings in this code.
Consumer wiring is R12.1 (out of scope for this turn):
redox-drm will call load_drm_panel_orientation() at
connector enumeration time and apply the returned
transform once the compositor supports rotation.
Phase R11 (2026-06-07) — ACPI DMI data side. Four runtime
TOML files land in quirks.d/, each populated with
real Linux 7.1 DMI table entries:
45-acpi-osi.toml — currently empty (no rules landed;
placeholder for concrete hardware
bugs to be added on real targets)
46-acpi-sleep.toml — 13 entries from sleep.c
(HP xw4600, ASUS M2N8L, Matsushita
CF51-2L, ASUS A8N-SLI DELUXE,
Sony VAIO VGN-FW/VPC series,
Everex StepNote, AVERATEC 1000)
covering SLEEP_OLD_ORDERING and
SLEEP_NVS_NOSAVE
47-acpi-button.toml — 4 entries from button.c (Insyde
T701, CherryTrail M882, Lenovo 82BG,
MEDION E2215T) covering LID_INIT
flags
48-acpi-battery.toml — 1 entry from battery.c (NEC
LZ750/LS) covering BATTERY_BIX_BROKEN
Each entry uses the new [[dmi_acpi_quirk]] table type
landed in the previous commit (5d06b0fa0). The
match sub-table is the same DmiMatchRule shape
used by [[dmi_system_quirk]] and [[dmi_xhci_system_quirk]]
(sys_vendor, product_name, board_vendor, board_name,
bios_version, etc).
The data covers 18 DMI rules total. Per the audit,
the compiled-in DMI_ACPI_QUIRK_RULES table stays
empty — runtime TOML is the data surface. As more
hardware bugs are reported on real Red Bear targets,
new entries can be appended to these files without
rebuilding.
Consumer-side: no consumer reads AcpiQuirkFlags yet.
The lookup is wired through load_dmi_acpi_quirks()
which is callable from any acpid / acpi-handler
process. Wiring the consumer is R12.
Phase R11 (2026-06-07) — ACPI DMI rules first commit. Lands
the infrastructure pieces (flag type, rule struct,
TOML parser, lookup function) needed for runtime ACPI
quirk matching against system DMI data. The data side
arrives in the follow-up commit (four quirks.d/*.toml
files).
Changes:
1. AcpiQuirkFlags bitflags (mod.rs:225) with 13 bits
sourced from Linux 7.1:
OSI_DISABLE_{LINUX,VISTA,WIN7,WIN8} — drivers/acpi/osi.c
SLEEP_{OLD_ORDERING,NVS_NOSAVE,DEFAULT_S3} — drivers/acpi/sleep.c
LID_INIT_{DISABLED,OPEN} — drivers/acpi/button.c
BATTERY_{BIX_BROKEN_PACKAGE,
NOTIFICATION_DELAY,
AC_IS_BROKEN} — drivers/acpi/battery.c
REV_OVERRIDE — drivers/acpi/x86/blacklist.c
2. DmiAcpiQuirkRule (dmi.rs:476) — DMI match + flag word,
mirrors the existing DmiXhciQuirkRule shape.
3. DMI_ACPI_QUIRK_RULES — empty compiled-in table for now;
runtime TOML is the data surface (R11 part 2). The
constant exists so the three-layer lookup shape is
stable from day one.
4. load_dmi_acpi_quirks() — reads live SMBIOS, applies
compiled-in + TOML rules, returns AcpiQuirkFlags.
Pattern mirrors load_dmi_xhci_quirks (R7-B).
5. apply_dmi_acpi_quirk_rules() — pure function, OR-
accumulates matching rules. Mirrors
apply_dmi_xhci_quirk_rules.
6. ACPI_FLAG_NAMES + parse_dmi_acpi_toml + load_dmi_acpi_quirks
in toml_loader.rs. New TOML table type
[[dmi_acpi_quirk]] with sub-table +
array of strings.
7. Two unit tests in dmi.rs: empty result for no match,
OR-accumulation for partial match (one rule fires
one flag, the other fires another — both must land).
cargo test: 122/122 (was 120, +2 for the new tests).
cargo check: clean.
cargo clippy: no new warnings in this code.
The data side (46-acpi-sleep.toml, 47-acpi-button.toml,
48-acpi-battery.toml) lands in the follow-up commit.
R1-R10 audit Gap 12: redbear-iwlwifi had zero PCI quirk
consumption at Wi-Fi device detection time. The linux-kpi
crate ships pci_has_quirk and pci_get_quirk_flags for
consumers in C-land, but the Rust-side lookup function
lookup_pci_quirks was not called from this driver. Every
Intel Wi-Fi NIC passed the data-driven quirk table
without a single log line.
This change:
- Adds source/src/quirks.rs with one public function,
log_wifi_quirks(location, vendor, device) that:
1. Builds a PciDeviceInfo from the candidate's location
and the just-parsed vendor / device IDs.
2. Calls redox_driver_sys::quirks::lookup_pci_quirks.
3. Logs the resulting flag word (info-level on a hit,
debug-level on empty).
4. Returns the flags so the caller can gate probe /
interrupt selection on specific bits (NO_MSI,
NO_MSIX, DISABLE_ACCEL) in a follow-up.
- Wires the call into detect_candidates() at
src/main.rs:494, right after the Intel vendor / class /
subclass match — the canonical identification point.
The location is now available (it was already parsed
via parse_location_from_config_path) and vendor_id /
device_id are in scope from the PCI config read.
Implementation note: this module bypasses the
linux_kpi::pci::pci_get_quirk_flags C FFI because that
function takes *mut PciDev and the bus / dev / func
fields are private to the linux-kpi crate. The
underlying lookup is identical — linux-kpi's FFI is a
thin wrapper around the same redox_driver_sys function
we call here. Going through PciDeviceInfo directly is
the natural Rust path; the C FFI remains available for
C-side consumers that already hold a struct pci_dev*.
3 unit tests cover the wiring:
- zeroed device returns empty
- unmatched vendor returns empty
- real Intel NIC ID round-trips through PciQuirkFlags
without losing bits
No Cargo.toml change needed: redox-driver-sys was
already a direct dependency.
R1-R10 audit Gap 10: evdevd had zero HID quirk consumption.
The lookup_hid_quirks entry point in redox-driver-sys was
populated by R10 with 191 compiled-in entries + TOML
support, but no consumer read it. Every InputDevice entering
the evdev scheme flew past the HID quirk table.
This change:
- Adds a redox-driver-sys path dependency to
source/Cargo.toml. Path mirrors the depth used by
pcid/usbhidd (4 ../ levels to reach local/, then
recipes/drivers/redox-driver-sys/source).
- Adds source/src/quirks.rs with one public function,
log_hid_quirks(vendor, product, kind), that calls
lookup_hid_quirks and emits an info-level line on a
non-empty result, debug-level on empty.
- Wires the call into EvdevScheme::add_device() at the
moment the InputDevice is created, before it is pushed
onto the device list.
- Adds 'mod quirks' to main.rs module declarations.
Caveat (carried forward from the audit, 2026-06-07):
evdevd currently constructs InputDevice with vendor=0
because the upstream usbhidd produces orbclient::Event
streams without forwarding the real USB vendor/product
IDs. The lookup therefore returns empty flags in
practice. Once the orbclient event pipe is extended to
carry the device IDs, the wiring below will start
logging the matched flag sets without any further code
change. This is documented in the module-level docstring
of quirks.rs.
4 unit tests cover the wiring:
- synthetic zero-vendor returns empty
- synthetic product IDs 0..32 return empty (these are
the IDs evdevd currently assigns)
- a real Linux HID table entry (0x06d6:0x0025 → BADPAD)
returns the expected flag
- the log helper does not panic on any input
Note on pre-existing test errors: cargo test fails to
compile the test binary because of unrelated errors in
src/translate.rs:517,534 and src/gesture.rs:1 (a
'translate_gesture' function that no longer exists).
These pre-date this change and are out of scope for
Gap 10. cargo check is clean (zero new warnings from
this change); the failing tests are in the existing
scheme.rs and device.rs test modules that have nothing
to do with the new quirks module.
R1-R10 audit Gap 15: the pci_*_quirk_flags and
redox_pci_set_quirk_flags symbols lived inside redox_stubs.c
alongside kmalloc, printk, and other generic glue functions.
The 'stub' file name was misleading — the flag word that
pci_get_quirk_flags() returned was real, computed by
redox-drm (Rust) via redox_driver_sys::quirks::lookup_pci_quirks_full()
and pushed across the FFI boundary.
This change:
- Adds source/redox_quirk_bridge.c containing the three
symbols plus a static g_redox_quirk_flags global. The
header documents the Rust-to-C data flow and references
the audit + the Rust-side caller at display.rs:155.
- Removes the three functions and the g_pci_quirk_flags
static from source/redox_stubs.c. redox_stubs.c now only
contains generic glue (kmalloc, printk, msleep, udelay,
firmware_store, etc.) and the file name matches its
contents.
- Updates recipe.toml Stage 1 to compile the new
translation unit alongside redox_stubs.c. Both files
are linked into libamdgpu_dc_redox.so.
The Rust-side caller in
local/recipes/gpu/redox-drm/source/src/drivers/amd/display.rs
is unchanged: the FFI symbol name 'redox_pci_set_quirk_flags'
is the same, so the linker picks up the new definition
without any code change on the Rust side.
No caller code in amdgpu_redox_main.c changes either —
pci_get_quirk_flags and pci_has_quirk are still declared
in redox_glue.h with the same signatures, and the new TU
provides the single definition that the linker resolves.
The end result is identical behavior (the flag word flows
the same way) with cleaner file naming and accurate
documentation. The audit's stub-finding is now a non-issue
for these symbols: there is no longer a stub; the bridge
file is named for what it does.
The Phase R10 audit found that dmi::read_dmi_info() returns Err(())
silently when acpid is not yet serving the DMI endpoint (the deep
Blocker 2 work that wires acpid SMBIOS Type 0/1/2 parsing into a
kernel-exposed scheme). Without an explicit log, every DMI lookup
in every driver fails opaquely, masking the root cause for anyone
triaging missing quirk rules.
The log is rate-limited to a single warn! per process lifetime via
a static AtomicBool, so the boot log is not flooded even when many
drivers call read_dmi_info() during enumeration. The 120/120 unit
tests in redox-driver-sys continue to pass.
Phase R10 audit (2026-06-07) identified that DmiInfo and DmiMatchRule
were missing the bios_vendor and bios_date fields that Linux SMBIOS
Type 0 (BIOS Information) provides. Many DMI-based quirk rules in
Linux drivers/acpi/osi.c, drivers/acpi/ec.c, and drivers/platform/x86/
match on BIOS vendor or BIOS release date for firmware-version
workarounds.
Changes:
- dmi.rs: add bios_vendor: Option<String> and bios_date: Option<String>
to both DmiInfo and DmiMatchRule structs
- dmi.rs: extend is_empty() and matches() to consider the new fields
- dmi.rs: extend parse_dmi_data() to handle bios_vendor and bios_date
keys in /scheme/acpi/dmi text format
- dmi.rs: extend all 8 compiled-in DmiPciQuirkRule literals and 3
DmiInfo test fixtures with the new fields
- toml_loader.rs: extend parse_dmi_match_rule() to parse bios_vendor
and bios_date from [[dmi_system_quirk]] match tables
- toml_loader.rs: extend all 4 DmiInfo test fixtures
- dmi.rs: 5 new unit tests (bios_vendor match, bios_date match,
combined match, parse_dmi_data, is_empty with bios fields)
- toml_loader.rs: 1 new integration test (TOML bios_vendor+date
parse and match, miss, and absent cases)
- QUIRKS-SYSTEM.md: mark Blocker 5 as RESOLVED
Tests: 120/120 pass (was 114, +6 new).
Clippy: +2 warnings (same map_or pattern as existing 7 DMI fields,
follows existing convention; not a new defect).
Source-of-truth: drivers/firmware/dmi_scan.c (dmi_decode_table) and
include/linux/mod_devicetable.h (dmi_system_id).
Depends on Blocker 2 (acpid DMI producer at /scheme/acpi/dmi) for
runtime data; the fields are now in place and will activate when
acpid is updated to populate the new keys.
Adds:
- local/recipes/system/redbear-quirks/source/quirks.d/40-hid.toml:
967-line runtime override file with all 191 HID quirk entries
(mirrors the compiled-in hid_table.rs; lets operators override,
extend, or disable flags without rebuilding the driver)
- local/docs/QUIRKS-SYSTEM.md: 103-line R10 implementation report
covering scope completed (items 1-6, 8 of the 8-item R10 plan),
item 7 (consumer wiring) deferred to input-stack maturity,
entry-count audit (191 not 500), flag-count audit (24 defined,
9 used), bit-position audit (gaps at 0/8/9/15/24-27 for removed
upstream flags), test progression (106 -> 114, +8 R10 tests)
Follows the commit pattern of R6 (5e44191c9) and R7-R9 (b56b810c0)
where the structural Rust code is committed first, then the runtime
data and docs update are committed as a follow-up.
Mirrors Linux 7.1 drivers/hid/hid-quirks.c. Adds:
- HidQuirkFlags bitflags (24 bits matching include/linux/hid.h, with
bit gaps at 0/8/9/15/24-27 for removed/renamed upstream flags)
- HidQuirkEntry struct (vendor:u16, product:u16, flags:HidQuirkFlags)
- hid_table.rs with 191 compiled-in entries (hid_quirks[] array, lines
27-223 of Linux 7.1 source). 2 of the 191 are HID_BLUETOOTH_DEVICE
and kept for forward compatibility with the Bluetooth HID transport
- 5 F_NN const helpers for the unique multi-flag OR combinations
(NOGET|MULTI_INPUT, NO_INIT_REPORTS|ALWAYS_POLL, etc.)
- HID_QUIRK_FLAG_NAMES const (24 names) for TOML parsing
- load_hid_quirks(), read_toml_hid_entries(), parse_hid_toml() — the
[[hid_quirk]] TOML section mirrors [[usb_quirk]] structure
- lookup_hid_quirks(vendor, product) public API mirrors lookup_usb_quirks
Test count: 106 -> 114 (+8 R10 tests).
Clippy: 30 warnings (was 29; +1 from new load_hid_quirks Result<_, ()>).
Note: the upstream 24-flag count is exact (matches include/linux/hid.h),
but only 9 of the 24 are actually populated in hid_quirks[]. The other
15 are reserved for future hardware and runtime TOML overrides.
Consumer wiring (lookup_hid_quirks call site in usbhidd/evdevd) is
out of scope for this commit and tracked in
local/docs/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md.
Phase R7 (xHCI closure, multi-session R7-R10 first commit):
* R7-A xHCI TOML layer: brings xHCI to 3-layer parity with PCI
(compiled-in + TOML + DMI). Adds XHCI_CONTROLLER_FLAG_NAMES (28
entries: 19 pre-R6 + 5 R6 + 3 R7-C with chronological markers),
read_toml_xhci_entries(), parse_xhci_toml(),
load_xhci_controller_quirks_toml(), updated
lookup_xhci_controller_quirks() to OR TOML flags, new
lookup_xhci_controller_quirks_full() as 3-layer entry point.
New quirks.d/25-xhci.toml with 8 example entries sourced from
Linux 7.1 xhci-pci.c.
* R7-B DMI xHCI bridge: mirrors the PCI DMI bridge. Linux itself
has no DMI-based xHCI quirks so DMI_XHCI_QUIRK_RULES is empty;
the wiring exists so future DMI rules can be added without
re-architecting. Adds DmiXhciQuirkRule struct,
apply_dmi_xhci_quirk_rules() OR-accumulator, DMI_XHCI_QUIRK_RULES
constant, load_dmi_xhci_quirks() public function,
read_toml_dmi_xhci_toml()/parse_dmi_xhci_toml() in toml_loader
for the new [[dmi_xhci_system_quirk]] section.
* R7-C 3 high-priority xHCI flags (already in 0.2.3 branch from
R7-C stand-alone commit): DEFAULT_PM_RUNTIME_ALLOW (bit 33),
SNPS_BROKEN_SUSPEND (bit 35), RESET_TO_DEFAULT (bit 44). Bit
positions match Linux 7.1 xhci.h:1586-1660 exactly. Six new
PCI entries: AMD 0x43f7, 0x15e0, 0x15e1, Intel 0x9a13/0x51e0/0x54ee.
Seven new R7-C tests.
Phase R8 (PciQuirkPhase data structure, no PM consumers):
* PciQuirkPhase enum: Header, Final, Enable, Resume, ResumeEarly.
Mirrors Linux DECLARE_PCI_FIXUP_* macro family.
* phase: PciQuirkPhase field on PciQuirkEntry. All 31 existing
compiled-in entries default to Final via ..WILDCARD.
* phase_visible(phase, pm_available) helper. Boot-time phases
always visible; Resume/ResumeEarly gated by pm_available.
* lookup_pci_quirks_full_with_pm() public function gates all
three layers. load_pci_quirks() defaults to pm_available=false
for safe existing-caller behavior.
* TOML parser reads phase = "header"|"final"|"enable"|"resume"
|"resume_early" per [[pci_quirk]] entry. Unknown/omitted
defaults to Final (graceful degradation).
* Seven R8 tests: header/resume/resume_early parse, omitted default,
unknown default, boot-phase visibility, resume-phase gating.
Phase R9 (USB storage gap closure, data-only):
* Resynced 30-storage.toml header to reference Linux 7.1 (was 7.0).
* Fixed one entry: VIA Labs VL817 SATA Bridge (0x2109:0x0715)
revision was "9999-9999" — corrected to wildcard "0000-9999"
to match Linux UNUSUAL_DEV(0x2109, 0x0715, 0x0000, 0x9999, ...).
* Verification: python3 local/scripts/extract-linux-quirks.py
local/reference/linux-7.1/drivers/usb/storage/unusual_devs.h
produces 214 entries. diff against 30-storage.toml = 0 lines.
The R1-R6 review's "108 missing" estimate was stale; the file
is in full sync with Linux 7.1.
Test count: 90 (R7-C) + 9 (R7-A, R7-B) + 7 (R8) = 106/106 passing.
No new clippy warnings beyond two Result<_, ()> stylistic lints
that follow the existing convention (7+ functions use this pattern).
Consumer wiring status: BROKEN_MSI consumer in xhcid main.rs:69,
ZERO_64B_REGS consumer in xhci/mod.rs:524,542. R7-C and R7-A new
flags are observability-only via log_unenforced_xhci_quirks()
(R6) until xhcid's suspend/resume path lands.
Deferred to next session: R10 HID infrastructure (24 flags +
500 entries) and any R7/R8 PM execution work when PM lands.
Multi-session plan: this is the first of 4 atomic commits for
R7-R10. R10 HID lands in a separate session.
Phase R6 (2026-06-07) extends the xHCI controller quirk layer with five
new XHCI_* bit positions from Linux 7.1's drivers/usb/host/xhci.h, three
new PCI table entries from xhci-pci.c, and an xhcid-side observability
hook for the unenforced flags. Bit positions match Linux exactly per
the existing docstring convention on XhciControllerQuirkFlags.
Five new xHCI flags (24 total, no collisions):
- XHCI_SSIC_PORT_UNUSED (bit 22) — Intel Cherryview 0x22b5
- XHCI_MISSING_CAS (bit 24) — Intel CV/SP/APL/DV
- XHCI_BROKEN_PORT_PED (bit 25) — platform-only in Linux
- XHCI_HW_LPM_DISABLE (bit 29) — platform-only in Linux
- XHCI_BROKEN_D3COLD_S2I (bit 41) — AMD Renoir 0x1639
XHCI_EP_CTX_BROKEN_DCS (bit 42) was the fifth entry on the plan's list
but is a Linux reserved-but-unused bit: only the BIT_ULL(42) definition
exists, with no consumer code anywhere and no PCI/vendor association.
Adding it would have been a stub. XHCI_SSIC_PORT_UNUSED is added in its
place — it has both a PCI association and a consumer site.
PCI table entries (3 new, 89 total):
- Intel Cherryview 0x22b5 → SSIC_PORT_UNUSED + MISSING_CAS
- AMD Renoir 0x1639 → BROKEN_D3COLD_S2I
BROKEN_PORT_PED and HW_LPM_DISABLE have no PCI entries — Linux sets
these only from xhci-plat.c / xhci-mtk.c / xhci-histb.c (non-PCI host
adapters). They are defined for forward-compatibility with future
platform xHCI support.
xhcid consumer wiring (in local/sources/base submodule):
- log_unenforced_xhci_quirks() called from Xhci::init() emits a
warn! line for each set-but-unenforced R6 flag, citing the Linux
consumer site and the missing Red Bear code path. Observability,
not fake enforcement.
- Real enforcement for consumer sites that require suspend, LPM,
port-disable, or CAS code paths in xhcid is deferred to Phase R8
(PM infrastructure) and follow-up work.
Tests: 8 new (75 → 83 total passing).
Clippy: 26 warnings, all pre-existing R0–R5 baseline. No new warnings.
TOML validator: 244 entries, 0 undefined (no TOML changes for R6 —
xHCI controller flags are compiled-in only).
Source of truth: Linux 7.1 drivers/usb/host/{xhci.h, xhci-pci.c,
xhci.c, xhci-hub.c, xhci-plat.c, xhci-mtk.c, xhci-histb.c}.
Replace stub ioctl handlers with real per-fd magic token assignment
and master tracking. First card opener auto-becomes master. Master
state is tracked and cleared on fd close.
When pcid-spawner launches redox-drm for a GPU device, the init
service (10_redox-drm.service) may also start a second instance.
The guard check in the service file (head -c 1 /scheme/drm/card0)
has a race condition with pcid-spawner's scheme registration.
Move the scheme:drm existence check into the binary itself. If
scheme:drm is already registered when run() starts, log and exit
gracefully with daemon.ready() instead of crashing with a fatal
"no GPU found" error.
Critical fixes from Linux kernel cross-reference:
- execlists.rs flush_pending(): write upper 32 bits FIRST, then lower.
BSpec requires upper-first on legacy ELSP; GPU latches on lower write.
Previously wrote lower then upper — stale upper dword used by GPU.
- execlists.rs init(): write only INHIBIT_SYN_CTX_SWITCH to RING_CONTEXT_CONTROL.
Linux init_common_regs() disables ENGINE_CTX_RESTORE_INHIBIT and
RS_CTX_ENABLE for normal operation. Our old code set restore inhibit,
preventing context save/restore on context switch — GPU would hang.
- context.rs: LRC image offsets were MMIO register offsets (0x30, 0x34, 0x38).
LRC state layout is different — CTX_CONTEXT_CONTROL is dword index 3 (byte 12).
Fixed to match Linux intel_lrc_reg.h dword layout:
LRC_CTX_CTRL_OFFSET = 12 (was 0x02)
LRC_HEAD_OFFSET = 20 (was 0x30)
LRC_TAIL_OFFSET = 28 (was 0x34)
LRC_RING_START_OFFSET = 36 (was 0x38)
Added LRC_RING_CTL_OFFSET = 40
- context.rs: corrected CTX_CTRL_INHIBIT_SYN_CTX_SWITCH from bit 2 to bit 3
to match Linux RING_CONTEXT_CONTROL bit layout at 0x244.
- ring.rs: added gpu_address() method to expose ring GGTT address for
LRC descriptor construction.
- mod.rs: wire execlist submission path after ring batch submit in
hw_submit_to_ring(), creating LRC descriptor and submitting via ExeclistPort.
- display.rs: program HDMI infoframes (AVI, audio, VSIF) on port enable.
On Redox there is no udev-based DRM device enumeration. KWin's DRM
backend relies on m_udev->listGPUs() which returns nothing without udev.
Add a fallback: when no KWIN_DRM_DEVICES is set and the session is
kde-wayland, inject KWIN_DRM_DEVICES=/scheme/drm/card0 so KWin knows
which device to open. This fixes the 'No suitable DRM devices' error
that prevented KWin from starting on Redox.
Added test: build_environment_sets_kwin_drm_devices_default_for_kde_wayland
to verify the fallback is applied correctly.
- gem_lmem: Replace bump allocator with best-fit free-list (BTreeMap) that
tracks individual allocations and coalesces freed blocks on both sides
- mocs: Add init_pat() - programs PAT index 0-7 with WB/WC/WT/UC for Gen9+,
and WB-only for Gen12+; called after init_mocs() in IntelDriver init
- regs_gt: Add PAT register constants (GEN8_PRIVATE_PAT_*, GEN12_PAT_INDEX,
GEN8_PPAT_* cache attributes) and TBIMR_FAST_CLIP
- PAT programming: Gen9 uses 0x40E0 base with LLC/LLCELLC attributes,
Gen12 uses 0x4800 base with simple WB/WC/WT/UC (no LLC on Xe2)
- All changes compile clean (0 errors)
- Changed make all -> make live to produce .iso files
- Skipped verify-overlay-integrity.sh (corrupts recipe symlinks)
- Added ac_cv_namespace_ok=yes to ICU recipe (toolchain libstdc++ stale)
- Fixed variable reference
- Mini ISO builds successfully via the script