qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH qom-cpu v2 25/29] cpu: Move CPU_INTERRUPT_* to qom/cpu.h
Date: Sun, 16 Jun 2013 17:57:45 +0200	[thread overview]
Message-ID: <1371398269-6213-26-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1371398269-6213-1-git-send-email-afaerber@suse.de>

Turn them into an enum. Un-poison them but make CPU_INTERRUPT_TGT_* only
available to CONFIG_SOFTMMU and CONFIG_USER_ONLY, i.e., not to devices.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/exec/cpu-all.h | 50 -------------------------------------------
 include/exec/poison.h  | 13 ------------
 include/qom/cpu.h      | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 63 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 6499cd0..5d7d8a6 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -357,56 +357,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
 void QEMU_NORETURN cpu_abort(CPUArchState *env, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
 
-/* 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
-   preceding 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
-#define CPU_INTERRUPT_TGT_INT_3   0x2000
-
-/* First unused bit: 0x4000.  */
-
-/* The set of all bits that should be masked when single-stepping.  */
-#define CPU_INTERRUPT_SSTEP_MASK \
-    (CPU_INTERRUPT_HARD          \
-     | CPU_INTERRUPT_TGT_EXT_0   \
-     | CPU_INTERRUPT_TGT_EXT_1   \
-     | CPU_INTERRUPT_TGT_EXT_2   \
-     | CPU_INTERRUPT_TGT_EXT_3   \
-     | CPU_INTERRUPT_TGT_EXT_4)
-
 /* Breakpoint/watchpoint flags */
 #define BP_MEM_READ           0x01
 #define BP_MEM_WRITE          0x02
diff --git a/include/exec/poison.h b/include/exec/poison.h
index 2341a75..00caabe 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -46,18 +46,5 @@
 #pragma GCC poison stl_phys
 #pragma GCC poison stq_phys
 
-#pragma GCC poison CPU_INTERRUPT_HARD
-#pragma GCC poison CPU_INTERRUPT_EXITTB
-#pragma GCC poison CPU_INTERRUPT_HALT
-#pragma GCC poison CPU_INTERRUPT_DEBUG
-#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
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 467896c..ca917d8 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -375,6 +375,63 @@ CPUState *qemu_get_cpu(int index);
  */
 bool cpu_exists(int64_t id);
 
+/**
+ * CPUInterruptFlags:
+ * @CPU_INTERRUPT_HARD: External hardware interrupt pending.
+ * This is typically used for interrupts from devices.
+ * @CPU_INTERRUPT_EXITTB: 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.
+ * @CPU_INTERRUPT_HALT: Halt the CPU.
+ * @CPU_INTERRUPT_DEBUG: Debug event pending.
+ * @CPU_INTERRUPT_SSTEP_MASK: The set of all bits that should be masked
+ * when single-stepping.
+ *
+ * Flags for #CPUState.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.
+ */
+enum CPUInterruptFlags {
+    CPU_INTERRUPT_HARD      = 0x0002,
+    CPU_INTERRUPT_EXITTB    = 0x0004,
+    CPU_INTERRUPT_HALT      = 0x0020,
+    CPU_INTERRUPT_DEBUG     = 0x0080,
+
+#if defined(CONFIG_SOFTMMU) || defined(CONFIG_USER_ONLY)
+    /* Several target-specific external hardware interrupts.
+     * Each target/cpu.h should define proper names based on them.
+     */
+    CPU_INTERRUPT_TGT_EXT_0 = 0x0008,
+    CPU_INTERRUPT_TGT_EXT_1 = 0x0010,
+    CPU_INTERRUPT_TGT_EXT_2 = 0x0040,
+    CPU_INTERRUPT_TGT_EXT_3 = 0x0200,
+    CPU_INTERRUPT_TGT_EXT_4 = 0x1000,
+
+    /* Several target-specific internal interrupts.  These differ from the
+     * preceding 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.
+     */
+    CPU_INTERRUPT_TGT_INT_0 = 0x0100,
+    CPU_INTERRUPT_TGT_INT_1 = 0x0400,
+    CPU_INTERRUPT_TGT_INT_2 = 0x0800,
+    CPU_INTERRUPT_TGT_INT_3 = 0x2000,
+
+    /* First unused bit: 0x4000. */
+
+    CPU_INTERRUPT_SSTEP_MASK = CPU_INTERRUPT_HARD |
+                               CPU_INTERRUPT_TGT_EXT_0 |
+                               CPU_INTERRUPT_TGT_EXT_1 |
+                               CPU_INTERRUPT_TGT_EXT_2 |
+                               CPU_INTERRUPT_TGT_EXT_3 |
+                               CPU_INTERRUPT_TGT_EXT_4,
+#endif
+};
+
 #ifndef CONFIG_USER_ONLY
 
 typedef void (*CPUInterruptHandler)(CPUState *, int);
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-16 15:58 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16 15:57 [Qemu-devel] [PATCH qom-cpu v2 00/29] QOM CPUState, part 10: CPU loops Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 01/29] kvm: Change kvm_cpu_synchronize_state() argument to CPUState Andreas Färber
2013-06-17 19:48   ` Richard Henderson
     [not found]   ` <51BF360E.8090402@redhat.com>
2013-06-18 16:36     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 02/29] kvm: Change cpu_synchronize_state() " Andreas Färber
2013-06-17 19:46   ` Richard Henderson
2013-06-17 20:58     ` Andreas Färber
2013-06-17 21:02       ` Richard Henderson
2013-06-17 21:09         ` Andreas Färber
2013-06-18  9:39   ` Igor Mammedov
2013-06-21 10:25     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 03/29] gdbstub: Simplify find_cpu() Andreas Färber
2013-06-17 19:54   ` Richard Henderson
2013-06-19 17:30     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 04/29] cpu: Change cpu_exit() argument to CPUState Andreas Färber
2013-06-17 19:59   ` Richard Henderson
2013-06-17 21:00     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 05/29] cpus: Change cpu_thread_is_idle() " Andreas Färber
2013-06-17 20:00   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 06/29] cpus: Change qemu_kvm_wait_io_event() " Andreas Färber
2013-06-17 20:02   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 07/29] kvm: Change kvm_set_signal_mask() " Andreas Färber
2013-06-17 16:15   ` Paolo Bonzini
2013-06-17 20:03   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 08/29] cpus: Change qemu_kvm_init_cpu_signals() " Andreas Färber
2013-06-17 20:04   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 09/29] cpu: Turn cpu_dump_{state, statistics}() into CPUState hooks Andreas Färber
2013-06-17 20:12   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 10/29] kvm: Change kvm_handle_internal_error() argument to CPUState Andreas Färber
2013-06-17 16:16   ` Paolo Bonzini
2013-06-17 20:13   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 11/29] kvm: Change kvm_cpu_exec() " Andreas Färber
2013-06-17 16:17   ` Paolo Bonzini
2013-06-17 20:14   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 12/29] gdbstub: Set gdb_set_stop_cpu() " Andreas Färber
2013-06-17 20:15   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 13/29] cpus: Change cpu_handle_guest_debug() " Andreas Färber
2013-06-17 20:17   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 14/29] cpus: Change qemu_kvm_start_vcpu() " Andreas Färber
2013-06-17 20:18   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 15/29] cpus: Change qemu_dummy_start_vcpu() " Andreas Färber
2013-06-17 20:19   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 16/29] cpu: Change qemu_init_vcpu() " Andreas Färber
2013-06-17 20:23   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 17/29] hwaddr: Make hwaddr type usable beyond softmmu Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 18/29] cpu: Turn cpu_unassigned_access() into a CPUState hook Andreas Färber
2013-06-17 20:34   ` Richard Henderson
2013-06-21 10:31     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 19/29] cpu: Replace cpu_single_env with CPUState cpu_single_cpu Andreas Färber
2013-06-16 20:49   ` Blue Swirl
2013-06-18 16:52     ` Andreas Färber
2013-06-19 12:59       ` Paolo Bonzini
2013-06-17 20:40   ` Richard Henderson
2013-06-21 10:32     ` Andreas Färber
2013-07-15 14:56   ` Paolo Bonzini
2013-07-15 15:20     ` Andreas Färber
2013-07-15 15:29       ` Paolo Bonzini
2013-07-18 10:25         ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 20/29] kvm: Change kvm_remove_all_breakpoints() argument to CPUState Andreas Färber
2013-06-17 16:17   ` Paolo Bonzini
2013-06-27 15:58     ` Andreas Färber
2013-06-17 20:41   ` Richard Henderson
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 21/29] cpu: Make first_cpu and next_cpu CPUState Andreas Färber
2013-06-17 16:20   ` Paolo Bonzini
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 22/29] linux-user: Change thread_env to CPUState Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 23/29] bsd-user: " Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 24/29] cpu: Drop qemu_for_each_cpu() Andreas Färber
2013-06-16 20:26   ` Michael S. Tsirkin
2013-06-16 20:30     ` Peter Maydell
2013-06-16 20:36       ` Michael S. Tsirkin
2013-06-16 20:41     ` Andreas Färber
2013-06-16 15:57 ` Andreas Färber [this message]
2013-06-17 20:59   ` [Qemu-devel] [PATCH qom-cpu v2 25/29] cpu: Move CPU_INTERRUPT_* to qom/cpu.h Richard Henderson
2013-06-17 21:13     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 26/29] intc/sh_intc: Build sh_intc only once Andreas Färber
2013-06-17 21:08   ` Richard Henderson
2013-06-17 21:17     ` Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 27/29] intc/arm_gic: Build arm_gic " Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 28/29] intc/openpic: Build openpic " Andreas Färber
2013-06-16 15:57 ` [Qemu-devel] [PATCH qom-cpu v2 29/29] timer/arm_mptimer: Build arm_mptimer " Andreas Färber
2013-06-26 14:20 ` [Qemu-devel] [PATCH qom-cpu v2 00/29] QOM CPUState, part 10: CPU loops Andreas Färber

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=1371398269-6213-26-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --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).