From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] target-i386: introduce kvm_put_one_msr
Date: Thu, 22 Sep 2016 16:10:37 +0100 [thread overview]
Message-ID: <20160922151036.GG2085@work-vm> (raw)
In-Reply-To: <1474556571-21200-2-git-send-email-pbonzini@redhat.com>
* Paolo Bonzini (pbonzini@redhat.com) wrote:
> Avoid further code duplication in the next patch.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target-i386/kvm.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index f1ad805..38609fd 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -1532,6 +1532,16 @@ static void kvm_msr_entry_add(X86CPU *cpu, uint32_t index, uint64_t value)
> msrs->nmsrs++;
> }
>
> +static int kvm_put_one_msr(X86CPU *cpu, int index, uint64_t value)
> +{
> + int ret;
^^^ Unused.
> + kvm_msr_buf_reset(cpu);
> + kvm_msr_entry_add(cpu, index, value);
> +
> + return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, cpu->kvm_msr_buf);
Dave
> +}
> +
> static int kvm_put_tscdeadline_msr(X86CPU *cpu)
> {
> CPUX86State *env = &cpu->env;
> @@ -1541,10 +1551,7 @@ static int kvm_put_tscdeadline_msr(X86CPU *cpu)
> return 0;
> }
>
> - kvm_msr_buf_reset(cpu);
> - kvm_msr_entry_add(cpu, MSR_IA32_TSCDEADLINE, env->tsc_deadline);
> -
> - ret = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, cpu->kvm_msr_buf);
> + ret = kvm_put_one_msr(cpu, MSR_IA32_TSCDEADLINE, env->tsc_deadline);
> if (ret < 0) {
> return ret;
> }
> @@ -1567,11 +1574,8 @@ static int kvm_put_msr_feature_control(X86CPU *cpu)
> return 0;
> }
>
> - kvm_msr_buf_reset(cpu);
> - kvm_msr_entry_add(cpu, MSR_IA32_FEATURE_CONTROL,
> - cpu->env.msr_ia32_feature_control);
> -
> - ret = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, cpu->kvm_msr_buf);
> + ret = kvm_put_one_msr(cpu, MSR_IA32_FEATURE_CONTROL,
> + cpu->env.msr_ia32_feature_control);
> if (ret < 0) {
> return ret;
> }
> --
> 2.7.4
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2016-09-22 15:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 15:02 [Qemu-devel] [PATCH 0/2] kvm: fix incorrect LAPIC reset after reboot in x2apic mode Paolo Bonzini
2016-09-22 15:02 ` [Qemu-devel] [PATCH 1/2] target-i386: introduce kvm_put_one_msr Paolo Bonzini
2016-09-22 15:10 ` Dr. David Alan Gilbert [this message]
2016-09-22 15:02 ` [Qemu-devel] [PATCH 2/2] kvm: apic: set APIC base as part of kvm_apic_put Paolo Bonzini
2016-09-22 15:09 ` Dr. David Alan Gilbert
-- strict thread matches above, loose matches on Subject: below --
2016-09-22 15:25 [Qemu-devel] [PATCH v2 0/2] kvm: fix incorrect LAPIC reset after reboot in x2apic mode Paolo Bonzini
2016-09-22 15:25 ` [Qemu-devel] [PATCH 1/2] target-i386: introduce kvm_put_one_msr 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=20160922151036.GG2085@work-vm \
--to=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.