From patchwork Mon Aug 20 03:31:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10569859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9DDD1575 for ; Mon, 20 Aug 2018 03:32:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA5DE29134 for ; Mon, 20 Aug 2018 03:32:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CED15291D7; Mon, 20 Aug 2018 03:32:37 +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,HK_RANDOM_FROM, MAILING_LIST_MULTI,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 9E83029134 for ; Mon, 20 Aug 2018 03:32:36 +0000 (UTC) Received: from localhost ([::1]:44897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fravh-000793-Uz for patchwork-qemu-devel@patchwork.kernel.org; Sun, 19 Aug 2018 23:32:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frauv-0006ph-7j for qemu-devel@nongnu.org; Sun, 19 Aug 2018 23:31:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frauu-0001Qb-IM for qemu-devel@nongnu.org; Sun, 19 Aug 2018 23:31:45 -0400 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:34453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frauu-0001QF-Bj for qemu-devel@nongnu.org; Sun, 19 Aug 2018 23:31:44 -0400 Received: by mail-lf1-x141.google.com with SMTP id g9-v6so4557517lfh.1 for ; Sun, 19 Aug 2018 20:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5eGhZbCr4fTlfPgKlEUAFl9aYe/Y1JMUQ1iTb3+LD0g=; b=hD2KtbSCzLOSPLOvBl+1xBWmn1A64Hxt5ZHn/9iTgujXuIJw6T61wrbFHX8BxrFDhJ /QewCVmce8ehkW2j7SDrhf/kQjOhHbArFW/bj+EQsizNv10lwQWJh22fyqFUoCA0+eyu fuqmhEvAzzD089bz6OB9GyI5A8qQJUXGnvUnmYfk4pxRCgZgXNvD6dOGh2dmEe0Acd35 wvmNItIj2KtAqpTaZCzI3tfwp6HaiQ+Ocji9pRtbOuqQH4J1zspIYcmoBI94DOU/dsvG K89ohs47GVaknRDxO0TQerEzFIuSOaEXPzo0g1etxxrH5VYMw99PN4QpciGKTG7cxWKL Uxpg== 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; bh=5eGhZbCr4fTlfPgKlEUAFl9aYe/Y1JMUQ1iTb3+LD0g=; b=P7L9XsvQMu2McvFnzb96/ZVtFpX/bYDdnN+MDvHCYUxnltnsA7ONC2VafmWgEwizO/ pZvZs486aMEeBz/PdlN3V7/p03hKBmWZhL6l0h95W+vjSj4SpyRgbXsC4X3T9aiA5AEg rc/vaumJvvR3/OcaT0NzlmYYgTS9mI0a1mDQVqNi3kClH3NkU6Dvnds2gA7TxsCPHcbP BVopatgbAC93OnWYQC3B9EmMajstqnp95N/231XrjMyvaRJb4Y6O+bQgVvlQoJ8PCnN9 xGO9P9ZNnIlUDojsSyHRz62lOYXGheFlpj7tBfM6pLes496Qm87O8fseIZT4i4LkS2ds v5Bg== X-Gm-Message-State: AOUpUlFWwCnS1HB8ALUNt61dnU3ZTuycQYYJHtvqm1nSEk5sGGSu1OKm GxnH13mCFIZaHr4jWplzEUWtlX4+3Fk= X-Google-Smtp-Source: AA+uWPyV94lZGhwo8ybFCj438SMARtl052aayioq5ocKYHjXvsy8ZxuPQSCYRzcH122oKHzUL8s3Yg== X-Received: by 2002:a19:d8e8:: with SMTP id r101-v6mr27560010lfi.121.1534735902962; Sun, 19 Aug 2018 20:31:42 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net. (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id m71-v6sm1394484lje.84.2018.08.19.20.31.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Aug 2018 20:31:42 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Sun, 19 Aug 2018 20:31:25 -0700 Message-Id: <20180820033125.10296-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::141 Subject: [Qemu-devel] [PATCH] tests/tcg/xtensa: add test for failed memory transactions 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 Failed memory transactions should raise exceptions 14 (for fetch) or 15 (for load/store) with XEA2. Signed-off-by: Max Filippov --- tests/tcg/xtensa/Makefile | 1 + tests/tcg/xtensa/test_phys_mem.S | 68 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/tcg/xtensa/test_phys_mem.S diff --git a/tests/tcg/xtensa/Makefile b/tests/tcg/xtensa/Makefile index 091518c05583..2f5691f75b09 100644 --- a/tests/tcg/xtensa/Makefile +++ b/tests/tcg/xtensa/Makefile @@ -44,6 +44,7 @@ TESTCASES += test_mmu.tst TESTCASES += test_mul16.tst TESTCASES += test_mul32.tst TESTCASES += test_nsa.tst +TESTCASES += test_phys_mem.tst ifdef XT TESTCASES += test_pipeline.tst endif diff --git a/tests/tcg/xtensa/test_phys_mem.S b/tests/tcg/xtensa/test_phys_mem.S new file mode 100644 index 000000000000..5db17ce506e8 --- /dev/null +++ b/tests/tcg/xtensa/test_phys_mem.S @@ -0,0 +1,68 @@ +#include "macros.inc" + +test_suite phys_mem + +.purgem test_init + +.macro test_init + movi a2, 0xc0000003 /* PPN */ + movi a3, 0xc0000004 /* VPN */ + wdtlb a2, a3 + witlb a2, a3 +.endm + +test inst_fetch_no_phys + set_vector kernel, 1f + + movi a2, 0xc0000000 + jx a2 +1: + movi a2, 0xc0000000 + rsr a3, excvaddr + assert eq, a2, a3 + rsr a3, epc1 + assert eq, a2, a3 + rsr a3, exccause + movi a2, 14 + assert eq, a2, a3 +test_end + +test read_no_phys + set_vector kernel, 2f + + movi a2, 0xc0000000 +1: + l32i a3, a2, 0 + test_fail +2: + movi a2, 0xc0000000 + rsr a3, excvaddr + assert eq, a2, a3 + movi a2, 1b + rsr a3, epc1 + assert eq, a2, a3 + rsr a3, exccause + movi a2, 15 + assert eq, a2, a3 +test_end + +test write_no_phys + set_vector kernel, 2f + + movi a2, 0xc0000000 +1: + s32i a3, a2, 0 + test_fail +2: + movi a2, 0xc0000000 + rsr a3, excvaddr + assert eq, a2, a3 + movi a2, 1b + rsr a3, epc1 + assert eq, a2, a3 + rsr a3, exccause + movi a2, 15 + assert eq, a2, a3 +test_end + +test_suite_end