summaryrefslogtreecommitdiff
path: root/tests/libqos
AgeCommit message (Collapse)AuthorFilesLines
2015-10-05qtest/ahci: fix redundant assertionJohn Snow1-1/+1
Fixes https://bugs.launchpad.net/qemu/+bug/1497711 (!ncq || (ncq && lba48)) is the same as (!ncq || lba48). The intention is simply: "If a command is NCQ, it must also be LBA48." Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1442868929-17777-1-git-send-email-jsnow@redhat.com
2015-09-18qtest/ahci: export generate_patternJohn Snow2-0/+27
Share the pattern function for ide and ahci test. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1441926555-19471-3-git-send-email-jsnow@redhat.com
2015-09-07i.MX: Add qtest support for I2C device emulator.Jean-Christophe Dubois2-0/+212
This is using a ds1338 RTC chip on the I2C bus. This RTC chip is not present on the real 3DS PDK board. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Acked-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: 05601683a2a95c881cbc9f22651a044d969bd0ae.1441057361.git.jcd@tribudubois.net Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-07-08libqos/ahci: fix ahci_write_fis for ncq on ppc64John Snow2-10/+12
Don't try to correct the endianness of NCQ commands, which do not use any fields wider than a single byte. This corrects the /x86_64/ahci/io/ncq/simple test (and others) for ppc64 BE hosts. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: John Snow <jsnow@redhat.com> Tested-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1436210229-4118-2-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: simple ncq data testJohn Snow2-33/+40
Test the NCQ pathways for a simple IO RW test. Also, test that libqos doesn't explode when running NCQ commands :) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-16-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: Force all NCQ commands to be LBA48John Snow1-1/+1
NCQ commands are LBA48 by definition. See SATA 3.2 13.6.4.1 "READ FPDMA QUEUED", or SATA 3.2 13.6.5.1 "WRITE FPDMA QUEUED." Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-15-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: set the NCQ tag on command_commitJohn Snow1-0/+5
NCQ commands have the concept of a "TAG" that they need to set, but in the AHCI world, it is mandated that the TAG always match the command slot that you executed the NCQ from. See AHCI 9.3.1.1.5.2 "Native Queued Commands". Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-14-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: adjust expected NCQ interruptsJohn Snow1-2/+7
NCQ commands will expect the SDBS interrupt, and in the normative case, do not expect to see a D2H Register FIS unless something went wrong. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-13-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: edit wait to be ncq awareJohn Snow1-3/+7
The wait command should check to make sure SACT is clear as well as the Command Issue register. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-12-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: add NCQ frame supportJohn Snow2-10/+63
NCQ frames are generated a little differently than their non-NCQ cousins. Add support for them. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-11-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: fix cmd_sanity for ncqJohn Snow2-24/+25
NCQ commands should not / do not update the byte count in the command header post command, so this field is meaningless for NCQ tests. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-10-git-send-email-jsnow@redhat.com
2015-07-04libqos/ahci: fix memory management bugsJohn Snow1-2/+4
There's a handful of trivial bugs in the libqos/ahci functions, squish them together. - Zero cached pointers after freeing them - The Command List Buffer is an array of 32x 32 byte structures, not 32x 8 byte pointers -- it's 1MiB, not 256 bytes. Zero it ALL. - Free the correct command in ahci_pick_cmd. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1434470575-21625-4-git-send-email-jsnow@redhat.com
2015-06-17libqos: Complete virtio device ID definition listFam Zheng1-2/+8
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-06-17libqos: Allow calling guest_free on NULL pointerFam Zheng1-0/+3
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-22libqos/ahci: Swap memread/write with bufread/writeJohn Snow1-2/+2
Where it makes sense, use the new faster primitives. For generally small reads/writes such as for the PRDT and FIS packets, stick with the more wasteful but easier to debug memread/memwrite. For ahci-test (before migration tests): With this patch: real 0m3.675s user 0m2.582s sys 0m1.718s Without any qtest protocol improvements: real 0m14.171s user 0m12.072s sys 0m12.527s Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1430864578-22072-6-git-send-email-jsnow@redhat.com
2015-05-22qtest/ahci: add migrate dma testJohn Snow1-0/+1
Write to one guest, migrate, and then read from the other. adjust ahci_io to clear any buffers it creates, so that we can use ahci_io safely on both guests knowing we are using empty buffers and not accidentally re-using data. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-7-git-send-email-jsnow@redhat.com
2015-05-22libqos: Add migration helpersJohn Snow4-17/+145
libqos.c: -set_context for addressing which commands go where -migrate performs the actual migration malloc.c: - Structure of the allocator is adjusted slightly with a second-tier malloc to make swapping around the allocators easy when we "migrate" the lists from the source to the destination. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-4-git-send-email-jsnow@redhat.com
2015-05-22libqos/ahci: Fix sector set methodJohn Snow1-2/+4
|| probably does not mean the same thing as |. Additionally, allow users to submit a prd_size of 0 to indicate that they'd like to continue using the default. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-3-git-send-email-jsnow@redhat.com
2015-05-22libqos/ahci: Add halted command helpersJohn Snow2-0/+30
Sometimes we want a command to halt the VM instead of complete successfully, so it'd be nice to let the libqos/ahci functions cope with such scenarios. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-2-git-send-email-jsnow@redhat.com
2015-04-30misc: Fix new collection of typosStefan Weil1-2/+2
All of them were reported by codespell. Most typos are in comments, one is in an error message. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-04-28libqos: add blkdebug_prepare_scriptJohn Snow2-0/+23
Pull this helper out of ide-test and into libqos, to be shared with ahci-test. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-6-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: Allow override of default CLI optionsJohn Snow2-0/+6
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-3-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: test different disk sectorsJohn Snow2-6/+8
Test sector offset 0, 1, and the last sector(s) in LBA28 and LBA48 modes. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1426274523-22661-3-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: add qcow2 support to ahci-testJohn Snow2-0/+46
This will enable the testing of high offsets without wasting a lot of disk space, and does not impact the previous tests. mkimg and mkqcow2 are added to libqos for other tests. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1426274523-22661-2-git-send-email-jsnow@redhat.com
2015-03-10libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.cMarc Marí1-4/+12
The MSIX interrupt was always acked without checking its value, which caused a race condition. If the ISR was raised between the read and the acking, the ISR was never detected and it timed out. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Reviewed-by: John Snow <jsnow@redhat.com> Tested-by: John Snow <jsnow@redhat.com> Message-id: 1424795655-16952-1-git-send-email-marc.mari.barcelo@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10libqos/ahci: add ahci command helpersJohn Snow2-0/+47
ahci_command_set_flags: Set additional flags in the command header. ahci_command_clr_flags: Clear flags from the command header. ahci_command_set_offset: Change the IO sector from 0. ahci_command_adjust: Adjust many values simultaneously. To be used to adjust the command header if the default values/guesses were incorrect or undesirable. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424905602-24715-4-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> [ kwolf: Fixed conflicting prototype for ahci_command_adjust() ] Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10libqos/ahci: Zero-fill AHCI headersJohn Snow1-1/+1
Even though it's just the reserved space, make sure they're zeroes. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424905602-24715-2-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10libqos: Add virtio MMIO supportMarc Marí2-0/+244
Add virtio MMIO support. Add virtio-blk-test MMIO test case. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1424812915-25728-6-git-send-email-marc.mari.barcelo@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10libqos: Add malloc genericMarc Marí2-0/+60
This malloc is a basic interface implementation that works for any platform. It should be replaced in the future for a real malloc implementation for each of the platforms. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1424812915-25728-5-git-send-email-marc.mari.barcelo@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10libqos: Remove PCI assumptions in constants of virtio driverMarc Marí2-27/+27
Convert PCI-specific constants names of libqos virtio driver. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1424812915-25728-4-git-send-email-marc.mari.barcelo@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10libqos: Change use of pointers to uint64_t in virtioMarc Marí3-21/+23
Convert use of pointers in functions of virtio to uint64_t in order to make it platform-independent. Add casting from pointers (in PCI functions) to uint64_t and vice versa through uintptr_t. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1424812915-25728-2-git-send-email-marc.mari.barcelo@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-02-16libqos/ahci: Add ahci_clean_memJohn Snow4-0/+25
Clean up guest memory being used in ahci_clean_mem, to be called during ahci_shutdown. With all guest memory leaks removed, add an option to the allocator to throw an assertion if a leak occurs. This test adds some sanity to both the AHCI library and the allocator. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-18-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: add ahci_ioJohn Snow2-0/+27
ahci_io is a wrapper around ahci_guest_io that takes a pointer to host memory instead, and will create a guest memory buffer and copy the data to/from as needed and as appropriate for a read/write command, such that after a read, the guest data will be in a host buffer, and for a write, the data will be transmitted to guest memory prior to the block operation. Now that we have all the syntactic sugar functions in place for AHCI, we can convert the identify test to be very, very short. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-17-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add ahci_guest_ioJohn Snow2-0/+17
ahci_guest_io is a shorthand function that will, in one shot, execute a data command on the guest to the specified guest buffer location, in the requested amount. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-16-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: add ahci command size settersJohn Snow2-0/+26
Adds setters for size, prd_size and both via set_sizes. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1423158090-25580-15-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: add ahci command verifyJohn Snow2-0/+16
Helps to verify that a command completed successfully. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-14-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: add ahci command functionsJohn Snow2-0/+220
This patch adds the AHCICommand structure, and a set of functions to operate on the structure. ahci_command_create - Initialize and create a new AHCICommand in memory ahci_command_free - Destroy this object. ahci_command_set_buffer - Set where the guest memory DMA buffer is. ahci_command_commit - Write this command to the AHCI HBA. ahci_command_issue - Issue the committed command synchronously. ahci_command_issue_async - Issue the committed command asynchronously. ahci_command_wait - Wait for an asynchronous command to finish. ahci_command_slot - Get the number of the command slot we committed to. Helpers: size_to_prdtl - Calculate the required minimum PRDTL size from a buffer size. ahci_command_find - Given an ATA command mnemonic, look it up in the properties table to obtain info about the command. command_header_init - Initialize the command header with sane values. command_table_init - Initialize the command table with sane values. [Peter Maydell <peter.maydell@linaro.org> reported the following clang warning: tests/libqos/ahci.c:598:3: warning: redefinition of typedef 'AHCICommand' is a C11 feature [-Wtypedef-redefinition] } AHCICommand; I have replaced typedef struct ... AHCICommand; with struct ... ; --Stefan] Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1423158090-25580-13-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add ide cmd propertiesJohn Snow1-0/+39
Add a structure that defines some properties of various IDE commands. These will be used to simplify the interface to the libqos AHCI calls, lessening the redundancy of specifying and respecifying properties of commands to various helper functions. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1423158090-25580-12-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16qtest/ahci: add ahci_write_fisJohn Snow2-1/+16
Similar to ahci_set_command_header, add a helper that takes an in-memory representation of a command FIS and writes it to guest memory, handling endianness as-needed. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1423158090-25580-11-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16qtest/ahci: Demagic ahci tests.John Snow1-0/+53
Add human-readable command names and other miscellaneous #defines to help make the code more readable. Some of these definitions are not yet used in this current series, but for convenience and sanity they have been lumped together here, as it's more trouble than it is worth in a test suite to hand-pick, one-by-one, which preprocessor definitions are useful per-each test. These definitions include: ATA Command Mnemonics Current expected AHCI sector size FIS magic bytes REG_H2D_FIS flags Command Header flags Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1423158090-25580-10-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add cmd response sanity check helpersJohn Snow2-17/+84
This patch adds a few helpers to help sanity-check the response of the AHCI device after a command. ahci_d2h_check_sanity inspects the D2H Register FIS, ahci_pio_check_sanity inspects the PIO Setup FIS, and ahci_cmd_check_sanity inspects the command header. To support the PIO sanity check, a new structure is added for the PIO Setup FIS type. Existing FIS types (H2D and D2H) have had their members renamed slightly to condense reserved members into fewer fields; and LBA fields are now represented by arrays of 8 byte chunks instead of independent variables. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-9-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add port_check_nonbusy helperJohn Snow2-0/+19
A simple helper that asserts a given port is not busy processing any commands via the TFD, Command Issue and SACT registers. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-8-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add ahci_port_check_interrupts helperJohn Snow2-0/+16
A helper that compares a given port's current interrupts and checks them against a supplied list of expected interrupt bits, and throws an error if they do not match. The helper then resets the requested interrupts on this port, and asserts that the interrupt register is now empty. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-7-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add ahci_port_check_error helperJohn Snow2-0/+23
ahci_port_check_error checks a given port's error registers and asserts that everything from the port-level view is still OK. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-6-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add command header helpersJohn Snow2-5/+87
Adds command header helper functions: -ahci_command_header_set -ahci_command_header_get, -ahci_command_destroy, and -ahci_cmd_pick These helpers help to quickly manage the command header information in the AHCI device. ahci_command_header_set and get will store or retrieve an AHCI command header, respectively. ahci_cmd_pick chooses the first available but least recently used command slot to allow us to cycle through the available command slots. ahci_command_destroy obliterates all information contained within a given slot's command header, and frees its associated command table, but not its DMA buffer! Lastly, the command table pointer fields (dba and dbau) are merged into a single 64bit value to make managing 64bit tests simpler. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1423158090-25580-5-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16qtest/ahci: rename 'Command' to 'CommandHeader'John Snow1-4/+3
The structure name is a bit of a misnomer; the structure currently named command is actually the commandheader. A future patch in this series will add an actual "Command" structure, so we'll rename it now before the rest of the functions in this series try to use it. In addition, rename the "b1" and "b2" fields to be a unified uint16_t named "flags." Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1423158090-25580-4-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add ahci_port_clear helperJohn Snow2-0/+17
Add a helper that assists in clearing out potentially old error and FIS information from an AHCI port's data structures. This ensures we always start with a blank slate for interrupt and FIS receipt information. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-3-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: Add ahci_port_select helperJohn Snow2-0/+28
This helper identifies which port of the AHCI HBA has a device we may run tests on. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-2-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos/ahci: create libqos/ahci.cJohn Snow2-1/+279
With global state removed, code responsible for booting up, verifying, and initializing the AHCI HBA is extracted and inserted into libqos/ahci.c, which would allow for other qtests in the future to quickly grab a meaningfully initialized reference to an AHCI HBA. Even without other users, functionalizing and isolating the code assists future AHCI tests that exercise Q35 migration. For now, libqos/ahci.o will be PC-only, but can be expanded into something arch-agnostic in the future, if needed. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1421698563-6977-16-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16qtest/ahci: Bookmark FB and CLB pointersJohn Snow1-0/+6
Instead of re-querying the AHCI device for the FB and CLB buffers, save the pointer we gave to the device during initialization and reference these values instead. [Peter Maydell <peter.maydell@linaro.org> reported the following clang compiler warnings: tests/libqos/ahci.c:256:40: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] g_test_message("CLB: 0x%08lx", ahci->port[i].clb); tests/libqos/ahci.c:264:39: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] g_test_message("FB: 0x%08lx", ahci->port[i].fb); The commit moved from uint32_t to uint64_t, so PRIx64 should be used for the format specifier. --Stefan] Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1421698563-6977-15-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>