From patchwork Mon May 6 12:37:14 2024 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: 795019 Delivered-To: patch@linaro.org Received: by 2002:adf:a453:0:b0:34e:ceec:bfcd with SMTP id e19csp902774wra; Mon, 6 May 2024 05:42:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXqKRoXjbdbp7IgZw65ub5Wn+cxdpTww/tXU5sphEvuJXzk1Q4dfXwo8sp70ieFoqsc1UQqWy0yk2bQtCr23ze3 X-Google-Smtp-Source: AGHT+IH4wEcvtPsYI8tUXbjs+eIk/OIomAI4jGXBiyuUUTI9/WKhoKXQfoIKMrCcMTtuIrjPW390 X-Received: by 2002:a05:6808:30a7:b0:3c7:5146:c4e5 with SMTP id bl39-20020a05680830a700b003c75146c4e5mr13496674oib.41.1714999378566; Mon, 06 May 2024 05:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714999378; cv=none; d=google.com; s=arc-20160816; b=D1pOAm9rXoP/NfV9cRYVV2utUhLNDHMYUMS+Ee0qugm13D0RNeT8jUFDsdP7hx+NZT mPwmYr4RJKWr6sjE5GjcbRpdxAC5Lj4g4HZL0LP0BU/R96/Ht2CtIvzJN+EAMBr/Fb6v F1vakRhgNrZlj5uXPh0mdHM6XO4rAgyGFpY55ZQX2Wb/Yx1U6fHk5T7U3317dFMOlYtC efY3oozabkW+x1ssM9XIhG+42aM/diOnjnKHhXK4YU7vC57daVqmtXYmTbU15g/GCTy8 uPRtSnyABQjRIxED+4I0uv9AA9pMRygk7/0HXdgnCsFzk+90zuacWVjHBk0VPja+cbJr mEow== 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=QDNxZj+xmGVZ6dRFb3MDxJip4ebx+5/K+HgTl2Olyoo=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=RlpkZ4JY/4+43kGTZi9GtGwfCkkpyBP65ewB3ls7YC3GERKa0uMluTB4aNjxw8IvpC 9h9TWWlNpJ0E9Dofv3rFMqk0le4/CnkQS9D/GelsHpPomT1pY3DLzfKa/6trU9tOaU7b RG7zsEXbwK9LsJlXN4UFgi9FFsUdba5/LSqHgM+XCqh/tcfxYmy9cOQ0Rp1uafXRKclu 4Cno+xm7H/UQ9clvU1+fXmzR5cCiqIJPX45gnpEGFyToquM++TQx/OXLUZS1sy+ga+kc k5Xpd5YmVixdxVRA0tJCvZ6GjyB3mtOICB64H4TmHVQgEMxFvYP08CXrw66RONXMP7gY N4og==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K7mO+6M/"; 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 t12-20020a05620a0b0c00b0079295710bf3si2678706qkg.757.2024.05.06.05.42.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 May 2024 05:42:58 -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="K7mO+6M/"; 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 1s3xcu-0003vY-Go; Mon, 06 May 2024 08:39:28 -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 1s3xck-0003YF-II for qemu-devel@nongnu.org; Mon, 06 May 2024 08:39:18 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3xcg-00027S-GD for qemu-devel@nongnu.org; Mon, 06 May 2024 08:39:16 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51f45104ef0so1975408e87.3 for ; Mon, 06 May 2024 05:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714999151; x=1715603951; 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=QDNxZj+xmGVZ6dRFb3MDxJip4ebx+5/K+HgTl2Olyoo=; b=K7mO+6M/yaF6Ti/eESVJUOftA+5vhsMYOGeDyvp3+NMEpYq0kkAlSA/FXg7u2EELhu ke8voxkK87EzauNy+WnRP/pROYR/RzljvwNe44newmk70AUcVMHTHX4128Sv21jGSPO2 7noGfMoPTVA+2XeEEyKOrQZKkzFV/2yPuQhXvcepokKoRHewpKhZdURakfPHtFJc+5ln DvcGtwjnBj+D3B+PbJmwtQ/vbAlvdnUItDoGghE7vnO8SJH2RmVMNjnS4WcU5u5kBRhn odslCjc1QSGeU9DvgA5/ePAxMh6gBfJ7rqcgMyMk8J5Db1lIYLPUCnsupXZ6jirxCjyM Udvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714999151; x=1715603951; 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=QDNxZj+xmGVZ6dRFb3MDxJip4ebx+5/K+HgTl2Olyoo=; b=ZGBDng0mUAF/P42UG+jOWBzrlTJp8XbCW84zvhJH5b0y2FMUjj7ttkVQG44xb2tcem KhLGHTyt3x/F6dMT/qn32YQ2iE6n7Y4h0T1eH0nuGT7mKys1Fh7GMH2RLceueyp6vvv2 eJtN3wfKCy5HgVFF3OYqJvVSqsbnB4ZZaZ1F0qY4ymMv9aAaDeLp4PeccXR+K3Aaz7jU KQSwToyzDe3QAqEs2bnQK6ox7uh2hcEwoi96M3Cra1PJ8pOV5i0T+FQmxnCIcwYayVwv y9RSpwmu+ePKD/XPWqu1UrV1LMRdg2oPYUwcppj9ss318NYHLFzyKErKAoULkyuW4ney jdfg== X-Gm-Message-State: AOJu0YwIRnE+MDlEAuP9ZQJ7kBuBe8TtTA7tT1Akmk29ED2Z+99sSlUI citvRRaxTBWtFl/4WeJLtYMGCPYi+/3POr6+SYMdKB/c1xh3sdglTnmitu13K+bBurGCIMC4je0 5 X-Received: by 2002:ac2:5291:0:b0:51e:f1a6:ac39 with SMTP id q17-20020ac25291000000b0051ef1a6ac39mr6195254lfm.12.1714999151475; Mon, 06 May 2024 05:39:11 -0700 (PDT) Received: from m1x-phil.lan ([176.187.211.4]) by smtp.gmail.com with ESMTPSA id h20-20020a05600c351400b0041be4065adasm16097989wmq.22.2024.05.06.05.39.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 06 May 2024 05:39:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 14/28] user: Declare get_task_state() once in 'accel/tcg/vcpu-state.h' Date: Mon, 6 May 2024 14:37:14 +0200 Message-ID: <20240506123728.65278-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240506123728.65278-1-philmd@linaro.org> References: <20240506123728.65278-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-lf1-x12a.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 each user emulation implentation defines its own TaskState structure, both use the same get_task_state() declaration, in particular in common code (such gdbstub). Declare the method once in "accel/tcg/vcpu-state.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240428221450.26460-10-philmd@linaro.org> --- accel/tcg/vcpu-state.h | 18 ++++++++++++++++++ bsd-user/qemu.h | 6 +----- linux-user/qemu.h | 6 +----- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 accel/tcg/vcpu-state.h diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h new file mode 100644 index 0000000000..e407d914df --- /dev/null +++ b/accel/tcg/vcpu-state.h @@ -0,0 +1,18 @@ +/* + * SPDX-FileContributor: Philippe Mathieu-Daudé + * SPDX-FileCopyrightText: 2023 Linaro Ltd. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef ACCEL_TCG_VCPU_STATE_H +#define ACCEL_TCG_VCPU_STATE_H + +#include "hw/core/cpu.h" + +#ifdef CONFIG_USER_ONLY +static inline TaskState *get_task_state(const CPUState *cs) +{ + return cs->opaque; +} +#endif + +#endif diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 1780f485d6..9d2fc7148e 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -36,6 +36,7 @@ extern char **environ; #include "exec/gdbstub.h" #include "exec/page-protection.h" #include "qemu/clang-tsa.h" +#include "accel/tcg/vcpu-state.h" #include "qemu-os.h" /* @@ -116,11 +117,6 @@ struct TaskState { struct target_sigaltstack sigaltstack_used; } __attribute__((aligned(16))); -static inline TaskState *get_task_state(CPUState *cs) -{ - return cs->opaque; -} - void stop_all_tasks(void); extern const char *interp_prefix; extern const char *qemu_uname_release; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 7df4645c2b..2e90a97175 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -8,6 +8,7 @@ #include "syscall_defs.h" #include "target_syscall.h" +#include "accel/tcg/vcpu-state.h" /* * This is the size of the host kernel's sigset_t, needed where we make @@ -160,11 +161,6 @@ struct TaskState { uint64_t start_boottime; }; -static inline TaskState *get_task_state(CPUState *cs) -{ - return cs->opaque; -} - abi_long do_brk(abi_ulong new_brk); int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, int flags, mode_t mode, bool safe);