[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/65] qtest/ahci: remove guest_malloc global
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 14/65] qtest/ahci: remove guest_malloc global |
Date: |
Fri, 13 Feb 2015 16:24:10 +0000 |
From: John Snow <address@hidden>
Make helper routines rely on the earmarked
guest allocator object with AHCIQState/QOSSTate instead.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/ahci-test.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 0cc56ab..bb98968 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -32,7 +32,6 @@
#include "libqos/libqos-pc.h"
#include "libqos/ahci.h"
#include "libqos/pci-pc.h"
-#include "libqos/malloc-pc.h"
#include "qemu-common.h"
#include "qemu/host-utils.h"
@@ -44,7 +43,6 @@
#define TEST_IMAGE_SIZE (64 * 1024 * 1024)
/*** Globals ***/
-static QGuestAllocator *guest_malloc;
static char tmp_path[] = "/tmp/qtest.XXXXXX";
static bool ahci_pedantic;
@@ -92,6 +90,11 @@ static void string_bswap16(uint16_t *s, size_t bytes)
}
}
+static uint64_t ahci_alloc(AHCIQState *ahci, size_t bytes)
+{
+ return qmalloc(ahci->parent, bytes);
+}
+
/**
* Locate, verify, and return a handle to the AHCI device.
*/
@@ -154,9 +157,6 @@ static AHCIQState *ahci_boot(void)
/* Verify that we have an AHCI device present. */
s->dev = get_ahci_device(&s->fingerprint);
- /* Stopgap: Copy the allocator reference */
- guest_malloc = s->parent->alloc;
-
return s;
}
@@ -272,13 +272,13 @@ static void ahci_hba_enable(AHCIQState *ahci)
/* Allocate Memory for the Command List Buffer & FIS Buffer */
/* PxCLB space ... 0x20 per command, as in 4.2.2 p 36 */
- clb = guest_alloc(guest_malloc, num_cmd_slots * 0x20);
+ clb = ahci_alloc(ahci, num_cmd_slots * 0x20);
g_test_message("CLB: 0x%08x", clb);
PX_WREG(i, AHCI_PX_CLB, clb);
g_assert_cmphex(clb, ==, PX_RREG(i, AHCI_PX_CLB));
/* PxFB space ... 0x100, as in 4.2.1 p 35 */
- fb = guest_alloc(guest_malloc, 0x100);
+ fb = ahci_alloc(ahci, 0x100);
g_test_message("FB: 0x%08x", fb);
PX_WREG(i, AHCI_PX_FB, fb);
g_assert_cmphex(fb, ==, PX_RREG(i, AHCI_PX_FB));
@@ -951,12 +951,12 @@ static void ahci_test_identify(AHCIQState *ahci)
/* Create a Command Table buffer. 0x80 is the smallest with a PRDTL of 0.
*/
/* We need at least one PRD, so round up to the nearest 0x80 multiple.
*/
- table = guest_alloc(guest_malloc, CMD_TBL_SIZ(1));
+ table = ahci_alloc(ahci, CMD_TBL_SIZ(1));
g_assert(table);
ASSERT_BIT_CLEAR(table, 0x7F);
/* Create a data buffer ... where we will dump the IDENTIFY data to. */
- data_ptr = guest_alloc(guest_malloc, 512);
+ data_ptr = ahci_alloc(ahci, 512);
g_assert(data_ptr);
/* Grab the Command List Buffer pointer */
--
2.1.0
- [Qemu-devel] [PULL 05/65] qtest/ahci: Create ahci.h, (continued)
- [Qemu-devel] [PULL 05/65] qtest/ahci: Create ahci.h, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 07/65] libqos: add qtest_vboot, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 04/65] libqos: Split apart pc_alloc_init, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 06/65] libqos: create libqos.c, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 09/65] libqos: Update QGuestAllocator to be opaque, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 12/65] qtest/ahci: finalize AHCIQState consolidation, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 10/65] libqos: add pc specific interface, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 11/65] qtest/ahci: Store hba_base in AHCIQState, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 13/65] qtest/ahci: remove pcibus global, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 17/65] qtest/ahci: Bookmark FB and CLB pointers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 14/65] qtest/ahci: remove guest_malloc global,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 20/65] libqos/ahci: Add ahci_port_select helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 19/65] dataplane: endianness-aware accesses, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 23/65] libqos/ahci: Add command header helpers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 21/65] libqos/ahci: Add ahci_port_clear helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 24/65] libqos/ahci: Add ahci_port_check_error helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 22/65] qtest/ahci: rename 'Command' to 'CommandHeader', Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 26/65] libqos/ahci: Add port_check_nonbusy helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 25/65] libqos/ahci: Add ahci_port_check_interrupts helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 28/65] qtest/ahci: Demagic ahci tests., Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 30/65] libqos/ahci: Add ide cmd properties, Stefan Hajnoczi, 2015/02/13