From patchwork Sat Mar 8 22:58:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 871619 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp347492wri; Sat, 8 Mar 2025 15:05:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXhdZU2WwEMAoYF7DobTzc8ul9jwpZXJ1KRlsgN5i3pvljfF27YqAE6dd5cuGcOV2StH1SAIw==@linaro.org X-Google-Smtp-Source: AGHT+IGK9b0+wydC7WGHIkHBTyqGXAjlhhQ1rY8sxfQ5o+sIuDd1sRlF+TxR+92KzHHYlfkK5JlN X-Received: by 2002:a05:620a:63c4:b0:7c3:d79c:9c3b with SMTP id af79cd13be357-7c4e167798dmr1450613285a.5.1741475154851; Sat, 08 Mar 2025 15:05:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741475154; cv=none; d=google.com; s=arc-20240605; b=dpm/6fB96GzrWv3Dfn453rIZa4iwD9bbNKTgF4WmWdOOcaWX4/uU6Ej+kYVRUXrs59 0++b3pg9KwYOumrGU3uTa+o/4eQ0BW/pF6YpEoYVVcR/1yw/hoO4nVL5nojh2Bq0/Yky d/qDtjgf/bJVXj9GlpQBrATt+7GxWbXlXkF0+aRANvPUkRXhzqcw/Bc9vIzrgy27FLDX U1y+OuRobejE9us5/1Z4KQXu4FKsdEN3LKaToSyWsHXEz+I4X32L/NXlebhSwICKXmwi /br6PEMdj2TgmnGQ5IismaIu5G4kj667EKOCo9rcmXxlSZ07FvwSLpL+ICxle+lUbjrM WDYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ky+UumnxoIb+tnFry+ljy4Y3+GeAuN7ZJzdcCFzcPCY=; fh=i/pWNGcx7KiR3ewgypxpPkuORYlkCnVXLqKVm9/UgNc=; b=QNPqmvIYOSzAaDU9+rBXELTJbQenu8PsqIW4U3LWxZf83N46e7E9CD2PdlG+5Yp5TV lhrwxJPGBBJfe5U8GwSXuH95LCGavatUQhDuS8swosPPa/koYRW4Dtgup+ky5UZPe2kl 51bUKl6Biig5UJP7akvFgPrLg/7r01GCxdJvquDCB3PhUmMOD+WitiyQYKYgb6Hy5Z8Z +y+OIng8NfW4V/QgDr3bXEQRo59RUM4NgsRTT9fAfMo+QM98SavEZ8/n6ZmJxDXrPnu2 ACxLEdNtkpsFT7npOCOZySHr/hCmjVoTcjQuPLrZranHTeAbJct2ZOIZ9CqazLB1sQ2F pTyQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FuJ6GJPs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c3e551fe01si642927785a.403.2025.03.08.15.05.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 Mar 2025 15:05:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FuJ6GJPs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tr38x-0004q2-Jr; Sat, 08 Mar 2025 17:59:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tr38Q-0004X5-Fh for qemu-devel@nongnu.org; Sat, 08 Mar 2025 17:59:10 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tr38O-0005Ka-3o for qemu-devel@nongnu.org; Sat, 08 Mar 2025 17:59:09 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-223594b3c6dso54087205ad.2 for ; Sat, 08 Mar 2025 14:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741474746; x=1742079546; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ky+UumnxoIb+tnFry+ljy4Y3+GeAuN7ZJzdcCFzcPCY=; b=FuJ6GJPsIFnwjls7icYgZPqyl+X2Oce/Az9nrMy04hsdAG9F8LP89IekRIvD3uS6x9 5fxRvmQp37+8WwuRVooxh4lRcgdilKQqBDvrsjC2A6NIeFKrgj3xw7ZBNxMWrlQk5SUr OtxVNsjuTRwVbHK96ne3zX5RIot/DUgPdGkHMdkw/7kSIkj2lEYmclR0iNiIpmaol0/R ++r/iE2LpGc7/mTdzOl8TEOsuGUtH0Jo3YFcW4ZUVDLfBVNXTtfAtmD1mZpseyXE/KAA 7M//i3QcebgEGUjuezSHX1FEY5X+8XUEoRhzxjua6h9bQHq+79YxaDIevJ0wfIf5EyuS UymQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741474746; x=1742079546; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ky+UumnxoIb+tnFry+ljy4Y3+GeAuN7ZJzdcCFzcPCY=; b=E493kJBbV2UVMiqLRRf8DdRKGlV2cyRg1pRCQ2SRwcaOR6MfGJnZbBn3OIjWBrLRUe I8Z97pHLgRqerP7cesFJjJLOjaH5zdfXzhMODa/YIKwarU6NIX8Lrn7W5KJFpUixcm/7 zLcd89CZO5SQ8GeuhYdxjGahZ27khAPGMvcG2VpkXChdk7+rma8AXfFHyBtOYEnvRfME 4Z6ay0Bl44BH6QpRqcfBi3MBfbvEzUrvHKHmI0zphTIlPXmURPG2y+efdOpLHoVwu04K BZ4sue/qanTva00HtI6zGRTHIn+4plnO6xwT7BAt6a8VK2zNKvJv12FGE2RWd3bvqapn ovRg== X-Gm-Message-State: AOJu0YwaOxGB7rReSr4KlPVLxSoU/KJf5xNRLL2I9k/FfUFE1dk8wUMe 3dBBJii0NqcmZvTpkrvNt54wN36G9MaMyvACUCL7xvs1MBsxN3r3LcZ0SnUvHFHpffCaCrKhMtl F X-Gm-Gg: ASbGncu0IZK5aaaAEc14F87jrprD4ZfeIGGxUB5XK/MOuDrSVIAx878ITir1yIqLcCn 5inpTvvUDZrJrUByJWdBlaly/LNNw1JxQ9tguWbXY8riVsej9U/JJ/z+yVtCuBm4U0qW/eMJ0Kl l4i1t7KmtldD+c/nnXzhVWOupCKsF2S23Y8p6bQ/XolBR96p5KL8gUYBoaI4VE/iMnmAKAw77Mg RBCtnYW6M5YZx2+1AjU4+S/R64su3o0kfPX4B309lkoCj0hILR0tl/hJRshJFSyG+eSlBGrVBpZ jkfqrfVDi4x5ChSDKLn4zN+b5F7CNhu/0B3gnTRioqwM2Sj0nC8R5V8uH0sV7d3HPojzxQn4xSA i X-Received: by 2002:a17:902:cccf:b0:224:194c:694c with SMTP id d9443c01a7336-22428aaeb6dmr169373625ad.28.1741474746633; Sat, 08 Mar 2025 14:59:06 -0800 (PST) Received: from stoup.. (174-21-74-48.tukw.qwest.net. [174.21.74.48]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22410a908a0sm51831175ad.162.2025.03.08.14.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Mar 2025 14:59:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 04/23] include/exec: Split out exec/cpu-interrupt.h Date: Sat, 8 Mar 2025 14:58:43 -0800 Message-ID: <20250308225902.1208237-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250308225902.1208237-1-richard.henderson@linaro.org> References: <20250308225902.1208237-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Some of these bits are actually common to all cpus; while the reset have common reservations for target-specific usage. While generic code cannot know what the target-specific usage is, common code can know what to do with the bits, e.g. single-step. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 53 +-------------------------- include/exec/cpu-interrupt.h | 70 ++++++++++++++++++++++++++++++++++++ include/exec/poison.h | 13 ------- 3 files changed, 71 insertions(+), 65 deletions(-) create mode 100644 include/exec/cpu-interrupt.h diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 8f7aebb088..9e6724097c 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -21,6 +21,7 @@ #include "exec/page-protection.h" #include "exec/cpu-common.h" +#include "exec/cpu-interrupt.h" #include "exec/memory.h" #include "exec/tswap.h" #include "hw/core/cpu.h" @@ -109,58 +110,6 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val CPUArchState *cpu_copy(CPUArchState *env); -/* 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 - -/* Reset signal. */ -#define CPU_INTERRUPT_RESET 0x0400 - -/* 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 0x0800 -#define CPU_INTERRUPT_TGT_INT_2 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) - #include "cpu.h" #ifdef CONFIG_USER_ONLY diff --git a/include/exec/cpu-interrupt.h b/include/exec/cpu-interrupt.h new file mode 100644 index 0000000000..40715193ca --- /dev/null +++ b/include/exec/cpu-interrupt.h @@ -0,0 +1,70 @@ +/* + * Flags for use with cpu_interrupt() + * + * Copyright (c) 2003 Fabrice Bellard + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef CPU_INTERRUPT_H +#define CPU_INTERRUPT_H + +/* + * 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 + +/* Reset signal. */ +#define CPU_INTERRUPT_RESET 0x0400 + +/* + * 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 0x0800 +#define CPU_INTERRUPT_TGT_INT_2 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) + +#endif /* CPU_INTERRUPT_H */ diff --git a/include/exec/poison.h b/include/exec/poison.h index 35721366d7..8ed04b3108 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -46,19 +46,6 @@ #pragma GCC poison TARGET_PHYS_ADDR_SPACE_BITS -#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 - #pragma GCC poison CONFIG_ALPHA_DIS #pragma GCC poison CONFIG_HPPA_DIS #pragma GCC poison CONFIG_I386_DIS