From patchwork Sat Sep 16 21:41:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723613 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1029029wro; Sat, 16 Sep 2023 14:45:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRlQwplrTHQrtV3kYsDU/4nMirs18khTMlGXs9Gr8MCiNTKusgbQcT/zuYnh9YRIA8ZAoU X-Received: by 2002:ac8:1205:0:b0:417:a514:72cd with SMTP id x5-20020ac81205000000b00417a51472cdmr2129343qti.19.1694900735357; Sat, 16 Sep 2023 14:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694900735; cv=none; d=google.com; s=arc-20160816; b=H2Txw51y/EakyxTjyP6vBfy/W0P3hntcDesk8pz4l+7HN9KOXwUjCV9Va7jXgwGKKR d7CW+wRBKZiwHUYTOZ9ql6Wy+k+6vu0jfG2LvwTopeFf0ZrenWY0GwSW+rfyXXS+FmMS boyRoirU8fzSQiu4k/HbWqK5o4NAHrXsamu8yInQcWeWsnwHR6qufp5E5ld1PkU2/25t CbLSZXFtX3XdiofTrMOhwflIroY1TCV0o5shT7la3l3JXjG2iwtGawoQ3rpKpWk6gVIW ibU9nX1uaJXVZnbNk1pNWjwCf2q5dj3Cxs+EHvSH8O/Rvf9aJnQEZk/Pl4k/Bu1SxNF4 zZog== 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=CzEQfKezgAt65j3pfMrIbIQsqXw7idxv2pPTvZtkhzo=; fh=d3q967Ss27yOZEBNWb7WV1pwIIYORDjfLhLmomzC17w=; b=GYojgTjshEkyRXcFJ6SVrAmIRFRgonr/du+ytM3ZqUpXfYWL6i/6Q/gm/7pm5//+Uk nLrNCZDVNTnCjFcyCEKTUMaadyUbD4cSul983q6m/bhdl3XLV5AnxQQNigVRU9noe6LU THumXTBeUgSGPtwrx1dukzb93pFaiot3pMP16Ndoqd8KyS0qBPmBUztyjorTsr/28MTl j2GQOp7dlNeDVbf9EF1PX3/fK13tUtnmfo1RcGdLH6J408acs8ERETcDDojGgM2LmJTJ vIjZ/wDyBwlsxkZMCJ47k1BBTyKlYWhcZqQIlf7I5kj+Qv50JmlTirY6snPXg2dydFCz FbyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=isuMucsf; 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 t34-20020a05622a182200b00417979ae590si2971040qtc.539.2023.09.16.14.45.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2023 14:45:35 -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=isuMucsf; 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 1qhd3m-0006OF-Bj; Sat, 16 Sep 2023 17:42:38 -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 1qhd34-0005D2-8h for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:54 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhd30-0000Ub-QN for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:53 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6c0d6fef60cso2057733a34.1 for ; Sat, 16 Sep 2023 14:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694900510; x=1695505310; 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=CzEQfKezgAt65j3pfMrIbIQsqXw7idxv2pPTvZtkhzo=; b=isuMucsfou+3yVWs8gno62tE3kXr+Kj4Cfp299AsL1Q3ZQ3Z7Ck+zXpBlZiK/mfNA+ jWwjVgAii0eFkUICj9UE4nju12y/n5HICbDfjfEzaOQ9Z98uY1wgUXgJwQSCuXevNNWE MgGgo50CTAcsFlSNu4DfKCyUtDiFfcuNYSSSw5Ogq2WtoRcQ/inGAKrrz+6HHQETE1Sb fiRExmjfjTbKgY++IOeIdQWxYUU1dWVLypjgc9ES8vybZFdV58ESOxtH0OCPYUclo0KL crWZuyyFj332yjlOaALfDZi/hFxEE6xX+rC1AJarK2VL/Ke2tgmKurhKqF6L1wO4TrvY YamQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694900510; x=1695505310; 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=CzEQfKezgAt65j3pfMrIbIQsqXw7idxv2pPTvZtkhzo=; b=WkSVYS7vd39i0EySQe8xZ+6yuf4NV8ed90Nrapv39xnoUQf49ztkRaSFdle7ETtnMv bu5uuoAFxwZUUB0qzFuikfp5wlR4W0Vf/MbcOLFX2YOrWQeGtwXfgGpS9/T7S0BrtC8J GvTMbAqzZ2m8+iD2fL3U7PEvYaoZ0V2bsdhSxJXGrK1m6CmE5kfvqQTYKNSB0FuTx7WO TGlXguFFvbBZRnWXa+OF+10pyVYo0vti2zOAc9zVs+WuLO4436kK1+IXtnQhGQuE/VGb Cc0ZUXlDlEAk8IZyhx+a07J+QiQnUSn0DLOjwqaRYEw6smqtprYrqqAMQaa+IIGPVdto Yuhw== X-Gm-Message-State: AOJu0YyQcX02i4fNnugVOIx4pVFJgpDId+mrNbXfToVN/zjmp7n74jlL FfzeSDIfq2YO4+xuHg9kRuwTchotXeiywyGJqfI= X-Received: by 2002:a05:6358:430c:b0:129:d242:f782 with SMTP id r12-20020a056358430c00b00129d242f782mr6754060rwc.0.1694900509723; Sat, 16 Sep 2023 14:41:49 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id n21-20020aa79055000000b0068fde95aa93sm4871708pfo.135.2023.09.16.14.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 14:41:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, anjo@rev.ng Subject: [PATCH v3 25/39] exec: Move cpu_loop_foo() target agnostic functions to 'cpu-common.h' Date: Sat, 16 Sep 2023 14:41:09 -0700 Message-Id: <20230916214123.525796-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916214123.525796-1-richard.henderson@linaro.org> References: <20230916214123.525796-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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 From: Philippe Mathieu-Daudé 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 Message-Id: <20230914185718.76241-3-philmd@linaro.org> Signed-off-by: Richard Henderson --- 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