From patchwork Sun Apr 28 22:14:35 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: 792925 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423560wrh; Sun, 28 Apr 2024 15:16:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXazini2mzKDWThhZs+RdKGXVVkNcerUgIi0N0pavaFfs3KTNrJwgZzhEmXJ9O0nm7DUNE1My5TfoqIXSwWf/Xx X-Google-Smtp-Source: AGHT+IEBQk5nXZ304NBSOM3b6f6CPDS7OJEPhvpByhYv/oQyhhT1TDOOSZfm/1wAdCwWiRhyCShf X-Received: by 2002:a05:620a:935c:b0:790:f577:30cd with SMTP id sg28-20020a05620a935c00b00790f57730cdmr1262099qkn.20.1714342584740; Sun, 28 Apr 2024 15:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342584; cv=none; d=google.com; s=arc-20160816; b=P4N+geAZdMucp4joZrUleGELTs33V/85C8kbSqWAndZwQmqYo71QBMpEGjTxserWZC 59bTltML9DYKv+1pot+K+MWjbOKaXXJ+Fo+UfPkB5CFzvC079bhYYJGGxEY35Frkawzq ZNBeQ3X4CeXpF11nNoQFE4DeLnjfjbQCBF72LPB2oAmKFZ25DYhqwrNuL8dxDEY7aIzY s3LCBIR8hjdegrMyXV+FI3cIxs+ppm3yUEkGNaY+YdrZVlL/hqqxAJrSXNTDsrnLCSoy 0n0/MG4Hjj/Rk0k56AH3I1kZTD7UrFtJLCkILpItMhTSkMW/RRNEZlpTmSWJzmLd4RZa lkWw== 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=ZwA4gGr9bUP88hrZk3uOFR181roNW8nQo5hO4TYpEMY=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=iMSohf/ULTCiJQfrvkvjkIJcY5AMm4A01qxHlMhCitYD+foZXqn3PMbehL8Bcj6dki vA6S1+aBM1UCHfZRomLL/LYgYSBKE9R2G3Jwt2W2xlHv+R9l18hbvJAsfBlkUAKnGdlL O2skxWQ3LrYaY4uCZ6LmPLDvpJjCMCo2AYUEDXEsTRuUwtb9Ve2TLGQjwpNU6jRBbFLo FEq9IghiLHMiEvZEgoIdR5UK525iEzPehiIU/i8LOB3hSY3fSPiFgFi6z5uNVsMOrSQ+ qb0EfKOad3mK4JTnBiQmm7NGOQhhzhEeCASRmtWgInepGzeUIlb3NR2jORHVGlNBLlJ5 YWKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GwmuzJS9; 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 wh1-20020a05620a56c100b0078d69b785a3si24607291qkn.739.2024.04.28.15.16.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:24 -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=GwmuzJS9; 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 1s1CoK-0006vB-Up; Sun, 28 Apr 2024 18:15:53 -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 1s1CoC-0006Zc-Ul for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:45 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoB-0005dW-77 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:44 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a5557e3ebcaso642111066b.1 for ; Sun, 28 Apr 2024 15:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342541; x=1714947341; 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=ZwA4gGr9bUP88hrZk3uOFR181roNW8nQo5hO4TYpEMY=; b=GwmuzJS9O3ErjeWe35HY0JngSNYtfVGOvx1spgMRk8KlCjUOcczp2tuw/wuTd9T7nF YsOKaZ2gmInwTbbMQFqAmjMHB3tZn+LA4YRxZB9ZR876tRC5V2YdhVXWCiZiN2WslPTi pmTDdlmPKLLIash+XcVySpFq8Fcqst1by0++dZLyCMPhH5hEPgl73NCYS3pCMg92pqdF xkYO7kH5kF0sNVu2LH9vDDhFXZAie6rOlzyL6AdnqhoVXMGn4MkHjHDPvBkEKvQWar6c HEWeUINaAoxThU4SR6V2k8LFSheHl6TvwJ83NRViW7D56SHWgkqx3MoSrZASWwLNq6HN jTwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342541; x=1714947341; 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=ZwA4gGr9bUP88hrZk3uOFR181roNW8nQo5hO4TYpEMY=; b=OA7oJ1ZwGKU7QnTlBJDVDNMD5a9YdE008gsIMHoqC5jdkEwTUgP2b6tzkPxanvp4Sp m+a7vXYpTaILoYp1OFTrK+tA3p3zUubVDQFo/2hu4Zq/kAYrz/ZpHDVA08QsG8hVJwju 0YE59eSQBQZjOorVnhADC0z3+IS3CAYGY/YznBK3zuh48i1q08n5BdnBi4+TNr736RCk mw3uQqrhnG7PJM4pEIcXWeRRC0M/KWrg26/F4VjR19BaZsxxM+ljUbEiH8wIcM2t+axL Z3+pKU8Rb9frjnfZIKWrZb+eGDVLSZdajrtU2qTmwfv95fX6Lpd7Egfyk8gsvtcGTT0c Bl5g== X-Gm-Message-State: AOJu0Yzjz/rf0Rw/QbGsvL+XglsaAYcRxL3WUOW4uHlVNLhA3TxzrhCr MzV+y3g48fK9ff3smLKi07XFrnlFGqoJJFu4o7x0TWVz78Sn/JRyrurGLOmrtZfKMholTQwZtLC H X-Received: by 2002:a17:906:16da:b0:a58:7e28:b6bc with SMTP id t26-20020a17090616da00b00a587e28b6bcmr7246359ejd.17.1714342541564; Sun, 28 Apr 2024 15:15:41 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id bv19-20020a170906b1d300b00a58eabf6082sm2011450ejb.199.2024.04.28.15.15.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 09/24] user: Declare get_task_state() once in 'accel/tcg/vcpu-state.h' Date: Mon, 29 Apr 2024 00:14:35 +0200 Message-ID: <20240428221450.26460-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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 --- 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 be57374b41..65fe95fed1 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 16d9f6ae8c..515af82d8b 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);