From patchwork Thu May 30 17:49:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 800201 Delivered-To: patch@linaro.org Received: by 2002:a5d:65c4:0:b0:35b:5a80:51b4 with SMTP id e4csp358941wrw; Thu, 30 May 2024 10:51:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5PGOW5ayScEJVsP66xqynR4q1pgVx1Lf29zUfPIfh4sb2PZfMcyL0WoxszkNPQJprgYfk7tg3Xhnq+l/I0isM X-Google-Smtp-Source: AGHT+IEiwK2inKXq604nfcIUaa3eQsKh9A0KGuc4Nx0eBr31/oEBCTr0saVK8iN6Qb6YaxQJPhFu X-Received: by 2002:a05:6808:1704:b0:3c8:6543:584b with SMTP id 5614622812f47-3d1dcd20f7fmr3208238b6e.54.1717091496700; Thu, 30 May 2024 10:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717091496; cv=none; d=google.com; s=arc-20160816; b=Ss+hAqIJsyKP/FnOvqLZqPD9kZ/Qbat9lR1qhQdNEfbjchKzBftGqrpa0PdVsu5JPE hvcCbl+5Dkbimmwknd7sIeEcvqxwKxFrV8XoKTvBiydEWz/rRFQbIQBtgG2I1/1HS/RK +3CnKrBZtPNMCKVg9Hn8h4FH6A4g7bcdna/jf9Icrz9H/nKfeDaluXeuLJWmN56p3cf2 mp+XjX8RDpCCFpjTd3A+dgIedMOdfqUUIi9hKdVCU+Kgk9FQPUjmVp6+QxtAQaUOww/A NdBk+OyL1kP/iFtzBszhQhsVNjco40vLicduteoI/acqOIIuW769lfrX5wW2MEt/Yvoe PbiA== 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=N8fpp15niTkZ3IPMy6ehe10O59rmldsghTOZNCkMcuE=; fh=cf3Q/5dJyAanhqpbGSZv6kxpEC/hZ4CRqZ3z5yvqhQw=; b=TYSMHDpTmDZGR9SuCK4dAm6mk52VZ8SgBy6w0mejjs4TEkK5xS01IGepCNY22QJRA/ +GCeWMJNDT0YwB905+4jm8C0NVjzoFM8ZpDkoYeK3owlAiE1ocPdXZHMnT5uIvuh0mnt k7tJ47RTiCxy+wT6S/UcJDHsGy+nPegm2kp7DzPsk1ALQIlgfn/z/wdz2hT43oHM+t0A Pi0FEBgfvEJBQPBZLeVTzpONx2n1/s3fVgojW8M6F5fOjJTbM9pjyAGYUhzcPyp9LaN2 SF1jb1Xw9kuSFnbhvXTO+KAVjoN9X28r2gL6ugWW59tdagw9Otk1VNPb6/EJ0diXOhnW pq7A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W3reaMr1; 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 6a1803df08f44-6ae4b42cd13si1258946d6.529.2024.05.30.10.51.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 May 2024 10:51:36 -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=W3reaMr1; 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 1sCjuX-0003rW-Hc; Thu, 30 May 2024 13:49:57 -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 1sCjuV-0003qu-Gq for qemu-devel@nongnu.org; Thu, 30 May 2024 13:49:55 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCjuT-0002SG-8h for qemu-devel@nongnu.org; Thu, 30 May 2024 13:49:55 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1f44b45d6abso8042455ad.0 for ; Thu, 30 May 2024 10:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717091391; x=1717696191; 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=N8fpp15niTkZ3IPMy6ehe10O59rmldsghTOZNCkMcuE=; b=W3reaMr1N9cVY5tN/SJOoavOaYYDvJnVaHFC2zVzsrcmYgJNb/i9psC2CgYYYVgnhj OXCjSDBmjEpEGrBV4DTbFClZJUAmOYWvkL2Gdhxorpv21t6+SVdVgqnsPa+Xg5uPvOuK 5XdFUUj3PH30vQvg7ZJitiW30/SLk4tJEVG7zT0Jc/92PIotwf9WSuCASq1mgttX9BBY KGOu/xYdQ6Es32Tseq3YtSnGP0Ll8k2MGOYbvn6aCbciX92TPAHXCgjOq52NeZolQyeh kjaG64oPyYYVhgkgA6uXX7a2qD9xaDODdFPkn47aitG8KyhNwOIFjUzdRBk43ZEniTj8 rAsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717091391; x=1717696191; 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=N8fpp15niTkZ3IPMy6ehe10O59rmldsghTOZNCkMcuE=; b=QiUM71OLQ4xjrKS2daEve7ijrvLMnx7jiNHYBDsPUdR7u9V4nSTYM+vZGNqLUqDJXK w343Su0ly7hDZizbcOWg+jiw9HSVmBhmPe/sLx0stRl7KHUYd7zGGC4jiNpNaIoik6YL lMnNqXXd2RBS8nKg2ChK138a8SZVsPOINBEHkgGBeTw0a8aRfFOs+HKf1OlB0TN4G57Q BOyNSXw9BtR2KSwyl8t4zM2ywPwuSyxyLTtLaAyqbmYRtPRanLv8idka2RdmlN84DltX Dp/WaHYgDKWILYFZVd7hpJiAe7F3Yh/7xv2wXYoYh+NqCeoDd9/TP7YNZ2AUW+juJZAp fVFA== X-Gm-Message-State: AOJu0YzUj58oYegDgvKKD0D3x7Nvwdjc3my3S6D+RjHdlbxmMtVTZL5G lDL/65xFY+t4YYeEfQjQGaqUu7tIBXlCA5TDCzngbeX528hyHyz0Juzeb1qe8ubCQ4sp1oA2hsI jhsA= X-Received: by 2002:a17:902:c94b:b0:1f4:89e2:b47b with SMTP id d9443c01a7336-1f61992ee59mr33274415ad.50.1717091390928; Thu, 30 May 2024 10:49:50 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::e697]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323deb38sm590405ad.124.2024.05.30.10.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:49:50 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Alexandre Iooss , Mahmoud Mandour , Paolo Bonzini , Pierrick Bouvier Subject: [PATCH v2 2/6] qtest: use cpu interface in qtest_clock_warp Date: Thu, 30 May 2024 10:49:35 -0700 Message-Id: <20240530174939.749163-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240530174939.749163-1-pierrick.bouvier@linaro.org> References: <20240530174939.749163-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée 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ée Signed-off-by: Alex Bennée Acked-by: Thomas Huth Signed-off-by: Pierrick Bouvier --- include/sysemu/qtest.h | 1 + accel/qtest/qtest.c | 1 + system/qtest.c | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index b5d5fd34637..45f3b7e1df5 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -36,6 +36,7 @@ void qtest_server_set_send_handler(void (*send)(void *, const char *), void qtest_server_inproc_recv(void *opaque, const char *buf); int64_t qtest_get_virtual_clock(void); +void qtest_set_virtual_clock(int64_t count); #endif #endif diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index f6056ac8361..53182e6c2ae 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -52,6 +52,7 @@ static void qtest_accel_ops_class_init(ObjectClass *oc, void *data) ops->create_vcpu_thread = dummy_start_vcpu_thread; ops->get_virtual_clock = qtest_get_virtual_clock; + ops->set_virtual_clock = qtest_set_virtual_clock; }; static const TypeInfo qtest_accel_ops_type = { diff --git a/system/qtest.c b/system/qtest.c index 6da58b3874e..ee8b139e982 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); } -static void qtest_set_virtual_clock(int64_t count) +void qtest_set_virtual_clock(int64_t count) { qatomic_set_i64(&qtest_clock_counter, count); } static void qtest_clock_warp(int64_t dest) { - int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + int64_t clock = cpus_get_virtual_clock(); AioContext *aio_context; assert(qtest_enabled()); aio_context = qemu_get_aio_context(); @@ -348,7 +348,7 @@ static void qtest_clock_warp(int64_t dest) QEMU_TIMER_ATTR_ALL); int64_t warp = qemu_soonest_timeout(dest - clock, deadline); - qtest_set_virtual_clock(qtest_get_virtual_clock() + warp); + cpus_set_virtual_clock(cpus_get_virtual_clock() + warp); qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]);