As the MSR supported features should be the same for all VMs, it is safe to directly use the global kvm_state. Remove the unnecessary KVMState* argument. Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> --- target/i386/kvm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 626cb04d88..988ed3c238 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1887,7 +1887,7 @@ void kvm_arch_do_init_vcpu(X86CPU *cpu) } } -static int kvm_get_supported_feature_msrs(KVMState *s) +static int kvm_get_supported_feature_msrs(void) { int ret = 0; @@ -1902,7 +1902,7 @@ static int kvm_get_supported_feature_msrs(KVMState *s) struct kvm_msr_list msr_list; msr_list.nmsrs = 0; - ret = kvm_ioctl(s, KVM_GET_MSR_FEATURE_INDEX_LIST, &msr_list); + ret = kvm_ioctl(kvm_state, KVM_GET_MSR_FEATURE_INDEX_LIST, &msr_list); if (ret < 0 && ret != -E2BIG) { error_report("Fetch KVM feature MSR list failed: %s", strerror(-ret)); @@ -1915,7 +1915,8 @@ static int kvm_get_supported_feature_msrs(KVMState *s) msr_list.nmsrs * sizeof(msr_list.indices[0])); kvm_feature_msrs->nmsrs = msr_list.nmsrs; - ret = kvm_ioctl(s, KVM_GET_MSR_FEATURE_INDEX_LIST, kvm_feature_msrs); + ret = kvm_ioctl(kvm_state, KVM_GET_MSR_FEATURE_INDEX_LIST, + kvm_feature_msrs); if (ret < 0) { error_report("Fetch KVM feature MSR list failed: %s", @@ -1928,7 +1929,7 @@ static int kvm_get_supported_feature_msrs(KVMState *s) return 0; } -static int kvm_get_supported_msrs(KVMState *s) +static int kvm_get_supported_msrs(void) { int ret = 0; struct kvm_msr_list msr_list, *kvm_msr_list; @@ -1938,7 +1939,7 @@ static int kvm_get_supported_msrs(KVMState *s) * save/restore. */ msr_list.nmsrs = 0; - ret = kvm_ioctl(s, KVM_GET_MSR_INDEX_LIST, &msr_list); + ret = kvm_ioctl(kvm_state, KVM_GET_MSR_INDEX_LIST, &msr_list); if (ret < 0 && ret != -E2BIG) { return ret; } @@ -1951,7 +1952,7 @@ static int kvm_get_supported_msrs(KVMState *s) sizeof(msr_list.indices[0]))); kvm_msr_list->nmsrs = msr_list.nmsrs; - ret = kvm_ioctl(s, KVM_GET_MSR_INDEX_LIST, kvm_msr_list); + ret = kvm_ioctl(kvm_state, KVM_GET_MSR_INDEX_LIST, kvm_msr_list); if (ret >= 0) { int i; @@ -2107,12 +2108,12 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } - ret = kvm_get_supported_msrs(s); + ret = kvm_get_supported_msrs(); if (ret < 0) { return ret; } - kvm_get_supported_feature_msrs(s); + kvm_get_supported_feature_msrs(); uname(&utsname); lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0; -- 2.21.3