From: dv Date: Tue, 9 Jul 2024 09:31:37 +0000 (+0000) Subject: vmd/vmm: move vm_run_params into mi header. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ba66f5646b2078267ada7f93fdb09284b0ca3a3d;p=openbsd vmd/vmm: move vm_run_params into mi header. To prepare for mi/md splitting vmd, need to fixup the dev/vmm/vmm.h mi header. Move the vm_run_params struct and clean up the includes in vmd. "sure", mlarkin@ --- diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 8426a5d94d1..50c1f15b0a3 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.101 2024/04/29 14:47:05 dv Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.102 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -23,14 +23,6 @@ #define VMM_HV_SIGNATURE "OpenBSDVMM58" -#define VMM_MAX_MEM_RANGES 16 -#define VMM_MAX_DISKS_PER_VM 4 -#define VMM_MAX_NAME_LEN 64 -#define VMM_MAX_VCPUS 512 -#define VMM_MAX_VCPUS_PER_VM 64 -#define VMM_MAX_VM_MEM_SIZE 128L * 1024 * 1024 * 1024 -#define VMM_MAX_NICS_PER_VM 4 - #define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL #define VMM_PCI_MMIO_BAR_END 0xFFDFFFFFULL /* 2 MiB below 4 GiB */ @@ -474,21 +466,6 @@ struct vm_exit { int cpl; }; -struct vm_run_params { - /* Input parameters to VMM_IOC_RUN */ - uint32_t vrp_vm_id; - uint32_t vrp_vcpu_id; - struct vcpu_inject_event vrp_inject; - uint8_t vrp_intr_pending; /* Additional intrs pending? */ - - /* Input/output parameter to VMM_IOC_RUN */ - struct vm_exit *vrp_exit; /* updated exit data */ - - /* Output parameter from VMM_IOC_RUN */ - uint16_t vrp_exit_reason; /* exit reason */ - uint8_t vrp_irqready; /* ready for IRQ on entry */ -}; - struct vm_intr_params { /* Input parameters to VMM_IOC_INTR */ uint32_t vip_vm_id; @@ -961,7 +938,6 @@ int vcpu_init(struct vcpu *); void vcpu_deinit(struct vcpu *); int vm_rwvmparams(struct vm_rwvmparams_params *, int); int vm_rwregs(struct vm_rwregs_params *, int); -int vm_run(struct vm_run_params *); int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *); #endif /* _KERNEL */ diff --git a/sys/dev/vmm/vmm.h b/sys/dev/vmm/vmm.h index 47f5e12cf4f..3ec2d20fe93 100644 --- a/sys/dev/vmm/vmm.h +++ b/sys/dev/vmm/vmm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.h,v 1.4 2024/01/11 17:13:48 jan Exp $ */ +/* $OpenBSD: vmm.h,v 1.5 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2014-2023 Mike Larkin * @@ -20,9 +20,19 @@ #include +#include + #ifndef DEV_VMM_H #define DEV_VMM_H +#define VMM_MAX_MEM_RANGES 16 +#define VMM_MAX_DISKS_PER_VM 4 +#define VMM_MAX_NAME_LEN 64 +#define VMM_MAX_VCPUS 512 +#define VMM_MAX_VCPUS_PER_VM 64 +#define VMM_MAX_VM_MEM_SIZE 128L * 1024 * 1024 * 1024 +#define VMM_MAX_NICS_PER_VM 4 + struct vm_mem_range { paddr_t vmr_gpa; vaddr_t vmr_va; @@ -83,6 +93,21 @@ struct vm_sharemem_params { struct vm_mem_range vsp_memranges[VMM_MAX_MEM_RANGES]; }; +struct vm_run_params { + /* Input parameters to VMM_IOC_RUN */ + uint32_t vrp_vm_id; + uint32_t vrp_vcpu_id; + struct vcpu_inject_event vrp_inject; + uint8_t vrp_intr_pending; /* Additional intrs pending? */ + + /* Input/output parameter to VMM_IOC_RUN */ + struct vm_exit *vrp_exit; /* updated exit data */ + + /* Output parameter from VMM_IOC_RUN */ + uint16_t vrp_exit_reason; /* exit reason */ + uint8_t vrp_irqready; /* ready for IRQ on entry */ +}; + /* IOCTL definitions */ #define VMM_IOC_CREATE _IOWR('V', 1, struct vm_create_params) /* Create VM */ #define VMM_IOC_RUN _IOWR('V', 2, struct vm_run_params) /* Run VCPU */ @@ -202,6 +227,7 @@ int vm_terminate(struct vm_terminate_params *); int vm_resetcpu(struct vm_resetcpu_params *); int vcpu_must_stop(struct vcpu *); int vm_share_mem(struct vm_sharemem_params *, struct proc *); +int vm_run(struct vm_run_params *); #ifdef VMM_DEBUG void dump_vcpu(struct vcpu *); diff --git a/usr.sbin/vmd/fw_cfg.c b/usr.sbin/vmd/fw_cfg.c index 3e9459baede..be84dc18361 100644 --- a/usr.sbin/vmd/fw_cfg.c +++ b/usr.sbin/vmd/fw_cfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fw_cfg.c,v 1.8 2024/02/04 14:53:12 dv Exp $ */ +/* $OpenBSD: fw_cfg.c,v 1.9 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2018 Claudio Jeker * @@ -17,8 +17,8 @@ #include #include #include /* bios_memmap_t */ -#include #include +#include #include #include diff --git a/usr.sbin/vmd/i8253.c b/usr.sbin/vmd/i8253.c index 100dd0891e9..ac9855e38be 100644 --- a/usr.sbin/vmd/i8253.c +++ b/usr.sbin/vmd/i8253.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i8253.c,v 1.39 2024/02/09 14:35:47 dv Exp $ */ +/* $OpenBSD: i8253.c,v 1.40 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2016 Mike Larkin * @@ -19,8 +19,7 @@ #include #include - -#include +#include #include #include diff --git a/usr.sbin/vmd/i8259.c b/usr.sbin/vmd/i8259.c index 189598965db..2de48481526 100644 --- a/usr.sbin/vmd/i8259.c +++ b/usr.sbin/vmd/i8259.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i8259.c,v 1.22 2023/09/01 19:42:26 dv Exp $ */ +/* $OpenBSD: i8259.c,v 1.23 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2016 Mike Larkin * @@ -20,8 +20,7 @@ #include #include - -#include +#include #include #include diff --git a/usr.sbin/vmd/i8259.h b/usr.sbin/vmd/i8259.h index 47fae8bbc51..0390d8250f1 100644 --- a/usr.sbin/vmd/i8259.h +++ b/usr.sbin/vmd/i8259.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i8259.h,v 1.6 2024/05/18 06:45:00 jsg Exp $ */ +/* $OpenBSD: i8259.h,v 1.7 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2016 Mike Larkin * @@ -17,8 +17,6 @@ #include -#include - #define MASTER 0 #define SLAVE 1 diff --git a/usr.sbin/vmd/loadfile_elf.c b/usr.sbin/vmd/loadfile_elf.c index 864344c88e0..166aa04c5e1 100644 --- a/usr.sbin/vmd/loadfile_elf.c +++ b/usr.sbin/vmd/loadfile_elf.c @@ -1,5 +1,5 @@ /* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */ -/* $OpenBSD: loadfile_elf.c,v 1.47 2023/04/25 12:46:13 dv Exp $ */ +/* $OpenBSD: loadfile_elf.c,v 1.48 2024/07/09 09:31:37 dv Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -96,7 +96,8 @@ #include #include -#include +#include + #include #include #include diff --git a/usr.sbin/vmd/mc146818.c b/usr.sbin/vmd/mc146818.c index 78139f6917c..660c625ebeb 100644 --- a/usr.sbin/vmd/mc146818.c +++ b/usr.sbin/vmd/mc146818.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mc146818.c,v 1.27 2023/10/25 12:44:28 dv Exp $ */ +/* $OpenBSD: mc146818.c,v 1.28 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2016 Mike Larkin * @@ -19,8 +19,7 @@ #include #include - -#include +#include #include #include diff --git a/usr.sbin/vmd/mmio.h b/usr.sbin/vmd/mmio.h index 8acf97a8487..b3f3fa40c25 100644 --- a/usr.sbin/vmd/mmio.h +++ b/usr.sbin/vmd/mmio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mmio.h,v 1.1 2022/11/10 11:46:39 dv Exp $ */ +/* $OpenBSD: mmio.h,v 1.2 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2022 Dave Voutila @@ -20,7 +20,6 @@ #define _MMIO_H_ #include -#include /* Code segment bits */ #define CS_L (1 << 13) diff --git a/usr.sbin/vmd/ns8250.c b/usr.sbin/vmd/ns8250.c index 425531cf6d0..bcb48ef95d8 100644 --- a/usr.sbin/vmd/ns8250.c +++ b/usr.sbin/vmd/ns8250.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ns8250.c,v 1.38 2023/10/25 12:44:28 dv Exp $ */ +/* $OpenBSD: ns8250.c,v 1.39 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2016 Mike Larkin * @@ -19,8 +19,7 @@ #include #include - -#include +#include #include #include diff --git a/usr.sbin/vmd/parse.y b/usr.sbin/vmd/parse.y index 2ee98897290..aacfd635100 100644 --- a/usr.sbin/vmd/parse.y +++ b/usr.sbin/vmd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.68 2023/07/13 18:31:59 dv Exp $ */ +/* $OpenBSD: parse.y,v 1.69 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include diff --git a/usr.sbin/vmd/pci.c b/usr.sbin/vmd/pci.c index 5309449b339..1722baa9ea1 100644 --- a/usr.sbin/vmd/pci.c +++ b/usr.sbin/vmd/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.31 2023/02/06 20:33:34 dv Exp $ */ +/* $OpenBSD: pci.c,v 1.32 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c index 536c7733a7a..80d035ef60b 100644 --- a/usr.sbin/vmd/virtio.c +++ b/usr.sbin/vmd/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.113 2024/02/20 21:40:37 dv Exp $ */ +/* $OpenBSD: virtio.c,v 1.114 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -20,13 +20,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c index 643c784f605..078e9b5172f 100644 --- a/usr.sbin/vmd/vm.c +++ b/usr.sbin/vmd/vm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm.c,v 1.102 2024/07/08 17:33:45 dv Exp $ */ +/* $OpenBSD: vm.c,v 1.103 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -31,11 +31,11 @@ #include #include #include +#include #include #include #include -#include #include diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index 4662f76bcab..3c053ae08a2 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.157 2024/05/18 06:45:00 jsg Exp $ */ +/* $OpenBSD: vmd.c,v 1.158 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2015 Reyk Floeter @@ -40,8 +40,8 @@ #include #include +#include #include -#include #include "proc.h" #include "atomicio.h" diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h index b6294548327..4f1b05e7058 100644 --- a/usr.sbin/vmd/vmd.h +++ b/usr.sbin/vmd/vmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.h,v 1.125 2024/02/20 21:40:37 dv Exp $ */ +/* $OpenBSD: vmd.h,v 1.126 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -21,8 +21,6 @@ #include #include -#include - #include #include diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c index dcd9a91fe4f..70c94c0dff8 100644 --- a/usr.sbin/vmd/vmm.c +++ b/usr.sbin/vmd/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.119 2024/02/05 21:58:09 dv Exp $ */ +/* $OpenBSD: vmm.c,v 1.120 2024/07/09 09:31:37 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -28,10 +28,10 @@ #include #include #include +#include #include #include -#include #include