From: Paul Durrant <xadimgnik@gmail.com>
To: Sean Christopherson <seanjc@google.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: Fri, 6 Jan 2023 09:20:00 +0000 [thread overview]
Message-ID: <4aba7537-7c70-4965-46e2-ac36d389ef0a@xen.org> (raw)
In-Reply-To: <Y7cSdYWX8e3FqlrO@google.com>
On 05/01/2023 18:09, Sean Christopherson wrote:
> 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.
I think it's cleaner too, and I already did the typing so I may as well
post. I don't think anyone else has expressed any strong opinions on the
code either way.
Paul
next prev parent reply other threads:[~2023-01-06 9:20 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
2023-01-06 9:20 ` Paul Durrant [this message]
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=4aba7537-7c70-4965-46e2-ac36d389ef0a@xen.org \
--to=xadimgnik@gmail.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=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=pdurrant@amazon.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®