From 4e27bee9bf382d210790af4dbb4025f596923fc0 Mon Sep 17 00:00:00 2001 From: Vasilito Date: Sat, 25 Apr 2026 19:38:23 +0100 Subject: [PATCH] Retire base monolith patch in favor of 27 individual P2 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 17,046-line redox.patch monolith is no longer referenced in the base recipe. All 27 individual P2 patches are now listed explicitly in recipe.toml with symlinks to local/patches/base/. Coverage gap closed: ixgbed/src/device.rs was the only file not covered by any individual patch. Added P2-ixgbed-error-handling.patch for the 10GbE Intel driver error handling (println → log::info/warn/error). Build verified: CI=1 make r.base completes successfully with the new patch list. The monolith file is preserved as backup but no longer applied. --- .../base/P2-ixgbed-error-handling.patch | 162 ++++++++++++++++++ recipes/core/base/P2-ac97d-ihdad-main.patch | 1 + .../core/base/P2-acpid-core-refactor.patch | 1 + recipes/core/base/P2-boot-logging.patch | 1 + recipes/core/base/P2-hwd-misc.patch | 1 + .../core/base/P2-ihdad-device-refactor.patch | 1 + recipes/core/base/P2-ihdad-hda-stream.patch | 1 + recipes/core/base/P2-init-acpid-wiring.patch | 1 + recipes/core/base/P2-init-subsystems.patch | 1 + recipes/core/base/P2-inputd.patch | 1 + .../core/base/P2-ixgbed-error-handling.patch | 1 + recipes/core/base/P2-logd.patch | 1 + recipes/core/base/P2-misc-daemon-fixes.patch | 1 + .../core/base/P2-network-driver-mains.patch | 1 + .../core/base/P2-network-error-handling.patch | 1 + recipes/core/base/P2-pcid-cfg-access.patch | 1 + .../core/base/P2-pcid-driver-interface.patch | 1 + recipes/core/base/P2-ps2d-improvements.patch | 1 + .../core/base/P2-storage-driver-mains.patch | 1 + .../core/base/P2-storage-error-handling.patch | 1 + recipes/core/base/P2-usb-pm-and-drivers.patch | 1 + recipes/core/base/P2-virtio-core-vbox.patch | 1 + recipes/core/base/P2-xhcid-remaining.patch | 1 + recipes/core/base/recipe.toml | 30 +++- 24 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 local/patches/base/P2-ixgbed-error-handling.patch create mode 120000 recipes/core/base/P2-ac97d-ihdad-main.patch create mode 120000 recipes/core/base/P2-acpid-core-refactor.patch create mode 120000 recipes/core/base/P2-boot-logging.patch create mode 120000 recipes/core/base/P2-hwd-misc.patch create mode 120000 recipes/core/base/P2-ihdad-device-refactor.patch create mode 120000 recipes/core/base/P2-ihdad-hda-stream.patch create mode 120000 recipes/core/base/P2-init-acpid-wiring.patch create mode 120000 recipes/core/base/P2-init-subsystems.patch create mode 120000 recipes/core/base/P2-inputd.patch create mode 120000 recipes/core/base/P2-ixgbed-error-handling.patch create mode 120000 recipes/core/base/P2-logd.patch create mode 120000 recipes/core/base/P2-misc-daemon-fixes.patch create mode 120000 recipes/core/base/P2-network-driver-mains.patch create mode 120000 recipes/core/base/P2-network-error-handling.patch create mode 120000 recipes/core/base/P2-pcid-cfg-access.patch create mode 120000 recipes/core/base/P2-pcid-driver-interface.patch create mode 120000 recipes/core/base/P2-ps2d-improvements.patch create mode 120000 recipes/core/base/P2-storage-driver-mains.patch create mode 120000 recipes/core/base/P2-storage-error-handling.patch create mode 120000 recipes/core/base/P2-usb-pm-and-drivers.patch create mode 120000 recipes/core/base/P2-virtio-core-vbox.patch create mode 120000 recipes/core/base/P2-xhcid-remaining.patch diff --git a/local/patches/base/P2-ixgbed-error-handling.patch b/local/patches/base/P2-ixgbed-error-handling.patch new file mode 100644 index 00000000..0b46ca2b --- /dev/null +++ b/local/patches/base/P2-ixgbed-error-handling.patch @@ -0,0 +1,162 @@ +# P2-ixgbed-error-handling.patch +# +# 10GbE Intel ixgbe driver error handling: replace println!/unwrap()/expect() +# with log::info!/log::error!/log::warn! and proper error propagation. +# This file was the only gap in the base patch split coverage. + +diff --git a/drivers/net/ixgbed/src/device.rs b/drivers/net/ixgbed/src/device.rs +index 0d59b46d..fc7c009f 100644 +--- a/drivers/net/ixgbed/src/device.rs ++++ b/drivers/net/ixgbed/src/device.rs +@@ -3,7 +3,7 @@ use std::time::{Duration, Instant}; + use std::{cmp, mem, ptr, slice, thread}; + + use driver_network::NetworkAdapter; +-use syscall::error::Result; ++use syscall::error::{Error, Result, EIO}; + + use common::dma::Dma; + +@@ -45,7 +45,12 @@ impl NetworkAdapter for Intel8259x { + + if (status & IXGBE_RXDADV_STAT_DD) != 0 { + if (status & IXGBE_RXDADV_STAT_EOP) == 0 { +- panic!("increase buffer size or decrease MTU") ++ log::error!("ixgbed: received fragmented packet, skipping descriptor"); ++ desc.read.pkt_addr = self.receive_buffer[self.receive_index].physical() as u64; ++ desc.read.hdr_addr = 0; ++ self.write_reg(IXGBE_RDT(0), self.receive_index as u32); ++ self.receive_index = wrap_ring(self.receive_index, self.receive_ring.len()); ++ return Ok(None); + } + + let data = unsafe { +@@ -132,13 +137,25 @@ impl Intel8259x { + .map(|_| Ok(unsafe { Dma::zeroed()?.assume_init() })) + .collect::>>()? + .try_into() +- .unwrap_or_else(|_| unreachable!()), ++ .map_err(|v: Vec<_>| { ++ log::error!( ++ "ixgbed: internal error: DMA buffer array conversion failed (got {} items, expected 32)", ++ v.len() ++ ); ++ Error::new(EIO) ++ })?, + receive_ring: unsafe { Dma::zeroed()?.assume_init() }, + transmit_buffer: (0..32) + .map(|_| Ok(unsafe { Dma::zeroed()?.assume_init() })) + .collect::>>()? + .try_into() +- .unwrap_or_else(|_| unreachable!()), ++ .map_err(|v: Vec<_>| { ++ log::error!( ++ "ixgbed: internal error: DMA buffer array conversion failed (got {} items, expected 32)", ++ v.len() ++ ); ++ Error::new(EIO) ++ })?, + receive_index: 0, + transmit_ring: unsafe { Dma::zeroed()?.assume_init() }, + transmit_ring_free: 32, +@@ -166,7 +183,7 @@ impl Intel8259x { + + if (status & IXGBE_RXDADV_STAT_DD) != 0 { + if (status & IXGBE_RXDADV_STAT_EOP) == 0 { +- panic!("increase buffer size or decrease MTU") ++ log::error!("ixgbed: received fragmented packet, buffer too small"); + } + + return unsafe { desc.wb.upper.length as usize }; +@@ -205,13 +222,8 @@ impl Intel8259x { + self.mac_address = mac; + } + +- /// Returns the register at `self.base` + `register`. +- /// +- /// # Panics +- /// +- /// Panics if `self.base` + `register` does not belong to the mapped memory of the PCIe device. + fn read_reg(&self, register: u32) -> u32 { +- assert!( ++ debug_assert!( + register as usize <= self.size - 4 as usize, + "MMIO access out of bounds" + ); +@@ -219,13 +231,8 @@ impl Intel8259x { + unsafe { ptr::read_volatile((self.base + register as usize) as *mut u32) } + } + +- /// Sets the register at `self.base` + `register`. +- /// +- /// # Panics +- /// +- /// Panics if `self.base` + `register` does not belong to the mapped memory of the PCIe device. + fn write_reg(&self, register: u32, data: u32) -> u32 { +- assert!( ++ debug_assert!( + register as usize <= self.size - 4 as usize, + "MMIO access out of bounds" + ); +@@ -279,7 +286,7 @@ impl Intel8259x { + + let mac = self.get_mac_addr(); + +- println!( ++ log::info!( + " - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] + ); +@@ -438,13 +445,11 @@ impl Intel8259x { + } + + /// Sets the rx queues` descriptors and enables the queues. +- /// +- /// # Panics +- /// Panics if length of `self.receive_ring` is not a power of 2. + fn start_rx_queue(&mut self, queue_id: u16) { +- if self.receive_ring.len() & (self.receive_ring.len() - 1) != 0 { +- panic!("number of receive queue entries must be a power of 2"); +- } ++ debug_assert!( ++ self.receive_ring.len() & (self.receive_ring.len() - 1) == 0, ++ "number of receive queue entries must be a power of 2" ++ ); + + for i in 0..self.receive_ring.len() { + self.receive_ring[i].read.pkt_addr = self.receive_buffer[i].physical() as u64; +@@ -466,13 +471,11 @@ impl Intel8259x { + } + + /// Enables the tx queues. +- /// +- /// # Panics +- /// Panics if length of `self.transmit_ring` is not a power of 2. + fn start_tx_queue(&mut self, queue_id: u16) { +- if self.transmit_ring.len() & (self.transmit_ring.len() - 1) != 0 { +- panic!("number of receive queue entries must be a power of 2"); +- } ++ debug_assert!( ++ self.transmit_ring.len() & (self.transmit_ring.len() - 1) == 0, ++ "number of transmit queue entries must be a power of 2" ++ ); + + for i in 0..self.transmit_ring.len() { + self.transmit_ring[i].read.buffer_addr = self.transmit_buffer[i].physical() as u64; +@@ -506,14 +509,14 @@ impl Intel8259x { + + /// Waits for the link to come up. + fn wait_for_link(&self) { +- println!(" - waiting for link"); ++ log::info!(" - waiting for link"); + let time = Instant::now(); + let mut speed = self.get_link_speed(); + while speed == 0 && time.elapsed().as_secs() < 10 { + thread::sleep(Duration::from_millis(100)); + speed = self.get_link_speed(); + } +- println!(" - link speed is {} Mbit/s", self.get_link_speed()); ++ log::info!(" - link speed is {} Mbit/s", self.get_link_speed()); + } + + /// Enables or disables promisc mode of this device. diff --git a/recipes/core/base/P2-ac97d-ihdad-main.patch b/recipes/core/base/P2-ac97d-ihdad-main.patch new file mode 120000 index 00000000..825cbc52 --- /dev/null +++ b/recipes/core/base/P2-ac97d-ihdad-main.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-ac97d-ihdad-main.patch \ No newline at end of file diff --git a/recipes/core/base/P2-acpid-core-refactor.patch b/recipes/core/base/P2-acpid-core-refactor.patch new file mode 120000 index 00000000..c35dc42c --- /dev/null +++ b/recipes/core/base/P2-acpid-core-refactor.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-acpid-core-refactor.patch \ No newline at end of file diff --git a/recipes/core/base/P2-boot-logging.patch b/recipes/core/base/P2-boot-logging.patch new file mode 120000 index 00000000..11f4da26 --- /dev/null +++ b/recipes/core/base/P2-boot-logging.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-boot-logging.patch \ No newline at end of file diff --git a/recipes/core/base/P2-hwd-misc.patch b/recipes/core/base/P2-hwd-misc.patch new file mode 120000 index 00000000..76a8309f --- /dev/null +++ b/recipes/core/base/P2-hwd-misc.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-hwd-misc.patch \ No newline at end of file diff --git a/recipes/core/base/P2-ihdad-device-refactor.patch b/recipes/core/base/P2-ihdad-device-refactor.patch new file mode 120000 index 00000000..18404cae --- /dev/null +++ b/recipes/core/base/P2-ihdad-device-refactor.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-ihdad-device-refactor.patch \ No newline at end of file diff --git a/recipes/core/base/P2-ihdad-hda-stream.patch b/recipes/core/base/P2-ihdad-hda-stream.patch new file mode 120000 index 00000000..02aa7043 --- /dev/null +++ b/recipes/core/base/P2-ihdad-hda-stream.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-ihdad-hda-stream.patch \ No newline at end of file diff --git a/recipes/core/base/P2-init-acpid-wiring.patch b/recipes/core/base/P2-init-acpid-wiring.patch new file mode 120000 index 00000000..996168b4 --- /dev/null +++ b/recipes/core/base/P2-init-acpid-wiring.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-init-acpid-wiring.patch \ No newline at end of file diff --git a/recipes/core/base/P2-init-subsystems.patch b/recipes/core/base/P2-init-subsystems.patch new file mode 120000 index 00000000..479a23c7 --- /dev/null +++ b/recipes/core/base/P2-init-subsystems.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-init-subsystems.patch \ No newline at end of file diff --git a/recipes/core/base/P2-inputd.patch b/recipes/core/base/P2-inputd.patch new file mode 120000 index 00000000..952b626c --- /dev/null +++ b/recipes/core/base/P2-inputd.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-inputd.patch \ No newline at end of file diff --git a/recipes/core/base/P2-ixgbed-error-handling.patch b/recipes/core/base/P2-ixgbed-error-handling.patch new file mode 120000 index 00000000..0eafdc40 --- /dev/null +++ b/recipes/core/base/P2-ixgbed-error-handling.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-ixgbed-error-handling.patch \ No newline at end of file diff --git a/recipes/core/base/P2-logd.patch b/recipes/core/base/P2-logd.patch new file mode 120000 index 00000000..1570199f --- /dev/null +++ b/recipes/core/base/P2-logd.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-logd.patch \ No newline at end of file diff --git a/recipes/core/base/P2-misc-daemon-fixes.patch b/recipes/core/base/P2-misc-daemon-fixes.patch new file mode 120000 index 00000000..31e83d90 --- /dev/null +++ b/recipes/core/base/P2-misc-daemon-fixes.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-misc-daemon-fixes.patch \ No newline at end of file diff --git a/recipes/core/base/P2-network-driver-mains.patch b/recipes/core/base/P2-network-driver-mains.patch new file mode 120000 index 00000000..93017413 --- /dev/null +++ b/recipes/core/base/P2-network-driver-mains.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-network-driver-mains.patch \ No newline at end of file diff --git a/recipes/core/base/P2-network-error-handling.patch b/recipes/core/base/P2-network-error-handling.patch new file mode 120000 index 00000000..b4954856 --- /dev/null +++ b/recipes/core/base/P2-network-error-handling.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-network-error-handling.patch \ No newline at end of file diff --git a/recipes/core/base/P2-pcid-cfg-access.patch b/recipes/core/base/P2-pcid-cfg-access.patch new file mode 120000 index 00000000..41782524 --- /dev/null +++ b/recipes/core/base/P2-pcid-cfg-access.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-pcid-cfg-access.patch \ No newline at end of file diff --git a/recipes/core/base/P2-pcid-driver-interface.patch b/recipes/core/base/P2-pcid-driver-interface.patch new file mode 120000 index 00000000..b2a2d83f --- /dev/null +++ b/recipes/core/base/P2-pcid-driver-interface.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-pcid-driver-interface.patch \ No newline at end of file diff --git a/recipes/core/base/P2-ps2d-improvements.patch b/recipes/core/base/P2-ps2d-improvements.patch new file mode 120000 index 00000000..e4e58dda --- /dev/null +++ b/recipes/core/base/P2-ps2d-improvements.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-ps2d-improvements.patch \ No newline at end of file diff --git a/recipes/core/base/P2-storage-driver-mains.patch b/recipes/core/base/P2-storage-driver-mains.patch new file mode 120000 index 00000000..db707a19 --- /dev/null +++ b/recipes/core/base/P2-storage-driver-mains.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-storage-driver-mains.patch \ No newline at end of file diff --git a/recipes/core/base/P2-storage-error-handling.patch b/recipes/core/base/P2-storage-error-handling.patch new file mode 120000 index 00000000..bcb49397 --- /dev/null +++ b/recipes/core/base/P2-storage-error-handling.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-storage-error-handling.patch \ No newline at end of file diff --git a/recipes/core/base/P2-usb-pm-and-drivers.patch b/recipes/core/base/P2-usb-pm-and-drivers.patch new file mode 120000 index 00000000..580be8db --- /dev/null +++ b/recipes/core/base/P2-usb-pm-and-drivers.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-usb-pm-and-drivers.patch \ No newline at end of file diff --git a/recipes/core/base/P2-virtio-core-vbox.patch b/recipes/core/base/P2-virtio-core-vbox.patch new file mode 120000 index 00000000..aebf32c8 --- /dev/null +++ b/recipes/core/base/P2-virtio-core-vbox.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-virtio-core-vbox.patch \ No newline at end of file diff --git a/recipes/core/base/P2-xhcid-remaining.patch b/recipes/core/base/P2-xhcid-remaining.patch new file mode 120000 index 00000000..a697629b --- /dev/null +++ b/recipes/core/base/P2-xhcid-remaining.patch @@ -0,0 +1 @@ +../../../local/patches/base/P2-xhcid-remaining.patch \ No newline at end of file diff --git a/recipes/core/base/recipe.toml b/recipes/core/base/recipe.toml index ac011867..def439b1 100644 --- a/recipes/core/base/recipe.toml +++ b/recipes/core/base/recipe.toml @@ -1,7 +1,35 @@ [source] git = "https://gitlab.redox-os.org/redox-os/base.git" rev = "463f76b9608a896e6f6c9f63457f57f6409873c7" -patches = ["redox.patch", "P2-boot-runtime-fixes.patch", "P2-acpi-i2c-resources.patch", "P2-daemon-ready-graceful.patch", "P2-daemon-hardening.patch", "P2-acpi-defer-aml.patch"] +patches = [ + "P2-ac97d-ihdad-main.patch", + "P2-acpi-defer-aml.patch", + "P2-acpi-i2c-resources.patch", + "P2-acpid-core-refactor.patch", + "P2-boot-logging.patch", + "P2-boot-runtime-fixes.patch", + "P2-daemon-hardening.patch", + "P2-daemon-ready-graceful.patch", + "P2-hwd-misc.patch", + "P2-ihdad-device-refactor.patch", + "P2-ihdad-hda-stream.patch", + "P2-init-acpid-wiring.patch", + "P2-init-subsystems.patch", + "P2-inputd.patch", + "P2-ixgbed-error-handling.patch", + "P2-logd.patch", + "P2-misc-daemon-fixes.patch", + "P2-network-driver-mains.patch", + "P2-network-error-handling.patch", + "P2-pcid-cfg-access.patch", + "P2-pcid-driver-interface.patch", + "P2-ps2d-improvements.patch", + "P2-storage-driver-mains.patch", + "P2-storage-error-handling.patch", + "P2-usb-pm-and-drivers.patch", + "P2-virtio-core-vbox.patch", + "P2-xhcid-remaining.patch", +] [build] template = "custom"