-
Notifications
You must be signed in to change notification settings - Fork 115
Support multiple virtio block devices #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmarks
Benchmark suite | Current: 9b4f2fe | Previous: 678c47a | Ratio |
---|---|---|---|
Dhrystone |
1323 Average DMIPS over 10 runs |
1290 Average DMIPS over 10 runs |
0.98 |
Coremark |
904.68 Average iterations/sec over 10 runs |
913.951 Average iterations/sec over 10 runs |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
e681621
to
678c47a
Compare
src/riscv.c
Outdated
#define DTB_EXPAND_SIZE 1024 /* or more if needed */ | ||
|
||
/* Allocate enough memory for DTB + extra room */ | ||
int minimal_len = ARRAY_SIZE(minimal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Since this variable represents a length, would size_t be more appropriate than int?
Previously, sysprog21#539 set VBLK_DEV_CNT_MAX to 1, limiting the virtual machine to a single block device. This commit introduces support for multiple block devices by switching from statically allocated storage to dynamic allocation based on CLI input. Key changes: 1. Dynamic Allocation Virtio block related fields are now dynamically allocated based on the number of -x vblk options provided. 2. Device Tree Generation The prewritten virtio@ subnode for block device in device/minimal.dts is commented and it can be an example subnode for future reference. load_dtb() dynamically appends virtio@ subnodes under the SoC node based on the number of block devices. 3. MMIO Handling Instead of hardcoding switch cases for each MMIO region of block device, the code now checks whether the accessed MMIO address falls within the valid range of any block device. Note: The /dev/vdx device order is assigned in reverse: the first -x vblk argument corresponds to the device with the highest letter, while subsequent arguments receive lower-lettered device names.
To reflect supporting multiple virtual block devices in guestOS.
This commit prevents null terminator at wrong position.
678c47a
to
9b4f2fe
Compare
Demo Video
multiple-vblk.mp4
Problem Statement
Previously, #539 set VBLK_DEV_CNT_MAX to 1, limiting the virtual
machine to a single block device. This commit introduces support for
multiple block devices by switching from statically allocated storage to
dynamic allocation based on CLI input.
Key changes:
Dynamic Allocation
Virtio block related fields are now dynamically allocated based on the
number of -x vblk options provided.
Device Tree Generation
The prewritten virtio@ subnode for block device in device/minimal.dts is
commented and it can be an example subnode for future reference.
load_dtb() dynamically appends virtio@ subnodes under the SoC node
based on the number of block devices.
MMIO Handling
Instead of hardcoding switch cases for each MMIO region of block device,
the code now checks whether the accessed MMIO address falls within the
valid range of any block device.
Note:
The /dev/vdx device order is assigned in reverse: the first -x vblk
argument corresponds to the device with the highest letter, while
subsequent arguments receive lower-lettered device names.
Testing Procedure
# ls /dev/vd*
Expected Result