From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, thuth@redhat.com,
peterx@redhat.com
Subject: [PATCH v2 2/4] kvm: selftests: introduce vm_vcpu_add
Date: Mon, 27 May 2019 16:31:39 +0200 [thread overview]
Message-ID: <20190527143141.13883-3-drjones@redhat.com> (raw)
In-Reply-To: <20190527143141.13883-1-drjones@redhat.com>
vm_vcpu_add() just adds a vcpu to the vm, but doesn't do any
additional vcpu setup.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
.../testing/selftests/kvm/include/kvm_util.h | 1 +
tools/testing/selftests/kvm/lib/kvm_util.c | 34 ++++++++++++++-----
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
index a82f877ea163..d16fdaad0511 100644
--- a/tools/testing/selftests/kvm/include/kvm_util.h
+++ b/tools/testing/selftests/kvm/include/kvm_util.h
@@ -88,6 +88,7 @@ int _vcpu_ioctl(struct kvm_vm *vm, uint32_t vcpuid, unsigned long ioctl,
void *arg);
void vm_ioctl(struct kvm_vm *vm, unsigned long ioctl, void *arg);
void vm_mem_region_set_flags(struct kvm_vm *vm, uint32_t slot, uint32_t flags);
+void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid);
void vm_vcpu_add_with_memslots(struct kvm_vm *vm, uint32_t vcpuid,
int pgd_memslot, int gdt_memslot);
vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min,
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 98d664825aa7..0ac1ee93a519 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -754,24 +754,20 @@ static int vcpu_mmap_sz(void)
}
/*
- * VM VCPU Add with provided memslots
+ * VM VCPU Add
*
* Input Args:
* vm - Virtual Machine
* vcpuid - VCPU ID
- * pgd_memslot - Memory region slot for new virtual translation tables
- * gdt_memslot - Memory region slot for data pages
*
* Output Args: None
*
* Return: None
*
- * Adds a virtual CPU to the VM specified by vm with the ID given by vcpuid
- * and then sets it up with vcpu_setup() using the provided memslots for the
- * MMU setup.
+ * Adds a virtual CPU to the VM specified by vm with the ID given by vcpuid.
+ * No additional VCPU setup is done.
*/
-void vm_vcpu_add_with_memslots(struct kvm_vm *vm, uint32_t vcpuid,
- int pgd_memslot, int gdt_memslot)
+void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid)
{
struct vcpu *vcpu;
@@ -805,7 +801,29 @@ void vm_vcpu_add_with_memslots(struct kvm_vm *vm, uint32_t vcpuid,
vm->vcpu_head->prev = vcpu;
vcpu->next = vm->vcpu_head;
vm->vcpu_head = vcpu;
+}
+/*
+ * VM VCPU Add with provided memslots
+ *
+ * Input Args:
+ * vm - Virtual Machine
+ * vcpuid - VCPU ID
+ * pgd_memslot - Memory region slot for new virtual translation tables
+ * gdt_memslot - Memory region slot for data pages
+ *
+ * Output Args: None
+ *
+ * Return: None
+ *
+ * Adds a virtual CPU to the VM specified by vm with the ID given by vcpuid
+ * and then sets it up with vcpu_setup() using the provided memslots for the
+ * MMU setup.
+ */
+void vm_vcpu_add_with_memslots(struct kvm_vm *vm, uint32_t vcpuid,
+ int pgd_memslot, int gdt_memslot)
+{
+ vm_vcpu_add(vm, vcpuid);
vcpu_setup(vm, vcpuid, pgd_memslot, gdt_memslot);
}
--
2.20.1
next prev parent reply other threads:[~2019-05-27 14:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 14:31 [PATCH v2 0/4] kvm: selftests: aarch64: use struct kvm_vcpu_init Andrew Jones
2019-05-27 14:31 ` [PATCH v2 1/4] kvm: selftests: rename vm_vcpu_add to vm_vcpu_add_with_memslots Andrew Jones
2019-05-28 2:14 ` Peter Xu
2019-05-27 14:31 ` Andrew Jones [this message]
2019-05-28 2:14 ` [PATCH v2 2/4] kvm: selftests: introduce vm_vcpu_add Peter Xu
2019-05-27 14:31 ` [PATCH v2 3/4] kvm: selftests: introduce aarch64_vcpu_setup Andrew Jones
2019-05-27 14:31 ` [PATCH v2 4/4] kvm: selftests: introduce aarch64_vcpu_add_default Andrew Jones
2019-06-04 17:16 ` [PATCH v2 0/4] kvm: selftests: aarch64: use struct kvm_vcpu_init Paolo Bonzini
2019-06-05 7:26 ` Peter Xu
2019-06-05 12:15 ` Paolo Bonzini
2019-06-04 17:17 ` Paolo Bonzini
2019-06-27 12:36 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190527143141.13883-3-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox