qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: quintela@redhat.com
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Avi Kivity <avi@redhat.com>,
	kvm@vger.kernel.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper
Date: Sun, 05 Feb 2012 21:36:28 +0100	[thread overview]
Message-ID: <4F2EE84C.80304@web.de> (raw)
In-Reply-To: <87d39tjbdm.fsf@elfo.elfo>

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

On 2012-02-05 21:03, Juan Quintela wrote:
> Jan Kiszka <jan.kiszka@web.de> wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> To be used for in-kernel PIT emulation.
> 
> ....
> 
>> +    int pit_state2;
> 
> This is used as a bool.
> 
>>      int xsave, xcrs;
>>      int many_ioeventfds;
>>      int irqchip_inject_ioctl;
>> @@ -954,6 +955,10 @@ int kvm_init(void)
>>      s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
>>  #endif
>>  
>> +#ifdef KVM_CAP_PIT_STATE2
>> +    s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
>> +#endif
>> +
> 
> [ this happened to me when I was reviewing this patch, but culprit is
> not this patch]
> 
> really kvm_check_extension() should also return a bool, but that is a
> bigger change that this patch series tend to introduce.
> 
> So, I went to "man ioctl"
> 
>> RETURN VALUE
>>        Usually, on success zero is returned.  A few ioctl() requests  use  the
>>        return  value  as an output parameter and return a nonnegative value on
>>       success.  On error, -1 is returned, and errno is set appropriately.
> 
> Usually is the important word there.

Right, because the driver decides in the end what is returned.

In case of KVM_CHECK_EXTENSION, it is > 0 for supported. Sometimes it
returns an integer value that encode "how much" is supported, e.g.
KVM_CAP_IRQ_ROUTING provides the number of supported GSI routes.

That said, all those boolean caps could indeed be encoded as such. Some
smarter way to initialize and retrieve them would also be nice. Too much
boilerplate code.

Thanks for bending your brain around this :)

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2012-02-05 20:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-05 10:46 [Qemu-devel] [PATCH 0/4] uq/master: Introduce KVM PIT support Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] [PATCH 1/4] i8254: Factor out base class for KVM reuse Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] [PATCH 2/4] i8254: Open-code timer restore Jan Kiszka
2012-02-05 11:23   ` Paolo Bonzini
2012-02-05 11:33     ` Jan Kiszka
2012-02-05 12:03   ` [Qemu-devel] [PATCH 2/4 v3] " Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper Jan Kiszka
2012-02-05 20:03   ` Juan Quintela
2012-02-05 20:36     ` Jan Kiszka [this message]
2012-02-05 10:46 ` [Qemu-devel] [PATCH 4/4] kvm: x86: Add user space part for in-kernel i8254 Jan Kiszka
2012-02-08 18:24 ` [Qemu-devel] [PATCH 0/4] uq/master: Introduce KVM PIT support Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2012-01-31 18:46 Jan Kiszka
2012-01-31 18:46 ` [Qemu-devel] [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper Jan Kiszka

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=4F2EE84C.80304@web.de \
    --to=jan.kiszka@web.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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).