qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Add support for CPU_LOG_INT (MIPS targets)
@ 2008-10-02 20:04 Stefan Weil
  2008-10-14  9:58 ` Aurelien Jarno
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2008-10-02 20:04 UTC (permalink / raw)
  To: QEMU Developers

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

This patch adds some interrupt logging for MIPS targets.

Please apply it to Qemu trunk.

Regards
Stefan



[-- Attachment #2: mips_int.patch --]
[-- Type: text/x-diff, Size: 1681 bytes --]

Add interrupt logging for MIPS targets.

Signed-off-by: Stefan Weil <weil@mail.berlios.de> 

Index: hw/mips_int.c
===================================================================
--- hw/mips_int.c	(Revision 5400)
+++ hw/mips_int.c	(Arbeitskopie)
@@ -1,6 +1,7 @@
 #include "hw.h"
 #include "mips.h"
 #include "cpu.h"
+#include "qemu-log.h"
 
 /* Raise IRQ to CPU if necessary. It must be called every time the active
    IRQ may change */
@@ -12,10 +13,28 @@
         !(env->hflags & MIPS_HFLAG_DM)) {
         if ((env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask) &&
             !(env->interrupt_request & CPU_INTERRUPT_HARD)) {
+            if (loglevel & CPU_LOG_INT) {
+                fprintf(logfile, "%s: cpu_interrupt (0x%08x,0x%08x)\n", __func__,
+                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
+                  env->interrupt_request);
+                cpu_dump_state(env, logfile, fprintf, 0);
+            }
             cpu_interrupt(env, CPU_INTERRUPT_HARD);
-	}
-    } else
+        } else {
+            if (loglevel & CPU_LOG_INT) {
+                fprintf(logfile, "%s: no interrupt (0x%08x,0x%08x)\n", __func__,
+                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
+                  env->interrupt_request);
+                cpu_dump_state(env, logfile, fprintf, 0);
+            }
+        }
+    } else {
+        if (loglevel & CPU_LOG_INT) {
+            fprintf(logfile, "%s: cpu_reset_interrupt\n", __func__);
+            cpu_dump_state(env, logfile, fprintf, 0);
+        }
         cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
+    }
 }
 
 static void cpu_mips_irq_request(void *opaque, int irq, int level)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Add support for CPU_LOG_INT (MIPS targets)
  2008-10-02 20:04 [Qemu-devel] [PATCH] Add support for CPU_LOG_INT (MIPS targets) Stefan Weil
@ 2008-10-14  9:58 ` Aurelien Jarno
  2008-10-14 17:25   ` Stefan Weil
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2008-10-14  9:58 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

On Thu, Oct 02, 2008 at 10:04:26PM +0200, Stefan Weil wrote:
> This patch adds some interrupt logging for MIPS targets.
> 
> Please apply it to Qemu trunk.
> 
> Regards
> Stefan
> 
> 

> Add interrupt logging for MIPS targets.
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de> 
> 
> Index: hw/mips_int.c
> ===================================================================
> --- hw/mips_int.c	(Revision 5400)
> +++ hw/mips_int.c	(Arbeitskopie)
> @@ -1,6 +1,7 @@
>  #include "hw.h"
>  #include "mips.h"
>  #include "cpu.h"
> +#include "qemu-log.h"
>  
>  /* Raise IRQ to CPU if necessary. It must be called every time the active
>     IRQ may change */
> @@ -12,10 +13,28 @@
>          !(env->hflags & MIPS_HFLAG_DM)) {
>          if ((env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask) &&
>              !(env->interrupt_request & CPU_INTERRUPT_HARD)) {
> +            if (loglevel & CPU_LOG_INT) {
> +                fprintf(logfile, "%s: cpu_interrupt (0x%08x,0x%08x)\n", __func__,
> +                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
> +                  env->interrupt_request);
> +                cpu_dump_state(env, logfile, fprintf, 0);
> +            }
>              cpu_interrupt(env, CPU_INTERRUPT_HARD);
> -	}
> -    } else
> +        } else {
> +            if (loglevel & CPU_LOG_INT) {
> +                fprintf(logfile, "%s: no interrupt (0x%08x,0x%08x)\n", __func__,
> +                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
> +                  env->interrupt_request);
> +                cpu_dump_state(env, logfile, fprintf, 0);
> +            }

I am not sure we really want to log this case, as no interrupt are
actually triggered (disabled interrupt, already processing an
interrupt, etc.)

> +        }
> +    } else {
> +        if (loglevel & CPU_LOG_INT) {
> +            fprintf(logfile, "%s: cpu_reset_interrupt\n", __func__);
> +            cpu_dump_state(env, logfile, fprintf, 0);
> +        }
>          cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
> +    }
>  }
>  
>  static void cpu_mips_irq_request(void *opaque, int irq, int level)

Otherwise looks ok.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Add support for CPU_LOG_INT (MIPS targets)
  2008-10-14  9:58 ` Aurelien Jarno
@ 2008-10-14 17:25   ` Stefan Weil
  2008-10-14 19:54     ` Aurelien Jarno
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2008-10-14 17:25 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: QEMU Developers

Aurelien Jarno schrieb:
> On Thu, Oct 02, 2008 at 10:04:26PM +0200, Stefan Weil wrote:
>   
> ...
>> Add interrupt logging for MIPS targets.
>>
>> Signed-off-by: Stefan Weil <weil@mail.berlios.de> 
>>
>> Index: hw/mips_int.c
>> ===================================================================
>> --- hw/mips_int.c	(Revision 5400)
>> +++ hw/mips_int.c	(Arbeitskopie)
>> @@ -1,6 +1,7 @@
>>  #include "hw.h"
>>  #include "mips.h"
>>  #include "cpu.h"
>> +#include "qemu-log.h"
>>  
>>  /* Raise IRQ to CPU if necessary. It must be called every time the active
>>     IRQ may change */
>> @@ -12,10 +13,28 @@
>>          !(env->hflags & MIPS_HFLAG_DM)) {
>>          if ((env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask) &&
>>              !(env->interrupt_request & CPU_INTERRUPT_HARD)) {
>> +            if (loglevel & CPU_LOG_INT) {
>> +                fprintf(logfile, "%s: cpu_interrupt (0x%08x,0x%08x)\n", __func__,
>> +                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
>> +                  env->interrupt_request);
>> +                cpu_dump_state(env, logfile, fprintf, 0);
>> +            }
>>              cpu_interrupt(env, CPU_INTERRUPT_HARD);
>> -	}
>> -    } else
>> +        } else {
>> +            if (loglevel & CPU_LOG_INT) {
>> +                fprintf(logfile, "%s: no interrupt (0x%08x,0x%08x)\n", __func__,
>> +                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
>> +                  env->interrupt_request);
>> +                cpu_dump_state(env, logfile, fprintf, 0);
>> +            }
>>     
>
> I am not sure we really want to log this case, as no interrupt are
> actually triggered (disabled interrupt, already processing an
> interrupt, etc.)
>   
Well, I added this code to debug a real problem, not just for fun.
It helps to see who triggers this code, even when interrupts are
disabled at that moment.

>> +        }
>> +    } else {
>> +        if (loglevel & CPU_LOG_INT) {
>> +            fprintf(logfile, "%s: cpu_reset_interrupt\n", __func__);
>> +            cpu_dump_state(env, logfile, fprintf, 0);
>> +        }
>>          cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
>> +    }
>>  }
>>  
>>  static void cpu_mips_irq_request(void *opaque, int irq, int level)
>>     
>
> Otherwise looks ok.
>
>   
Thanks,
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Add support for CPU_LOG_INT (MIPS targets)
  2008-10-14 17:25   ` Stefan Weil
@ 2008-10-14 19:54     ` Aurelien Jarno
  0 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2008-10-14 19:54 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

On Tue, Oct 14, 2008 at 07:25:30PM +0200, Stefan Weil wrote:
> Aurelien Jarno schrieb:
> > On Thu, Oct 02, 2008 at 10:04:26PM +0200, Stefan Weil wrote:
> >   
> > ...
> >> Add interrupt logging for MIPS targets.
> >>
> >> Signed-off-by: Stefan Weil <weil@mail.berlios.de> 
> >>
> >> Index: hw/mips_int.c
> >> ===================================================================
> >> --- hw/mips_int.c	(Revision 5400)
> >> +++ hw/mips_int.c	(Arbeitskopie)
> >> @@ -1,6 +1,7 @@
> >>  #include "hw.h"
> >>  #include "mips.h"
> >>  #include "cpu.h"
> >> +#include "qemu-log.h"
> >>  
> >>  /* Raise IRQ to CPU if necessary. It must be called every time the active
> >>     IRQ may change */
> >> @@ -12,10 +13,28 @@
> >>          !(env->hflags & MIPS_HFLAG_DM)) {
> >>          if ((env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask) &&
> >>              !(env->interrupt_request & CPU_INTERRUPT_HARD)) {
> >> +            if (loglevel & CPU_LOG_INT) {
> >> +                fprintf(logfile, "%s: cpu_interrupt (0x%08x,0x%08x)\n", __func__,
> >> +                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
> >> +                  env->interrupt_request);
> >> +                cpu_dump_state(env, logfile, fprintf, 0);
> >> +            }
> >>              cpu_interrupt(env, CPU_INTERRUPT_HARD);
> >> -	}
> >> -    } else
> >> +        } else {
> >> +            if (loglevel & CPU_LOG_INT) {
> >> +                fprintf(logfile, "%s: no interrupt (0x%08x,0x%08x)\n", __func__,
> >> +                  env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask,
> >> +                  env->interrupt_request);
> >> +                cpu_dump_state(env, logfile, fprintf, 0);
> >> +            }
> >>     
> >
> > I am not sure we really want to log this case, as no interrupt are
> > actually triggered (disabled interrupt, already processing an
> > interrupt, etc.)
> >   
> Well, I added this code to debug a real problem, not just for fun.
> It helps to see who triggers this code, even when interrupts are
> disabled at that moment.
> 

Then if you want to see the interrupts in all cases, what about 
adding it directly to cpu_mips_irq_request()? The resulting code would
be cleaner.


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-14 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-02 20:04 [Qemu-devel] [PATCH] Add support for CPU_LOG_INT (MIPS targets) Stefan Weil
2008-10-14  9:58 ` Aurelien Jarno
2008-10-14 17:25   ` Stefan Weil
2008-10-14 19:54     ` Aurelien Jarno

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).