Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178283865
D61043.1796424044.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D61043.1796424044.diff
View Options
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -313,7 +313,7 @@
}
static void
-vm_init(struct vm *vm, bool create)
+vm_init(struct vm *vm)
{
vm->cookie = vmmops_init(vm, vmspace_pmap(vm_vmspace(vm)));
vm->iommu = NULL;
@@ -322,8 +322,6 @@
vm->vatpic = vatpic_init(vm);
vm->vatpit = vatpit_init(vm);
vm->vpmtmr = vpmtmr_init(vm);
- if (create)
- vm->vrtc = vrtc_init(vm);
CPU_ZERO(&vm->active_cpus);
CPU_ZERO(&vm->debug_cpus);
@@ -331,13 +329,6 @@
vm->suspend = 0;
CPU_ZERO(&vm->suspended_cpus);
-
- if (!create) {
- for (int i = 0; i < vm->maxcpus; i++) {
- if (vm->vcpu[i] != NULL)
- vcpu_init(vm->vcpu[i]);
- }
- }
}
struct vcpu *
@@ -395,7 +386,8 @@
vm->threads = 1; /* XXX backwards compatibility */
vm->maxcpus = vm_maxcpu;
- vm_init(vm, true);
+ vm->vrtc = vrtc_init(vm);
+ vm_init(vm);
*retvm = vm;
return (0);
@@ -453,7 +445,11 @@
vm_reset(struct vm *vm)
{
vm_cleanup(vm, false);
- vm_init(vm, false);
+ vm_init(vm);
+ for (int i = 0; i < vm->maxcpus; i++) {
+ if (vm->vcpu[i] != NULL)
+ vcpu_init(vm->vcpu[i]);
+ }
}
int
diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c
--- a/sys/arm64/vmm/vmm.c
+++ b/sys/arm64/vmm/vmm.c
@@ -261,10 +261,8 @@
}
static void
-vm_init(struct vm *vm, bool create)
+vm_init(struct vm *vm)
{
- int i;
-
vm->cookie = vmmops_init(vm, vmspace_pmap(vm_vmspace(vm)));
MPASS(vm->cookie != NULL);
@@ -276,13 +274,6 @@
memset(vm->mmio_region, 0, sizeof(vm->mmio_region));
memset(vm->special_reg, 0, sizeof(vm->special_reg));
-
- if (!create) {
- for (i = 0; i < vm->maxcpus; i++) {
- if (vm->vcpu[i] != NULL)
- vcpu_init(vm->vcpu[i]);
- }
- }
}
struct vcpu *
@@ -345,7 +336,7 @@
vm->vcpu = malloc(sizeof(*vm->vcpu) * vm->maxcpus, M_VMM,
M_WAITOK | M_ZERO);
- vm_init(vm, true);
+ vm_init(vm);
*retvm = vm;
return (0);
@@ -399,7 +390,11 @@
vm_reset(struct vm *vm)
{
vm_cleanup(vm, false);
- vm_init(vm, false);
+ vm_init(vm);
+ for (int i = 0; i < vm->maxcpus; i++) {
+ if (vm->vcpu[i] != NULL)
+ vcpu_init(vm->vcpu[i]);
+ }
}
int
diff --git a/sys/riscv/vmm/vmm.c b/sys/riscv/vmm/vmm.c
--- a/sys/riscv/vmm/vmm.c
+++ b/sys/riscv/vmm/vmm.c
@@ -147,10 +147,8 @@
}
static void
-vm_init(struct vm *vm, bool create)
+vm_init(struct vm *vm)
{
- int i;
-
vm->cookie = vmmops_init(vm, vmspace_pmap(vm_vmspace(vm)));
MPASS(vm->cookie != NULL);
@@ -161,13 +159,6 @@
CPU_ZERO(&vm->suspended_cpus);
memset(vm->mmio_region, 0, sizeof(vm->mmio_region));
-
- if (!create) {
- for (i = 0; i < vm->maxcpus; i++) {
- if (vm->vcpu[i] != NULL)
- vcpu_init(vm->vcpu[i]);
- }
- }
}
struct vcpu *
@@ -224,7 +215,7 @@
vm->vcpu = malloc(sizeof(*vm->vcpu) * vm->maxcpus, M_VMM,
M_WAITOK | M_ZERO);
- vm_init(vm, true);
+ vm_init(vm);
*retvm = vm;
return (0);
@@ -269,7 +260,11 @@
vm_reset(struct vm *vm)
{
vm_cleanup(vm, false);
- vm_init(vm, false);
+ vm_init(vm);
+ for (int i = 0; i < vm->maxcpus; i++) {
+ if (vm->vcpu[i] != NULL)
+ vcpu_init(vm->vcpu[i]);
+ }
}
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 4, 10:40 PM (16 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42214161
Default Alt Text
D61043.1796424044.diff (3 KB)
Attached To
Mode
D61043: vmm: Refactor VM reinitialization code a bit
Attached
Detach File
Event Timeline