qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com
Subject: [Qemu-devel] [PATCH 1/8] irq: Introduce CPU_INTERRUPT_TGT_* defines.
Date: Wed,  4 May 2011 13:34:24 -0700	[thread overview]
Message-ID: <1304541271-5891-2-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1304541271-5891-1-git-send-email-rth@twiddle.net>

These defines will be place-holders for cpu-specific functionality.
Generic code will, at the end of the patch series, no longer have to
concern itself about how SMI, NMI, etc should be handled.  Instead,
generic code will know only that the interrupt is internal or external.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 cpu-all.h |   63 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
 poison.h  |    8 +++++++
 2 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/cpu-all.h b/cpu-all.h
index 88126ea..dd9c230 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -786,18 +786,57 @@ void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
 extern CPUState *first_cpu;
 extern CPUState *cpu_single_env;
 
-#define CPU_INTERRUPT_HARD   0x02 /* hardware interrupt pending */
-#define CPU_INTERRUPT_EXITTB 0x04 /* exit the current TB (use for x86 a20 case) */
-#define CPU_INTERRUPT_TIMER  0x08 /* internal timer exception pending */
-#define CPU_INTERRUPT_FIQ    0x10 /* Fast interrupt pending.  */
-#define CPU_INTERRUPT_HALT   0x20 /* CPU halt wanted */
-#define CPU_INTERRUPT_SMI    0x40 /* (x86 only) SMI interrupt pending */
-#define CPU_INTERRUPT_DEBUG  0x80 /* Debug event occured.  */
-#define CPU_INTERRUPT_VIRQ   0x100 /* virtual interrupt pending.  */
-#define CPU_INTERRUPT_NMI    0x200 /* NMI pending. */
-#define CPU_INTERRUPT_INIT   0x400 /* INIT pending. */
-#define CPU_INTERRUPT_SIPI   0x800 /* SIPI pending. */
-#define CPU_INTERRUPT_MCE    0x1000 /* (x86 only) MCE pending. */
+/* Flags for use in ENV->INTERRUPT_PENDING.
+
+   The numbers assigned here are non-sequential in order to preserve
+   binary compatibility with the vmstate dump.  Bit 0 (0x0001) was
+   previously used for CPU_INTERRUPT_EXIT, and is cleared when loading
+   the vmstate dump.  */
+
+/* External hardware interrupt pending.  This is typically used for
+   interrupts from devices.  */
+#define CPU_INTERRUPT_HARD        0x0002
+
+/* Exit the current TB.  This is typically used when some system-level device
+   makes some change to the memory mapping.  E.g. the a20 line change.  */
+#define CPU_INTERRUPT_EXITTB      0x0004
+
+/* Halt the CPU.  */
+#define CPU_INTERRUPT_HALT        0x0020
+
+/* Debug event pending.  */
+#define CPU_INTERRUPT_DEBUG       0x0080
+
+/* Several target-specific external hardware interrupts.  Each target/cpu.h
+   should define proper names based on these defines.  */
+#define CPU_INTERRUPT_TGT_EXT_0   0x0008
+#define CPU_INTERRUPT_TGT_EXT_1   0x0010
+#define CPU_INTERRUPT_TGT_EXT_2   0x0040
+#define CPU_INTERRUPT_TGT_EXT_3   0x0200
+#define CPU_INTERRUPT_TGT_EXT_4   0x1000
+
+/* Several target-specific internal interrupts.  These differ from the
+   preceeding target-specific interrupts in that they are intended to
+   originate from within the cpu itself, typically in response to some
+   instruction being executed.  These, therefore, are not masked while
+   single-stepping within the debugger.  */
+#define CPU_INTERRUPT_TGT_INT_0   0x0100
+#define CPU_INTERRUPT_TGT_INT_1   0x0400
+#define CPU_INTERRUPT_TGT_INT_2   0x0800
+
+/* First unused bit: 0x2000.  */
+
+/* Temporary remapping from the generic names back to the previous
+   cpu-specific names.  These will be moved to target-foo/cpu.h next.  */
+#define CPU_INTERRUPT_TIMER       CPU_INTERRUPT_TGT_EXT_0
+#define CPU_INTERRUPT_FIQ         CPU_INTERRUPT_TGT_EXT_1
+#define CPU_INTERRUPT_SMI         CPU_INTERRUPT_TGT_EXT_2
+#define CPU_INTERRUPT_VIRQ        CPU_INTERRUPT_TGT_INT_0
+#define CPU_INTERRUPT_NMI         CPU_INTERRUPT_TGT_EXT_3
+#define CPU_INTERRUPT_INIT        CPU_INTERRUPT_TGT_INT_1
+#define CPU_INTERRUPT_SIPI        CPU_INTERRUPT_TGT_INT_2
+#define CPU_INTERRUPT_MCE         CPU_INTERRUPT_TGT_EXT_4
+
 
 #ifndef CONFIG_USER_ONLY
 typedef void (*CPUInterruptHandler)(CPUState *, int);
diff --git a/poison.h b/poison.h
index 93c75fa..8fa3ee6 100644
--- a/poison.h
+++ b/poison.h
@@ -46,6 +46,14 @@
 #pragma GCC poison CPU_INTERRUPT_DEBUG
 #pragma GCC poison CPU_INTERRUPT_VIRQ
 #pragma GCC poison CPU_INTERRUPT_NMI
+#pragma GCC poison CPU_INTERRUPT_TGT_EXT_0
+#pragma GCC poison CPU_INTERRUPT_TGT_EXT_1
+#pragma GCC poison CPU_INTERRUPT_TGT_EXT_2
+#pragma GCC poison CPU_INTERRUPT_TGT_EXT_3
+#pragma GCC poison CPU_INTERRUPT_TGT_EXT_4
+#pragma GCC poison CPU_INTERRUPT_TGT_INT_0
+#pragma GCC poison CPU_INTERRUPT_TGT_INT_1
+#pragma GCC poison CPU_INTERRUPT_TGT_INT_2
 
 #endif
 #endif
-- 
1.7.4.4

  reply	other threads:[~2011-05-04 20:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 20:34 [Qemu-devel] [PATCH 0/8] cpu interrupt cleanup, v2 Richard Henderson
2011-05-04 20:34 ` Richard Henderson [this message]
2011-05-04 20:34 ` [Qemu-devel] [PATCH 2/8] irq: Introduce and use CPU_INTERRUPT_SSTEP_MASK Richard Henderson
2011-05-04 20:34 ` [Qemu-devel] [PATCH 3/8] target-mips: Do not check CPU_INTERRUPT_TIMER Richard Henderson
2011-05-04 20:34 ` [Qemu-devel] [PATCH 4/8] target-sparc: " Richard Henderson
2011-05-04 20:34 ` [Qemu-devel] [PATCH 5/8] irq: Remove CPU_INTERRUPT_TIMER Richard Henderson
2011-05-04 20:34 ` [Qemu-devel] [PATCH 6/8] target-arm: Privatize CPU_INTERRUPT_FIQ Richard Henderson
2011-05-04 20:34 ` [Qemu-devel] [PATCH 7/8] target-i386: Privatize some i386-specific interrupt names Richard Henderson
2011-05-04 20:34 ` [Qemu-devel] [PATCH 8/8] irq: Privatize CPU_INTERRUPT_NMI Richard Henderson
2011-05-08 16:50 ` [Qemu-devel] [PATCH 0/8] cpu interrupt cleanup, v2 Richard Henderson
2011-05-08 18:30   ` Blue Swirl
  -- strict thread matches above, loose matches on Subject: below --
2011-04-30 22:24 [Qemu-devel] [PATCH 0/8] cpu interrupt cleanup Richard Henderson
2011-04-30 22:24 ` [Qemu-devel] [PATCH 1/8] irq: Introduce CPU_INTERRUPT_TGT_* defines Richard Henderson

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=1304541271-5891-2-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=blauwirbel@gmail.com \
    --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).