From patchwork Sun Jan 15 21:10:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 9517871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 543C2600F6 for ; Sun, 15 Jan 2017 21:16:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 166A128402 for ; Sun, 15 Jan 2017 21:16:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B4872840A; Sun, 15 Jan 2017 21:16:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E6F3528402 for ; Sun, 15 Jan 2017 21:16:33 +0000 (UTC) Received: from localhost ([::1]:52973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSsAC-0002iw-V3 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 15 Jan 2017 16:16:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSs4l-00068z-QF for qemu-devel@nongnu.org; Sun, 15 Jan 2017 16:10:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cSs4k-0002qN-OQ for qemu-devel@nongnu.org; Sun, 15 Jan 2017 16:10:55 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:33041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cSs4k-0002q8-JZ for qemu-devel@nongnu.org; Sun, 15 Jan 2017 16:10:54 -0500 Received: by mail-pg0-x241.google.com with SMTP id 194so3586007pgd.0 for ; Sun, 15 Jan 2017 13:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VLr38pgavQKSaeuNSCV3BpZnLVxXArPAHoZFtxLjZpo=; b=T08AYwie9vKJVk/glR0Nw/2zscGZqasPelTuqG4Y2TXwwyW2UuSB0hSITPPUCjaUaL b3Wz8jga0C1uki+d79n0VF8T9sH5C3EBinZFrLlOCtwePiIqWVu2qAjtI4XuQ/mmIOQW loE2Ln4I28vyPFwnETXXxjFj9zj9ipVUWy2Euzy9ie6keSeyJN8uJKDSW8OF9Rnt26r4 oMBKebhPus9eld5JA71o+1Ua/TrBh84V8ed+DDsIqXv8t87NTVURgiJ1PGFtBjROxFzO VxvDAm6JvPWNa1D7tF9sLBBMfCD/4j7W92j6o+Z37lvCu9eS6b7buWCv3W3Wy8t6JRBf aCwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VLr38pgavQKSaeuNSCV3BpZnLVxXArPAHoZFtxLjZpo=; b=UfkNBKmgnqSseCmxw+cKNpesk9lDGkL269H5eiMNc0p+hnc679JDiMxfe3VyFhCqRk gnCSqF6y4ITYmlDOGieNRLP+6Gmu6wXXIh8d0rvlXCkuT+dek3+1U+N/NqQv2bJj7hKU Sz9RtoeT5LqucURq4EXh4BVgCjJm6znK2uEiBcqLwgsQGjkRm+Bzw0Q9sAYjRzd0dI4g rO8kNwphjnK5/pjrfKxOv1GSeDe0zmgFpkGUpOy+nw2nWPqCyKcop11B+elSqqcAgTS6 56/moVxzEHQ1Tkgdpu9PdaE/0J9HQy0OVHBUsSHPw24ZnLqo6SwzeTL4CPcLEdih9huW 7MpA== X-Gm-Message-State: AIkVDXJ1GV1i1+msvMhYvUlLMhuQd+Ff8IGs0UEWGtQGB9HrWBrDFng7isqD9k3hGo6h2A== X-Received: by 10.84.216.24 with SMTP id m24mr45592366pli.22.1484514653903; Sun, 15 Jan 2017 13:10:53 -0800 (PST) Received: from octofox.net (c-73-202-152-109.hsd1.ca.comcast.net. [73.202.152.109]) by smtp.gmail.com with ESMTPSA id y15sm42626323pgc.43.2017.01.15.13.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Jan 2017 13:10:53 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Sun, 15 Jan 2017 13:10:15 -0800 Message-Id: <1484514617-11726-6-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1484514617-11726-1-git-send-email-jcmvbkbc@gmail.com> References: <1484514617-11726-1-git-send-email-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PATCH 5/7] target/xtensa: tests: fix timer tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Don't expect that CCOUNT increments are equal to the number of executed instructions. Verify that timer interrupt does not fire before the programmed CCOMPARE value and does fire after. Signed-off-by: Max Filippov --- tests/tcg/xtensa/test_timer.S | 61 +++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/tests/tcg/xtensa/test_timer.S b/tests/tcg/xtensa/test_timer.S index f8c6f74..9e6012d 100644 --- a/tests/tcg/xtensa/test_timer.S +++ b/tests/tcg/xtensa/test_timer.S @@ -1,12 +1,22 @@ #include "macros.inc" +#define CCOUNT_SHIFT 4 +#define WAIT_LOOPS 20 + +.macro make_ccount_delta target, delta + rsr \delta, ccount + rsr \target, ccount + sub \delta, \target, \delta + slli \delta, \delta, CCOUNT_SHIFT + add \target, \target, \delta +.endm + test_suite timer test ccount rsr a3, ccount rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 1 + assert ne, a3, a4 test_end test ccompare @@ -18,18 +28,18 @@ test ccompare wsr a2, ccompare1 wsr a2, ccompare2 - movi a3, 20 - rsr a2, ccount - addi a2, a2, 20 + make_ccount_delta a2, a15 wsr a2, ccompare0 - rsr a2, interrupt - assert eqi, a2, 0 - loop a3, 1f - rsr a3, interrupt - bnez a3, 2f 1: - test_fail + rsr a3, interrupt + rsr a4, ccount + rsr a5, interrupt + sub a4, a4, a2 + bgez a4, 2f + assert eqi, a3, 0 + j 1b 2: + assert nei, a5, 0 test_end test ccompare0_interrupt @@ -42,9 +52,8 @@ test ccompare0_interrupt wsr a2, ccompare1 wsr a2, ccompare2 - movi a3, 20 - rsr a2, ccount - addi a2, a2, 20 + movi a3, WAIT_LOOPS + make_ccount_delta a2, a15 wsr a2, ccompare0 rsync rsr a2, interrupt @@ -72,9 +81,8 @@ test ccompare1_interrupt wsr a2, ccompare0 wsr a2, ccompare2 - movi a3, 20 - rsr a2, ccount - addi a2, a2, 20 + movi a3, WAIT_LOOPS + make_ccount_delta a2, a15 wsr a2, ccompare1 rsync rsr a2, interrupt @@ -99,9 +107,8 @@ test ccompare2_interrupt wsr a2, ccompare0 wsr a2, ccompare1 - movi a3, 20 - rsr a2, ccount - addi a2, a2, 20 + movi a3, WAIT_LOOPS + make_ccount_delta a2, a15 wsr a2, ccompare2 rsync rsr a2, interrupt @@ -125,11 +132,10 @@ test ccompare_interrupt_masked movi a2, 0 wsr a2, ccompare2 - movi a3, 40 - rsr a2, ccount - addi a2, a2, 20 + movi a3, 2 * WAIT_LOOPS + make_ccount_delta a2, a15 wsr a2, ccompare1 - addi a2, a2, 20 + add a2, a2, a15 wsr a2, ccompare0 rsync rsr a2, interrupt @@ -156,11 +162,10 @@ test ccompare_interrupt_masked_waiti movi a2, 0 wsr a2, ccompare2 - movi a3, 40 - rsr a2, ccount - addi a2, a2, 20 + movi a3, 2 * WAIT_LOOPS + make_ccount_delta a2, a15 wsr a2, ccompare1 - addi a2, a2, 20 + add a2, a2, a15 wsr a2, ccompare0 rsync rsr a2, interrupt