Linux's own r8169 through LDLS, deep idle, and the GPU plan
The RTL8168 is now driven by Linux's r8169, unmodified, in a process. `make ldls-r8169` stages it from the running kernel together with libphy, mdio-bus, mdio_devres and the Realtek PHY driver, the kernel's BTF and the RTL PHY firmware, and etc/schinit/ldls-r8169.job starts it at boot with its log in /var/log/ldls-r8169.log. The native driver is out of the registry; its code, now with Linux's 8168H setup, stays as the fallback. LDLS grows what that needed: - ldlsd loads a comma-separated module set in dependency order, each linking against the ones before it, with BTF read before any init_module runs; - a driver core (bus match, driver probe), devres, kernel printf, real udelay/msleep/ktime and 1000 Hz jiffies, phylib's bitmaps and link_mode_params, firmware from /lib/firmware, and the symbols whose stub zero was a lie (list validity, try_module_get, dev_err_probe, eth_platform_get_mac_address); - pdev->bus is a real pci_bus, and cmovcc from per-CPU memory is rewritten like the other %gs forms. In QEMU all five modules load, link and initialise, and r8169 registers and finds no device. Probe and traffic are untested until real hardware. The kernel turns ASPM off on Realtek NIC links at boot, as r8169 does through pci_disable_link_state, which a process cannot. Idle CPUs enter ACPI _CST's C2 (CC6 on Zen) by port read or MWAIT when the APIC timer keeps running, instead of only ever halting at C1. docs/plan/gpu.md: amdgpu and nouveau through LDLS, with measurements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
438e7af141
commit
4ad49ed5f2
18 changed files with 1945 additions and 81 deletions
31
Makefile
31
Makefile
|
|
@ -1098,7 +1098,7 @@ $(BUILD)/lib/%.o: lib/%.S
|
|||
# stub.c are freestanding and build unchanged for either side, which is the
|
||||
# whole point of having written them that way.
|
||||
LDLS_GUEST = $(addprefix $(BUILD)/ldls/guest/, ko.o btf.o stub.o) \
|
||||
$(addprefix $(BUILD)/ldls/guest/kpi/, kpi.o pci.o io.o net.o skb.o string.o work.o thunk.o)
|
||||
$(addprefix $(BUILD)/ldls/guest/kpi/, kpi.o pci.o io.o net.o skb.o string.o work.o thunk.o base.o)
|
||||
|
||||
$(BUILD)/ldls/guest/%.o: ldls/%.c ldls/ko.h ldls/btf.h ldls/stub.h
|
||||
@mkdir -p $(BUILD)/ldls/guest
|
||||
|
|
@ -1106,7 +1106,7 @@ $(BUILD)/ldls/guest/%.o: ldls/%.c ldls/ko.h ldls/btf.h ldls/stub.h
|
|||
|
||||
# The KPI -- the Linux symbols, implemented. Guest-only: it reaches /dev/pci
|
||||
# and /dev/netdev, which exist on SchOS and nowhere else.
|
||||
$(BUILD)/ldls/guest/kpi/%.o: ldls/kpi/%.c ldls/kpi/kpi.h
|
||||
$(BUILD)/ldls/guest/kpi/%.o: ldls/kpi/%.c ldls/kpi/kpi.h ldls/kpi/link_modes.inc
|
||||
@mkdir -p $(BUILD)/ldls/guest/kpi
|
||||
$(CC) $(CFLAGS) -I./ldls -c $< -o $@
|
||||
|
||||
|
|
@ -1378,6 +1378,33 @@ ldls-stage:
|
|||
@test -z "$(BTF)" || cp "$(BTF)" $(SYSROOT)/lib/modules/btf
|
||||
@echo "staged into $(SYSROOT)/lib/modules -- this image is now yours alone"
|
||||
|
||||
# Linux's r8169 and what it needs, from the kernel this machine runs, for
|
||||
# etc/schinit/ldls-r8169.job. The module set is r8169's dependency closure less
|
||||
# what LDLS answers itself (led-class, of_mdio, fwnode_mdio, fixed_phy), in load
|
||||
# order; the firmware is the RTL8168/8111 PHY patches. SchOS is GPL-2.0-or-later
|
||||
# and ships these knowingly -- see docs/plan/gpu.md.
|
||||
LDLS_KDIR ?= /run/current-system/kernel-modules/lib/modules/$(shell uname -r)/kernel
|
||||
LDLS_FWDIR ?= /run/current-system/firmware
|
||||
LDLS_R8169 = drivers/net/phy/mdio-bus drivers/net/phy/libphy \
|
||||
drivers/net/phy/mdio_devres drivers/net/phy/realtek/realtek \
|
||||
drivers/net/ethernet/realtek/r8169
|
||||
ldls-r8169:
|
||||
@mkdir -p $(SYSROOT)/lib/modules $(SYSROOT)/lib/firmware/rtl_nic
|
||||
@set -e; list=; for m in $(LDLS_R8169); do \
|
||||
f=$$(ls $(LDLS_KDIR)/$$m.ko* | head -1); n=$$(basename $$m).ko; \
|
||||
case $$f in *.xz) xz -dc $$f;; *.zst) zstd -qdc $$f;; *) cat $$f;; esac \
|
||||
> $(SYSROOT)/lib/modules/$$n; \
|
||||
list=$$list$${list:+,}/lib/modules/$$n; done; \
|
||||
cp /sys/kernel/btf/vmlinux $(SYSROOT)/lib/modules/btf; \
|
||||
printf '#!/bin/sh\nmkdir -p /var/log\nexec /bin/ldlsd %s /lib/modules/btf > /var/log/ldls-r8169.log 2>&1\n' \
|
||||
"$$list" > $(SYSROOT)/lib/modules/ldls-r8169.sh
|
||||
@for f in $(LDLS_FWDIR)/rtl_nic/rtl8168*.fw*; do \
|
||||
n=$$(basename $$f); case $$n in \
|
||||
*.zst) zstd -qdc $$f > $(SYSROOT)/lib/firmware/rtl_nic/$${n%.zst};; \
|
||||
*.xz) xz -dc $$f > $(SYSROOT)/lib/firmware/rtl_nic/$${n%.xz};; \
|
||||
*) cp $$f $(SYSROOT)/lib/firmware/rtl_nic/;; esac; done
|
||||
@echo "staged Linux r8169 ($(shell uname -r)) into $(SYSROOT)"
|
||||
|
||||
ldls-unstage:
|
||||
rm -rf $(SYSROOT)/lib/modules
|
||||
@echo "removed"
|
||||
|
|
|
|||
Loading…
Reference in a new issue