[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29150d3f-36fb-516d-55d0-a9aebe23cdcf@redhat.com>
Date: Wed, 10 Aug 2022 14:52:11 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Like Xu <like.xu.linux@...il.com>
Subject: Re: [RFC PATCH 2/3] KVM: x86: Generate set of VMX feature MSRs using
first/last definitions
On 8/5/22 19:29, Sean Christopherson wrote:
>
> +static void kvm_proble_feature_msr(u32 msr_index)
> +{
> + struct kvm_msr_entry msr = {
> + .index = msr_index,
> + };
> +
> + if (kvm_get_msr_feature(&msr))
> + return;
> +
> + msr_based_features[num_msr_based_features++] = msr_index;
> +}
> +
> static void kvm_init_msr_list(void)
> {
> u32 dummy[2];
> @@ -6954,15 +6949,11 @@ static void kvm_init_msr_list(void)
> emulated_msrs[num_emulated_msrs++] = emulated_msrs_all[i];
> }
>
> - for (i = 0; i < ARRAY_SIZE(msr_based_features_all); i++) {
> - struct kvm_msr_entry msr;
> + for (i = KVM_FIRST_EMULATED_VMX_MSR; i <= KVM_LAST_EMULATED_VMX_MSR; i++)
> + kvm_proble_feature_msr(i);
>
> - msr.index = msr_based_features_all[i];
> - if (kvm_get_msr_feature(&msr))
> - continue;
> -
> - msr_based_features[num_msr_based_features++] = msr_based_features_all[i];
> - }
> + for (i = 0; i < ARRAY_SIZE(msr_based_features_all_except_vmx); i++)
> + kvm_proble_feature_msr(msr_based_features_all_except_vmx[i]);
I'd rather move all the code to a new function
kvm_init_feature_msr_list() instead, and call it from
kvm_arch_hardware_setup().
Thanks,
paolo
Powered by blists - more mailing lists