Re: [Qemu-devel] [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()

2012-08-13 Thread Marcelo Tosatti
On Sun, Aug 12, 2012 at 02:13:52PM +0100, Peter Maydell wrote:
 Ping? I don't think this one quite made it into Avi's pullreq...

Please post this with the rest of the code to support the new
s-irqchip_inject_ioctl value.

 thanks
 -- PMM
 
 On 6 August 2012 18:05, Peter Maydell peter.mayd...@linaro.org wrote:
  Move the init of the irqchip_inject_ioctl field of KVMState out of
  kvm_irqchip_create() and into kvm_init(), so that kvm_set_irq()
  can be used even when no irqchip is created (for architectures
  that support async interrupt notification even without an in
  kernel irqchip).
 
  Signed-off-by: Peter Maydell peter.mayd...@linaro.org
  ---
  We can't just set irqchip_inject_ioctl in target-*/kvm.c because
  the KVMState struct layout is private to kvm-all.c. Moving the
  default initialisation of this field seemed the simplest approach.
  It's safe because the use in kvm_set_irq() is guarded by a check of
  kvm_async_interrupts_enabled().
 
  The other approach would be to have a helper function for setting
  the field, but that seems overkill when KVM_IRQ_LINE is the standard
  default value. (KVM_IRQ_LINE_STATUS seems to be undocumented,
  incidentally. I am going to assume it's another x86ism until somebody
  does document it :-))
 
   kvm-all.c |3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
 
  diff --git a/kvm-all.c b/kvm-all.c
  index 6def6c9..9a1f001 100644
  --- a/kvm-all.c
  +++ b/kvm-all.c
  @@ -1200,7 +1200,6 @@ static int kvm_irqchip_create(KVMState *s)
   return ret;
   }
 
  -s-irqchip_inject_ioctl = KVM_IRQ_LINE;
   if (kvm_check_extension(s, KVM_CAP_IRQ_INJECT_STATUS)) {
   s-irqchip_inject_ioctl = KVM_IRQ_LINE_STATUS;
   }
  @@ -1321,6 +1320,8 @@ int kvm_init(void)
   s-direct_msi = (kvm_check_extension(s, KVM_CAP_SIGNAL_MSI)  0);
   #endif
 
  +s-irqchip_inject_ioctl = KVM_IRQ_LINE;
  +
   ret = kvm_arch_init(s);
   if (ret  0) {
   goto err;
  --
  1.7.9.5
 --
 To unsubscribe from this list: send the line unsubscribe kvm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()

2012-08-13 Thread Peter Maydell
On 13 August 2012 21:45, Marcelo Tosatti mtosa...@redhat.com wrote:
 On Sun, Aug 12, 2012 at 02:13:52PM +0100, Peter Maydell wrote:
 Ping? I don't think this one quite made it into Avi's pullreq...

 Please post this with the rest of the code to support the new
 s-irqchip_inject_ioctl value.

Er, which new irqchip_inject_ioctl value? There are still only
two possibilities, KVM_IRQ_LINE and KVM_IRQ_LINE_STATUS.
The patch just allows you to use kvm_set_irq() without having
called kvm_irqchip_create() first [which makes sense to me given
the previous patches which remove the assumption that you need
an in-kernel irqchip to be able to do KVM_IRQ_LINE style
interrupt delivery].

-- PMM
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()

2012-08-12 Thread Peter Maydell
Ping? I don't think this one quite made it into Avi's pullreq...

thanks
-- PMM

On 6 August 2012 18:05, Peter Maydell peter.mayd...@linaro.org wrote:
 Move the init of the irqchip_inject_ioctl field of KVMState out of
 kvm_irqchip_create() and into kvm_init(), so that kvm_set_irq()
 can be used even when no irqchip is created (for architectures
 that support async interrupt notification even without an in
 kernel irqchip).

 Signed-off-by: Peter Maydell peter.mayd...@linaro.org
 ---
 We can't just set irqchip_inject_ioctl in target-*/kvm.c because
 the KVMState struct layout is private to kvm-all.c. Moving the
 default initialisation of this field seemed the simplest approach.
 It's safe because the use in kvm_set_irq() is guarded by a check of
 kvm_async_interrupts_enabled().

 The other approach would be to have a helper function for setting
 the field, but that seems overkill when KVM_IRQ_LINE is the standard
 default value. (KVM_IRQ_LINE_STATUS seems to be undocumented,
 incidentally. I am going to assume it's another x86ism until somebody
 does document it :-))

  kvm-all.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/kvm-all.c b/kvm-all.c
 index 6def6c9..9a1f001 100644
 --- a/kvm-all.c
 +++ b/kvm-all.c
 @@ -1200,7 +1200,6 @@ static int kvm_irqchip_create(KVMState *s)
  return ret;
  }

 -s-irqchip_inject_ioctl = KVM_IRQ_LINE;
  if (kvm_check_extension(s, KVM_CAP_IRQ_INJECT_STATUS)) {
  s-irqchip_inject_ioctl = KVM_IRQ_LINE_STATUS;
  }
 @@ -1321,6 +1320,8 @@ int kvm_init(void)
  s-direct_msi = (kvm_check_extension(s, KVM_CAP_SIGNAL_MSI)  0);
  #endif

 +s-irqchip_inject_ioctl = KVM_IRQ_LINE;
 +
  ret = kvm_arch_init(s);
  if (ret  0) {
  goto err;
 --
 1.7.9.5
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html