KVM: selftests: Convert get-reg-list away from its "VCPU_ID"
Track the vCPU's 'struct kvm_vcpu' object in get-reg-list instead of hardcoding '0' everywhere. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Родитель
e813129a3d
Коммит
3cc3eeb165
|
@ -411,6 +411,7 @@ static void run_test(struct vcpu_config *c)
|
||||||
struct kvm_vcpu_init init = { .target = -1, };
|
struct kvm_vcpu_init init = { .target = -1, };
|
||||||
int new_regs = 0, missing_regs = 0, i, n;
|
int new_regs = 0, missing_regs = 0, i, n;
|
||||||
int failed_get = 0, failed_set = 0, failed_reject = 0;
|
int failed_get = 0, failed_set = 0, failed_reject = 0;
|
||||||
|
struct kvm_vcpu *vcpu;
|
||||||
struct kvm_vm *vm;
|
struct kvm_vm *vm;
|
||||||
struct reg_sublist *s;
|
struct reg_sublist *s;
|
||||||
|
|
||||||
|
@ -418,11 +419,11 @@ static void run_test(struct vcpu_config *c)
|
||||||
|
|
||||||
vm = vm_create_barebones();
|
vm = vm_create_barebones();
|
||||||
prepare_vcpu_init(c, &init);
|
prepare_vcpu_init(c, &init);
|
||||||
__vm_vcpu_add(vm, 0);
|
vcpu = __vm_vcpu_add(vm, 0);
|
||||||
aarch64_vcpu_setup(vm, 0, &init);
|
aarch64_vcpu_setup(vm, vcpu->id, &init);
|
||||||
finalize_vcpu(vm, 0, c);
|
finalize_vcpu(vm, vcpu->id, c);
|
||||||
|
|
||||||
reg_list = vcpu_get_reg_list(vm, 0);
|
reg_list = vcpu_get_reg_list(vm, vcpu->id);
|
||||||
|
|
||||||
if (fixup_core_regs)
|
if (fixup_core_regs)
|
||||||
core_reg_fixup();
|
core_reg_fixup();
|
||||||
|
@ -458,7 +459,7 @@ static void run_test(struct vcpu_config *c)
|
||||||
bool reject_reg = false;
|
bool reject_reg = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = __vcpu_get_reg(vm, 0, reg_list->reg[i], &addr);
|
ret = __vcpu_get_reg(vm, vcpu->id, reg_list->reg[i], &addr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("%s: Failed to get ", config_name(c));
|
printf("%s: Failed to get ", config_name(c));
|
||||||
print_reg(c, reg.id);
|
print_reg(c, reg.id);
|
||||||
|
@ -470,7 +471,7 @@ static void run_test(struct vcpu_config *c)
|
||||||
for_each_sublist(c, s) {
|
for_each_sublist(c, s) {
|
||||||
if (s->rejects_set && find_reg(s->rejects_set, s->rejects_set_n, reg.id)) {
|
if (s->rejects_set && find_reg(s->rejects_set, s->rejects_set_n, reg.id)) {
|
||||||
reject_reg = true;
|
reject_reg = true;
|
||||||
ret = __vcpu_ioctl(vm, 0, KVM_SET_ONE_REG, ®);
|
ret = __vcpu_ioctl(vm, vcpu->id, KVM_SET_ONE_REG, ®);
|
||||||
if (ret != -1 || errno != EPERM) {
|
if (ret != -1 || errno != EPERM) {
|
||||||
printf("%s: Failed to reject (ret=%d, errno=%d) ", config_name(c), ret, errno);
|
printf("%s: Failed to reject (ret=%d, errno=%d) ", config_name(c), ret, errno);
|
||||||
print_reg(c, reg.id);
|
print_reg(c, reg.id);
|
||||||
|
@ -482,7 +483,7 @@ static void run_test(struct vcpu_config *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reject_reg) {
|
if (!reject_reg) {
|
||||||
ret = __vcpu_ioctl(vm, 0, KVM_SET_ONE_REG, ®);
|
ret = __vcpu_ioctl(vm, vcpu->id, KVM_SET_ONE_REG, ®);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("%s: Failed to set ", config_name(c));
|
printf("%s: Failed to set ", config_name(c));
|
||||||
print_reg(c, reg.id);
|
print_reg(c, reg.id);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче