From: Sean Christopherson <seanjc@google.com>
To: Paul Durrant <xadimgnik@gmail.com>
Cc: Paul Durrant <pdurrant@amazon.com>,
x86@kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v6 1/2] KVM: x86/cpuid: generalize kvm_update_kvm_cpuid_base() and also capture limit
Date: Thu, 5 Jan 2023 18:09:57 +0000 [thread overview]
Message-ID: <Y7cSdYWX8e3FqlrO@google.com> (raw)
In-Reply-To: <82fbc53e-be3e-b516-2420-dc27e5b811e8@gmail.com>
On Thu, Jan 05, 2023, Paul Durrant wrote:
> On 04/01/2023 19:34, Sean Christopherson wrote:
> > Since the struct is a 64-bit value, what about making this a pure getter that
> > returns a copy?
> >
> > static struct kvm_hypervisor_cpuid kvm_get_hypervisor_cpuid(struct kvm_vcpu *vcpu,
> > const char *sig)
> > {
> > struct kvm_hypervisor_cpuid cpuid = {};
> > struct kvm_cpuid_entry2 *entry;
> > u32 function;
> >
> > for_each_possible_hypervisor_cpuid_base(cpuid.base) {
> > entry = kvm_find_cpuid_entry(vcpu, function);
> >
> > if (entry) {
> > u32 signature[3];
> >
> > signature[0] = entry->ebx;
> > signature[1] = entry->ecx;
> > signature[2] = entry->edx;
> >
> > if (!memcmp(signature, sig, sizeof(signature))) {
> > cpuid.base = function;
> > cpuid.limit = entry->eax;
> > break;
> > }
> > }
> > }
> >
> > return cpuid;
> > }
> >
> >
> > vcpu->arch.kvm_cpuid = kvm_get_hypervisor_cpuid(vcpu, KVM_SIGNATURE);
> > vcpu->arch.xen.cpuid = kvm_get_hypervisor_cpuid(vcpu, XEN_SIGNATURE);
>
> Yes, if that's preferable then no problem.
I like it (obviously), but it's probably worth waiting a few days to see what
others think before posting a new version.
next prev parent reply other threads:[~2023-01-05 18:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 13:40 [PATCH v6 0/2] KVM: x86/xen: update Xen CPUID Leaf 4 Paul Durrant
2022-12-20 13:40 ` [PATCH v6 1/2] KVM: x86/cpuid: generalize kvm_update_kvm_cpuid_base() and also capture limit Paul Durrant
2023-01-03 16:20 ` David Woodhouse
2023-01-04 19:34 ` Sean Christopherson
2023-01-05 10:38 ` Paul Durrant
2023-01-05 18:09 ` Sean Christopherson [this message]
2023-01-06 9:20 ` Paul Durrant
2022-12-20 13:40 ` [PATCH v6 2/2] KVM: x86/xen: update Xen CPUID Leaf 4 (tsc info) sub-leaves, if present Paul Durrant
2023-01-03 16:20 ` David Woodhouse
2023-01-04 19:40 ` Sean Christopherson
2023-01-04 20:09 ` David Woodhouse
2023-01-04 20:20 ` Sean Christopherson
2023-01-04 21:03 ` David Woodhouse
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=Y7cSdYWX8e3FqlrO@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pdurrant@amazon.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xadimgnik@gmail.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.