From patchwork Sat Apr 30 22:24:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 93526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 86D1BB6F29 for ; Sun, 1 May 2011 08:25:06 +1000 (EST) Received: from localhost ([::1]:53848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGIb1-0007nf-Gm for incoming@patchwork.ozlabs.org; Sat, 30 Apr 2011 18:25:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGIaf-0007jX-5p for qemu-devel@nongnu.org; Sat, 30 Apr 2011 18:24:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGIae-0004hD-92 for qemu-devel@nongnu.org; Sat, 30 Apr 2011 18:24:41 -0400 Received: from mail-px0-f173.google.com ([209.85.212.173]:54253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGIad-0004h1-Vn for qemu-devel@nongnu.org; Sat, 30 Apr 2011 18:24:40 -0400 Received: by pxi16 with SMTP id 16so1464927pxi.4 for ; Sat, 30 Apr 2011 15:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=7Cdlg2VqYBAZJK/8c+Qxo0exfV2U0/aTO1oHj4J1Mhg=; b=uPvFqUippnyxrix6I8LPhJ60PQIKyGpN1U8rp2dDSSB0DaKJyCe6/b4qgzTdit6tbu LuKNPSvdceiqSnSrAgbzvSF7ddXiDTmISviGh+eOKhW2QX2Uzl+dQl1mos01DgT3QDNX ILnl1PYMBq11nzfJtNbuNK75/M4jjl3YxrqRQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=VyEjU9/EXmOaZTNjq1UblEDbkM8gfBlrAO2sEWYLVU9zsPtV4Anvp5U0/zvCFI6sLs mKlnxWMQh8qPBVh/WqKU4F5tnIQ/dw6VW9ytfy9KoJPRLvoYi6Mgo9NIX5uJKqbU6pBq 3HPyKCAkFq93Ami8MtMF+me+LxyTjCxnUOvbI= Received: by 10.68.51.129 with SMTP id k1mr3236761pbo.343.1304202279131; Sat, 30 Apr 2011 15:24:39 -0700 (PDT) Received: from localhost.localdomain (are.twiddle.net [75.101.38.216]) by mx.google.com with ESMTPS id y7sm2797195pbk.30.2011.04.30.15.24.38 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 30 Apr 2011 15:24:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 30 Apr 2011 15:24:24 -0700 Message-Id: <1304202271-24730-2-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1304202271-24730-1-git-send-email-rth@twiddle.net> References: <1304202271-24730-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.173 Cc: Blue Swirl , Aurelien Jarno Subject: [Qemu-devel] [PATCH 1/8] irq: Introduce CPU_INTERRUPT_TGT_* defines. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 0bae6df..8c3222e 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 + void cpu_interrupt(CPUState *s, int mask); void cpu_reset_interrupt(CPUState *env, int mask); 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