From nobody Mon Nov 25 00:24:06 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=1719224400; cv=none; d=zohomail.com; s=zohoarc; b=RtiMQrPMaDIHCbHceEcGNEBqldtPg8qyhGQK7RMJH6do9pQZKhdxWnLbGZGGJQihiCdXK2uCEqgmPlow/FyzhqPU68l+TTlcIihhHWwEMil4/PtQFV41o1JbWsYUFPvEGkJkqVvTbQQbvajlCZRnbRmCDUa5BUZtMBZ4xOP28qk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719224400; 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=DnPYMS9aYu3Dj6IJQtGryC0W7EDGLSoROmhQZYsJ9o8=; b=MTK3lvXfbYqVtOMKLlYG+53+OlfPe7an16gEHgjgvpAZd03qJylm4dERg/O4+YkXtHWi8hPWTJonCQ8YRlpPEtg8B0Tv7dddlVZz0MWr48Fu9kdX/f4gD2qF6ZzV/E0/WuPrmxtPWo/GL2QCOq7/oCmBAOSwuohJlX/0pAWV/58= 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 1719224400817509.4070526436511; Mon, 24 Jun 2024 03:20:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLgmf-0006oK-VK; Mon, 24 Jun 2024 06:18:49 -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 1sLgme-0006mc-4E for qemu-devel@nongnu.org; Mon, 24 Jun 2024 06:18:48 -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 1sLgmY-0007gi-Mr for qemu-devel@nongnu.org; Mon, 24 Jun 2024 06:18:47 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a6fe61793e2so92326166b.0 for ; Mon, 24 Jun 2024 03:18:42 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57d303da378sm4442631a12.18.2024.06.24.03.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 03:18:38 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CBC6C5FA1B; Mon, 24 Jun 2024 11:18:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719224321; x=1719829121; 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=DnPYMS9aYu3Dj6IJQtGryC0W7EDGLSoROmhQZYsJ9o8=; b=SkgGU456E/eRQZtALQKNApf6IQXAJEzetyKxLSdL0OxPh9ITqvCih2DW+mCjwLOPRh tRsFof4yWrj214CYktrFMHrE+eBxqpa/CF6yqecSvYsKi7U+yWbNCvN810pkZ/IcgvRh osshWM7tVa8jxn1IWZSNouZTMJJH5acRoeIUKCGcvDyO9K3rRVWu7/m8SMO5kPSaXcSf /+59GeuhAacrZKyYdyGnM+g7nFJfsP87NEbk3Yl9UpsTp9S+kJRg4LqQ/71qMskB9tS4 zeddr9vM2P2Y8dKB4vd9LUFT/FTHaXpo1tPY5UD8dx7xNegJwSLPdhcRTHqy0/MvYhih oKSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719224321; x=1719829121; 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=DnPYMS9aYu3Dj6IJQtGryC0W7EDGLSoROmhQZYsJ9o8=; b=HB9UPveOPwVyvhSL9ricmCRow5jqQBCXuqmVOEKv/J8FB+m/SVe4LJzfmA31JS7V/z TFDp0nM0jihcxZwQXctwq0VD9QubHz1U754Q+Vo+mVxwm02fN6IC2353UDV5RJP551wr oQ6VLbSVz7RCAo7l+MUotmMQGrJMVet+zqn7EiBp+CY9N6vPJ65vVXgxxlmWaG+f+Cc0 qg1OjHFKFDi+lNt/zMeYcG3apKI7zWsRPM7yMSIqFToyzYlInL+IgH0N/EStvXQG6clr foHqmm2iTpHbBYOqmOUy4i6NymDlbiLQw6XIUmhEVUpT3+fSzA2HFPU82UP8eEjNvweE 2NCw== X-Gm-Message-State: AOJu0YyjRtNIqcxIawOrEuOnHy1k5eGqYYJ2VODGajrUPBDwJUMGjro5 6947F6B+f7SHKmm4F42HBfnDMkXFEFdbTJbWnllwrj/ekopJFfyhWRduEaYSW0o= X-Google-Smtp-Source: AGHT+IGwR4NEtHCek9W3waMcRLouJdItHMJoas8iVZ3gRebQxMeepupzKLm8cZoLyvO41bsz0ny7lQ== X-Received: by 2002:a50:ab5b:0:b0:57d:2659:9143 with SMTP id 4fb4d7f45d1cf-57d4bde078cmr2805979a12.37.1719224321011; Mon, 24 Jun 2024 03:18:41 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Pierrick Bouvier , Laurent Vivier , Paolo Bonzini Subject: [PULL 05/12] qtest: use cpu interface in qtest_clock_warp Date: Mon, 24 Jun 2024 11:18:29 +0100 Message-Id: <20240624101836.193761-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624101836.193761-1-alex.bennee@linaro.org> References: <20240624101836.193761-1-alex.bennee@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::635; envelope-from=alex.bennee@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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719224402681100005 This generalises the qtest_clock_warp code to use the AccelOps handlers for updating its own sense of time. This will make the next patch which moves the warp code closer to pure code motion. From: Alex Benn=C3=A9e Acked-by: Thomas Huth Signed-off-by: Pierrick Bouvier Message-Id: <20240530220610.1245424-3-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-Id: <20240620152220.2192768-6-alex.bennee@linaro.org> diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index b5d5fd3463..45f3b7e1df 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -36,6 +36,7 @@ void qtest_server_set_send_handler(void (*send)(void *, c= onst char *), void qtest_server_inproc_recv(void *opaque, const char *buf); =20 int64_t qtest_get_virtual_clock(void); +void qtest_set_virtual_clock(int64_t count); #endif =20 #endif diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index f6056ac836..53182e6c2a 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -52,6 +52,7 @@ static void qtest_accel_ops_class_init(ObjectClass *oc, v= oid *data) =20 ops->create_vcpu_thread =3D dummy_start_vcpu_thread; ops->get_virtual_clock =3D qtest_get_virtual_clock; + ops->set_virtual_clock =3D qtest_set_virtual_clock; }; =20 static const TypeInfo qtest_accel_ops_type =3D { diff --git a/system/qtest.c b/system/qtest.c index 507a358f3b..5be66b0140 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -332,14 +332,14 @@ int64_t qtest_get_virtual_clock(void) return qatomic_read_i64(&qtest_clock_counter); } =20 -static void qtest_set_virtual_clock(int64_t count) +void qtest_set_virtual_clock(int64_t count) { qatomic_set_i64(&qtest_clock_counter, count); } =20 static void qtest_clock_warp(int64_t dest) { - int64_t clock =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + int64_t clock =3D cpus_get_virtual_clock(); AioContext *aio_context; assert(qtest_enabled()); aio_context =3D qemu_get_aio_context(); @@ -348,7 +348,7 @@ static void qtest_clock_warp(int64_t dest) QEMU_TIMER_ATTR_ALL); int64_t warp =3D qemu_soonest_timeout(dest - clock, deadline); =20 - qtest_set_virtual_clock(qtest_get_virtual_clock() + warp); + cpus_set_virtual_clock(cpus_get_virtual_clock() + warp); =20 qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]); --=20 2.39.2