kernkonzept / manifest

The main L4Re manifest to checkout the L4Re operating system.
GNU General Public License v2.0
19 stars 5 forks source link

Hardware pass-through to the VM, the guest os can't bringup #25

Closed chiaqi closed 1 year ago

chiaqi commented 1 year ago

on the A76 platform Refer to https://github.com/kernkonzept/manifest/wiki/HwPassThrough steps, create the io.cfg 、io.dts、 vm_hw.bus but the guest os (linux) can't bringup; The problem positioning is crg_clk, Just pass it through, guest os will be halted! Please give some debug suggestions;

best regards!

log&cfg.zip

alacko commented 1 year ago

Hi, I'm afraid but I guess you need to instrument Linux to find the code location where it does what it does to halt the guest OS. Is it just the guest OS that is halted or the whole system? I would guess it's more than just the guest OS. Passing the clk to the guest is delicate, you give the guest OS power of the platform. You need to modify Linux such that it does not do what it is currently doing and probably switch off some needed clock. Adam

chiaqi commented 1 year ago

hi alacko : Thank you very much for your reply! Through T32 tracking, it was found that guestOS was trapped in fiasco, and fiasco had been polling for locks and can't get the lock; 11

alacko commented 1 year ago

The wfi instruction indicates that this is the idle loop, so Fiasco is just sitting there waiting to do things. Do you know which trap it was that exited the VM?

chiaqi commented 1 year ago

After initializing the crg_clock in the kernel, the unused clock will be turned on/off, and after I comment out the code to turn on/off the clock, the kernel execution goes one step further, but kernel panic occurs; As you mentioned, I think the operation of the unused clock trap in , I haven't traced it yet. The good news is that cons is able to receive input and output;

kernel panic log: vm1 | [ 2.202457] cfg80211: Loading compiled-in X.509 certificates for regulatory database vm1 | [ 2.213735] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9efedadd3' vm1 | [ 2.222483] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 vm1 | [ 2.224566] ALSA device list: vm1 | [ 2.251472] platform regulatory.0: Falling back to sysfs fallback for: regulatory.db vm1 | [ 2.267868] No soundcards found. vm1 | [ 2.273786] Warning: unable to open an initial console. vm1 | [ 2.282664] Freeing unused kernel memory: 3456K vm1 | [ 2.300424] Run /bin/sh as init process vm1 | [ 2.306753] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 vm1 | [ 2.317659] CPU: 0 PID: 1 Comm: sh Not tainted 5.10.110-JY vm1 | [ 2.329775] Hardware name: L4 VM (DT) vm1 | [ 2.335971] Call trace: vm1 | [ 2.340745] dump_backtrace+0x0/0x1c0 vm1 | [ 2.346943] show_stack+0x18/0x28 vm1 | [ 2.352735] dump_stack_lvl+0xd4/0xfc vm1 | [ 2.358931] dump_stack+0x18/0x58 vm1 | [ 2.364720] panic+0x184/0x3b0 vm1 | [ 2.370203] do_exit+0xa18/0xb10 vm1 | [ 2.375890] do_group_exit+0x48/0xa8 vm1 | [ 2.381984] __wake_up_parent+0x0/0x30 vm1 | [ 2.388283] el0_svc_common.constprop.4+0x98/0x1b8 vm1 | [ 2.395807] do_el0_svc+0x24/0x90 vm1 | [ 2.401596] el0_svc+0x14/0x20 vm1 | [ 2.407646] el0_sync_handler+0x90/0xb8 vm1 | [ 2.413481] el0_sync+0x184/0x1c0 vm1 | [ 2.419271] SMP: stopping secondary CPUs vm1 | [ 2.425788] Kernel Offset: disabled vm1 | [ 2.431781] CPU features: 0x000,48040006,6a00a238 vm1 | [ 2.439202] Memory Limit: none vm1 | [ 2.444686] Rebooting in 5 seconds.. Positioning to this panic problem is because Earlycon was used, When I undid the EarlyCon configuration in DTS, the system booted。

alacko commented 1 year ago

Super :) The panic might be due to no console available and thus the init process exiting. The dump indicates it is just exiting. So the kernel seems to work now :)

chiaqi commented 1 year ago

hi alacko: Although the system started normally, but the passthrough device node was not created in the /dev directory, I suspect that it is a problem with cfg and vbus configuration; by the way , I pass through the usb3 to guestOS. Could you please take the time to check if there is a problem with the configuration file?

config& log.zip

the pmx@91 in the dts is the gpio for usb vbus supply, how to config it in the cfg & vm.vbus file?

chiaqi commented 1 year ago

The problem has been resolved

alacko commented 1 year ago

Thanks, good to know and I'm happy it works now :)