qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: "linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Patch Tracking <patches@linaro.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: [Qemu-devel] [PATCH 3/4] kvm: Common device control API functions
Date: Fri, 6 Sep 2013 14:15:52 +0100	[thread overview]
Message-ID: <CAFEAcA_tMsPTYsAsehKF85FBdDcgT+CJQn2vYWYvG0aMkp_8Vw@mail.gmail.com> (raw)
In-Reply-To: <1377286862-5879-4-git-send-email-christoffer.dall@linaro.org>

On 23 August 2013 20:41, Christoffer Dall <christoffer.dall@linaro.org> wrote:
> Introduces two simple functions:
>     int kvm_device_ioctl(int fd, int type, ...);
>     int kvm_create_device(KVMState *s, uint64_t type, bool test);
>
> These functions wrap the basic ioctl-based interactions with KVM in a
> way similar to other KVM ioctl wrappers.
>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  include/sysemu/kvm.h |    5 +++++
>  kvm-all.c            |   39 +++++++++++++++++++++++++++++++++++++++
>  trace-events         |    1 +
>  3 files changed, 45 insertions(+)
>
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 1e5847e..84ca5ef 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -190,6 +190,11 @@ int kvm_vm_ioctl(KVMState *s, int type, ...);
>
>  int kvm_vcpu_ioctl(CPUState *cpu, int type, ...);
>
> +int kvm_device_ioctl(int fd, int type, ...);
> +
> +int kvm_create_device(KVMState *s, uint64_t type, bool test);

Could we have doc comments for these, please?

> +
> +
>  /* Arch specific hooks */
>
>  extern const KVMCapabilityInfo kvm_arch_required_capabilities[];
> diff --git a/kvm-all.c b/kvm-all.c
> index fe64f3b..957b961 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1770,6 +1770,24 @@ int kvm_vcpu_ioctl(CPUState *cpu, int type, ...)
>      return ret;
>  }
>
> +int kvm_device_ioctl(int fd, int type, ...)
> +{
> +    int ret;
> +    void *arg;
> +    va_list ap;
> +
> +    va_start(ap, type);
> +    arg = va_arg(ap, void *);
> +    va_end(ap);
> +
> +    trace_kvm_device_ioctl(fd, type, arg);
> +    ret = ioctl(fd, type, arg);
> +    if (ret == -1) {
> +        ret = -errno;
> +    }
> +    return ret;
> +}
> +
>  int kvm_has_sync_mmu(void)
>  {
>      return kvm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
> @@ -2064,3 +2082,24 @@ int kvm_on_sigbus(int code, void *addr)
>  {
>      return kvm_arch_on_sigbus(code, addr);
>  }
> +
> +int kvm_create_device(KVMState *s, uint64_t type, bool test)
> +{
> +    int ret;
> +    struct kvm_create_device create_dev;
> +
> +    create_dev.type = type;
> +    create_dev.fd = -1;
> +    create_dev.flags = (test) ? KVM_CREATE_DEVICE_TEST : 0;

Why the brackets round 'test' ?

> +
> +    if (!kvm_check_extension(s, KVM_CAP_DEVICE_CTRL)) {
> +        return -1;

We should probably return -$some_errno here, since we
pass through a -errno return from kvm_vm_ioctl below.

> +    }
> +
> +    ret = kvm_vm_ioctl(s, KVM_CREATE_DEVICE, &create_dev);
> +    if (ret) {
> +        return ret;
> +    }
> +
> +    return (test) ? 0 : create_dev.fd;
> +}

thanks
-- PMM

  reply	other threads:[~2013-09-06 13:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 19:40 [Qemu-devel] [PATCH 0/4] Create ARM KVM VGIC with device control API Christoffer Dall
2013-08-23 19:40 ` [Qemu-devel] [PATCH 1/4] kvm: Update headers for device control api Christoffer Dall
2013-08-24 10:31   ` Peter Maydell
2013-08-23 19:41 ` [Qemu-devel] [PATCH 2/4] kvm: Introduce kvm_arch_irqchip_create Christoffer Dall
2013-09-06 13:08   ` Peter Maydell
2013-08-23 19:41 ` [Qemu-devel] [PATCH 3/4] kvm: Common device control API functions Christoffer Dall
2013-09-06 13:15   ` Peter Maydell [this message]
2013-08-23 19:41 ` [Qemu-devel] [PATCH 4/4] arm: vgic device control api support Christoffer Dall
2013-09-06 13:34   ` Peter Maydell
2013-09-13  5:15     ` Christoffer Dall

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=CAFEAcA_tMsPTYsAsehKF85FBdDcgT+CJQn2vYWYvG0aMkp_8Vw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=patches@linaro.org \
    --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 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).