/ 详情

【虚拟化】kernel OLK-5.10 supports KVM RISC-V

Done
Task
Opened this issue  
2020-11-25 15:20

测试RISC-V虚拟化功能

  1. 启动虚拟机
    1.1 为仿真器配置虚拟网桥
    $ brctl addbr virbr0
    $ brctl stp virbr0 on
    $ ifconfig virbr0 up
    $ ifconfig virbr0 192.168.122.1 netmask 255.255.255.0

1.2 启动仿真器
$ ./qemu-system-riscv64 -M virt -m 4096M -cpu rv64,x-h=true -nographic
-name guest=riscv-hyp,debug-threads=on
-smp 4
-bios ./fw_jump.bin
-kernel ./Image
-drive file=./hypervisor.img,format=raw,id=hd0
-device virtio-blk-device,drive=hd0
-append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
-netdev type=tap,script=./ifup.sh,downscript=./ifdown.sh,id=net0
-device virtio-net-device,netdev=net0
结果如下:
输入图片说明

1.3 启动RISC-V虚拟机
$ ./qemu-system-riscv64 -M virt,accel=kvm -m 512M -cpu host -nographic
-name guest=riscv-guest
-bios none
-smp 2
-kernel ./Image
-drive file=./guest.img,format=raw,id=hd0
-device virtio-blk,drive=hd0
-append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
结果如下:
输入图片说明

  1. 热迁移
    2.1 在仿真器1上启动源端虚拟机
    $ ./qemu-system-riscv64 -M virt,accel=kvm -m 512M -cpu host -nographic
    -name guest=riscv-guest
    -bios none
    -smp 2
    -kernel ./Image
    -drive file=./guest.img,format=raw,id=hd0
    -device virtio-blk,drive=hd0
    -append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
    -monitor tcp:0:55555,server,nowait
    2.2 在仿真器2上启动对端虚拟机,等待源端迁移
    $ ./qemu-system-riscv64 -M virt,accel=kvm -m 512M -cpu host -nographic
    -name guest=riscv-guest
    -bios none
    -smp 2
    -kernel ./Image
    -drive file=./guest.img,format=raw,id=hd0
    -device virtio-blk,drive=hd0
    -append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
    -device i6300esb,id=watchdog
    -serial tcp:0:33333,server,nowait
    -incoming tcp:0:44444
    -monitor tcp:0:55555,server,nowait

2.3 登录仿真器1,启动热迁移
$ socat -,echo=0,icanon=0 tcp-connect:192.168.122.2:55555
(qemu) migrate -d -i tcp:192.168.122.3:44444

2.4 登录热迁移后的虚拟机
$ socat -,echo=0,icanon=0 tcp-connect:192.168.122.3:33333
结果如下:
输入图片说明

Attachments

Comments (2)

limingwang created任务
limingwang set related repository to openEuler/kernel
展开全部操作日志

Hey limingwang0, Welcome to openEuler Community.
All of the projects in openEuler Community are maintained by @openeuler-ci-bot .
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at https://gitee.com/openeuler/community/blob/master/en/sig-infrastructure/command.md to find the details.

openeuler-ci-bot set assignee to weiyj
YangYingliang changed issue state from 待办的 to 进行中
limingwang changed title
limingwang changed description
limingwang changed description
limingwang changed description
limingwang changed description
limingwang changed description
成坚 (CHENG Jian) changed assignee from weiyj to zhengzengkai

已合入如下相关补丁:
bb420cf9aa96 RISCV: KVM: fix bug in migration
8d9fb94def6d RISC-V: Enable KVM for RV64 and RV32
0fb0f6010791 RISC-V: KVM: Add MAINTAINERS entry
94249beff832 RISC-V: KVM: Document RISC-V specific parts of KVM API
7b4c2ba99524 RISC-V: KVM: Add SBI v0.1 support
1740d169ec24 RISC-V: KVM: Implement ONE REG interface for FP registers
d58a09d981c6 RISC-V: KVM: FP lazy save/restore
5d694703a4df RISC-V: KVM: Add timer functionality
3bba8056692e RISC-V: KVM: Implement MMU notifiers
4c99be36676d RISC-V: KVM: Implement stage2 page table programming
f2c078138b96 RISC-V: KVM: Implement VMID allocator
ac864e222df9 RISC-V: KVM: Handle WFI exits for VCPU
76580c26bfaf RISC-V: KVM: Handle MMIO exits for VCPU
a8c4fcfe6cca RISC-V: KVM: Implement VCPU world-switch
5fbaad69b54f RISC-V: KVM: Implement KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls
712a392a1ee1 RISC-V: KVM: Implement VCPU interrupts and requests handling
547754bf9ebe RISC-V: KVM: Implement VCPU create, init and destroy functions
e91613aec0b9 RISC-V: Add initial skeletal KVM support
145b00007b88 RISC-V: Add hypervisor extension related CSR defines
ddc1d948927c RISC-V: Enable drivers for Microchip PolarFire ICICLE board
41e926e6ead2 RISC-V: Initial DTS for Microchip ICICLE board
ee81ec41a2d0 RISC-V: Add Microchip PolarFire kconfig option
b87003a9d82f Microchip Polarfire SoC Clock Driver
ff85bc34763a RISC-V: Enable CPU Hotplug in defconfigs
3693aa3de291 Revert "riscv: Use latest system call ABI"
688923d14395 RISC-V: Add fragmented config for debug options

zhengzengkai changed issue state from 进行中 to 已完成

Sign in to comment

状态
Assignees
Projects
Milestones
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
Branches
Planed to start   -   Planed to end
-
Top level
Priority
Duration (hours)
确定
参与者(3)
5329419 openeuler ci bot 1578984659