From b3584b98b780ef2a744b349d384fdd2a3b9d0eb0 Mon Sep 17 00:00:00 2001 From: Ryo Shimizu Date: Wed, 15 Mar 2023 06:28:27 +0900 Subject: [PATCH 02/13] change layout of nvmm. nvmm common part moved under accel/nvmm --- accel/meson.build | 1 + accel/nvmm/meson.build | 6 +++++ {target/i386 => accel}/nvmm/nvmm-accel-ops.c | 1 - include/system/nvmm.h | 9 ++++++++ target/i386/nvmm/meson.build | 7 ++---- target/i386/nvmm/nvmm-accel-ops.h | 24 -------------------- target/i386/nvmm/{nvmm-all.c => nvmm.c} | 2 -- 7 files changed, 18 insertions(+), 32 deletions(-) create mode 100644 accel/nvmm/meson.build rename {target/i386 => accel}/nvmm/nvmm-accel-ops.c (99%) delete mode 100644 target/i386/nvmm/nvmm-accel-ops.h rename target/i386/nvmm/{nvmm-all.c => nvmm.c} (99%) diff --git a/accel/meson.build b/accel/meson.build index 983dfd0bd5..a6a7ae9343 100644 --- a/accel/meson.build +++ b/accel/meson.build @@ -9,6 +9,7 @@ if have_system subdir('qtest') subdir('kvm') subdir('xen') + subdir('nvmm') subdir('stubs') subdir('mshv') endif diff --git a/accel/nvmm/meson.build b/accel/nvmm/meson.build new file mode 100644 index 0000000000..0308ab1e3f --- /dev/null +++ b/accel/nvmm/meson.build @@ -0,0 +1,6 @@ +nvmm_ss = ss.source_set() +nvmm_ss.add(files( + 'nvmm-accel-ops.c', +)) + +specific_ss.add_all(when: 'CONFIG_NVMM', if_true: nvmm_ss) diff --git a/target/i386/nvmm/nvmm-accel-ops.c b/accel/nvmm/nvmm-accel-ops.c similarity index 99% rename from target/i386/nvmm/nvmm-accel-ops.c rename to accel/nvmm/nvmm-accel-ops.c index dd5d5428b1..ffb82cf7bf 100644 --- a/target/i386/nvmm/nvmm-accel-ops.c +++ b/accel/nvmm/nvmm-accel-ops.c @@ -15,7 +15,6 @@ #include "qemu/guest-random.h" #include "system/nvmm.h" -#include "nvmm-accel-ops.h" static void *qemu_nvmm_cpu_thread_fn(void *arg) { diff --git a/include/system/nvmm.h b/include/system/nvmm.h index 7390def9ad..39d06957a5 100644 --- a/include/system/nvmm.h +++ b/include/system/nvmm.h @@ -20,6 +20,15 @@ # define CONFIG_NVMM_IS_POSSIBLE #endif /* COMPILING_PER_TARGET */ +int nvmm_init_vcpu(CPUState *cpu); +int nvmm_vcpu_exec(CPUState *cpu); +void nvmm_destroy_vcpu(CPUState *cpu); + +void nvmm_cpu_synchronize_state(CPUState *cpu); +void nvmm_cpu_synchronize_post_reset(CPUState *cpu); +void nvmm_cpu_synchronize_post_init(CPUState *cpu); +void nvmm_cpu_synchronize_pre_loadvm(CPUState *cpu); + #ifdef CONFIG_NVMM_IS_POSSIBLE extern bool nvmm_allowed; #define nvmm_enabled() (nvmm_allowed) diff --git a/target/i386/nvmm/meson.build b/target/i386/nvmm/meson.build index 885a708665..b24fa0ff4d 100644 --- a/target/i386/nvmm/meson.build +++ b/target/i386/nvmm/meson.build @@ -1,8 +1,5 @@ -i386_system_ss.add(when: 'CONFIG_NVMM', if_true: +i386_system_ss.add(when: [nvmm, 'CONFIG_NVMM'], if_true: files( - 'nvmm-all.c', - 'nvmm-accel-ops.c', + 'nvmm.c', ) ) - -i386_system_ss.add(when: 'CONFIG_NVMM', if_true: nvmm) diff --git a/target/i386/nvmm/nvmm-accel-ops.h b/target/i386/nvmm/nvmm-accel-ops.h deleted file mode 100644 index 931bb5ca24..0000000000 --- a/target/i386/nvmm/nvmm-accel-ops.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2018-2019 Maxime Villard, All rights reserved. - * - * NetBSD Virtual Machine Monitor (NVMM) accelerator for QEMU. - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef TARGET_I386_NVMM_ACCEL_OPS_H -#define TARGET_I386_NVMM_ACCEL_OPS_H - -#include "system/cpus.h" - -int nvmm_init_vcpu(CPUState *cpu); -int nvmm_vcpu_exec(CPUState *cpu); -void nvmm_destroy_vcpu(CPUState *cpu); - -void nvmm_cpu_synchronize_state(CPUState *cpu); -void nvmm_cpu_synchronize_post_reset(CPUState *cpu); -void nvmm_cpu_synchronize_post_init(CPUState *cpu); -void nvmm_cpu_synchronize_pre_loadvm(CPUState *cpu); - -#endif /* TARGET_I386_NVMM_ACCEL_OPS_H */ diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm.c similarity index 99% rename from target/i386/nvmm/nvmm-all.c rename to target/i386/nvmm/nvmm.c index f808828d49..824fa94d60 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm.c @@ -26,8 +26,6 @@ #include "migration/blocker.h" #include "strings.h" -#include "nvmm-accel-ops.h" - #include struct AccelCPUState { -- 2.54.0 (Apple Git-157)