Commit 1079c3d4 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: selftests: Rename vcpu.state => vcpu.run

Rename the "state" field of 'struct vcpu' to "run".  KVM calls it "run",
the struct name is "kvm_run", etc...
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 70ca149b
...@@ -48,7 +48,7 @@ struct vcpu { ...@@ -48,7 +48,7 @@ struct vcpu {
uint32_t id; uint32_t id;
int fd; int fd;
struct kvm_vm *vm; struct kvm_vm *vm;
struct kvm_run *state; struct kvm_run *run;
struct kvm_dirty_gfn *dirty_gfns; struct kvm_dirty_gfn *dirty_gfns;
uint32_t fetch_index; uint32_t fetch_index;
uint32_t dirty_gfns_count; uint32_t dirty_gfns_count;
......
...@@ -514,7 +514,7 @@ static void vm_vcpu_rm(struct kvm_vm *vm, struct vcpu *vcpu) ...@@ -514,7 +514,7 @@ static void vm_vcpu_rm(struct kvm_vm *vm, struct vcpu *vcpu)
vcpu->dirty_gfns = NULL; vcpu->dirty_gfns = NULL;
} }
ret = munmap(vcpu->state, vcpu_mmap_sz()); ret = munmap(vcpu->run, vcpu_mmap_sz());
TEST_ASSERT(!ret, __KVM_SYSCALL_ERROR("munmap()", ret)); TEST_ASSERT(!ret, __KVM_SYSCALL_ERROR("munmap()", ret));
ret = close(vcpu->fd); ret = close(vcpu->fd);
...@@ -1081,13 +1081,7 @@ void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid) ...@@ -1081,13 +1081,7 @@ void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid)
struct vcpu *vcpu; struct vcpu *vcpu;
/* Confirm a vcpu with the specified id doesn't already exist. */ /* Confirm a vcpu with the specified id doesn't already exist. */
vcpu = vcpu_find(vm, vcpuid); TEST_ASSERT(!vcpu_find(vm, vcpuid), "vCPU%d already exists\n", vcpuid);
if (vcpu != NULL)
TEST_FAIL("vcpu with the specified id "
"already exists,\n"
" requested vcpuid: %u\n"
" existing vcpuid: %u state: %p",
vcpuid, vcpu->id, vcpu->state);
/* Allocate and initialize new vcpu structure. */ /* Allocate and initialize new vcpu structure. */
vcpu = calloc(1, sizeof(*vcpu)); vcpu = calloc(1, sizeof(*vcpu));
...@@ -1098,12 +1092,12 @@ void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid) ...@@ -1098,12 +1092,12 @@ void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid)
vcpu->fd = __vm_ioctl(vm, KVM_CREATE_VCPU, (void *)(unsigned long)vcpuid); vcpu->fd = __vm_ioctl(vm, KVM_CREATE_VCPU, (void *)(unsigned long)vcpuid);
TEST_ASSERT(vcpu->fd >= 0, KVM_IOCTL_ERROR(KVM_CREATE_VCPU, vcpu->fd)); TEST_ASSERT(vcpu->fd >= 0, KVM_IOCTL_ERROR(KVM_CREATE_VCPU, vcpu->fd));
TEST_ASSERT(vcpu_mmap_sz() >= sizeof(*vcpu->state), "vcpu mmap size " TEST_ASSERT(vcpu_mmap_sz() >= sizeof(*vcpu->run), "vcpu mmap size "
"smaller than expected, vcpu_mmap_sz: %i expected_min: %zi", "smaller than expected, vcpu_mmap_sz: %i expected_min: %zi",
vcpu_mmap_sz(), sizeof(*vcpu->state)); vcpu_mmap_sz(), sizeof(*vcpu->run));
vcpu->state = (struct kvm_run *) mmap(NULL, vcpu_mmap_sz(), vcpu->run = (struct kvm_run *) mmap(NULL, vcpu_mmap_sz(),
PROT_READ | PROT_WRITE, MAP_SHARED, vcpu->fd, 0); PROT_READ | PROT_WRITE, MAP_SHARED, vcpu->fd, 0);
TEST_ASSERT(vcpu->state != MAP_FAILED, TEST_ASSERT(vcpu->run != MAP_FAILED,
__KVM_SYSCALL_ERROR("mmap()", (int)(unsigned long)MAP_FAILED)); __KVM_SYSCALL_ERROR("mmap()", (int)(unsigned long)MAP_FAILED));
/* Add to linked-list of VCPUs. */ /* Add to linked-list of VCPUs. */
...@@ -1460,7 +1454,7 @@ struct kvm_run *vcpu_state(struct kvm_vm *vm, uint32_t vcpuid) ...@@ -1460,7 +1454,7 @@ struct kvm_run *vcpu_state(struct kvm_vm *vm, uint32_t vcpuid)
{ {
struct vcpu *vcpu = vcpu_get(vm, vcpuid); struct vcpu *vcpu = vcpu_get(vm, vcpuid);
return vcpu->state; return vcpu->run;
} }
/* /*
...@@ -1502,9 +1496,9 @@ void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid) ...@@ -1502,9 +1496,9 @@ void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid)
struct vcpu *vcpu = vcpu_get(vm, vcpuid); struct vcpu *vcpu = vcpu_get(vm, vcpuid);
int ret; int ret;
vcpu->state->immediate_exit = 1; vcpu->run->immediate_exit = 1;
ret = __vcpu_run(vm, vcpuid); ret = __vcpu_run(vm, vcpuid);
vcpu->state->immediate_exit = 0; vcpu->run->immediate_exit = 0;
TEST_ASSERT(ret == -1 && errno == EINTR, TEST_ASSERT(ret == -1 && errno == EINTR,
"KVM_RUN IOCTL didn't exit immediately, rc: %i, errno: %i", "KVM_RUN IOCTL didn't exit immediately, rc: %i, errno: %i",
......
...@@ -210,7 +210,7 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent) ...@@ -210,7 +210,7 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
struct vcpu *vcpu = vcpu_get(vm, vcpuid); struct vcpu *vcpu = vcpu_get(vm, vcpuid);
fprintf(stream, "%*spstate: psw: 0x%.16llx:0x%.16llx\n", fprintf(stream, "%*spstate: psw: 0x%.16llx:0x%.16llx\n",
indent, "", vcpu->state->psw_mask, vcpu->state->psw_addr); indent, "", vcpu->run->psw_mask, vcpu->run->psw_addr);
} }
void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid) void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment