On Wed, Jan 31 2018, Patrick Wildt <patr...@blueri.se> wrote: > On Wed, Jan 31, 2018 at 09:46:52AM -0800, Mike Larkin wrote: >> On Wed, Jan 31, 2018 at 05:12:03PM +0100, Patrick Wildt wrote: >> > Hi, >> > >> > this diff allows us to load the Intel microcode much earlier. So far >> > we load it after the CPUs have identified and then have to update the >> > CPU flags afterwards. This is not good since we have to assume that >> > those updates can remove and add instructions and other features. We >> > need to load it earlier. The only other option is to have the boot- >> > blocks load the ucode for us. >> > >> > One issue though is actually loading and passing the binaries that can >> > range from 2k to 90k of binary size. As far as I know we don't use the >> > lower 16M of memory on amd64, which the bootblocks use as heap. Thus >> > allocating a buffer for using alloc() should be "fine" if we make sure >> > that we read the ucode after we early enough. kettenis@ tells me that >> > cpu_startup() is the earliest MD code which can use malloc(9), so that >> > is where we can copy the ucode from the bootloader to kernel land. >> > >> > I have tested this with efiboot(8), more tests would be appreciated. >> > >> > Thanks, >> > Patrick >> > >> >> I like the idea. We should probably make sure it works with sr crypto also, >> I can check that later today unless someone beats me to it. > > That would be nice! > >> After that, I'll review the diff more carefully. Are you looking for oks yet, >> or is this just being passed around for comments at this time? > > I can start collecting OKs I guess. :) I have no other changes pending > for this, so as long as there is no negative feedback I intend to commit > this at some point. Before doing that, I want to collect a bit of feed- > back and test results.
Looks like ramdisks need more love: [...] cp /usr/src/sys/conf/param.c . cc -g -Werror -Wall -Wimplicit-function-declaration -Wno-uninitialized -Wno-pointer-sign -Wno-address-of-packed-member -Wno-constant-conversion -Wframe-larger-than=2047 -mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse -mno-3dnow -mno-mmx -msoft-float -fno-omit-frame-pointer -ffreestanding -fno-pie -fno-stack-protector -Oz -pipe -nostdinc -I/usr/src/sys -I/usr/src/sys/arch/amd64/compile/RAMDISK_CD/obj -I/usr/src/sys/arch -DTIMEZONE="0" -DDST="0" -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DPCIVERBOSE -DSCSITERSE -DFFS -DFFS2 -DEXT2FS -DNFSCLIENT -DCD9660 -DUDF -DMSDOSFS -DINET6 -DCRYPTO -DRAMDISK_HOOKS -DMINIROOTSIZE="0x1cc0" -DMAXUSERS=4 -D_KERNEL -MD -MP -c param.c cc -g -Werror -Wall -Wimplicit-function-declaration -Wno-uninitialized -Wno-pointer-sign -Wno-address-of-packed-member -Wno-constant-conversion -Wframe-larger-than=2047 -mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse -mno-3dnow -mno-mmx -msoft-float -fno-omit-frame-pointer -ffreestanding -fno-pie -fno-stack-protector -Oz -pipe -nostdinc -I/usr/src/sys -I/usr/src/sys/arch/amd64/compile/RAMDISK_CD/obj -I/usr/src/sys/arch -DTIMEZONE="0" -DDST="0" -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DPCIVERBOSE -DSCSITERSE -DFFS -DFFS2 -DEXT2FS -DNFSCLIENT -DCD9660 -DUDF -DMSDOSFS -DINET6 -DCRYPTO -DRAMDISK_HOOKS -DMINIROOTSIZE="0x1cc0" -DMAXUSERS=4 -D_KERNEL -MD -MP -c ioconf.c cp /usr/src/sys/arch/amd64/conf/ld.script ld.script sh /usr/src/sys/conf/newvers.sh cc -g -Werror -Wall -Wimplicit-function-declaration -Wno-uninitialized -Wno-pointer-sign -Wno-address-of-packed-member -Wno-constant-conversion -Wframe-larger-than=2047 -mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse -mno-3dnow -mno-mmx -msoft-float -fno-omit-frame-pointer -ffreestanding -fno-pie -fno-stack-protector -Oz -pipe -nostdinc -I/usr/src/sys -I/usr/src/sys/arch/amd64/compile/RAMDISK_CD/obj -I/usr/src/sys/arch -DTIMEZONE="0" -DDST="0" -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DPCIVERBOSE -DSCSITERSE -DFFS -DFFS2 -DEXT2FS -DNFSCLIENT -DCD9660 -DUDF -DMSDOSFS -DINET6 -DCRYPTO -DRAMDISK_HOOKS -DMINIROOTSIZE="0x1cc0" -DMAXUSERS=4 -D_KERNEL -MD -MP -c vers.c LD="ld" sh makegap.sh 0xcccccccc cc -g -Werror -Wall -Wimplicit-function-declaration -Wno-uninitialized -Wno-pointer-sign -Wno-address-of-packed-member -Wno-constant-conversion -Wframe-larger-than=2047 -mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse -mno-3dnow -mno-mmx -msoft-float -fno-omit-frame-pointer -ffreestanding -fno-pie -fno-stack-protector -Oz -pipe -nostdinc -I/usr/src/sys -I/usr/src/sys/arch/amd64/compile/RAMDISK_CD/obj -I/usr/src/sys/arch -DTIMEZONE="0" -DDST="0" -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DPCIVERBOSE -DSCSITERSE -DFFS -DFFS2 -DEXT2FS -DNFSCLIENT -DCD9660 -DUDF -DMSDOSFS -DINET6 -DCRYPTO -DRAMDISK_HOOKS -DMINIROOTSIZE="0x1cc0" -DMAXUSERS=4 -D_KERNEL -MD -MP -c swapbsd.c ld -T ld.script -X --warn-common -nopie -o bsd ${SYSTEM_HEAD} vers.o ${OBJS} machdep.o: In function `cpu_startup': /usr/src/sys/arch/amd64/amd64/machdep.c:312: undefined reference to `cpu_ucode_setup' cpu.o: In function `cpu_attach': /usr/src/sys/arch/amd64/amd64/cpu.c:409: undefined reference to `cpu_ucode_apply' /usr/src/sys/arch/amd64/amd64/cpu.c:422: undefined reference to `cpu_ucode_apply' *** Error 1 in /usr/src/sys/arch/amd64/compile/RAMDISK_CD (Makefile:543 'bsd': @echo ld -T ld.script -X --warn-common -nopie -o bsd '${SYSTE...) *** Error 1 in /usr/src/distrib/amd64/ramdisk_cd (Makefile.inc:81 'bsd') *** Error 1 in /usr/src/distrib/amd64 (<bsd.subdir.mk>:48 'all') *** Error 1 in /usr/src/distrib (<bsd.subdir.mk>:48 'all') *** Error 1 in . (Makefile:292 'distrib') *** Error 1 in . (Makefile:268 'do-release') *** Error 1 in /usr/src/etc (Makefile:251 'release') russell /usr/src$ -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE