Re: [PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest

2010-12-20 Thread Marcelo Tosatti
On Fri, Dec 10, 2010 at 03:42:53PM +0800, Lai Jiangshan wrote:
> 
> Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
> user space raised them. (example: qemu monitor's "nmi" command)
> 
> Signed-off-by: Lai Jiangshan 

Applied to uq/master, thanks.

--
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: [PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest

2010-12-19 Thread Lai Jiangshan
On 12/10/2010 04:41 PM, Jan Kiszka wrote:
> Am 10.12.2010 08:42, Lai Jiangshan wrote:
>>
>> Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
>> user space raised them. (example: qemu monitor's "nmi" command)
>>
>> Signed-off-by: Lai Jiangshan 
>> ---
>> diff --git a/configure b/configure
>> index 2917874..f6f9362 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1646,6 +1646,9 @@ if test "$kvm" != "no" ; then
>>  #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
>>  #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
>>  #endif
>> +#if !defined(KVM_CAP_USER_NMI)
>> +#error Missing KVM capability KVM_CAP_USER_NMI
>> +#endif
>>  int main(void) { return 0; }
>>  EOF
>>if test "$kerneldir" != "" ; then
> 
> That's what I meant.
> 
> We also have a runtime check for KVM_CAP_DESTROY_MEMORY_REGION_WORKS on
> kvm init, but IMHO adding the same for KVM_CAP_USER_NMI would be
> overkill. So...
> 
>> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
>> index 7dfc357..755f8c9 100644
>> --- a/target-i386/kvm.c
>> +++ b/target-i386/kvm.c
>> @@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
>>  
>>  int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
>>  {
>> +/* Inject NMI */
>> +if (env->interrupt_request & CPU_INTERRUPT_NMI) {
>> +env->interrupt_request &= ~CPU_INTERRUPT_NMI;
>> +DPRINTF("injected NMI\n");
>> +kvm_vcpu_ioctl(env, KVM_NMI);
>> +}
>> +
>>  /* Try to inject an interrupt if the guest can accept it */
>>  if (run->ready_for_interrupt_injection &&
>>  (env->interrupt_request & CPU_INTERRUPT_HARD) &&
> 
> Acked-by: Jan Kiszka 
> 
> Jan
> 

Hi, Avi,

Could you apply this patch?

Thanks,
Lai
--
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: [PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest

2010-12-13 Thread Lai Jiangshan
On 12/10/2010 04:41 PM, Jan Kiszka wrote:
> Am 10.12.2010 08:42, Lai Jiangshan wrote:
>>
>> Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
>> user space raised them. (example: qemu monitor's "nmi" command)
>>
>> Signed-off-by: Lai Jiangshan 
>> ---
>> diff --git a/configure b/configure
>> index 2917874..f6f9362 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1646,6 +1646,9 @@ if test "$kvm" != "no" ; then
>>  #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
>>  #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
>>  #endif
>> +#if !defined(KVM_CAP_USER_NMI)
>> +#error Missing KVM capability KVM_CAP_USER_NMI
>> +#endif
>>  int main(void) { return 0; }
>>  EOF
>>if test "$kerneldir" != "" ; then
> 
> That's what I meant.
> 
> We also have a runtime check for KVM_CAP_DESTROY_MEMORY_REGION_WORKS on
> kvm init, but IMHO adding the same for KVM_CAP_USER_NMI would be
> overkill. So...
> 
>> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
>> index 7dfc357..755f8c9 100644
>> --- a/target-i386/kvm.c
>> +++ b/target-i386/kvm.c
>> @@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
>>  
>>  int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
>>  {
>> +/* Inject NMI */
>> +if (env->interrupt_request & CPU_INTERRUPT_NMI) {
>> +env->interrupt_request &= ~CPU_INTERRUPT_NMI;
>> +DPRINTF("injected NMI\n");
>> +kvm_vcpu_ioctl(env, KVM_NMI);
>> +}
>> +
>>  /* Try to inject an interrupt if the guest can accept it */
>>  if (run->ready_for_interrupt_injection &&
>>  (env->interrupt_request & CPU_INTERRUPT_HARD) &&
> 
> Acked-by: Jan Kiszka 
> 

Hi, Avi

Could you apply this patch or give me any comments/suggest?

Thanks,
Lai
--
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: [PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest

2010-12-10 Thread Jan Kiszka
Am 10.12.2010 08:42, Lai Jiangshan wrote:
> 
> Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
> user space raised them. (example: qemu monitor's "nmi" command)
> 
> Signed-off-by: Lai Jiangshan 
> ---
> diff --git a/configure b/configure
> index 2917874..f6f9362 100755
> --- a/configure
> +++ b/configure
> @@ -1646,6 +1646,9 @@ if test "$kvm" != "no" ; then
>  #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
>  #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
>  #endif
> +#if !defined(KVM_CAP_USER_NMI)
> +#error Missing KVM capability KVM_CAP_USER_NMI
> +#endif
>  int main(void) { return 0; }
>  EOF
>if test "$kerneldir" != "" ; then

That's what I meant.

We also have a runtime check for KVM_CAP_DESTROY_MEMORY_REGION_WORKS on
kvm init, but IMHO adding the same for KVM_CAP_USER_NMI would be
overkill. So...

> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 7dfc357..755f8c9 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
>  
>  int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
>  {
> +/* Inject NMI */
> +if (env->interrupt_request & CPU_INTERRUPT_NMI) {
> +env->interrupt_request &= ~CPU_INTERRUPT_NMI;
> +DPRINTF("injected NMI\n");
> +kvm_vcpu_ioctl(env, KVM_NMI);
> +}
> +
>  /* Try to inject an interrupt if the guest can accept it */
>  if (run->ready_for_interrupt_injection &&
>  (env->interrupt_request & CPU_INTERRUPT_HARD) &&

Acked-by: Jan Kiszka 

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
--
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


[PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest

2010-12-09 Thread Lai Jiangshan

Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
user space raised them. (example: qemu monitor's "nmi" command)

Signed-off-by: Lai Jiangshan 
---
diff --git a/configure b/configure
index 2917874..f6f9362 100755
--- a/configure
+++ b/configure
@@ -1646,6 +1646,9 @@ if test "$kvm" != "no" ; then
 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
 #endif
+#if !defined(KVM_CAP_USER_NMI)
+#error Missing KVM capability KVM_CAP_USER_NMI
+#endif
 int main(void) { return 0; }
 EOF
   if test "$kerneldir" != "" ; then
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 7dfc357..755f8c9 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
 
 int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
 {
+/* Inject NMI */
+if (env->interrupt_request & CPU_INTERRUPT_NMI) {
+env->interrupt_request &= ~CPU_INTERRUPT_NMI;
+DPRINTF("injected NMI\n");
+kvm_vcpu_ioctl(env, KVM_NMI);
+}
+
 /* Try to inject an interrupt if the guest can accept it */
 if (run->ready_for_interrupt_injection &&
 (env->interrupt_request & CPU_INTERRUPT_HARD) &&
--
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