Page MenuHomeFreeBSD

vmm: fix compilation errors for static kernel on arm64
ClosedPublic

Authored by njain15_protonmail.com on Thu, Aug 6, 6:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Aug 30, 3:57 AM
Unknown Object (File)
Wed, Aug 26, 3:31 PM
Unknown Object (File)
Wed, Aug 26, 4:10 AM
Unknown Object (File)
Mon, Aug 24, 10:11 PM
Unknown Object (File)
Sun, Aug 23, 5:32 AM
Unknown Object (File)
Sat, Aug 22, 7:23 PM
Unknown Object (File)
Sat, Aug 22, 3:47 PM
Unknown Object (File)
Sat, Aug 22, 12:00 PM
Subscribers

Details

Summary

Fixes: 35164034e390 ("arm64/vmm: Make remaining registers use hypctx_*_sys_reg")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Please add Fixes: tags to the commit log message as appropriate.

sys/conf/files.arm64
176–178

I think this file also has the hyp_assym.h dependency.

186

This is also missing on riscv. For some reason there is no way to compile VMM into the kernel on amd64.

sys/conf/files.arm64
186

For some reason there is no way to compile VMM into the kernel on amd64.

Yes. I have a patch for that, I will submit.

This is also missing on riscv.

I did not see a way to compile it statically into riscv either. options.riscv does not have VMM?

About all this, I am also unsure when you should write device vmm (and when/if that compiles the files) vs options VMM. From what I understand, device is for literal/pseudo hardware devices/drivers, and options is for general subsystems.

sys/conf/files.arm64
186

Hum. I am not sure how this works to be honest. I can add device vmm to sys/riscv/conf/GENERIC, and the kernel builds but fails to link (because vmm_vm.c is missing). It may be that there is no authoritative list of kernel devices, I think config(8) just verifies that there is some source file in sys/conf/files* that depends on a given device.

As far as I know options and device are basically the same thing now. I think config(8) used to emit some extra glue code for devices, before it was possible for drivers to dynamically register nodes in /dev during boot.

I think the options* files are only used to generate the LINT configuration files, they are not authoritative.

njain15_protonmail.com added inline comments.
sys/conf/files.arm64
186

Hmm, that makes sense. I guess the only time you'd use options would be when you need conditional includes provided via the opt_[name].h file.

This revision is now accepted and ready to land.Fri, Aug 7, 12:45 AM

I tried cross-compiling an arm64 kernel from amd64 with "device vmm" in sys/arm64/conf/GENERIC, and I see an error:

> make -j32 -s buildkernel TARGET=arm64 WITH_CLEAN=                                                                                                                                                                                                                                                     
make[1]: /home/markj/sb/claude/src/Makefile.inc1:369: SYSTEM_COMPILER: Determined that CC=/usr/local/bin/ccache cc matches the source tree.  Not bootstrapping a cross-compiler.                                                                                                                                              
make[1]: /home/markj/sb/claude/src/Makefile.inc1:376: SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker.                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                                              
--------------------------------------------------------------                                                                                                                                                                                                                                                                
>>> Kernel build for GENERIC started on Mon Aug 10 16:37:39 UTC 2026                                                                                                                                                                                                                                                          
--------------------------------------------------------------                                                                                                                                                                                                                                                                
===> GENERIC                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                              
--------------------------------------------------------------                                                                                                                                                                                                                                                                
>>> stage 1: configuring the kernel                                                                                                                                                                                                                                                                                           
--------------------------------------------------------------                                                                                                                                                                                                                                                                
Kernel build directory is /home/markj/sb/claude/obj/home/markj/sb/claude/src/arm64.aarch64/sys/GENERIC                                                                                                                                                                                                                        
Don't forget to do ``make cleandepend && make depend''                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                              
--------------------------------------------------------------                                                                                                                                                                                                                                                                
>>> stage 2.1: cleaning up the object tree                                                                                                                                                                                                                                                                                    
--------------------------------------------------------------                                                                                                                                                                                                                                                                
        0.51 real         5.77 user         5.84 sys                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                              
--------------------------------------------------------------                                                                                                                                                                                                                                                                
>>> stage 2.3: build tools                                                                                                                                                                                                                                                                                                    
--------------------------------------------------------------                                                                                                                                                                                                                                                                
        0.06 real         0.04 user         0.01 sys                                                                                                           
                                                                                                                                                               
--------------------------------------------------------------                                                                                                                                                                                                                                                                
>>> stage 3.1: building everything                                                                                                                             
--------------------------------------------------------------                                                                                                 
make[2]: Graph cycles through `hyp_assym.h'                                                                                                                    
make[2]: Graph cycles through `hyp_genassym.o'                               
`opt_global.h' is up to date

Could you try this? I will also update the diff for amd64.

This revision now requires review to proceed.Mon, Aug 10, 7:34 PM

Looks good. I tested bhyve on an arm64 box with this patch and "device vmm" configured.

This revision is now accepted and ready to land.Thu, Aug 13, 3:12 PM