From 6192773a860707a4028c6558770a853d9bb9885c Mon Sep 17 00:00:00 2001 From: Xiangyang Wu Date: Mon, 25 Jun 2018 14:43:35 +0800 Subject: [PATCH] DM: Update the vcpu id type as uint16_t for vm_create_vcpu Update the vcpu id type as uint16_t for vm_create_vcpu, this keeps alignment with the updates for the structure acrn_create_vcpu used by hcall_create_vcpu in the hypervisor. In the device model, the caller is responsible for vcpu id type conversion; vcpu id type is uint16_t for external interface in the current implement. Signed-off-by: Xiangyang Wu Acked-by: Eddie Dong --- devicemodel/core/main.c | 2 +- devicemodel/core/vmmapi.c | 2 +- devicemodel/include/vmmapi.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 6ad067d41..4dce40669 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -259,7 +259,7 @@ add_cpu(struct vmctx *ctx, int guest_ncpus) int error; for (i = 0; i < guest_ncpus; i++) { - error = vm_create_vcpu(ctx, i); + error = vm_create_vcpu(ctx, (uint16_t)i); if (error != 0) { fprintf(stderr, "ERROR: could not create VCPU %d\n", i); return error; diff --git a/devicemodel/core/vmmapi.c b/devicemodel/core/vmmapi.c index 605b80002..5cc227a89 100644 --- a/devicemodel/core/vmmapi.c +++ b/devicemodel/core/vmmapi.c @@ -707,7 +707,7 @@ vm_reset_ptdev_intx_info(struct vmctx *ctx, int virt_pin, bool pic_pin) } int -vm_create_vcpu(struct vmctx *ctx, int vcpu_id) +vm_create_vcpu(struct vmctx *ctx, uint16_t vcpu_id) { struct acrn_create_vcpu cv; int error; diff --git a/devicemodel/include/vmmapi.h b/devicemodel/include/vmmapi.h index fcf8ab3b5..1fd32c8c3 100644 --- a/devicemodel/include/vmmapi.h +++ b/devicemodel/include/vmmapi.h @@ -156,7 +156,7 @@ int vm_set_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf, uint16_t phys_bdf, int virt_pin, int phys_pin, bool pic_pin); int vm_reset_ptdev_intx_info(struct vmctx *ctx, int virt_pin, bool pic_pin); -int vm_create_vcpu(struct vmctx *ctx, int vcpu_id); +int vm_create_vcpu(struct vmctx *ctx, uint16_t vcpu_id); int vm_get_cpu_state(struct vmctx *ctx, void *state_buf);