From: Jing Liu <jing2.liu@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/5] KVM: cpuid: do_cpuid_ent works on a whole CPUID function
Date: Mon, 8 Jul 2019 15:05:13 +0800 [thread overview]
Message-ID: <50fccadc-ad5c-6548-529d-412f68cab1f5@linux.intel.com> (raw)
In-Reply-To: <20190704140715.31181-2-pbonzini@redhat.com>
Hi Paolo,
On 7/4/2019 10:07 PM, Paolo Bonzini wrote:
> Rename it as well as __do_cpuid_ent and __do_cpuid_ent_emulated to have
> "func" in its name, and drop the index parameter which is always 0.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/x86/kvm/cpuid.c | 89 +++++++++++++++++++++-----------------------
> 1 file changed, 42 insertions(+), 47 deletions(-)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 004cbd84c351..ddffc56c39b4 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -294,14 +294,19 @@ static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
> {
> entry->function = function;
> entry->index = index;
> + entry->flags = 0;
> +
I'm wondering if we need set entry->flags = 0 here?
entry->flags was initialized as zero when vzalloc.
> cpuid_count(entry->function, entry->index,
> &entry->eax, &entry->ebx, &entry->ecx, &entry->edx);
> - entry->flags = 0;
> }
>
> -static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry,
> - u32 func, u32 index, int *nent, int maxnent)
> +static int __do_cpuid_func_emulated(struct kvm_cpuid_entry2 *entry,
> + u32 func, int *nent, int maxnent)
> {
> + entry->function = func;
> + entry->index = 0;
> + entry->flags = 0;
> +
The same question for flags and index, because entry is allocated
by vzalloc.
> switch (func) {
> case 0:
> entry->eax = 7;
> @@ -313,21 +318,18 @@ static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry,
> break;
> case 7:
> entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
> - if (index == 0)
> - entry->ecx = F(RDPID);
> + entry->eax = 0;
> + entry->ecx = F(RDPID);
> ++*nent;
> default:
> break;
> }
>
> - entry->function = func;
> - entry->index = index;
> -
> return 0;
> }
>
Thanks,
Jing
next prev parent reply other threads:[~2019-07-08 7:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 14:07 [PATCH 0/5] KVM: cpuid: cleanups, simplify multi-index CPUID leaves Paolo Bonzini
2019-07-04 14:07 ` [PATCH 1/5] KVM: cpuid: do_cpuid_ent works on a whole CPUID function Paolo Bonzini
2019-07-08 7:05 ` Jing Liu [this message]
2019-07-04 14:07 ` [PATCH 2/5] KVM: cpuid: extract do_cpuid_7_mask and support multiple subleafs Paolo Bonzini
2019-07-08 7:07 ` Jing Liu
2019-07-10 6:30 ` Paolo Bonzini
2019-07-10 7:32 ` Jing Liu
2019-07-10 7:48 ` Paolo Bonzini
2019-07-04 14:07 ` [PATCH 3/5] KVM: cpuid: set struct kvm_cpuid_entry2 flags in do_cpuid_1_ent Paolo Bonzini
2019-07-04 14:07 ` [PATCH 4/5] KVM: cpuid: rename do_cpuid_1_ent Paolo Bonzini
2019-07-04 14:07 ` [PATCH 5/5] KVM: cpuid: remove has_leaf_count from struct kvm_cpuid_param Paolo Bonzini
2019-07-08 7:09 ` Jing Liu
2019-07-10 6:34 ` 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=50fccadc-ad5c-6548-529d-412f68cab1f5@linux.intel.com \
--to=jing2.liu@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).