# keelOS management VM (docs/72 M2): kernel config fragment.
# build.sh runs `make allnoconfig KCONFIG_ALLCONFIG=<this + generated lines>` on an unmodified
# upstream kernel and then checks that every line below made it into .config unchanged
# (a dependency that silently drops an option fails the build). x86_64 only.
# build.sh adds: CONFIG_INITRAMFS_SOURCE.
#
# hyp loads vmlinux itself (an ELF, PVH entry: XEN_ELFNOTE_PHYS32_ENTRY), not through firmware:
# no EFI, no ACPI, no SMP. One CPU, its local APIC in x2APIC mode (locked: hyp reports
# IA32_XAPIC_DISABLE_STATUS), the TSC frequency on the command line, PCI through configuration
# mechanism 1 (hyp emulates it: one function at 00:00.0, the passed NIC). docs/72 §13.

CONFIG_64BIT=y
CONFIG_EXPERT=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_PRINTK=y
CONFIG_PRINTK_TIME=y
# earlyprintk=serial (hyp.conf mvm_cmdline=) shows the kernel's first messages, before the 8250
# driver: for debugging an mvm that dies early
CONFIG_EARLY_PRINTK=y
CONFIG_BUG=y
CONFIG_MULTIUSER=y
CONFIG_SHMEM=y
CONFIG_FUTEX=y
CONFIG_BINFMT_ELF=y
CONFIG_NO_HZ_IDLE=y
# M3: init sleeps 100 us .. 1 ms between polls (nanosleep): hrtimers on the TSC-deadline timer
CONFIG_HIGH_RES_TIMERS=y
# CONFIG_SMP is not set
# The kernel at 2 MiB (default 16 MiB): the mvm has 64 MiB of RAM.
CONFIG_PHYSICAL_START=0x200000
CONFIG_PHYSICAL_ALIGN=0x200000
# CONFIG_RELOCATABLE is not set

# Entry: PVH (hyp's launch is a 32-bit flat protected-mode entry with EBX = hvm_start_info).
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PVH=y
CONFIG_X86_X2APIC=y

# Built-in command line; hyp appends its own (tsc_early_khz=, hyp.conf mvm_cmdline=).
# printk.devkmsg=on: no rate limit on /dev/kmsg (init's lines; keelRM's audit lines must all
# reach hyp's log: the default, 10 lines per 5 s, dropped them silently).
# reboot=t: a panic ends in a triple fault, which makes hyp relaunch the mvm from its image.
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0,115200 loglevel=6 panic=1 reboot=t tsc=reliable pci=conf1 8250.nr_uarts=1 printk.devkmsg=on"
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_COMPRESSION_NONE=y
CONFIG_PCI=y
CONFIG_PCI_MSI=y

# Pseudo file systems for init; /dev/mem for the shared page (an E820 "reserved" page).
CONFIG_DEVTMPFS=y
CONFIG_PROC_FS=y
CONFIG_SYSFS=y
CONFIG_DEVMEM=y
# CONFIG_STRICT_DEVMEM is not set
# sysrq 'c': init crashes the kernel on the shared page's test=1 (the crash test)
CONFIG_MAGIC_SYSRQ=y

# COM1: hyp's 16550 at 0x3f8, lines go into hyp's log ([mvm] ...). Kernel console only (polled);
# init writes through /dev/kmsg.
CONFIG_TTY=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=1
CONFIG_SERIAL_8250_RUNTIME_UARTS=1

# Network: the NIC drivers, AF_PACKET; no IPv4 stack in the kernel (init has its own).
CONFIG_NET=y
CONFIG_PACKET=y
# M3: byte queue limits: the qdisc hands the driver frames in bulk (one tail write per batch)
CONFIG_BQL=y
CONFIG_NETDEVICES=y
CONFIG_ETHERNET=y
CONFIG_NET_VENDOR_INTEL=y
CONFIG_E1000E=y
CONFIG_IGB=y
CONFIG_IGC=y
CONFIG_IXGBE=y
CONFIG_I40E=y
CONFIG_NET_VENDOR_REALTEK=y
CONFIG_R8169=y
# CONFIG_INET is not set

# Not wanted: modules, block devices, sound, display, USB, input.
# CONFIG_MODULES is not set
# CONFIG_BLOCK is not set
# CONFIG_SOUND is not set
# CONFIG_DRM is not set
# CONFIG_USB_SUPPORT is not set
# CONFIG_VT is not set
# CONFIG_ACPI is not set
# CONFIG_EFI is not set
