WIP: typed PCI registers, virtio MAC randomization, SMP syscall trap#2367
Draft
uadhran wants to merge 2 commits into
Draft
WIP: typed PCI registers, virtio MAC randomization, SMP syscall trap#2367uadhran wants to merge 2 commits into
uadhran wants to merge 2 commits into
Conversation
…P syscall trap - Replace PCI config register #defines with typed enum classes (includeos#2333) - Randomize virtio-net host MAC bytes on init to avoid local collisions (includeos#1409) - Set up syscall trap on AP cores via shared init_syscall_trap() (includeos#2358)
Drivers initialize before RNG::init(), so rng_extract() was reading uninitialized state. Use RDRAND/RDSEED when available, with a pci_addr + clock fallback otherwise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status: In progress — not tested yet
This is a draft. Nothing has been built or run against it so far.
Please don't review as ready until
nix-build unittests.nixpasses.Work in progress on three small issues:
PCI config registers (#2333)
The PCI register offsets were plain #defines in the header.
Moved them to enum classes (
config_reg,command,cap_id) fortype safety. Updates in
pci_device.cppandpci_msi.cpp.VirtioNet MAC (#1409)
QEMU hands out the same default MAC on every virtio-net device, which
is awkward when running multiple instances locally. After reading the
MAC from virtio config we randomize the host-specific bytes and set the
locally-administered bit. Uses RDRAND/RDSEED when available, with a
pci_addr + clock fallback (drivers init before
RNG::init()).SMP syscall trap (#2358)
Only CPU 0 had the syscall MSR set up. Pulled that into
init_syscall_trap()and call it from both the BSP libc init pathand
revenant_main. Handler still panics — syscalls aren'timplemented — but APs get a trap instead of nothing.
Related: #2333, #1409, #2358