From nobody Tue Apr 15 10:55:53 2025 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=1615228463; cv=none; d=zohomail.com; s=zohoarc; b=IppS5kjBJrqtpP0C6MWNqB9ZUt/1fYPGSS2aK1XY9va3WqM0iF8YpG5WX6uapYf2szX5WmQiL4nhlCOwd6Z+wuycibO1FLA0989ZEsqipSS5R0PW74xs5zpvjM6eAGnNyiqbr8j1AA7MTf26wFoIv3yUMXYw0mm4J5ukyESTZJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615228463; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ziICIXGPvQZza0uMOa3mR8fWI7bLdTpYK7osvD3e7VI=; b=Mm0ptl4ij93qFPBM9rqbOl74xKwD8Oyrp589JB2eDQCpo/IHVcpZ6GavKuW7Dpvg0Bh1TJv/+NuaNQrKOGNtdlEPqIo2OG0H8qeEa3M16ZqiCV5O7hWqwPUyAhiL+6rET67MFc0uMiDyO2imhHXHTKlZLAFz0jEipwRUA7Vobo8= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161522846303119.94934905146249; Mon, 8 Mar 2021 10:34:23 -0800 (PST) Received: from localhost ([::1]:35188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJKhx-0000rl-OT for importer@patchew.org; Mon, 08 Mar 2021 13:34:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJJlE-0007Kn-TW for qemu-devel@nongnu.org; Mon, 08 Mar 2021 12:33:40 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:43826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJJku-0007Aa-W1 for qemu-devel@nongnu.org; Mon, 08 Mar 2021 12:33:40 -0500 Received: by mail-wm1-x330.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so1354751wmj.2 for ; Mon, 08 Mar 2021 09:33:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id i10sm18628217wrs.11.2021.03.08.09.33.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 09:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ziICIXGPvQZza0uMOa3mR8fWI7bLdTpYK7osvD3e7VI=; b=N7sdkzGgAZ3RxRvkjnnuaS6tLGu/n1RfpsjL88Jb3x25HR21pHCjgjSd+mjyA9NDAj zWZtT7N3NIORASnHU0cC3As/SMCM2+fjktOSl/BnSX5s3t3QpMK6mDpfBz1T5rNSAfdf wJ3Q74fsAe76k40iBuAPxS9hzWUp4G/e+37OhvmogzlyyDsLbKPl6GeEwZaM0vIyYZok GWC/NWi2EEL4BNcryiK/QwfKmSjY9sQC0POU+kxYGiK0w3F6ZMtxRaWspkxxMJ317JBu ruaaj0cDM0NUxa6BlA83nyjApXyfaCQz+wmfd80R6eCbfryfALUwUJKbZchl3oHQPCuo 2mHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ziICIXGPvQZza0uMOa3mR8fWI7bLdTpYK7osvD3e7VI=; b=rmuD2LPjpPRTZqIzDA5QZjRBrPJ9eqGjB1OyMyG/LxVZB1ZrcyK12Dvj6OoKByLALi 7WqRlMRb7Typ76dMaLLOR3+MByKbk34rSDbq/rFHqq0G3GEUDe0L3r1TuXbtM/z3nef6 IeVf5ynIMZ6IhrLG4p10X3b+Flo7OofUQqISJUf3bCLF7NrUSD4zya6MQJnHzQlvT58/ VuD6bdNLmDQ0B/gVB/+CBPzOcDT/ehsA73MOCblBHnp51smjlBhXIzV6zwxihh/oLPOg KRQHGMrg+E6Yx2J7ZkXWknrBrx+t5nvjjSeSTOIhKr+jGevktwiRGJ1l+kHcJGF6szNq zPPA== X-Gm-Message-State: AOAM532Mv+e000Xdg5d1Top5Zn+2arriFDx6Zyt6LST78yENJ4PP0jBK u6x4Q6dXLBQGsd8Z5dQD4iFwryefdyTJFg== X-Google-Smtp-Source: ABdhPJz807v0nf9G8n02jyy7pmgefxuLfuSF3rRdajZLcQu0GKcD46b0wyVyZE4lDH0v5f3Z1+45Jw== X-Received: by 2002:a05:600c:1992:: with SMTP id t18mr3035296wmq.125.1615224799635; Mon, 08 Mar 2021 09:33:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 46/54] tests/qtest/sse-timer-test: Test counter scaling changes Date: Mon, 8 Mar 2021 17:32:36 +0000 Message-Id: <20210308173244.20710-47-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210308173244.20710-1-peter.maydell@linaro.org> References: <20210308173244.20710-1-peter.maydell@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::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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.23 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" X-ZohoMail-DKIM: pass (identity @linaro.org) Test that when we change the scaling of the system counter that the system timer responds appropriately. Signed-off-by: Peter Maydell Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/sse-timer-test.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/qtest/sse-timer-test.c b/tests/qtest/sse-timer-test.c index f4f6704b308..a65d7542d51 100644 --- a/tests/qtest/sse-timer-test.c +++ b/tests/qtest/sse-timer-test.c @@ -189,6 +189,37 @@ static void test_timer(void) g_assert_cmpuint(readl(TIMER_BASE + CNTP_AIVAL_HI), =3D=3D, 0x42); } =20 +static void test_timer_scale_change(void) +{ + /* + * Test that the timer responds correctly to counter + * scaling changes while it has an active timer. + */ + reset_counter_and_timer(); + /* Give ourselves access to the timer, and enable the counter and time= r */ + writel(PERIPHNSPPC0, 1); + writel(COUNTER_BASE + CNTCR, 1); + writel(TIMER_BASE + CNTP_CTL, 1); + /* Set the CompareValue to 4000 ticks */ + writel(TIMER_BASE + CNTP_CVAL_LO, 4000); + writel(TIMER_BASE + CNTP_CVAL_HI, 0); + /* Advance halfway and check ISTATUS is not set */ + clock_step_ticks(2000); + g_assert_cmpuint(readl(TIMER_BASE + CNTP_CTL), =3D=3D, 1); + /* Reprogram the counter to run at 1/16th speed */ + writel(COUNTER_BASE + CNTCR, 0); + writel(COUNTER_BASE + CNTSCR, 0x00100000); /* 1/16th normal speed */ + writel(COUNTER_BASE + CNTCR, 5); /* EN, SCEN */ + /* Advance to where the timer would have fired and check it has not */ + clock_step_ticks(2000); + g_assert_cmpuint(readl(TIMER_BASE + CNTP_CTL), =3D=3D, 1); + /* Advance to where the timer must fire at the new clock rate */ + clock_step_ticks(29996); + g_assert_cmpuint(readl(TIMER_BASE + CNTP_CTL), =3D=3D, 1); + clock_step_ticks(4); + g_assert_cmpuint(readl(TIMER_BASE + CNTP_CTL), =3D=3D, 5); +} + int main(int argc, char **argv) { int r; @@ -199,6 +230,7 @@ int main(int argc, char **argv) =20 qtest_add_func("/sse-timer/counter", test_counter); qtest_add_func("/sse-timer/timer", test_timer); + qtest_add_func("/sse-timer/timer-scale-change", test_timer_scale_chang= e); =20 r =3D g_test_run(); =20 --=20 2.20.1