From patchwork Wed Jul 1 17:09:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 490254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 54A541401EF for ; Thu, 2 Jul 2015 03:10:05 +1000 (AEST) Received: from localhost ([::1]:60246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZALWN-0002sM-En for incoming@patchwork.ozlabs.org; Wed, 01 Jul 2015 13:10:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZALVy-0002Ia-FT for qemu-devel@nongnu.org; Wed, 01 Jul 2015 13:09:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZALVw-0002iq-Fp for qemu-devel@nongnu.org; Wed, 01 Jul 2015 13:09:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZALVv-0002iY-P2 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 13:09:35 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 82D2A347DCF for ; Wed, 1 Jul 2015 17:09:35 +0000 (UTC) Received: from localhost (ovpn-112-80.ams2.redhat.com [10.36.112.80]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t61H9W8E023918; Wed, 1 Jul 2015 13:09:34 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Wed, 1 Jul 2015 18:09:31 +0100 Message-Id: <1435770571-9906-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: John Snow , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] qtest/ide: add another short PRDT test flavor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The existing short PRDT test case does not transfer any data because the first PRD is less than 1 sector. This patch adds another short PRDT test case where the first sector can be read but the PRDT is still smaller than the requested number of sectors. This exercises a different code path in ide_dma_cb(). Cc: John Snow Signed-off-by: Stefan Hajnoczi Reviewed-by: John Snow --- tests/ide-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/ide-test.c b/tests/ide-test.c index 78382e9..4a07e3a 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -339,6 +339,31 @@ static void test_bmdma_short_prdt(void) assert_bit_clear(inb(IDE_BASE + reg_status), DF | ERR); } +static void test_bmdma_one_sector_short_prdt(void) +{ + uint8_t status; + + /* Read 2 sectors but only give 1 sector in PRDT */ + PrdtEntry prdt[] = { + { + .addr = 0, + .size = cpu_to_le32(0x200 | PRDT_EOT), + }, + }; + + /* Normal request */ + status = send_dma_request(CMD_READ_DMA, 0, 2, + prdt, ARRAY_SIZE(prdt)); + g_assert_cmphex(status, ==, 0); + assert_bit_clear(inb(IDE_BASE + reg_status), DF | ERR); + + /* Abort the request before it completes */ + status = send_dma_request(CMD_READ_DMA | CMDF_ABORT, 0, 2, + prdt, ARRAY_SIZE(prdt)); + g_assert_cmphex(status, ==, 0); + assert_bit_clear(inb(IDE_BASE + reg_status), DF | ERR); +} + static void test_bmdma_long_prdt(void) { uint8_t status; @@ -592,6 +617,8 @@ int main(int argc, char **argv) qtest_add_func("/ide/bmdma/setup", test_bmdma_setup); qtest_add_func("/ide/bmdma/simple_rw", test_bmdma_simple_rw); qtest_add_func("/ide/bmdma/short_prdt", test_bmdma_short_prdt); + qtest_add_func("/ide/bmdma/one_sector_short_prdt", + test_bmdma_one_sector_short_prdt); qtest_add_func("/ide/bmdma/long_prdt", test_bmdma_long_prdt); qtest_add_func("/ide/bmdma/no_busmaster", test_bmdma_no_busmaster); qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown);