From 020ff60e0cbdc4275d4ddcf0cfba51c8be09a287 Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:13:05 -0700 Subject: [PATCH 1/8] configure requires bash, won't work with older /bin/sh --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 86fd833feb6..9cf2f2f3ce7 100755 --- a/configure +++ b/configure @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # qemu configure script (c) 2003 Fabrice Bellard # From a971156081aa24a757de388a9034a4798639e0b5 Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:17:45 -0700 Subject: [PATCH 2/8] Add sparcv9 auto-detection to configure --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 9cf2f2f3ce7..f1ac6273611 100755 --- a/configure +++ b/configure @@ -470,6 +470,8 @@ SunOS) # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then cpu="x86_64" + elif test -z "$cpu" && test "$(isainfo -k)" = "sparcv9"; then + cpu="sparc64" fi esac From 7f242de0f547dde0520905b79e55ac42107fd60a Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:20:28 -0700 Subject: [PATCH 3/8] Set PKG_CONFIG_LIBDIR based on compilation target --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index f1ac6273611..1066d9fe81f 100755 --- a/configure +++ b/configure @@ -665,6 +665,11 @@ SunOS) solarisnetlibs="-lsocket -lnsl -lresolv" LIBS="$solarisnetlibs $LIBS" libs_qga="$solarisnetlibs $libs_qga" + if [ "$cpu" = "x86_64" ]; then + export PKG_CONFIG_LIBDIR=/usr/lib/x86_64/pkgconfig + elif [ "$cpu" = "sparc64" ]; then + export PKG_CONFIG_LIBDIR=/usr/lib/sparcv9/pkgconfig + fi ;; AIX) aix="yes" From 425003beba43180a890968759436dd9b8a016f67 Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:26:46 -0700 Subject: [PATCH 4/8] Don't use "sun" as an identifier, rename to sa_un --- contrib/ivshmem-client/ivshmem-client.c | 12 ++++++------ contrib/ivshmem-server/ivshmem-server.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/contrib/ivshmem-client/ivshmem-client.c b/contrib/ivshmem-client/ivshmem-client.c index 44ae3646e11..67d1b3cc069 100644 --- a/contrib/ivshmem-client/ivshmem-client.c +++ b/contrib/ivshmem-client/ivshmem-client.c @@ -179,7 +179,7 @@ ivshmem_client_init(IvshmemClient *client, const char *unix_sock_path, int ivshmem_client_connect(IvshmemClient *client) { - struct sockaddr_un sun; + struct sockaddr_un sa_un; int fd, ret; int64_t tmp; @@ -193,16 +193,16 @@ ivshmem_client_connect(IvshmemClient *client) return -1; } - sun.sun_family = AF_UNIX; - ret = snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", + sa_un.sun_family = AF_UNIX; + ret = snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s", client->unix_sock_path); - if (ret < 0 || ret >= sizeof(sun.sun_path)) { + if (ret < 0 || ret >= sizeof(sa_un.sun_path)) { IVSHMEM_CLIENT_DEBUG(client, "could not copy unix socket path\n"); goto err_close; } - if (connect(client->sock_fd, (struct sockaddr *)&sun, sizeof(sun)) < 0) { - IVSHMEM_CLIENT_DEBUG(client, "cannot connect to %s: %s\n", sun.sun_path, + if (connect(client->sock_fd, (struct sockaddr *)&sa_un, sizeof(sa_un)) < 0) { + IVSHMEM_CLIENT_DEBUG(client, "cannot connect to %s: %s\n", sa_un.sun_path, strerror(errno)); goto err_close; } diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index e2f295bd439..ef28a0b75f2 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -289,7 +289,7 @@ ivshmem_server_init(IvshmemServer *server, const char *unix_sock_path, int ivshmem_server_start(IvshmemServer *server) { - struct sockaddr_un sun; + struct sockaddr_un sa_un; int shm_fd, sock_fd, ret; /* open shm file */ @@ -328,15 +328,15 @@ ivshmem_server_start(IvshmemServer *server) goto err_close_shm; } - sun.sun_family = AF_UNIX; - ret = snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", + sa_un.sun_family = AF_UNIX; + ret = snprintf(sa_un.sun_path, sizeof(sa_un.sun_path), "%s", server->unix_sock_path); - if (ret < 0 || ret >= sizeof(sun.sun_path)) { + if (ret < 0 || ret >= sizeof(sa_un.sun_path)) { IVSHMEM_SERVER_DEBUG(server, "could not copy unix socket path\n"); goto err_close_sock; } - if (bind(sock_fd, (struct sockaddr *)&sun, sizeof(sun)) < 0) { - IVSHMEM_SERVER_DEBUG(server, "cannot connect to %s: %s\n", sun.sun_path, + if (bind(sock_fd, (struct sockaddr *)&sa_un, sizeof(sa_un)) < 0) { + IVSHMEM_SERVER_DEBUG(server, "cannot connect to %s: %s\n", sa_un.sun_path, strerror(errno)); goto err_close_sock; } From 0ebfe05b6c8fdb8fea23d7d76541cf1015c095e5 Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:27:59 -0700 Subject: [PATCH 5/8] SEC conflicts with SEC defined in on SunOS --- hw/net/e1000x_common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/e1000x_common.h b/hw/net/e1000x_common.h index 21bf28e0cca..96bbb68f684 100644 --- a/hw/net/e1000x_common.h +++ b/hw/net/e1000x_common.h @@ -22,6 +22,7 @@ * License along with this library; if not, see . */ +#undef SEC /* conflicts with sys/time.h on SunOS */ #include "e1000_regs.h" #define defreg(x) x = (E1000_##x >> 2) From cf5dd82a2f299b2825eed190a64d2e0d1ceef65c Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:29:31 -0700 Subject: [PATCH 6/8] queue conflicts with STREAMS queue on SunOS, rename to mqueue --- memory.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/memory.c b/memory.c index 6c58373422f..d4f0e4db222 100644 --- a/memory.c +++ b/memory.c @@ -2469,10 +2469,10 @@ typedef struct MemoryRegionList MemoryRegionList; struct MemoryRegionList { const MemoryRegion *mr; - QTAILQ_ENTRY(MemoryRegionList) queue; + QTAILQ_ENTRY(MemoryRegionList) mqueue; }; -typedef QTAILQ_HEAD(queue, MemoryRegionList) MemoryRegionListHead; +typedef QTAILQ_HEAD(mqueue, MemoryRegionList) MemoryRegionListHead; #define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \ int128_sub((size), int128_one())) : 0) @@ -2501,7 +2501,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, bool found = false; /* check if the alias is already in the queue */ - QTAILQ_FOREACH(ml, alias_print_queue, queue) { + QTAILQ_FOREACH(ml, alias_print_queue, mqueue) { if (ml->mr == mr->alias) { found = true; } @@ -2510,7 +2510,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, if (!found) { ml = g_new(MemoryRegionList, 1); ml->mr = mr->alias; - QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue); + QTAILQ_INSERT_TAIL(alias_print_queue, ml, mqueue); } mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx @@ -2540,26 +2540,26 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, QTAILQ_FOREACH(submr, &mr->subregions, subregions_link) { new_ml = g_new(MemoryRegionList, 1); new_ml->mr = submr; - QTAILQ_FOREACH(ml, &submr_print_queue, queue) { + QTAILQ_FOREACH(ml, &submr_print_queue, mqueue) { if (new_ml->mr->addr < ml->mr->addr || (new_ml->mr->addr == ml->mr->addr && new_ml->mr->priority > ml->mr->priority)) { - QTAILQ_INSERT_BEFORE(ml, new_ml, queue); + QTAILQ_INSERT_BEFORE(ml, new_ml, mqueue); new_ml = NULL; break; } } if (new_ml) { - QTAILQ_INSERT_TAIL(&submr_print_queue, new_ml, queue); + QTAILQ_INSERT_TAIL(&submr_print_queue, new_ml, mqueue); } } - QTAILQ_FOREACH(ml, &submr_print_queue, queue) { + QTAILQ_FOREACH(ml, &submr_print_queue, mqueue) { mtree_print_mr(mon_printf, f, ml->mr, level + 1, base + mr->addr, alias_print_queue); } - QTAILQ_FOREACH_SAFE(ml, &submr_print_queue, queue, next_ml) { + QTAILQ_FOREACH_SAFE(ml, &submr_print_queue, mqueue, next_ml) { g_free(ml); } } @@ -2618,13 +2618,13 @@ void mtree_info(fprintf_function mon_printf, void *f, bool flatview) } /* print aliased regions */ - QTAILQ_FOREACH(ml, &ml_head, queue) { + QTAILQ_FOREACH(ml, &ml_head, mqueue) { mon_printf(f, "memory-region: %s\n", memory_region_name(ml->mr)); mtree_print_mr(mon_printf, f, ml->mr, 1, 0, &ml_head); mon_printf(f, "\n"); } - QTAILQ_FOREACH_SAFE(ml, &ml_head, queue, ml2) { + QTAILQ_FOREACH_SAFE(ml, &ml_head, mqueue, ml2) { g_free(ml); } } From f7894cabfc89864bf1fa701b543ae524fc370a40 Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 18:31:23 -0700 Subject: [PATCH 7/8] htonll already defined on SunOS --- migration/rdma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index 674ccab12e1..6a15f21a181 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -249,6 +249,7 @@ typedef struct QEMU_PACKED RDMADestBlock { uint32_t padding; } RDMADestBlock; +#ifndef htonll static uint64_t htonll(uint64_t v) { union { uint32_t lv[2]; uint64_t llv; } u; @@ -262,6 +263,7 @@ static uint64_t ntohll(uint64_t v) { u.llv = v; return ((uint64_t)ntohl(u.lv[0]) << 32) | (uint64_t) ntohl(u.lv[1]); } +#endif static void dest_block_to_network(RDMADestBlock *db) { From dd20304d094bb647c37750ac6a8614e1790547ce Mon Sep 17 00:00:00 2001 From: Greg Onufer Date: Mon, 17 Apr 2017 19:04:13 -0700 Subject: [PATCH 8/8] No -lutil for SunOS --- tests/Makefile.include | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index 634394aecf4..f1a11f71998 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -740,8 +740,10 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF) rmdir $(INITRD_WORK_DIR) ifeq ($(CONFIG_POSIX),y) +ifneq ($(CONFIG_SOLARIS),y) LIBS += -lutil endif +endif # QTest rules