From b52522215b3c513e6be163b1333473fa115b03c3 Mon Sep 17 00:00:00 2001 From: Ivan Velickovic Date: Sat, 6 Jul 2024 12:37:02 +1000 Subject: [PATCH] Sort out our includes This commit puts all includes in their own directory. This is done to simplify building and using libvmm such that there is only one include directory to install/add to path. Signed-off-by: Ivan Velickovic --- build.zig | 8 ++-- examples/rust/Makefile | 17 ++++---- examples/simple/Makefile | 24 +++++------ examples/simple/build.zig | 7 ++-- examples/simple/vmm.c | 12 +++--- examples/virtio-snd/Makefile | 31 +++++++------- examples/virtio-snd/client_vmm.c | 17 ++++---- examples/virtio-snd/snd_driver_vmm.c | 15 +++---- examples/virtio/Makefile | 41 ++++++++++--------- examples/virtio/blk_driver_vmm.c | 14 +++---- examples/virtio/client_vmm.c | 18 ++++---- examples/zig/build.zig | 7 +--- examples/zig/src/vmm.zig | 8 ++-- {src => include/libvmm}/arch/aarch64/fault.h | 0 {src => include/libvmm}/arch/aarch64/hsr.h | 0 {src => include/libvmm}/arch/aarch64/linux.h | 0 {src => include/libvmm}/arch/aarch64/psci.h | 0 {src => include/libvmm}/arch/aarch64/smc.h | 0 .../libvmm}/arch/aarch64/vgic/vdist.h | 4 +- .../libvmm}/arch/aarch64/vgic/vgic.h | 2 +- .../libvmm}/arch/aarch64/vgic/vgic_v2.h | 2 +- .../libvmm}/arch/aarch64/vgic/vgic_v3.h | 0 .../libvmm}/arch/aarch64/vgic/virq.h | 2 +- {src => include/libvmm}/dtb.h | 0 {src => include/libvmm}/guest.h | 0 {src => include/libvmm}/tcb.h | 2 +- {src => include/libvmm}/util/atomic.h | 0 {src => include/libvmm}/util/printf.h | 0 {src => include/libvmm}/util/queue.h | 1 + {src => include/libvmm}/util/util.h | 2 +- {src => include/libvmm}/vcpu.h | 2 +- {src => include/libvmm}/virq.h | 0 {src => include/libvmm}/virtio/block.h | 2 +- {src => include/libvmm}/virtio/config.h | 0 {src => include/libvmm}/virtio/console.h | 2 +- {src => include/libvmm}/virtio/mmio.h | 4 +- {src => include/libvmm}/virtio/sound.h | 4 +- {src => include/libvmm}/virtio/virtio.h | 9 ++-- {src => include/libvmm}/virtio/virtq.h | 0 src/arch/aarch64/fault.c | 14 +++---- src/arch/aarch64/linux.c | 6 +-- src/arch/aarch64/psci.c | 10 ++--- src/arch/aarch64/smc.c | 6 +-- src/arch/aarch64/tcb.c | 4 +- src/arch/aarch64/vcpu.c | 4 +- src/arch/aarch64/vgic/vgic.c | 14 +++---- src/arch/aarch64/vgic/vgic_v2.c | 14 +++---- src/arch/aarch64/vgic/vgic_v3.c | 11 +++-- src/arch/aarch64/virq.c | 6 +-- src/guest.c | 6 +-- src/util/printf.c | 2 +- src/util/util.c | 4 +- src/virtio/block.c | 12 +++--- src/virtio/console.c | 10 ++--- src/virtio/mmio.c | 12 +++--- src/virtio/sound.c | 12 +++--- tools/linux/uio_drivers/snd/main.c | 2 +- 57 files changed, 192 insertions(+), 214 deletions(-) rename {src => include/libvmm}/arch/aarch64/fault.h (100%) rename {src => include/libvmm}/arch/aarch64/hsr.h (100%) rename {src => include/libvmm}/arch/aarch64/linux.h (100%) rename {src => include/libvmm}/arch/aarch64/psci.h (100%) rename {src => include/libvmm}/arch/aarch64/smc.h (100%) rename {src => include/libvmm}/arch/aarch64/vgic/vdist.h (99%) rename {src => include/libvmm}/arch/aarch64/vgic/vgic.h (98%) rename {src => include/libvmm}/arch/aarch64/vgic/vgic_v2.h (99%) rename {src => include/libvmm}/arch/aarch64/vgic/vgic_v3.h (100%) rename {src => include/libvmm}/arch/aarch64/vgic/virq.h (99%) rename {src => include/libvmm}/dtb.h (100%) rename {src => include/libvmm}/guest.h (100%) rename {src => include/libvmm}/tcb.h (86%) rename {src => include/libvmm}/util/atomic.h (100%) rename {src => include/libvmm}/util/printf.h (100%) rename {src => include/libvmm}/util/queue.h (98%) rename {src => include/libvmm}/util/util.h (98%) rename {src => include/libvmm}/vcpu.h (89%) rename {src => include/libvmm}/virq.h (100%) rename {src => include/libvmm}/virtio/block.h (99%) rename {src => include/libvmm}/virtio/config.h (100%) rename {src => include/libvmm}/virtio/console.h (99%) rename {src => include/libvmm}/virtio/mmio.h (98%) rename {src => include/libvmm}/virtio/sound.h (99%) rename {src => include/libvmm}/virtio/virtio.h (58%) rename {src => include/libvmm}/virtio/virtq.h (100%) diff --git a/build.zig b/build.zig index d180c746..7c0f3ec2 100644 --- a/build.zig +++ b/build.zig @@ -70,12 +70,10 @@ pub fn build(b: *std.Build) void { } }); - // @ivanv: fix all of our libvmm includes! This is a mess! - libvmm.addIncludePath(b.path("src")); - libvmm.addIncludePath(b.path("src/util/")); - libvmm.addIncludePath(b.path("src/arch/aarch64")); - libvmm.addIncludePath(b.path("src/arch/aarch64/vgic/")); + libvmm.addIncludePath(b.path("include")); libvmm.addIncludePath(.{ .cwd_relative = libmicrokit_include }); + libvmm.installHeadersDirectory(b.path("include/libvmm"), "libvmm", .{}); + b.installArtifact(libvmm); } diff --git a/examples/rust/Makefile b/examples/rust/Makefile index 5fcaf83e..2703d8d1 100644 --- a/examples/rust/Makefile +++ b/examples/rust/Makefile @@ -14,7 +14,7 @@ BUILD_DIR ?= build # Default config is a debug build, pass CONFIG= to override CONFIG ?= debug # Default board supported is QEMU ARM virt -BOARD ?= qemu_arm_virt +BOARD = qemu_arm_virt # Specify that we use bash for all shell commands SHELL=/bin/bash @@ -27,7 +27,7 @@ AR := llvm-ar MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit BOARD_DIR := $(MICROKIT_SDK)/board/$(BOARD)/$(CONFIG) -LIBVMM := ../../src +LIBVMM := $(abspath ../../) SYSTEM_DESCRIPTION := rust_vmm.system IMAGE_DIR := images @@ -67,7 +67,7 @@ CFLAGS := -mstrict-align \ -nostdlib \ -Wno-unused-command-line-argument \ -Wall -Wno-unused-function -Werror \ - -I$(LIBVMM)/arch/aarch64 -I$(LIBVMM) -I$(LIBVMM)/util -I$(BOARD_DIR)/include \ + -I$(LIBVMM)/include -I$(BOARD_DIR)/include \ -DBOARD_$(BOARD) \ -DCONFIG_$(CONFIG) \ -target aarch64-none-elf @@ -112,19 +112,16 @@ directories: $(DTB): $(DTS) $(DTC) -q -I dts -O dtb $< > $@ -$(BUILD_DIR)/%.o: %.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM)/src/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(LIBVMM)/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM)/src/util/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(LIBVMM)/util/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM)/src/arch/aarch64/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(LIBVMM)/arch/aarch64/%.c Makefile - $(CC) -c $(CFLAGS) $< -o $@ - -$(BUILD_DIR)/%.o: $(LIBVMM)/arch/aarch64/vgic/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM)/src/arch/aarch64/vgic/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ $(BUILD_DIR)/libvmm.a: $(addprefix $(BUILD_DIR)/, $(LIBVMM_OBJS)) diff --git a/examples/simple/Makefile b/examples/simple/Makefile index 00945291..95befe73 100644 --- a/examples/simple/Makefile +++ b/examples/simple/Makefile @@ -55,9 +55,9 @@ MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit # @ivanv: incremental builds don't work with IMAGE_DIR changing BOARD_DIR := $(MICROKIT_SDK)/board/$(BOARD)/$(CONFIG) -VMM := ../../ -VMM_TOOLS := $(VMM)/tools -VMM_SRC_DIR := $(VMM)/src +LIBVMM := $(abspath ../../) +LIBVMM_TOOLS := $(LIBVMM)/tools +LIBVMM_SRC_DIR := $(LIBVMM)/src SYSTEM_DESCRIPTION := board/$(BOARD)/simple.system IMAGE_DIR := board/$(BOARD) @@ -72,8 +72,8 @@ ELFS := vmm.elf IMAGE_FILE = $(BUILD_DIR)/loader.img REPORT_FILE = $(BUILD_DIR)/report.txt -V3_BOARDS := maaxboard -ifeq ($(filter ${BOARD},${V3_BOARDS}),) +GIC_V3_BOARDS := maaxboard +ifeq ($(filter ${BOARD},${GIC_V3_BOARDS}),) VGIC := GIC_V2 VGIC_OBJS := vgic_v2.o else @@ -98,7 +98,7 @@ CFLAGS := -mstrict-align \ -nostdlib \ -Wno-unused-command-line-argument \ -Wall -Wno-unused-function -Werror \ - -I$(VMM_SRC_DIR)/arch/aarch64 -I$(VMM_SRC_DIR) -I$(VMM_SRC_DIR)/util -I$(BOARD_DIR)/include \ + -I$(LIBVMM)/include -I$(BOARD_DIR)/include \ -DBOARD_$(BOARD) \ -DCONFIG_$(CONFIG) \ -target aarch64-none-elf @@ -123,11 +123,11 @@ directories: $(DTB): $(DTS_BASE) $(DTS_OVERLAYS) if ! command -v $(DTC) &> /dev/null; then echo "Could not find dependency: Device Tree Compiler (dtc)"; exit 1; fi - sh $(VMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/guest.dts + sh $(LIBVMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/guest.dts # @ivanv: Shouldn't supress warnings $(DTC) -q -I dts -O dtb $(BUILD_DIR)/guest.dts > $@ -$(BUILD_DIR)/package_guest_images.o: $(VMM_TOOLS)/package_guest_images.S $(IMAGE_DIR) $(LINUX) $(INITRD) $(DTB) +$(BUILD_DIR)/package_guest_images.o: $(LIBVMM_TOOLS)/package_guest_images.S $(IMAGE_DIR) $(LINUX) $(INITRD) $(DTB) $(CC) -c -g3 -x assembler-with-cpp \ -DGUEST_KERNEL_IMAGE_PATH=\"$(LINUX)\" \ -DGUEST_DTB_IMAGE_PATH=\"$(DTB)\" \ @@ -138,16 +138,16 @@ $(BUILD_DIR)/package_guest_images.o: $(VMM_TOOLS)/package_guest_images.S $(IMAGE $(BUILD_DIR)/%.o: %.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/util/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/util/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/arch/aarch64/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/arch/aarch64/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/arch/aarch64/vgic/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/arch/aarch64/vgic/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ $(BUILD_DIR)/vmm.elf: $(addprefix $(BUILD_DIR)/, $(VMM_OBJS)) diff --git a/examples/simple/build.zig b/examples/simple/build.zig index 30056f1b..53be783b 100644 --- a/examples/simple/build.zig +++ b/examples/simple/build.zig @@ -131,16 +131,15 @@ pub fn build(b: *std.Build) void { // Add microkit.h to be used by the API wrapper. exe.addIncludePath(.{ .cwd_relative = libmicrokit_include }); - exe.addIncludePath(libvmm_dep.path("src")); - // @ivanv: shouldn't need to do this! fix our includes - exe.addIncludePath(libvmm_dep.path("src/arch/aarch64")); // Add the static library that provides each protection domain's entry // point (`main()`), which runs the main handler loop. exe.addObjectFile(.{ .cwd_relative = libmicrokit }); - exe.linkLibrary(libvmm); // Specify the linker script, this is necessary to set the ELF entry point address. exe.setLinkerScriptPath(.{ .cwd_relative = libmicrokit_linker_script }); + // Link the libvmm library, this will automatically add the libvmm headers as well. + exe.linkLibrary(libvmm); + exe.addCSourceFiles(.{ .files = &.{"vmm.c"}, .flags = &.{ diff --git a/examples/simple/vmm.c b/examples/simple/vmm.c index 7b5772a5..91826c19 100644 --- a/examples/simple/vmm.c +++ b/examples/simple/vmm.c @@ -6,13 +6,11 @@ #include #include #include -#include "util/util.h" -#include "arch/aarch64/linux.h" -#include "arch/aarch64/fault.h" -#include "guest.h" -#include "virq.h" -#include "tcb.h" -#include "vcpu.h" +#include +#include +#include +#include +#include // @ivanv: ideally we would have none of these hardcoded values // initrd, ram size come from the DTB diff --git a/examples/virtio-snd/Makefile b/examples/virtio-snd/Makefile index 818af7bb..967b800f 100644 --- a/examples/virtio-snd/Makefile +++ b/examples/virtio-snd/Makefile @@ -36,14 +36,14 @@ RANLIB := llvm-ranlib MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit BOARD_DIR := $(MICROKIT_SDK)/board/$(BOARD)/$(CONFIG) -VMM := ../../ -VMM_TOOLS := $(VMM)/tools -VMM_SRC_DIR := $(VMM)/src +LIBVMM := $(abspath ../../) +LIBVMM_TOOLS := $(LIBVMM)/tools +LIBVMM_SRC_DIR := $(LIBVMM)/src SYSTEM_DESCRIPTION := board/$(BOARD)/virtio-snd.system CURRENT_DIR := $(shell pwd) -LINUX_DIR := $(VMM_TOOLS)/linux +LINUX_DIR := $(LIBVMM_TOOLS)/linux LINUX_SND_DIR := $(LINUX_DIR)/snd UIO_DRIVERS_DIR := $(LINUX_DIR)/uio_drivers @@ -148,7 +148,8 @@ CFLAGS := -mstrict-align \ -nostdlib \ -Wno-unused-command-line-argument \ -Wall -Wno-unused-function -Werror \ - -I$(VMM_SRC_DIR)/arch/aarch64 -I$(VMM_SRC_DIR) -I$(VMM_SRC_DIR)/util -I$(BOARD_DIR)/include \ + -I$(LIBVMM)/include \ + -I$(BOARD_DIR)/include \ -I$(SDDF_SERIAL_DRIVER)/include \ -I$(SDDF_DIR)/include \ -I$(SERIAL_CONFIG_INCLUDE) \ @@ -163,7 +164,7 @@ CFLAGS_USERLEVEL := -g \ -Wall -Wno-unused-function -Werror \ -I$(SDDF_DIR) \ -I$(SDDF_DIR)/include \ - -I$(VMM_SRC_DIR) \ + -I$(LIBVMM)/include \ -I$(LINUX_DIR)/include \ -DBOARD_$(BOARD) \ -lasound \ @@ -226,14 +227,14 @@ SND_DRIVER_VM_ETC := $(LINUX_SND_DIR)/board/$(BOARD)/asound.conf $(SND_DRIVER_VM_INITRD_OVERLAYED): $(addprefix $(BUILD_DIR)/, $(SND_DRIVER_VM_USERLEVEL_ELFS)) \ $(SND_DRIVER_VM_USERLEVEL_INIT) \ $(SND_DRIVER_VM_ETC) - $(VMM_TOOLS)/packrootfs $(SND_DRIVER_VM_INITRD) $(SND_DRIVER_VM_ROOTFS_TMP_DIR) -o $(SND_DRIVER_VM_INITRD_OVERLAYED) \ + $(LIBVMM_TOOLS)/packrootfs $(SND_DRIVER_VM_INITRD) $(SND_DRIVER_VM_ROOTFS_TMP_DIR) -o $(SND_DRIVER_VM_INITRD_OVERLAYED) \ --startup $(SND_DRIVER_VM_USERLEVEL_INIT) \ --home $(addprefix $(BUILD_DIR)/, $(SND_DRIVER_VM_USERLEVEL_ELFS)) \ --etc $(SND_DRIVER_VM_ETC) $(CLIENT_VM_INITRD_OVERLAYED): $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_USERLEVEL_ELFS)) \ $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_USERLEVEL_INIT)) - $(VMM_TOOLS)/packrootfs $(CLIENT_VM_INITRD) $(CLIENT_VM_ROOTFS_TMP_DIR) -o $(CLIENT_VM_INITRD_OVERLAYED) \ + $(LIBVMM_TOOLS)/packrootfs $(CLIENT_VM_INITRD) $(CLIENT_VM_ROOTFS_TMP_DIR) -o $(CLIENT_VM_INITRD_OVERLAYED) \ --home $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_USERLEVEL_ELFS)) @@ -241,7 +242,7 @@ $(SND_DRIVER_VM_DTB): $(SND_DRIVER_VM_BASE_DTS) $(SND_DRIVER_VM_DTS_OVERLAYS) sh ../../tools/dtscat $^ > $(BUILD_DIR)/snd_driver_vm.dts $(DTC) -q -I dts -O dtb $(BUILD_DIR)/snd_driver_vm.dts > $@ -$(BUILD_DIR)/snd_driver_images.o: $(VMM_TOOLS)/package_guest_images.S $(SND_DRIVER_VM_LINUX) $(SND_DRIVER_VM_DTB) $(SND_DRIVER_VM_INITRD_OVERLAYED) +$(BUILD_DIR)/snd_driver_images.o: $(LIBVMM_TOOLS)/package_guest_images.S $(SND_DRIVER_VM_LINUX) $(SND_DRIVER_VM_DTB) $(SND_DRIVER_VM_INITRD_OVERLAYED) $(CC) -c -g3 -x assembler-with-cpp \ -DGUEST_KERNEL_IMAGE_PATH=\"$(SND_DRIVER_VM_LINUX)\" \ -DGUEST_DTB_IMAGE_PATH=\"$(SND_DRIVER_VM_DTB)\" \ @@ -253,7 +254,7 @@ $(CLIENT_VM_DTB): $(CLIENT_VM_BASE_DTS) $(CLIENT_VM_DTS_OVERLAYS) sh ../../tools/dtscat $^ > $(BUILD_DIR)/client_vm.dts $(DTC) -q -I dts -O dtb $(BUILD_DIR)/client_vm.dts > $@ -$(BUILD_DIR)/client_images.o: $(VMM_TOOLS)/package_guest_images.S $(CLIENT_VM_LINUX) $(CLIENT_VM_DTB) $(CLIENT_VM_INITRD_OVERLAYED) +$(BUILD_DIR)/client_images.o: $(LIBVMM_TOOLS)/package_guest_images.S $(CLIENT_VM_LINUX) $(CLIENT_VM_DTB) $(CLIENT_VM_INITRD_OVERLAYED) $(CC) -c -g3 -x assembler-with-cpp \ -DGUEST_KERNEL_IMAGE_PATH=\"$(CLIENT_VM_LINUX)\" \ -DGUEST_DTB_IMAGE_PATH=\"$(CLIENT_VM_DTB)\" \ @@ -276,19 +277,19 @@ $(BUILD_DIR)/%.elf: $(VM_USERLEVEL_DIR)/%.c $(BUILD_DIR)/%.o: %.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/util/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/util/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/arch/aarch64/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/arch/aarch64/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/arch/aarch64/vgic/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/arch/aarch64/vgic/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/virtio/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/virtio/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ $(BUILD_DIR)/sound_%.o: $(SDDF_SOUND_COMPONENTS)/%.c Makefile diff --git a/examples/virtio-snd/client_vmm.c b/examples/virtio-snd/client_vmm.c index 7f575d34..6cf3af02 100644 --- a/examples/virtio-snd/client_vmm.c +++ b/examples/virtio-snd/client_vmm.c @@ -6,16 +6,13 @@ #include #include #include -#include "util/atomic.h" -#include "util/util.h" -#include "arch/aarch64/linux.h" -#include "arch/aarch64/fault.h" -#include "guest.h" -#include "virq.h" -#include "tcb.h" -#include "vcpu.h" -#include "virtio/console.h" -#include "virtio/sound.h" +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/examples/virtio-snd/snd_driver_vmm.c b/examples/virtio-snd/snd_driver_vmm.c index 74e26b74..f9073921 100644 --- a/examples/virtio-snd/snd_driver_vmm.c +++ b/examples/virtio-snd/snd_driver_vmm.c @@ -6,15 +6,12 @@ #include #include #include -#include "util/util.h" -#include "arch/aarch64/linux.h" -#include "arch/aarch64/fault.h" -#include "guest.h" -#include "fault.h" -#include "virq.h" -#include "tcb.h" -#include "vcpu.h" -#include "virtio/console.h" +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/examples/virtio/Makefile b/examples/virtio/Makefile index ae000cf7..5a86ed45 100644 --- a/examples/virtio/Makefile +++ b/examples/virtio/Makefile @@ -46,14 +46,14 @@ MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit # @ivanv: incremental builds don't work with IMAGE_DIR changing BOARD_DIR := $(MICROKIT_SDK)/board/$(BOARD)/$(CONFIG) -VMM := ../.. -VMM_TOOLS := $(VMM)/tools -VMM_SRC_DIR := $(VMM)/src +LIBVMM := $(abspath ../..) +LIBVMM_TOOLS := $(LIBVMM)/tools +LIBVMM_SRC_DIR := $(LIBVMM)/src SYSTEM_DESCRIPTION := board/$(BOARD)/virtio.system CURRENT_DIR := $(shell pwd) -LINUX_DIR := $(VMM_TOOLS)/linux +LINUX_DIR := $(LIBVMM_TOOLS)/linux LINUX_BLK_DIR := $(LINUX_DIR)/blk LINUX_BLK_BOARD_DIR := $(LINUX_BLK_DIR)/board/$(BOARD) @@ -195,8 +195,9 @@ CFLAGS := -mstrict-align \ -nostdlib \ -Wno-unused-command-line-argument \ -Wall -Wno-unused-function -Werror \ - -I$(VMM_SRC_DIR)/arch/aarch64 -I$(VMM_SRC_DIR) -I$(VMM_SRC_DIR)/util -I$(BOARD_DIR)/include \ + -I$(BOARD_DIR)/include \ -I$(SDDF_DIR)/include \ + -I$(LIBVMM)/include \ -I$(VMM_INCLUDE) \ -DBOARD_$(BOARD) \ -DCONFIG_$(CONFIG) \ @@ -268,40 +269,40 @@ $(BUILD_DIR)/serial/virt_%.o: ${SDDF_DIR}/serial/components/virt_%.c ${CC} ${CFLAGS} -o $@ -c $< $(BUILD_DIR)/storage: - $(VMM_TOOLS)/mkvirtdisk $@ $(NUM_PART) $(BLK_SIZE) $(BLK_MEM) + $(LIBVMM_TOOLS)/mkvirtdisk $@ $(NUM_PART) $(BLK_SIZE) $(BLK_MEM) # Unpack rootfs, put the userlevel in /root and userlevel_init in /etc/init.d/S99, repack rootfs $(BLK_DRIVER_VM_INITRD_MODIFIED): $(addprefix $(BUILD_DIR)/, $(BLK_DRIVER_VM_USERLEVEL)) \ $(addprefix $(BUILD_DIR)/, $(BLK_DRIVER_VM_USERLEVEL_INIT)) - $(VMM_TOOLS)/packrootfs $(BLK_DRIVER_VM_INITRD) $(BLK_DRIVER_VM_ROOTFS_TMP_DIR) -o $(BLK_DRIVER_VM_INITRD_MODIFIED) \ + $(LIBVMM_TOOLS)/packrootfs $(BLK_DRIVER_VM_INITRD) $(BLK_DRIVER_VM_ROOTFS_TMP_DIR) -o $(BLK_DRIVER_VM_INITRD_MODIFIED) \ --startup $(addprefix $(BUILD_DIR)/, $(BLK_DRIVER_VM_USERLEVEL_INIT)) \ --home $(addprefix $(BUILD_DIR)/, $(BLK_DRIVER_VM_USERLEVEL)) $(CLIENT_VM_1_INITRD_MODIFIED): $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_1_USERLEVEL)) \ $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_1_USERLEVEL_INIT)) - $(VMM_TOOLS)/packrootfs $(CLIENT_VM_1_INITRD) $(CLIENT_VM_1_ROOTFS_TMP_DIR) -o $(CLIENT_VM_1_INITRD_MODIFIED) \ + $(LIBVMM_TOOLS)/packrootfs $(CLIENT_VM_1_INITRD) $(CLIENT_VM_1_ROOTFS_TMP_DIR) -o $(CLIENT_VM_1_INITRD_MODIFIED) \ --startup $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_1_USERLEVEL_INIT)) \ --home $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_1_USERLEVEL)) $(CLIENT_VM_2_INITRD_MODIFIED): $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_2_USERLEVEL)) \ $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_2_USERLEVEL_INIT)) - $(VMM_TOOLS)/packrootfs $(CLIENT_VM_2_INITRD) $(CLIENT_VM_2_ROOTFS_TMP_DIR) -o $(CLIENT_VM_2_INITRD_MODIFIED) \ + $(LIBVMM_TOOLS)/packrootfs $(CLIENT_VM_2_INITRD) $(CLIENT_VM_2_ROOTFS_TMP_DIR) -o $(CLIENT_VM_2_INITRD_MODIFIED) \ --startup $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_2_USERLEVEL_INIT)) \ --home $(addprefix $(BUILD_DIR)/, $(CLIENT_VM_2_USERLEVEL)) $(BLK_DRIVER_VM_DTB): $(BLK_DRIVER_VM_BASE_DTS) $(BLK_DRIVER_VM_DTS_OVERLAYS) - $(VMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/blk_driver_vm.dts + $(LIBVMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/blk_driver_vm.dts $(DTC) -q -I dts -O dtb $(BUILD_DIR)/blk_driver_vm.dts > $@ $(CLIENT_VM_1_DTB): $(CLIENT_VM_1_BASE_DTS) $(CLIENT_VM_1_DTS_OVERLAYS) - $(VMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/client_vm_1.dts + $(LIBVMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/client_vm_1.dts $(DTC) -q -I dts -O dtb $(BUILD_DIR)/client_vm_1.dts > $@ $(CLIENT_VM_2_DTB): $(CLIENT_VM_2_BASE_DTS) $(CLIENT_VM_2_DTS_OVERLAYS) - $(VMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/client_vm_2.dts + $(LIBVMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/client_vm_2.dts $(DTC) -q -I dts -O dtb $(BUILD_DIR)/client_vm_2.dts > $@ -$(BUILD_DIR)/blk_driver_images.o: $(VMM_TOOLS)/package_guest_images.S $(BLK_DRIVER_VM_LINUX) $(BLK_DRIVER_VM_DTB) $(BLK_DRIVER_VM_INITRD_MODIFIED) +$(BUILD_DIR)/blk_driver_images.o: $(LIBVMM_TOOLS)/package_guest_images.S $(BLK_DRIVER_VM_LINUX) $(BLK_DRIVER_VM_DTB) $(BLK_DRIVER_VM_INITRD_MODIFIED) $(CC) -c -g3 -x assembler-with-cpp \ -DGUEST_KERNEL_IMAGE_PATH=\"$(BLK_DRIVER_VM_LINUX)\" \ -DGUEST_DTB_IMAGE_PATH=\"$(BLK_DRIVER_VM_DTB)\" \ @@ -309,7 +310,7 @@ $(BUILD_DIR)/blk_driver_images.o: $(VMM_TOOLS)/package_guest_images.S $(BLK_DRIV -target aarch64-none-elf \ $< -o $@ -$(BUILD_DIR)/client_images_1.o: $(VMM_TOOLS)/package_guest_images.S $(CLIENT_VM_1_LINUX) $(CLIENT_VM_1_DTB) $(CLIENT_VM_1_INITRD_MODIFIED) +$(BUILD_DIR)/client_images_1.o: $(LIBVMM_TOOLS)/package_guest_images.S $(CLIENT_VM_1_LINUX) $(CLIENT_VM_1_DTB) $(CLIENT_VM_1_INITRD_MODIFIED) $(CC) -c -g3 -x assembler-with-cpp \ -DGUEST_KERNEL_IMAGE_PATH=\"$(CLIENT_VM_1_LINUX)\" \ -DGUEST_DTB_IMAGE_PATH=\"$(CLIENT_VM_1_DTB)\" \ @@ -317,7 +318,7 @@ $(BUILD_DIR)/client_images_1.o: $(VMM_TOOLS)/package_guest_images.S $(CLIENT_VM_ -target aarch64-none-elf \ $< -o $@ -$(BUILD_DIR)/client_images_2.o: $(VMM_TOOLS)/package_guest_images.S $(CLIENT_VM_2_LINUX) $(CLIENT_VM_2_DTB) $(CLIENT_VM_2_INITRD_MODIFIED) +$(BUILD_DIR)/client_images_2.o: $(LIBVMM_TOOLS)/package_guest_images.S $(CLIENT_VM_2_LINUX) $(CLIENT_VM_2_DTB) $(CLIENT_VM_2_INITRD_MODIFIED) $(CC) -c -g3 -x assembler-with-cpp \ -DGUEST_KERNEL_IMAGE_PATH=\"$(CLIENT_VM_2_LINUX)\" \ -DGUEST_DTB_IMAGE_PATH=\"$(CLIENT_VM_2_DTB)\" \ @@ -328,19 +329,19 @@ $(BUILD_DIR)/client_images_2.o: $(VMM_TOOLS)/package_guest_images.S $(CLIENT_VM_ $(BUILD_DIR)/%.o: %.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/util/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/util/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/arch/aarch64/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/arch/aarch64/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/arch/aarch64/vgic/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/arch/aarch64/vgic/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/%.o: $(VMM_SRC_DIR)/virtio/%.c Makefile +$(BUILD_DIR)/%.o: $(LIBVMM_SRC_DIR)/virtio/%.c Makefile $(CC) -c $(CFLAGS) $< -o $@ $(BUILD_DIR)/sddf_blk_%.o: $(SDDF_BLK_COMPONENTS)/%.c Makefile diff --git a/examples/virtio/blk_driver_vmm.c b/examples/virtio/blk_driver_vmm.c index 3687de11..deb8ac87 100644 --- a/examples/virtio/blk_driver_vmm.c +++ b/examples/virtio/blk_driver_vmm.c @@ -6,14 +6,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include "virtio/console.h" +#include +#include +#include +#include +#include +#include #include #include diff --git a/examples/virtio/client_vmm.c b/examples/virtio/client_vmm.c index 1d5c59df..726a833b 100644 --- a/examples/virtio/client_vmm.c +++ b/examples/virtio/client_vmm.c @@ -6,19 +6,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include #include +#include #include #define GUEST_RAM_SIZE 0x6000000 diff --git a/examples/zig/build.zig b/examples/zig/build.zig index cb06b74c..2f1a91a2 100644 --- a/examples/zig/build.zig +++ b/examples/zig/build.zig @@ -80,20 +80,17 @@ pub fn build(b: *std.Build) void { exe.root_module.addAnonymousImport("linux", .{ .root_source_file = b.path("images/linux") }); exe.root_module.addAnonymousImport("rootfs", .{ .root_source_file = b.path("images/rootfs.cpio.gz") }); + exe.addIncludePath(b.path("src/")); // Add microkit.h to be used by the API wrapper. exe.addIncludePath(.{ .cwd_relative = libmicrokit_include }); - exe.addIncludePath(libvmm_dep.path("src")); - // @ivanv: shouldn't need to do this! fix our includes - exe.addIncludePath(libvmm_dep.path("src/arch/aarch64")); // Add the static library that provides each protection domain's entry // point (`main()`), which runs the main handler loop. exe.addObjectFile(.{ .cwd_relative = libmicrokit }); - exe.linkLibrary(libvmm); exe.addObject(zig_libmicrokit); // Specify the linker script, this is necessary to set the ELF entry point address. exe.setLinkerScriptPath(.{ .cwd_relative = libmicrokit_linker_script }); - exe.addIncludePath(b.path("src/")); + exe.linkLibrary(libvmm); b.installArtifact(exe); diff --git a/examples/zig/src/vmm.zig b/examples/zig/src/vmm.zig index a6dac6ec..db20ba38 100644 --- a/examples/zig/src/vmm.zig +++ b/examples/zig/src/vmm.zig @@ -3,11 +3,9 @@ const std = @import("std"); const c = @cImport({ - @cInclude("linux.h"); - @cInclude("virq.h"); - @cInclude("guest.h"); - @cInclude("vcpu.h"); - @cInclude("tcb.h"); + @cInclude("libvmm/virq.h"); + @cInclude("libvmm/guest.h"); + @cInclude("libvmm/arch/aarch64/linux.h"); }); const microkit = @import("libmicrokit.zig"); diff --git a/src/arch/aarch64/fault.h b/include/libvmm/arch/aarch64/fault.h similarity index 100% rename from src/arch/aarch64/fault.h rename to include/libvmm/arch/aarch64/fault.h diff --git a/src/arch/aarch64/hsr.h b/include/libvmm/arch/aarch64/hsr.h similarity index 100% rename from src/arch/aarch64/hsr.h rename to include/libvmm/arch/aarch64/hsr.h diff --git a/src/arch/aarch64/linux.h b/include/libvmm/arch/aarch64/linux.h similarity index 100% rename from src/arch/aarch64/linux.h rename to include/libvmm/arch/aarch64/linux.h diff --git a/src/arch/aarch64/psci.h b/include/libvmm/arch/aarch64/psci.h similarity index 100% rename from src/arch/aarch64/psci.h rename to include/libvmm/arch/aarch64/psci.h diff --git a/src/arch/aarch64/smc.h b/include/libvmm/arch/aarch64/smc.h similarity index 100% rename from src/arch/aarch64/smc.h rename to include/libvmm/arch/aarch64/smc.h diff --git a/src/arch/aarch64/vgic/vdist.h b/include/libvmm/arch/aarch64/vgic/vdist.h similarity index 99% rename from src/arch/aarch64/vgic/vdist.h rename to include/libvmm/arch/aarch64/vgic/vdist.h index a950eee5..0d4823bc 100644 --- a/src/arch/aarch64/vgic/vdist.h +++ b/include/libvmm/arch/aarch64/vgic/vdist.h @@ -5,8 +5,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "fault.h" -#include "util.h" +#include +#include /* GIC Distributor register access utilities */ #define GIC_DIST_REGN(offset, reg) ((offset-reg)/sizeof(uint32_t)) diff --git a/src/arch/aarch64/vgic/vgic.h b/include/libvmm/arch/aarch64/vgic/vgic.h similarity index 98% rename from src/arch/aarch64/vgic/vgic.h rename to include/libvmm/arch/aarch64/vgic/vgic.h index 31544c39..a4c670cc 100644 --- a/src/arch/aarch64/vgic/vgic.h +++ b/include/libvmm/arch/aarch64/vgic/vgic.h @@ -8,7 +8,7 @@ #include #include #include -#include "../../../virq.h" +#include // @ivanv: this should all come from the DTS! // @ivanv: either this should all be compile time or all runtime diff --git a/src/arch/aarch64/vgic/vgic_v2.h b/include/libvmm/arch/aarch64/vgic/vgic_v2.h similarity index 99% rename from src/arch/aarch64/vgic/vgic_v2.h rename to include/libvmm/arch/aarch64/vgic/vgic_v2.h index 30477739..3dad2271 100644 --- a/src/arch/aarch64/vgic/vgic_v2.h +++ b/include/libvmm/arch/aarch64/vgic/vgic_v2.h @@ -8,7 +8,7 @@ #pragma once #include -#include "util.h" +#include #define GIC_ENABLED 1 diff --git a/src/arch/aarch64/vgic/vgic_v3.h b/include/libvmm/arch/aarch64/vgic/vgic_v3.h similarity index 100% rename from src/arch/aarch64/vgic/vgic_v3.h rename to include/libvmm/arch/aarch64/vgic/vgic_v3.h diff --git a/src/arch/aarch64/vgic/virq.h b/include/libvmm/arch/aarch64/vgic/virq.h similarity index 99% rename from src/arch/aarch64/vgic/virq.h rename to include/libvmm/arch/aarch64/vgic/virq.h index 3d68df8d..f55df33c 100644 --- a/src/arch/aarch64/vgic/virq.h +++ b/include/libvmm/arch/aarch64/vgic/virq.h @@ -9,7 +9,7 @@ #include #include -#include "util.h" +#include /* The ARM GIC architecture defines 16 SGIs (0 - 7 is recommended for non-secure * state, 8 - 15 for secure state), 16 PPIs (interrupt 16 - 31) and 988 SPIs diff --git a/src/dtb.h b/include/libvmm/dtb.h similarity index 100% rename from src/dtb.h rename to include/libvmm/dtb.h diff --git a/src/guest.h b/include/libvmm/guest.h similarity index 100% rename from src/guest.h rename to include/libvmm/guest.h diff --git a/src/tcb.h b/include/libvmm/tcb.h similarity index 86% rename from src/tcb.h rename to include/libvmm/tcb.h index af0f6647..7d5e8f32 100644 --- a/src/tcb.h +++ b/include/libvmm/tcb.h @@ -6,6 +6,6 @@ #pragma once -#include +#include void tcb_print_regs(size_t vcpu_id); diff --git a/src/util/atomic.h b/include/libvmm/util/atomic.h similarity index 100% rename from src/util/atomic.h rename to include/libvmm/util/atomic.h diff --git a/src/util/printf.h b/include/libvmm/util/printf.h similarity index 100% rename from src/util/printf.h rename to include/libvmm/util/printf.h diff --git a/src/util/queue.h b/include/libvmm/util/queue.h similarity index 98% rename from src/util/queue.h rename to include/libvmm/util/queue.h index f256d400..4a09decb 100644 --- a/src/util/queue.h +++ b/include/libvmm/util/queue.h @@ -1,5 +1,6 @@ #pragma once #include +#include /** * Generic fixed-size circular queue diff --git a/src/util/util.h b/include/libvmm/util/util.h similarity index 98% rename from src/util/util.h rename to include/libvmm/util/util.h index 9d6bfe1f..c0bfbfb1 100644 --- a/src/util/util.h +++ b/include/libvmm/util/util.h @@ -10,7 +10,7 @@ #include #include #include -#include "printf.h" +#include // @ivanv: these are here for convience, should not be here though #define GUEST_VCPU_ID 0 diff --git a/src/vcpu.h b/include/libvmm/vcpu.h similarity index 89% rename from src/vcpu.h rename to include/libvmm/vcpu.h index 3c92b528..83cf23af 100644 --- a/src/vcpu.h +++ b/include/libvmm/vcpu.h @@ -6,7 +6,7 @@ #pragma once -#include +#include void vcpu_reset(size_t vcpu_id); void vcpu_print_regs(size_t vcpu_id); diff --git a/src/virq.h b/include/libvmm/virq.h similarity index 100% rename from src/virq.h rename to include/libvmm/virq.h diff --git a/src/virtio/block.h b/include/libvmm/virtio/block.h similarity index 99% rename from src/virtio/block.h rename to include/libvmm/virtio/block.h index 96c49eee..7d22bceb 100644 --- a/src/virtio/block.h +++ b/include/libvmm/virtio/block.h @@ -33,10 +33,10 @@ #pragma once #include +#include #include #include #include -#include "virtio/mmio.h" /* Feature bits */ #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ diff --git a/src/virtio/config.h b/include/libvmm/virtio/config.h similarity index 100% rename from src/virtio/config.h rename to include/libvmm/virtio/config.h diff --git a/src/virtio/console.h b/include/libvmm/virtio/console.h similarity index 99% rename from src/virtio/console.h rename to include/libvmm/virtio/console.h index 1a6bbd1c..3d949d79 100644 --- a/src/virtio/console.h +++ b/include/libvmm/virtio/console.h @@ -37,7 +37,7 @@ #include #include -#include "virtio/mmio.h" +#include #define RX_QUEUE 0 #define TX_QUEUE 1 diff --git a/src/virtio/mmio.h b/include/libvmm/virtio/mmio.h similarity index 98% rename from src/virtio/mmio.h rename to include/libvmm/virtio/mmio.h index 8faf360e..74604e81 100644 --- a/src/virtio/mmio.h +++ b/include/libvmm/virtio/mmio.h @@ -6,8 +6,8 @@ #pragma once #include -#include "util.h" -#include "virtio/virtq.h" +#include +#include // table 4.1 #define VIRTIO_MMIO_DEV_MAGIC 0x74726976 // "virt" diff --git a/src/virtio/sound.h b/include/libvmm/virtio/sound.h similarity index 99% rename from src/virtio/sound.h rename to include/libvmm/virtio/sound.h index cae21161..8af04a12 100644 --- a/src/virtio/sound.h +++ b/include/libvmm/virtio/sound.h @@ -27,10 +27,10 @@ #pragma once #include +#include +#include #include #include -#include "virtio/mmio.h" -#include "util/queue.h" #define VIRTIO_SND_NUM_VIRTQ 4 diff --git a/src/virtio/virtio.h b/include/libvmm/virtio/virtio.h similarity index 58% rename from src/virtio/virtio.h rename to include/libvmm/virtio/virtio.h index 67347428..0a6ba442 100644 --- a/src/virtio/virtio.h +++ b/include/libvmm/virtio/virtio.h @@ -1,8 +1,9 @@ #pragma once -#include "mmio.h" -#include "block.h" -#include "console.h" -#include "sound.h" + +#include +#include +#include +#include /* * All terminology used and functionality of the virtIO device implementation diff --git a/src/virtio/virtq.h b/include/libvmm/virtio/virtq.h similarity index 100% rename from src/virtio/virtq.h rename to include/libvmm/virtio/virtq.h diff --git a/src/arch/aarch64/fault.c b/src/arch/aarch64/fault.c index fb83bce2..407b670c 100644 --- a/src/arch/aarch64/fault.c +++ b/src/arch/aarch64/fault.c @@ -5,13 +5,13 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "hsr.h" -#include "../../util/util.h" -#include "smc.h" -#include "vgic/vgic.h" -#include "tcb.h" -#include "vcpu.h" -#include "fault.h" +#include +#include +#include +#include +#include +#include +#include // #define CPSR_THUMB (1 << 5) // #define CPSR_IS_THUMB(x) ((x) & CPSR_THUMB) diff --git a/src/arch/aarch64/linux.c b/src/arch/aarch64/linux.c index 0cce2df6..2445212e 100644 --- a/src/arch/aarch64/linux.c +++ b/src/arch/aarch64/linux.c @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "../../util/util.h" -#include "dtb.h" -#include "linux.h" +#include +#include +#include uintptr_t linux_setup_images(uintptr_t ram_start, uintptr_t kernel, diff --git a/src/arch/aarch64/psci.c b/src/arch/aarch64/psci.c index 84495e55..fb7dc36d 100644 --- a/src/arch/aarch64/psci.c +++ b/src/arch/aarch64/psci.c @@ -6,11 +6,11 @@ */ #include -#include "psci.h" -#include "smc.h" -#include "fault.h" -#include "../../util/util.h" -#include "../../guest.h" +#include +#include +#include +#include +#include /* * The PSCI version is represented by a 32-bit unsigned integer. diff --git a/src/arch/aarch64/smc.c b/src/arch/aarch64/smc.c index 21a6c5f2..cd305d5b 100644 --- a/src/arch/aarch64/smc.c +++ b/src/arch/aarch64/smc.c @@ -5,9 +5,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "smc.h" -#include "psci.h" -#include "../../util/util.h" +#include +#include +#include // Values in this file are taken from: // SMC CALLING CONVENTION diff --git a/src/arch/aarch64/tcb.c b/src/arch/aarch64/tcb.c index 97d8f2bd..49892ef4 100644 --- a/src/arch/aarch64/tcb.c +++ b/src/arch/aarch64/tcb.c @@ -5,8 +5,8 @@ */ #include -#include "util.h" -#include "tcb.h" +#include +#include void tcb_print_regs(size_t vcpu_id) { /* diff --git a/src/arch/aarch64/vcpu.c b/src/arch/aarch64/vcpu.c index 108ad701..7e228a70 100644 --- a/src/arch/aarch64/vcpu.c +++ b/src/arch/aarch64/vcpu.c @@ -5,8 +5,8 @@ */ #include -#include "util.h" -#include "vcpu.h" +#include +#include #define SCTLR_EL1_UCI (1 << 26) /* Enable EL0 access to DC CVAU, DC CIVAC, DC CVAC, and IC IVAU in AArch64 state */ diff --git a/src/arch/aarch64/vgic/vgic.c b/src/arch/aarch64/vgic/vgic.c index 50776c98..57859802 100644 --- a/src/arch/aarch64/vgic/vgic.c +++ b/src/arch/aarch64/vgic/vgic.c @@ -5,20 +5,20 @@ * SPDX-License-Identifier: BSD-2-Clause */ #include -#include "vgic.h" -#include "virq.h" -#include "fault.h" -#include "../../util/util.h" +#include +#include +#include +#include #if defined(GIC_V2) -#include "vgic_v2.h" +#include #elif defined(GIC_V3) -#include "vgic_v3.h" +#include #else #error "Unknown GIC version" #endif -#include "vdist.h" +#include /* The driver expects the VGIC state to be initialised before calling any of the driver functionality. */ extern vgic_t vgic; diff --git a/src/arch/aarch64/vgic/vgic_v2.c b/src/arch/aarch64/vgic/vgic_v2.c index f777e5c1..62cec8bc 100644 --- a/src/arch/aarch64/vgic/vgic_v2.c +++ b/src/arch/aarch64/vgic/vgic_v2.c @@ -43,13 +43,13 @@ #include #include -#include "vgic.h" -#include "vgic_v2.h" -#include "virq.h" -#include "vdist.h" -#include "../../util/util.h" -#include "fault.h" -#include "../../../virq.h" +#include +#include +#include +#include +#include +#include +#include vgic_t vgic; struct gic_dist_map dist; diff --git a/src/arch/aarch64/vgic/vgic_v3.c b/src/arch/aarch64/vgic/vgic_v3.c index 38cac4d1..87507c22 100644 --- a/src/arch/aarch64/vgic/vgic_v3.c +++ b/src/arch/aarch64/vgic/vgic_v3.c @@ -35,14 +35,13 @@ * will never occur again. */ -#include "vgic.h" - #include -#include "../fault.h" -#include "virq.h" -#include "vgic_v3.h" -#include "vdist.h" +#include +#include +#include +#include +#include vgic_t vgic; diff --git a/src/arch/aarch64/virq.c b/src/arch/aarch64/virq.c index 298e4a22..fc134fbd 100644 --- a/src/arch/aarch64/virq.c +++ b/src/arch/aarch64/virq.c @@ -1,7 +1,7 @@ #include -#include "vgic/vgic.h" -#include "../../util/util.h" -#include "../../virq.h" +#include +#include +#include /* Maps Microkit channel numbers with registered vIRQ */ int virq_passthrough_map[MAX_PASSTHROUGH_IRQ] = {-1}; diff --git a/src/guest.c b/src/guest.c index 941dd48b..f6ca887c 100644 --- a/src/guest.c +++ b/src/guest.c @@ -1,7 +1,7 @@ #include -#include "util/util.h" -#include "vcpu.h" -#include "guest.h" +#include +#include +#include bool guest_start(size_t boot_vcpu_id, uintptr_t kernel_pc, uintptr_t dtb, uintptr_t initrd) { /* diff --git a/src/util/printf.c b/src/util/printf.c index 93029741..37459b37 100644 --- a/src/util/printf.c +++ b/src/util/printf.c @@ -33,7 +33,7 @@ #include #include -#include "printf.h" +#include // define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the diff --git a/src/util/util.c b/src/util/util.c index 7abf1769..cfca9bb0 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "util.h" -#include "printf.h" +#include +#include /* This is required to use the printf library we brought in, it is simply for convenience since there's a lot of logging/debug printing diff --git a/src/virtio/block.c b/src/virtio/block.c index 737093a5..f95bb330 100644 --- a/src/virtio/block.c +++ b/src/virtio/block.c @@ -1,15 +1,15 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include -#include "virtio/config.h" -#include "virtio/virtq.h" -#include "virtio/mmio.h" -#include "virtio/block.h" -#include "virq.h" -#include "util.h" /* Uncomment this to enable debug logging */ // #define DEBUG_BLOCK diff --git a/src/virtio/console.c b/src/virtio/console.c index 5b6a9b01..b6188d67 100644 --- a/src/virtio/console.c +++ b/src/virtio/console.c @@ -1,8 +1,8 @@ -#include "virtio/config.h" -#include "virtio/mmio.h" -#include "virtio/console.h" -#include "virq.h" -#include "util.h" +#include +#include +#include +#include +#include #include /* Uncomment this to enable debug logging */ diff --git a/src/virtio/mmio.c b/src/virtio/mmio.c index 01285489..9362ee7d 100644 --- a/src/virtio/mmio.c +++ b/src/virtio/mmio.c @@ -4,12 +4,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ #include -#include "util.h" -#include "fault.h" -#include "virq.h" -#include "virtio/config.h" -#include "virtio/mmio.h" -#include "virtio/virtq.h" +#include +#include +#include +#include +#include +#include /* Uncomment this to enable debug logging */ // #define DEBUG_MMIO diff --git a/src/virtio/sound.c b/src/virtio/sound.c index 35df181d..16ab36bd 100644 --- a/src/virtio/sound.c +++ b/src/virtio/sound.c @@ -1,9 +1,9 @@ -#include "sound.h" -#include "config.h" -#include "microkit.h" -#include "virq.h" -#include "virtio/mmio.h" -#include "virtio/virtq.h" +#include +#include +#include +#include +#include +#include #include // #define DEBUG_SOUND diff --git a/tools/linux/uio_drivers/snd/main.c b/tools/linux/uio_drivers/snd/main.c index 25eb6690..5488efc8 100644 --- a/tools/linux/uio_drivers/snd/main.c +++ b/tools/linux/uio_drivers/snd/main.c @@ -1,6 +1,6 @@ #include "log.h" #include "stream.h" -#include "util/atomic.h" +#include #include #include #include