From nobody Wed Nov 27 02:34:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1701964043; cv=none; d=zohomail.com; s=zohoarc; b=gHqS56Gx2nJDuS/LQIi16NwItqHIksBt6wYDcPxpoelkYoulCdV8QcYsZt0epGHiRZwWjTjwdFsBUBRBLovZ4QZKFlt2JWqhMYtnuHens0MXtJOecOoBwuwQSNXZKRGQZsP1Sqgcp4F5PzosrJ92SCMikCR0rxhw/8uL7vlcVJw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701964043; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aTaowFnx2H+uQC34ffSxi316ffYwhZaQm2jWOVPrZuQ=; b=QXBNdlJOxbcN6sCBWJcsBZ2NcJ4fv8Qozz+W+VKroYsIEeLaKsOOQ15JuYbKW5UFX1HIivbDmNW+P321gyKtKQmKqxihjoiMDZCxFSPsYt38CMpMAxQkpFQNuP2mRKImDffCImIyKUm7A73C8rNGpTZ0dA26BbX6L+pfy32DnrA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701964043902908.0976929601647; Thu, 7 Dec 2023 07:47:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBGaM-0000xz-Me; Thu, 07 Dec 2023 10:46:46 -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 1rBGa5-0000p7-P7 for qemu-devel@nongnu.org; Thu, 07 Dec 2023 10:46:29 -0500 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBGa0-0002DI-Ou for qemu-devel@nongnu.org; Thu, 07 Dec 2023 10:46:29 -0500 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9fa2714e828so133733766b.1 for ; Thu, 07 Dec 2023 07:46:23 -0800 (PST) Received: from m1x-phil.lan ([176.187.202.111]) by smtp.gmail.com with ESMTPSA id u13-20020a17090626cd00b00a1e8fa8b1f1sm973463ejc.79.2023.12.07.07.46.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Dec 2023 07:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701963983; x=1702568783; 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=aTaowFnx2H+uQC34ffSxi316ffYwhZaQm2jWOVPrZuQ=; b=yh5s31wDOyOF69MMOHFk5N1Yuz/QkIM0x8+nouKPuEf1N+MUIw5DvpsJpj/oOc8RIS gpEK4PcJarN+HE47Fp5Y+kQud2B2VixnnD9OtsWbYS6tbSt40HRdBV0MuPkVjgArGxhH pjaUvwFpRT4FRJFzWGi1hP2f6GBOo1A8QKlebqyUC6DK7FSFW90Xs6K21lKNLQwf/llq KehMGuudxFvSpudp3ht1Cxm5cdEq7ckOENm8E2MzF/hX4wzrW8N2krn9SYTHiQ2X+HXS ED095M3kblTqgd0A/IDXCArk8JuCsqYfDDRv/kfqQdEINahnipyNTPZ3/ikopK17cNHi JGZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701963983; x=1702568783; 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=aTaowFnx2H+uQC34ffSxi316ffYwhZaQm2jWOVPrZuQ=; b=JhsQNqrSx4NUNoVG/kC2wMAaArFOp3EzrJVOvraHOv7voEAm8qFVy+QhkUw5laNDYx 2m6DokBC93nb3gZk5vjKApTj7cxTP2Eepy3aS6Gd/q4BOu+R2MM2+v7QCc/evBYQguIQ dJtsOw9AB+183wS7CCaSmeTpDWWogCZ7DTi14GDvOSByl2pjjR0R3cQpxLUoGFoDpyUP uujrtqVecLfdkf7v839VpiARhbgRGXMwy+1i9TibWEmsEbN1B5wNPRJtjaA1keS1JtU2 oMln+p0/dhdiFHhoIJ8tpHX+8ZhPlBhFO1nITfHy50eAaVXTaENco29GDoKr5uHxnDeN 0sig== X-Gm-Message-State: AOJu0Yxm48shGUaRrshj9LV+cxyOdARUou/s6DmI7jSnqdWi8qulqrAU mu5K16t2ve7Uf6Ia9tOfanz7uJfoOFS/OTwIoDY= X-Google-Smtp-Source: AGHT+IH9OyUELfNSL6kMUBsGE6Luba9SS4Oy+xn8bsHoQR1QGp1lP4ujn8Vw+pyDOZwbb8VwGk6DEA== X-Received: by 2002:a17:906:2c47:b0:a1d:15ac:14fc with SMTP id f7-20020a1709062c4700b00a1d15ac14fcmr1319786ejh.22.1701963982824; Thu, 07 Dec 2023 07:46:22 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Pavel Dovgalyuk , Fam Zheng , Stefan Hajnoczi , Richard Henderson , qemu-block@nongnu.org, Paolo Bonzini , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 5/5] sysemu/replay: Restrict icount to system emulation Date: Thu, 7 Dec 2023 16:45:50 +0100 Message-ID: <20231207154550.65087-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231207154550.65087-1-philmd@linaro.org> References: <20231207154550.65087-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1701964044682100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/cpu-timers.h | 2 +- include/sysemu/replay.h | 11 ++++++++--- stubs/icount.c | 19 ------------------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/include/sysemu/cpu-timers.h b/include/sysemu/cpu-timers.h index e909ffae47..25dfc76599 100644 --- a/include/sysemu/cpu-timers.h +++ b/include/sysemu/cpu-timers.h @@ -30,7 +30,7 @@ typedef enum { ICOUNT_ADAPTATIVE =3D 2, } ICountMode; =20 -#ifdef CONFIG_TCG +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) extern ICountMode use_icount; #define icount_enabled() (use_icount) #else diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 08aae5869f..8102fa54f0 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -1,6 +1,3 @@ -#ifndef SYSEMU_REPLAY_H -#define SYSEMU_REPLAY_H - /* * QEMU replay (system interface) * @@ -11,6 +8,12 @@ * See the COPYING file in the top-level directory. * */ +#ifndef SYSEMU_REPLAY_H +#define SYSEMU_REPLAY_H + +#ifdef CONFIG_USER_ONLY +#error Cannot include this header from user emulation +#endif =20 #include "exec/replay-core.h" #include "qapi/qapi-types-misc.h" @@ -79,12 +82,14 @@ int64_t replay_save_clock(ReplayClockKind kind, int64_t= clock, int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount); /*! Saves or reads the clock depending on the current replay mode. */ #define REPLAY_CLOCK(clock, value) \ + !icount_enabled() ? (value) : \ (replay_mode =3D=3D REPLAY_MODE_PLAY = \ ? replay_read_clock((clock), icount_get_raw()) \ : replay_mode =3D=3D REPLAY_MODE_RECORD = \ ? replay_save_clock((clock), (value), icount_get_raw()) \ : (value)) #define REPLAY_CLOCK_LOCKED(clock, value) \ + !icount_enabled() ? (value) : \ (replay_mode =3D=3D REPLAY_MODE_PLAY = \ ? replay_read_clock((clock), icount_get_raw_locked()) \ : replay_mode =3D=3D REPLAY_MODE_RECORD = \ diff --git a/stubs/icount.c b/stubs/icount.c index b060b03a73..9a29084ecc 100644 --- a/stubs/icount.c +++ b/stubs/icount.c @@ -5,30 +5,11 @@ =20 ICountMode use_icount =3D ICOUNT_DISABLED; =20 -void icount_update(CPUState *cpu) -{ - abort(); -} int64_t icount_get_raw(void) { abort(); return 0; } -int64_t icount_get(void) -{ - abort(); - return 0; -} -int64_t icount_to_ns(int64_t icount) -{ - abort(); - return 0; -} -int64_t icount_round(int64_t count) -{ - abort(); - return 0; -} void icount_start_warp_timer(void) { abort(); --=20 2.41.0