From: Avi Kivity <avi@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface
Date: Wed, 14 Jan 2009 16:52:12 +0200 [thread overview]
Message-ID: <496DFC1C.4010004@redhat.com> (raw)
In-Reply-To: <1231843674-11333-3-git-send-email-amit.shah@redhat.com>
Amit Shah wrote:
> kvm_set_cpuid2() builds on top of kvm_set_cpuid() and correctly populates
> cpuid functions that have sub-leaves.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
> libkvm/libkvm-x86.c | 18 ++++++++++++++++++
> libkvm/libkvm.h | 16 ++++++++++++++++
> 2 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
> index a8cca15..93a9c4e 100644
> --- a/libkvm/libkvm-x86.c
> +++ b/libkvm/libkvm-x86.c
> @@ -475,6 +475,24 @@ int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
> return r;
> }
>
> +int kvm_setup_cpuid2(kvm_context_t kvm, int vcpu, int nent,
> + struct kvm_cpuid_entry2 *entries)
> +{
> + struct kvm_cpuid2 *cpuid;
> + int r;
> +
> + cpuid = malloc(sizeof(*cpuid) + nent * sizeof(*entries));
> + if (!cpuid)
> + return -ENOMEM;
> +
> + cpuid->nent = nent;
> + memcpy(cpuid->entries, entries, nent * sizeof(*entries));
> + r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_CPUID2, cpuid);
> +
> + free(cpuid);
> + return r;
> +}
>
Should return -errno, not -EPERM, if the ioctl fails.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2009-01-14 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 10:47 Support for cpuid functions with subleaves Amit Shah
2009-01-13 10:47 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
2009-01-13 10:47 ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Amit Shah
2009-01-13 10:47 ` [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-01-14 14:57 ` Avi Kivity
2009-01-14 14:52 ` Avi Kivity [this message]
2009-01-13 10:53 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
2009-01-14 14:55 ` Avi Kivity
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=496DFC1C.4010004@redhat.com \
--to=avi@redhat.com \
--cc=amit.shah@redhat.com \
--cc=kvm@vger.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