~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to tests/ide-test.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
};
65
65
 
66
66
enum {
 
67
    DEV     = 0x10,
67
68
    LBA     = 0x40,
68
69
};
69
70
 
76
77
enum {
77
78
    CMD_READ_DMA    = 0xc8,
78
79
    CMD_WRITE_DMA   = 0xca,
 
80
    CMD_FLUSH_CACHE = 0xe7,
79
81
    CMD_IDENTIFY    = 0xec,
80
82
 
81
83
    CMDF_ABORT      = 0x100,
120
122
 
121
123
static void ide_test_quit(void)
122
124
{
123
 
    qtest_quit(global_qtest);
 
125
    qtest_end();
124
126
}
125
127
 
126
128
static QPCIDevice *get_pci_device(uint16_t *bmdma_base)
394
396
 
395
397
    /* Read in the IDENTIFY buffer and check registers */
396
398
    data = inb(IDE_BASE + reg_device);
397
 
    g_assert_cmpint(data & 0x10, ==, 0);
 
399
    g_assert_cmpint(data & DEV, ==, 0);
398
400
 
399
401
    for (i = 0; i < 256; i++) {
400
402
        data = inb(IDE_BASE + reg_status);
423
425
    ide_test_quit();
424
426
}
425
427
 
 
428
static void test_flush(void)
 
429
{
 
430
    uint8_t data;
 
431
 
 
432
    ide_test_start(
 
433
        "-vnc none "
 
434
        "-drive file=blkdebug::%s,if=ide,cache=writeback",
 
435
        tmp_path);
 
436
 
 
437
    /* Delay the completion of the flush request until we explicitly do it */
 
438
    qmp("{'execute':'human-monitor-command', 'arguments': { "
 
439
        "'command-line': 'qemu-io ide0-hd0 \"break flush_to_os A\"'} }");
 
440
 
 
441
    /* FLUSH CACHE command on device 0*/
 
442
    outb(IDE_BASE + reg_device, 0);
 
443
    outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE);
 
444
 
 
445
    /* Check status while request is in flight*/
 
446
    data = inb(IDE_BASE + reg_status);
 
447
    assert_bit_set(data, BSY | DRDY);
 
448
    assert_bit_clear(data, DF | ERR | DRQ);
 
449
 
 
450
    /* Complete the command */
 
451
    qmp("{'execute':'human-monitor-command', 'arguments': { "
 
452
        "'command-line': 'qemu-io ide0-hd0 \"resume A\"'} }");
 
453
 
 
454
    /* Check registers */
 
455
    data = inb(IDE_BASE + reg_device);
 
456
    g_assert_cmpint(data & DEV, ==, 0);
 
457
 
 
458
    do {
 
459
        data = inb(IDE_BASE + reg_status);
 
460
    } while (data & BSY);
 
461
 
 
462
    assert_bit_set(data, DRDY);
 
463
    assert_bit_clear(data, BSY | DF | ERR | DRQ);
 
464
 
 
465
    ide_test_quit();
 
466
}
 
467
 
426
468
int main(int argc, char **argv)
427
469
{
428
470
    const char *arch = qtest_get_arch();
453
495
    qtest_add_func("/ide/bmdma/long_prdt", test_bmdma_long_prdt);
454
496
    qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown);
455
497
 
 
498
    qtest_add_func("/ide/flush", test_flush);
 
499
 
456
500
    ret = g_test_run();
457
501
 
458
502
    /* Cleanup */