Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/huth/tags/pull-request-2017-10-…
Browse files Browse the repository at this point in the history
…16' into staging

Some m68k, qtest and config improvements

# gpg: Signature made Mon 16 Oct 2017 13:38:03 BST
# gpg:                using RSA key 0x2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth/tags/pull-request-2017-10-16:
  default-configs: Enable CONFIG_VMXNET3_PCI only on x86
  tests/prom-env: Bump the timeout, and test pseries only in slow mode
  tests: use g_new() family of functions
  M68K: use g_new() family of functions
  hw/m68k: Replace fprintf(stderr, "*\n" with error_report()

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed Oct 16, 2017
2 parents c5bbcaa + 03bf6b5 commit e24cdd0
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 27 deletions.
1 change: 1 addition & 0 deletions default-configs/i386-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_QXL=$(CONFIG_SPICE)
CONFIG_VGA_ISA=y
CONFIG_VGA_CIRRUS=y
CONFIG_VMWARE_VGA=y
CONFIG_VMXNET3_PCI=y
CONFIG_VIRTIO_VGA=y
CONFIG_VMMOUSE=y
CONFIG_IPMI=y
Expand Down
1 change: 0 additions & 1 deletion default-configs/pci.mak
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ CONFIG_MPTSAS_SCSI_PCI=y
CONFIG_RTL8139_PCI=y
CONFIG_E1000_PCI=y
CONFIG_E1000E_PCI=y
CONFIG_VMXNET3_PCI=y
CONFIG_IDE_CORE=y
CONFIG_IDE_QDEV=y
CONFIG_IDE_PCI=y
Expand Down
1 change: 1 addition & 0 deletions default-configs/x86_64-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_QXL=$(CONFIG_SPICE)
CONFIG_VGA_ISA=y
CONFIG_VGA_CIRRUS=y
CONFIG_VMWARE_VGA=y
CONFIG_VMXNET3_PCI=y
CONFIG_VIRTIO_VGA=y
CONFIG_VMMOUSE=y
CONFIG_IPMI=y
Expand Down
4 changes: 2 additions & 2 deletions hw/m68k/an5206.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void an5206_init(MachineState *machine)
if (qtest_enabled()) {
return;
}
fprintf(stderr, "Kernel image must be specified\n");
error_report("Kernel image must be specified");
exit(1);
}

Expand All @@ -83,7 +83,7 @@ static void an5206_init(MachineState *machine)
entry = KERNEL_LOAD_ADDR;
}
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
error_report("Could not load kernel '%s'", kernel_filename);
exit(1);
}

Expand Down
7 changes: 4 additions & 3 deletions hw/m68k/mcf5206.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* This code is licensed under the GPL
*/
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu-common.h"
#include "cpu.h"
#include "hw/hw.h"
Expand Down Expand Up @@ -137,7 +138,7 @@ static m5206_timer_state *m5206_timer_init(qemu_irq irq)
m5206_timer_state *s;
QEMUBH *bh;

s = (m5206_timer_state *)g_malloc0(sizeof(m5206_timer_state));
s = g_new0(m5206_timer_state, 1);
bh = qemu_bh_new(m5206_timer_trigger, s);
s->timer = ptimer_init(bh, PTIMER_POLICY_DEFAULT);
s->irq = irq;
Expand Down Expand Up @@ -220,7 +221,7 @@ static void m5206_mbar_update(m5206_mbar_state *s)
break;
default:
/* Unknown vector. */
fprintf(stderr, "Unhandled vector for IRQ %d\n", irq);
error_report("Unhandled vector for IRQ %d", irq);
vector = 0xf;
break;
}
Expand Down Expand Up @@ -533,7 +534,7 @@ qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, M68kCPU *cpu)
m5206_mbar_state *s;
qemu_irq *pic;

s = (m5206_mbar_state *)g_malloc0(sizeof(m5206_mbar_state));
s = g_new0(m5206_mbar_state, 1);

memory_region_init_io(&s->iomem, NULL, &m5206_mbar_ops, s,
"mbar", 0x00001000);
Expand Down
9 changes: 5 additions & 4 deletions hw/m68k/mcf5208.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* This code is licensed under the GPL
*/
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "cpu.h"
Expand Down Expand Up @@ -183,7 +184,7 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
memory_region_add_subregion(address_space, 0xfc0a8000, iomem);
/* Timers. */
for (i = 0; i < 2; i++) {
s = (m5208_timer_state *)g_malloc0(sizeof(m5208_timer_state));
s = g_new0(m5208_timer_state, 1);
bh = qemu_bh_new(m5208_timer_trigger, s);
s->timer = ptimer_init(bh, PTIMER_POLICY_DEFAULT);
memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s,
Expand Down Expand Up @@ -257,7 +258,7 @@ static void mcf5208evb_init(MachineState *machine)
mcf5208_sys_init(address_space_mem, pic);

if (nb_nics > 1) {
fprintf(stderr, "Too many NICs\n");
error_report("Too many NICs");
exit(1);
}
if (nd_table[0].used) {
Expand Down Expand Up @@ -292,7 +293,7 @@ static void mcf5208evb_init(MachineState *machine)
if (qtest_enabled()) {
return;
}
fprintf(stderr, "Kernel image must be specified\n");
error_report("Kernel image must be specified");
exit(1);
}

Expand All @@ -309,7 +310,7 @@ static void mcf5208evb_init(MachineState *machine)
entry = 0x40000000;
}
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
error_report("Could not load kernel '%s'", kernel_filename);
exit(1);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/ahci-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static AHCIQState *ahci_vboot(const char *cli, va_list ap)
{
AHCIQState *s;

s = g_malloc0(sizeof(AHCIQState));
s = g_new0(AHCIQState, 1);
s->parent = qtest_pc_vboot(cli, ap);
alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);

Expand Down Expand Up @@ -1806,7 +1806,7 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
char *name;
AHCIIOTestOptions *opts;

opts = g_malloc(sizeof(AHCIIOTestOptions));
opts = g_new(AHCIIOTestOptions, 1);
opts->length = len;
opts->address_type = addr;
opts->io_type = type;
Expand Down
4 changes: 2 additions & 2 deletions tests/fw_cfg-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ static void test_fw_cfg_numa(void)

g_assert_cmpint(qfw_cfg_get_u64(fw_cfg, FW_CFG_NUMA), ==, nb_nodes);

cpu_mask = g_malloc0(sizeof(uint64_t) * max_cpus);
node_mask = g_malloc0(sizeof(uint64_t) * nb_nodes);
cpu_mask = g_new0(uint64_t, max_cpus);
node_mask = g_new0(uint64_t, nb_nodes);

qfw_cfg_read_data(fw_cfg, cpu_mask, sizeof(uint64_t) * max_cpus);
qfw_cfg_read_data(fw_cfg, node_mask, sizeof(uint64_t) * nb_nodes);
Expand Down
2 changes: 1 addition & 1 deletion tests/libqos/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ AHCICommand *ahci_command_create(uint8_t command_name)
AHCICommand *cmd;

g_assert(props);
cmd = g_malloc0(sizeof(AHCICommand));
cmd = g_new0(AHCICommand, 1);
g_assert(!(props->dma && props->pio));
g_assert(!(props->lba28 && props->lba48));
g_assert(!(props->read && props->write));
Expand Down
2 changes: 1 addition & 1 deletion tests/libqos/libqos.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)
{
char *cmdline;

struct QOSState *qs = g_malloc(sizeof(QOSState));
struct QOSState *qs = g_new(QOSState, 1);

cmdline = g_strdup_vprintf(cmdline_fmt, ap);
qs->qts = qtest_start(cmdline);
Expand Down
6 changes: 3 additions & 3 deletions tests/libqos/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static MemBlock *mlist_new(uint64_t addr, uint64_t size)
if (!size) {
return NULL;
}
block = g_malloc0(sizeof(MemBlock));
block = g_new0(MemBlock, 1);

block->addr = addr;
block->size = size;
Expand Down Expand Up @@ -305,8 +305,8 @@ QGuestAllocator *alloc_init(uint64_t start, uint64_t end)
s->start = start;
s->end = end;

s->used = g_malloc(sizeof(MemList));
s->free = g_malloc(sizeof(MemList));
s->used = g_new(MemList, 1);
s->free = g_new(MemList, 1);
QTAILQ_INIT(s->used);
QTAILQ_INIT(s->free);

Expand Down
2 changes: 1 addition & 1 deletion tests/libqtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
gchar *command;
const char *qemu_binary = qtest_qemu_binary();

s = g_malloc(sizeof(*s));
s = g_new(QTestState, 1);

socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid());
qmp_socket_path = g_strdup_printf("/tmp/qtest-%d.qmp", getpid());
Expand Down
2 changes: 1 addition & 1 deletion tests/pc-cpu-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void add_pc_test_case(const char *mname)
if (!g_str_has_prefix(mname, "pc-")) {
return;
}
data = g_malloc(sizeof(PCTestData));
data = g_new(PCTestData, 1);
data->machine = g_strdup(mname);
data->cpu_model = "Haswell"; /* 1.3+ theoretically */
data->sockets = 1;
Expand Down
14 changes: 8 additions & 6 deletions tests/prom-env-test.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Test OpenBIOS-based machines.
* Test Open-Firmware-based machines.
*
* Copyright (c) 2016 Red Hat Inc.
* Copyright (c) 2016, 2017 Red Hat Inc.
*
* Author:
* Thomas Huth <[email protected]>
Expand Down Expand Up @@ -30,8 +30,8 @@ static void check_guest_memory(void)
uint32_t signature;
int i;

/* Poll until code has run and modified memory. Wait at most 120 seconds */
for (i = 0; i < 12000; ++i) {
/* Poll until code has run and modified memory. Wait at most 600 seconds */
for (i = 0; i < 60000; ++i) {
signature = readl(ADDRESS);
if (signature == MAGIC) {
break;
Expand Down Expand Up @@ -78,15 +78,17 @@ int main(int argc, char *argv[])
const char *sparc_machines[] = { "SPARCbook", "Voyager", "SS-20", NULL };
const char *sparc64_machines[] = { "sun4u", NULL };
const char *ppc_machines[] = { "mac99", "g3beige", NULL };
const char *ppc64_machines[] = { "mac99", "g3beige", "pseries", NULL };
const char *arch = qtest_get_arch();

g_test_init(&argc, &argv, NULL);

if (!strcmp(arch, "ppc")) {
add_tests(ppc_machines);
} else if (!strcmp(arch, "ppc64")) {
add_tests(ppc64_machines);
add_tests(ppc_machines);
if (g_test_slow()) {
qtest_add_data_func("prom-env/pseries", "pseries", test_machine);
}
} else if (!strcmp(arch, "sparc")) {
add_tests(sparc_machines);
} else if (!strcmp(arch, "sparc64")) {
Expand Down

0 comments on commit e24cdd0

Please sign in to comment.