From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Like Xu <like.xu.linux@gmail.com>
Subject: Re: [RFC PATCH 2/3] KVM: x86: Generate set of VMX feature MSRs using first/last definitions
Date: Wed, 10 Aug 2022 14:52:11 +0200 [thread overview]
Message-ID: <29150d3f-36fb-516d-55d0-a9aebe23cdcf@redhat.com> (raw)
In-Reply-To: <20220805172945.35412-3-seanjc@google.com>
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
next prev parent reply other threads:[~2022-08-10 12:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-05 17:29 [RFC PATCH 0/3] KVM: x86: Disallow writes to feature MSRs post-KVM_RUN Sean Christopherson
2022-08-05 17:29 ` [RFC PATCH 1/3] KVM: x86: Add macros to track first...last VMX feature MSRs Sean Christopherson
2022-08-05 17:29 ` [RFC PATCH 2/3] KVM: x86: Generate set of VMX feature MSRs using first/last definitions Sean Christopherson
2022-08-10 12:52 ` Paolo Bonzini [this message]
2022-08-10 14:40 ` Sean Christopherson
2022-08-10 19:16 ` Paolo Bonzini
2022-08-05 17:29 ` [RFC PATCH 3/3] KVM: x86: Disallow writes to immutable feature MSRs after KVM_RUN Sean Christopherson
2022-08-10 6:29 ` Xiaoyao Li
2022-08-10 14:45 ` Sean Christopherson
2022-08-10 12:52 ` [RFC PATCH 0/3] KVM: x86: Disallow writes to feature MSRs post-KVM_RUN Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29150d3f-36fb-516d-55d0-a9aebe23cdcf@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.