From 285df82b807bfa6ce25c13831df4268f911a836f Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Sun, 24 Mar 2019 01:09:58 +0800 Subject: [PATCH] Fix qcow2, and add pci_passthru to MakeFile Signed-off-by: Jiajie Chen --- README.md | 1 + kernel/Makefile | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 66c532b..25fdf4c 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ $ cd rCore/user $ make sfsimg arch={riscv32,riscv64,x86_64,aarch64} # requires x86_64-linux-musl-gcc or musl-gcc $ cd ../kernel $ make run arch={riscv32,riscv64,x86_64,aarch64} mode=release +$ make run arch=x86_64 mode=release pci_passthru=0000:00:00.1 # for ixgbe real nic, find its pci (bus, dev, func) first ``` ## History diff --git a/kernel/Makefile b/kernel/Makefile index 5f54b5a..33b3891 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -21,6 +21,7 @@ # | u540 Only available on riscv64, run on HiFive U540, use Sv39 # | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+ # m_mode Only available on riscv32, build for M-Mode, without MMU +# pci_passthru Only available on x86_64, passthrough the specified PCI device arch ?= riscv64 board ?= none @@ -29,6 +30,7 @@ LOG ?= debug graphic ?= off smp ?= 4 m_mode ?= +pci_passthru ?= target := $(arch) build_path := target/$(target)/$(mode) @@ -68,11 +70,18 @@ qemu_net_opts := \ ifeq ($(arch), x86_64) qemu_opts += \ -drive format=raw,file=$(bootimage) \ - -drive format=raw,file=$(SFSIMG),media=disk,cache=writeback \ + -drive format=qcow2,file=$(SFSIMG),media=disk,cache=writeback \ -serial mon:stdio \ -device isa-debug-exit +ifeq ($(pci_passthru), ) qemu_net_opts += \ -device e1000e,netdev=net0 +else +qemu_opts += \ + -machine ubuntu,accel=kvm +qemu_net_opts += \ + -device vfio-pci,host=$(pci_passthru) +endif else ifeq ($(arch), riscv32) qemu_opts += \