From patchwork Fri Mar 7 18:56:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 871246 Delivered-To: patch@linaro.org Received: by 2002:a5d:64c8:0:b0:38f:210b:807b with SMTP id f8csp916184wri; Fri, 7 Mar 2025 10:59:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU1UA7nOMN6lF02CTbTYN8S8em7pAYQNxyM7Qr2absfNyeHDgHQ6Qk3EE2G71ZNHeRoAQ3jCg==@linaro.org X-Google-Smtp-Source: AGHT+IHseMlOT3yrm/b8QyHQ2/gckgannJYR80vLjBM5S8MFrbgZvV5Ztvo5IBoXcGHnUPm2iPyq X-Received: by 2002:a05:620a:2707:b0:7c3:bbe2:d71 with SMTP id af79cd13be357-7c4e61126dcmr646155485a.30.1741373980736; Fri, 07 Mar 2025 10:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741373980; cv=none; d=google.com; s=arc-20240605; b=aichUxGtBRoy99NR68AYdWNxd4vLqlp45e0qmawiO1y0+5167vvDcVz3Hz7yLE+nIW IHmUlBrqg5mC2V2o3HZ7wmcoXo/2Ba/rn+pXkDJHxK72u//PW1/Q3n1SOMk92ijmslYJ P/1NJlVlnNi7OcL8LZruwGulhWh+JitsinXMhgh5KBxpu0VB3r0muJhXXVtjl3eblFQ2 AfhseI+kTw1QpRG7Mdvjx/r8biDg3VRUNkNCMG4pJH182d2griQsH3tleC+wUihK5YK0 Pn8AythElaFLtqWT2EgNQhIFCfcI4yN2sryNiTfn+1DM9RZlVp5pv+dIi+ARUD1fdT0/ 4wUw== 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=jZWYvDukaHCKn8Evm+7YplK9ZxqRKLhmL0oVaH6y4jI=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=ZiD5NVQ/RNhERfvoqkQGeEdaPXHlk0u9eH4oNfDjY+fJyqHDpqjB3/lhmZaLKbZnQO vt2E3VQJnvzLImRt9Zsq9W6wz0urSzwTe8No+6j8r+ujAdQ2jlzqB9TsEj1xMYmZCdhf Cx134+6/JSmBSrAEULyCO0VjQNpcoquPKImXZJULXPM4Vqgmyv8BBDOOQGgSM1Re6NyO S5OrWzVqselQjsZOC19ejG+n+d8ApcLVUuRG7ooeyc/CWsOD9biXt0GfoNMY7MMHFF6m 2+0H7mcp5o4ZZE474v6aqrmHuSeiVp8ZFY6BlfDogkbP657IFx0rXf/Lj7kXMQbKnwAA JVug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fya8TKml; 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 d75a77b69052e-476624490d3si3113181cf.105.2025.03.07.10.59.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Mar 2025 10:59:40 -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=Fya8TKml; 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 1tqcsZ-0007Uw-86; Fri, 07 Mar 2025 13:57:03 -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 1tqcsO-0007RM-PE for qemu-devel@nongnu.org; Fri, 07 Mar 2025 13:56:52 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqcsM-0007lG-PC for qemu-devel@nongnu.org; Fri, 07 Mar 2025 13:56:52 -0500 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2fecba90cc3so4573505a91.2 for ; Fri, 07 Mar 2025 10:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741373809; x=1741978609; 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=jZWYvDukaHCKn8Evm+7YplK9ZxqRKLhmL0oVaH6y4jI=; b=Fya8TKmlPnOFMdrlY5Bhma/yZnzm6/Hshr/iKiiwsjXQUOD2ogmJtHD0Es3I1nvjp6 kzHoZUXDLDe28ywR4SyDTRiBPXDJlI7ULgEyQemBJv73j4D3LM70wokD24XVDfpgNelY ghLcAexY4WxTyFAVSODsON7FBZVgiY93BX8SaqxvDLh0iuEa54zsJ4e7xJOcZAI2OPZx Q4lfmIJw/A6kkAchBYPHkoBWl+kJmEwWDk1ZrWU5A0EO3JDYaKFpoixbYJ74KYZv0fSW IiMPcxiPN4m2PW+lustG5SaKpYY7qdg84Rvzs9vPRco9XQGO0jCCZNZVq3bU0knAR5kj IIHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741373809; x=1741978609; 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=jZWYvDukaHCKn8Evm+7YplK9ZxqRKLhmL0oVaH6y4jI=; b=ci+VbYz1Pz8KupIy72B2z1SsQeBcelDP6qIoCDH/OpYyB5/s/GACpO5ztDZP6dQgeL JRz3d5J3BN6SD6tUORc1dooz79o//9jsrVsff4lG+g+lRT6TN/VWZDXcY2HlSZTIPfFg IFU0iZqlFCrN34W+7a0IlgAajmKWUPexo0ksrmLftwy5m7b6WHW1lnReJOc9z9lztzZr CB5wzqto4MgZoLogVsGppWeRQ51yrH24LKupGZiTjF7yswWGgdiJzE/LM7KHNUg5UdGr VMJncybgI6PNCIJ/JcJrtOjmfzslyqqxw4lFuh/DfcFP9Ev1JgTe88Bxw6OYGTwBHFp+ L+Gw== X-Gm-Message-State: AOJu0YwOBu1SzEZq1yKj+BVoki+K2FJbEN1RTnW/d+0JmbYWu3VZL7ai xTbAJBSfqp4vVD4+KyER1XXWWskYc4j7GaPMVBhE0uolmUnwtmqdmAsERZC2lgUWkuxiboNt2f0 U X-Gm-Gg: ASbGncsZWaTmGRyL54QUr/8eNX5hAgVm9KwOYMcu1YJOLvrWaoFCvEwD6XEx2r2G2U/ 8SpIzBLkjOlphQLIAQx4vdtpvz+DEb8Iw2Ra7JodZLgKRIszvm48FV0hk2WZ9IwyJ9GT2Brg0d7 9BOJ1O+UHyrvWqYOIM16g/1wi5RwTaGB7Hur3I1kUrrTcyMFTJv2ykd49cXILb6GxC1BBYi60Pz j/gkaUGK0xaBo/c1nMINakew0FlbkbVSOSbjnPV9TC+0C1BtKmRNjED9DCn8uEloqxmEtPK8f/F EHmHcBUUT3FXkwkeKhUMXZl9ZxUuup2MiR+vPfkwUQcCkXnBQB4ef1ZIaezRbAk+4flSFei3YQ2 4 X-Received: by 2002:a17:90b:4c:b0:2ff:6a5f:9b39 with SMTP id 98e67ed59e1d1-2ff7ce844b6mr8226390a91.18.1741373808901; Fri, 07 Mar 2025 10:56:48 -0800 (PST) Received: from stoup.. (174-21-74-48.tukw.qwest.net. [174.21.74.48]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ff693534f8sm3391917a91.17.2025.03.07.10.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 10:56:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 01/16] include/exec: Split out exec/cpu-interrupt.h Date: Fri, 7 Mar 2025 10:56:30 -0800 Message-ID: <20250307185645.970034-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250307185645.970034-1-richard.henderson@linaro.org> References: <20250307185645.970034-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé --- 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