qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 09/30] ide-test: Check what happens with bus mastering disabled
Date: Thu, 31 Oct 2013 16:48:23 +0100	[thread overview]
Message-ID: <1383234524-372-10-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1383234524-372-1-git-send-email-kwolf@redhat.com>

The main goal is that qemu doesn't crash.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/ide-test.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/ide-test.c b/tests/ide-test.c
index 7307f1d..bc824a8 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -81,6 +81,7 @@ enum {
     CMD_IDENTIFY    = 0xec,
 
     CMDF_ABORT      = 0x100,
+    CMDF_NO_BM      = 0x200,
 };
 
 enum {
@@ -192,6 +193,11 @@ static int send_dma_request(int cmd, uint64_t sector, int nb_sectors,
         g_assert_not_reached();
     }
 
+    if (flags & CMDF_NO_BM) {
+        qpci_config_writew(dev, PCI_COMMAND,
+                           PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
+    }
+
     /* Select device 0 */
     outb(IDE_BASE + reg_device, 0 | LBA);
 
@@ -352,6 +358,25 @@ static void test_bmdma_long_prdt(void)
     assert_bit_clear(inb(IDE_BASE + reg_status), DF | ERR);
 }
 
+static void test_bmdma_no_busmaster(void)
+{
+    uint8_t status;
+
+    /* No PRDT_EOT, each entry addr 0/size 64k, and in theory qemu shouldn't be
+     * able to access it anyway because the Bus Master bit in the PCI command
+     * register isn't set. This is complete nonsense, but it used to be pretty
+     * good at confusing and occasionally crashing qemu. */
+    PrdtEntry prdt[4096] = { };
+
+    status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512,
+                              prdt, ARRAY_SIZE(prdt));
+
+    /* Not entirely clear what the expected result is, but this is what we get
+     * in practice. At least we want to be aware of any changes. */
+    g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR);
+    assert_bit_clear(inb(IDE_BASE + reg_status), DF | ERR);
+}
+
 static void test_bmdma_setup(void)
 {
     ide_test_start(
@@ -493,6 +518,7 @@ int main(int argc, char **argv)
     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/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);
 
     qtest_add_func("/ide/flush", test_flush);
-- 
1.8.1.4

  parent reply	other threads:[~2013-10-31 15:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 15:48 [Qemu-devel] [PULL v2 00/30] Block patches Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 01/30] qapi: fix documentation example Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 02/30] qcow2: Restore total_sectors value in save_vmstate Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 03/30] qcow2: Unset zero_beyond_eof " Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 04/30] qemu-img: add special exit code if bdrv_check is not supported Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 05/30] block/vpc: check that the image has not been truncated Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 06/30] qemu-iotests: Test for loading VM state from qcow2 Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 07/30] qcow2: Flush image after creation Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 08/30] exec: Fix bounce buffer allocation in address_space_map() Kevin Wolf
2013-10-31 15:48 ` Kevin Wolf [this message]
2013-10-31 15:48 ` [Qemu-devel] [PULL 10/30] tests: Multiboot mmap test case Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 11/30] block: Don't copy backing file name on error Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 12/30] sheepdog: explicitly set copies as type uint8_t Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 13/30] sheepdog: pass copy_policy in the request Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 14/30] ahci: fix win7 hang on boot Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 15/30] block: Disable BDRV_O_COPY_ON_READ for the backing file Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 16/30] block: Avoid unecessary drv->bdrv_getlength() calls Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 17/30] qemu-iotests: Fix 051 reference output Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 18/30] qemu-iotests: drop duplicated "create_image" Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 19/30] qemu-iotests: Test case for backing file deletion Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 20/30] sheepdog: check return values of qemu_co_recv/send correctly Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 21/30] sheepdog: handle vdi objects in resend_aio_req Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 22/30] sheepdog: reload inode outside of resend_aioreq Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 23/30] coroutine: add co_aio_sleep_ns() to allow sleep in block drivers Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 24/30] sheepdog: try to reconnect to sheepdog after network error Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 25/30] sheepdog: make add_aio_request and send_aioreq void functions Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 26/30] sheepdog: cancel aio requests if possible Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 27/30] sheepdog: check simultaneous create in resend_aioreq Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 28/30] qemu-iotests: prefill some data to test image Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 29/30] qapi: Add optional field 'compressed' to ImageInfo Kevin Wolf
2013-10-31 15:48 ` [Qemu-devel] [PULL 30/30] vmdk: Implment bdrv_get_specific_info Kevin Wolf
2013-10-31 16:13   ` Eric Blake
2013-10-31 16:20     ` Kevin Wolf
2013-11-01  9:32       ` Fam Zheng
2013-10-31 20:50 ` [Qemu-devel] [PULL v2 00/30] Block patches Anthony Liguori
2013-10-31 21:52   ` Paolo Bonzini
2013-11-01  7:22     ` Anthony Liguori
2013-11-04 11:00   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383234524-372-10-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).