From patchwork Thu Sep 14 18:57:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 722590 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp559385wro; Thu, 14 Sep 2023 11:58:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVLzJAO0hdrp5Je5EqXK6mX40mh/WiNH5pVUR8vCL1sBKct0slIry8NyoNMMyhM7p3DbuY X-Received: by 2002:a05:6214:20e3:b0:641:8d8c:addd with SMTP id 3-20020a05621420e300b006418d8cadddmr7601995qvk.48.1694717888397; Thu, 14 Sep 2023 11:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694717888; cv=none; d=google.com; s=arc-20160816; b=bidVo+z/9Wh1OH+3aPHzojvdPwmD/p69N6aaBxukHDD7Hh6TsQFx7rxkAOm8AsW5JD g1MAMLdoXyaVWHusFVAqMSZdzVtUpMUfap5B3X4bhnKdfpmpUCYbVsDYJnzNobiftoUk AAcT7f2cNIjuOMb61zPf0hGClXQSoZy/FZ0JdrMVHV+e31DyJTGeT3w9wnfQ+FF5IhhF oatOo/VaJUcvTlmD+lisv+LznGkqZ90pYTKGNXw5BeQyCqPIsIjvFuv17BusxPLYwQGv irKqKnrwWxAW/s+FM42jf2uldRmf1Nh76KxC06IucDPtzgMAvNn3w2vw1IxHg00zsPuK EajQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=zPNAVtdj61Dd1NsUTVG5W7vZpG0MSnrlxikP0a9bkyc=; fh=N22+cq4r3bt3EFi1ekaqHEIttLrOanCgE4ldlzS79LU=; b=btH//WebN7l9UohNpAqfVaC4VXFW4yeWSw4/LNTxMgMewvY4uCFUnYNUO5kabIEdPk xr+Uj6FHZSbt0jkpUakYv9JYo6mv3o+OuMwhdLmc2ltwoST6pwl3VIPCfYt5u7P4iVrR haz/mqLP2PSnUy+X+6b3oh2ANzQvNrP7A+RNER8yoHD6SDtPGL19CoegvFH3QXs16TYh CX5ObLomn89QThmWCd4RKq4sIxT2MgJ/kPFnPWs2qjgrkv9shGfb9aoko+LxI1DUdDbC y/JyVVHBNG6BWhU95Xs9eiXiinRa3Exa7IZ3Izk3k/Rw8kMaeEklVnOoXka+xEBVEjSX 1//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hwf9dN1X; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x15-20020a0cb20f000000b00655e15f4d4asi1210022qvd.339.2023.09.14.11.58.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Sep 2023 11:58:08 -0700 (PDT) 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=hwf9dN1X; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgrX1-0007qs-25; Thu, 14 Sep 2023 14:57:39 -0400 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 1qgrWz-0007qX-Pt for qemu-devel@nongnu.org; Thu, 14 Sep 2023 14:57:37 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgrWx-0007Y7-3R for qemu-devel@nongnu.org; Thu, 14 Sep 2023 14:57:36 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-52889bc61b6so1546038a12.0 for ; Thu, 14 Sep 2023 11:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694717853; x=1695322653; 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=zPNAVtdj61Dd1NsUTVG5W7vZpG0MSnrlxikP0a9bkyc=; b=hwf9dN1XiBHf4iQ7HLqcVWH/kHVlli89AYCXEfqIFJjBWlD8MIES8nF/fJ+zXIWIBA OYoWk2gwTMFiZh1GL58JdlGub6CKL1HbSdcmggDwuJt2Ti/PbEMlzXsKgJlhAHjLKy3q NUGyzwg3sup6qGB4PKBrrLI6XcLhABkkNkiKtSBlD+SDyWWpLNUpFrNYRpC7II1Qrb9m MlzcYKZ1z3uc/mQYs8hHsSdE9try4XqYzOu25IStELkgqEblBz/3OluInqauc8Eow5Y1 R7zVNSCSBKE7VBu9/CTBlUN5cNxkkCuyy0HEnbCl5dvq0Yiwf8HWfoRYV6NibWQF5iTg w5pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694717853; x=1695322653; 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=zPNAVtdj61Dd1NsUTVG5W7vZpG0MSnrlxikP0a9bkyc=; b=DZctj64ikthrC1GQZ9cGb/yUZlgnvnfev0v0OfeiNIuZ+eOygQ93u48zfvhFAwlnJh x4IC+FOSPEhzx89CzVWGV4n0z56E4KFOaMb526l8qUUfTMNddtloe7W/GQdYcjEMpiGy g3Cut0hbX3xsDSBfBreaD779SAkY3TpLJXPb6BNfbkQqkDHTgdcabARnnKTkZWH5WD9n ZP7dRY5OTdCAVKwMN33UCaENQ7vES0/AsOB4QzEJq9xIWkp/zOjrOYdLpzPZeREGHQVC ViphhA623F6XxIv7lXZ+2pXrIRG2m8egDrUwbbYB2ET/a0++t1Yj5oc1ODCPuMRUyMKz rijg== X-Gm-Message-State: AOJu0YzcKSk3+lKQ0OfkP1agqlqLe48PjU4jLSeWVGmhdQ8PQo2+X6hI f7lYx9eBoEMmIYQ5dfe+B0dey7LwDRtbxPR6SS0= X-Received: by 2002:a05:6402:517b:b0:51d:d4c3:6858 with SMTP id d27-20020a056402517b00b0051dd4c36858mr5669878ede.12.1694717853497; Thu, 14 Sep 2023 11:57:33 -0700 (PDT) Received: from m1x-phil.lan (176-131-223-129.abo.bbox.fr. [176.131.223.129]) by smtp.gmail.com with ESMTPSA id d15-20020a056402078f00b0052f8c67a399sm1273708edy.37.2023.09.14.11.57.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Sep 2023 11:57:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Daniel_P=2E_?= =?utf-8?q?Berrang=C3=A9?= , Paolo Bonzini , Thomas Huth , Alessandro Di Federico , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Anton Johansson , Riku Voipio , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 02/11] exec: Move cpu_loop_foo() target agnostic functions to 'cpu-common.h' Date: Thu, 14 Sep 2023 20:57:08 +0200 Message-ID: <20230914185718.76241-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230914185718.76241-1-philmd@linaro.org> References: <20230914185718.76241-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 While these functions are not TCG specific, they are not target specific. Move them to "exec/cpu-common.h" so their callers don't have to be tainted as target specific. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson --- include/exec/cpu-common.h | 32 ++++++++++++++++++++++++++++++++ include/exec/exec-all.h | 30 ------------------------------ 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 360b8298a4..605b160a7e 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -173,4 +173,36 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, /* vl.c */ void list_cpus(void); +#ifdef CONFIG_TCG +/** + * cpu_unwind_state_data: + * @cpu: the cpu context + * @host_pc: the host pc within the translation + * @data: output data + * + * Attempt to load the the unwind state for a host pc occurring in + * translated code. If @host_pc is not in translated code, the + * function returns false; otherwise @data is loaded. + * This is the same unwind info as given to restore_state_to_opc. + */ +bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data); + +/** + * cpu_restore_state: + * @cpu: the cpu context + * @host_pc: the host pc within the translation + * @return: true if state was restored, false otherwise + * + * Attempt to restore the state for a fault occurring in translated + * code. If @host_pc is not in translated code no state is + * restored and the function returns false. + */ +bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc); + +G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); +G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); +#endif /* CONFIG_TCG */ +G_NORETURN void cpu_loop_exit(CPUState *cpu); +G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); + #endif /* CPU_COMMON_H */ diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 2e4d337805..ee90ef122b 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -27,36 +27,6 @@ #include "exec/translation-block.h" #include "qemu/clang-tsa.h" -/** - * cpu_unwind_state_data: - * @cpu: the cpu context - * @host_pc: the host pc within the translation - * @data: output data - * - * Attempt to load the the unwind state for a host pc occurring in - * translated code. If @host_pc is not in translated code, the - * function returns false; otherwise @data is loaded. - * This is the same unwind info as given to restore_state_to_opc. - */ -bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data); - -/** - * cpu_restore_state: - * @cpu: the cpu context - * @host_pc: the host pc within the translation - * @return: true if state was restored, false otherwise - * - * Attempt to restore the state for a fault occurring in translated - * code. If @host_pc is not in translated code no state is - * restored and the function returns false. - */ -bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc); - -G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); -G_NORETURN void cpu_loop_exit(CPUState *cpu); -G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); -G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); - /** * cpu_loop_exit_requested: * @cpu: The CPU state to be tested