bao-project / bao-hypervisor Goto Github PK
View Code? Open in Web Editor NEWBao, a Lightweight Static Partitioning Hypervisor
License: Apache License 2.0
Bao, a Lightweight Static Partitioning Hypervisor
License: Apache License 2.0
Hi,
Can bao hypersior support multi linux guest os running? If supports, what should I do for this.
Update the latest change in main branch, got following error:
env
export CROSS_COMPILE=aarch64-none-elf-
export PLATFORM=qemu-aarch64-virt
export DEMO=linux+freertos
launch
=> go 0x50000000
Bao Hypervisor
BAO INFO: parange_table[parange] = 40
BAO ERROR: Can't allocate address
I am trying to debug the problem, current find it will alloc 32768 pages, and got failed at core/mmu/mem.c:397
Just let you know if you can reproduce at your side
hello, do you have guideline or develop docs of hypervisor?
I noticed that the same topic about shared devices was launched 2 years ago. I wonder if there is anything new about shared devices.
I know the concern about isolation, but in some cases the hardware unit does not own enough specific I/O devices (e.g. disk, net) to support multiple guests if no sharing support.
Besides, virtio support is mentioned in this topic before, and I wonder how the virtio is supported and used in different platforms now.
Thanks for considering. Wish your reply!
There is an error when compiling Bao for RISC-V in sbi_ipi_handler
function for gcc version 12.1.0
struct sbiret sbi_ipi_handler(unsigned long fid)
{
if (fid != SBI_SEND_IPI_FID) return (struct sbiret){SBI_ERR_NOT_SUPPORTED};
unsigned long hart_mask = vcpu_readreg(cpu()->vcpu, REG_A0);
unsigned long hart_mask_base = vcpu_readreg(cpu()->vcpu, REG_A1);
struct cpu_msg msg = {
.handler = SBI_MSG_ID,
.event = SEND_IPI,
};
for (size_t i = 0; i < sizeof(hart_mask) * 8; i++) {
if (bitmap_get((bitmap_t*)&hart_mask, i)) {
vcpuid_t vhart_id = hart_mask_base + i;
cpuid_t phart_id = vm_translate_to_pcpuid(cpu()->vcpu->vm, vhart_id);
if(phart_id != INVALID_CPUID) cpu_send_msg(phart_id, &msg);
}
}
return (struct sbiret){SBI_SUCCESS};
}
The following error occurs:
In function 'bitmap_get',
inlined from 'sbi_ipi_handler.part.0' at /media/ninolomata/Nino/bao-demos/wrkdir/srcs/bao/src/arch/riscv/sbi.c:260:13:
/media/ninolomata/Nino/bao-demos/wrkdir/srcs/bao/src/lib/inc/bitmap.h:43:16: error: 'hart_mask' is used uninitialized [-Werror=uninitialized]
43 | return (map[bit / BITMAP_GRANULE_LEN] & (ONE << (bit % BITMAP_GRANULE_LEN)))
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/media/ninolomata/Nino/bao-demos/wrkdir/srcs/bao/src/arch/riscv/sbi.c: In function 'sbi_ipi_handler.part.0':
/media/ninolomata/Nino/bao-demos/wrkdir/srcs/bao/src/arch/riscv/sbi.c:251:19: note: 'hart_mask' declared here
251 | unsigned long hart_mask = vcpu_readreg(cpu()->vcpu, REG_A0);
| ^~~~~~~~~
cc1: all warnings being treated as errors
I tested running Bao demos Linux + Freertos in the following scenarios:
bitmap_get
function to non inline function -> -> compiled and demo worked;I ran into a hard to debug situation: In a config.c
I specified the same VM_IMAGE
for multiple VMs, assuming this would be copied into an allocated memory region. However if the memory region where the entry address lies is not physically placed, the image will be mapped to the image in the config blob instead. So my two VMs where sharing the data sections in the binary and strange side effects started to appear.
Feature request: When running identical binaries on different cores the binary has to be included in the config multiple times, which bloats the config binary (e.g., 4x identical Linux kernel binary). Introducing a flag to force a copy would reduce the size of the config blob drastically in those cases.
I tried to implement that in vm_map_img_rgn
but it didn't seem to work like this (freeze after boot):
if (reg->place_phys) {
->
if (reg->place_phys || config->image.force_copy) {
I guess I'm missing something, but couldn't figure out what.
Hi,
I was wondering how would one implement a shared memory region between hypervisor and VM?
I am basically trying to profile a few things with bao and baremetal VM and my code would work out quite well if I can share an object between hypervisor and Baremetal VM. Any suggestions would be helpful.
Thanks.
Is there any customized version of Bao to run in RISC-V platforms without H-extension support ?
Hi.
I am trying to add a custom device to Bao Hypervisor which I have to read and write to. What is the best way to doing so?
Having a look at src/platform/xyz/xyz_desc.c file, it seems that the struct used is called platform. Looking into the definition of the struct platform, it seems that it does have a element for specifying devices. Specifically platform.dev_num and platform.devs elements. I do not yet have an understanding of how mapping is done for Bao's VAS itself. Would simply specifying device in this struct work.
P.S: I have been able to add a device and get it working by using mem_map_dev function and I am able to read and write to the device registers. But I am wondering if the authors implemented the functionality of adding device through config file?
Hello,
I am researching separation kernels as well as other Type-1 hypervisors and came across Bao.
Was wondering if there were any plans to support the x86_64 platform or how hard it might be to add that in?
Thanks and have a great day
I want to use gdb to debug bao, I don't know if I can debug it, or if there are other debugging methods?
I want to run zephyr(RTOS) on bao instead of freertos. So, I want to know if I need to do some modify on zephyr code? For simple, firtsly dont consider the divece driver.
When you run freertos on bao, do you do some porting work on freertos?
Can you tell me more information about how to use it on qemu riscv64?Thank you
Hello, your project is very interesting, I would like to ask, is it now possible to add support for the ubuntu system, can you run ubuntu+freeRTOS
I ran it according to the demo, linux can actively communicate with freertos, but how does freertos actively communicate with linux?
I use TX2 board.
I use TFTP in uboot to download bao.bin. The uboot IP is set as below:
setenv serverip 192.168.42.16
setenv ipaddr 192.168.42.15
The UART log is:
tftp 0xa0000000 bao.bin;go 0xa0000000
Bao Hypervisor
BAO WARNING: smmuv2 does not support coherent page table walks
Bao FreeRTOS guest
Task1: 0
Task2: 0
Task1: 1
Task2: 1
Task1: 2
Task2: 2
Task1: 3
So,it looks like that the FreeRTOS run OK. But I dont know if the Linux run OK too. In README.md, it said that Linux has the static IP(192.168.42.15), but I cant ping it sucessfully and cant ssh it too.
So ,what's wrong with Linux? How to debug?
@josecm @sandro2pinto
I was reading the code, and got the impression the Underflow condition of the Maintenance IRQ is not being used. Instead it is using this one:
Does this mean we are having a VM exit per EOId vIRQ which might be ineficient.
Can we improve it by dynamically changing the settings of ICH_HCR_EL2 with U bit ?
Example: Max 4 LRs supported.
Case1: When we have up to 4 vIRQs injected, we have the U bit cleared. No traps!
Case2: If there are more than 4 vIRQs, example 5 vIRQs. We add the 5th vIRQ to a sw pending list and set the U bit. This will trap when 3 vIRQs of the 4 LRs get deactivated. The hardware will automatically generate a maintenance IRQ to be possible for the hypervisor to inject the 5th vIRQ in a LR free room.
What do you think? Would that reduce the number of hypervisor traps?
Such as, the Linux and freertos both write data to the same uart, how to sync them? And, such as two guests OS want write EMMC,how?
I want to port Bao to a new architecture platform, such as SPARC architecture, do I need any features of SPARC architecture, such as hardware virtualization extensions?
Is SR-IOV technology supported by Bao for direct assignment of virtual functions to VMs? If yes, is there any demo or anything else?
Hi, I want to run Linux+RTOS on bao。The Linux will use all the hardware devices, and the RTOS don't use hardware device, only do some numerical calculations on CPU。
Now I have to add the device configuration into config file one by one, which is really troublesome and easy to go wrong. So if there some easy way that can configure the whole hardware devices to Linux? Can you give a example config file?
Very thanks.
src/arch/armv8/boot.S line 131:
bic x3, x0, #0x7
should be:
bic x3, x3, #0x7
Just like some IPC that guest OS can communicate
Hello author, I would like to know the relevant features of the two branches of direct_irq_injection and the wip/direct-irq-injection. Can they skip the virtual cpu interface and inject physical interrupts directly into the Guest OS?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.