From: SeokYeon Hwang Date: Mon, 20 Jun 2016 06:25:33 +0000 (+0900) Subject: Merge tag 'v2.6.0' into develop X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~30^2~6^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5b5a72b01ac12c4dfb5867deb00c7b39f4fece5;p=sdk%2Femulator%2Fqemu.git Merge tag 'v2.6.0' into develop v2.6.0 release Change-Id: I76aaeae2ace35ddf6dbbd4c11436724688b01929 Signed-off-by: SeokYeon Hwang --- b5b5a72b01ac12c4dfb5867deb00c7b39f4fece5 diff --cc audio/dsoundaudio.c index 05a1403fa5,516846eb80..db77b6d5aa --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@@ -26,22 -26,11 +26,23 @@@ * SEAL 1.07 by Carlos 'pel' Hasan was used as documentation */ +/* + * Patched audio jack hot-plug event handling + * + * Contributors: + * - S-Core Co., Ltd + * + * Contact: + * Byeongki Shin + */ + + #include "qemu/osdep.h" #include "qemu-common.h" #include "audio.h" +#include "qemu/thread.h" #define AUDIO_CAP "dsound" +#define COBJMACROS #include "audio_int.h" #include diff --cc block.c index 32483e6cbf,d4939b49bf..4e445b0bc3 --- a/block.c +++ b/block.c @@@ -2125,11 -2340,11 +2340,13 @@@ static void bdrv_delete(BlockDriverStat bdrv_close(bs); + bdrv_close(bs); + /* remove from list, if necessary */ - bdrv_make_anon(bs); + if (bs->node_name[0] != '\0') { + QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list); + } + QTAILQ_REMOVE(&all_bdrv_states, bs, bs_list); g_free(bs); } diff --cc blockdev.c index b9912ce573,f1f520a265..c891187d94 --- a/blockdev.c +++ b/blockdev.c @@@ -49,11 -50,12 +50,16 @@@ #include "qmp-commands.h" #include "trace.h" #include "sysemu/arch_init.h" + #include "qemu/cutils.h" + #include "qemu/help_option.h" + + static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states = + QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states); +#ifdef CONFIG_MARU +#include "tizen/src/util/exported_strings.h" +#endif + static const char *const if_name[IF_COUNT] = { [IF_NONE] = "none", [IF_IDE] = "ide", diff --cc configure index 5cdaaab527,c37fc5fe75..3bbc31ccea --- a/configure +++ b/configure @@@ -5177,29 -4867,8 +5201,30 @@@ echo "bzip2 support $bzip2 echo "NUMA host support $numa" echo "tcmalloc support $tcmalloc" echo "jemalloc support $jemalloc" + echo "avx2 optimization $avx2_opt" +echo "Qt support $qt" +echo "HAX support $hax" +echo "YaGL support $yagl" +echo "YaGL stats $yagl_stats" +echo "VIGS support $vigs" + +# for TIZEN-maru +if test "$maru" = "yes"; then +echo "TIZEN-maru options:" +echo "maru enabled $maru" + if test "$mingw32" = "yes"; then +echo "WINVER $winver" + fi +echo "libav support $libav" +echo "libpng support $libpng" +echo "DXVA2 support $dxva2" +echo "vaapi support $vaapi" +echo "libtizenusb support $libtizenusb" +echo "extension path $extension_path" +fi +# + if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" fi diff --cc cpu-exec.c index 62eb0eddb2,bbfcbfb543..e98ae319c0 --- a/cpu-exec.c +++ b/cpu-exec.c @@@ -33,6 -33,6 +33,8 @@@ #endif #include "sysemu/replay.h" ++#include "sysemu/hax.h" ++ /* -icount align implementation. */ typedef struct SyncClocks { diff --cc cpus.c index 53a76f9fbc,cbeb1f6139..07d6bd70dd --- a/cpus.c +++ b/cpus.c @@@ -1505,12 -1385,18 +1517,22 @@@ void qemu_init_vcpu(CPUState *cpu cpu->nr_threads = smp_threads; cpu->stopped = true; + if (!cpu->as) { + /* If the target cpu hasn't set up any address spaces itself, + * give it the default one. + */ + AddressSpace *as = address_space_init_shareable(cpu->memory, + "cpu-memory"); + cpu->num_ases = 1; + cpu_address_space_init(cpu, as, 0); + } + if (kvm_enabled()) { qemu_kvm_start_vcpu(cpu); +#ifdef CONFIG_HAX + } else if (hax_enabled() && hax_ug_platform()) { + qemu_hax_start_vcpu(cpu); +#endif } else if (tcg_enabled()) { qemu_tcg_init_vcpu(cpu); } else { diff --cc exec.c index edbe1e0d8e,c4f9036184..6dcb8d327b --- a/exec.c +++ b/exec.c @@@ -30,9 -30,7 +30,8 @@@ #include "hw/boards.h" #endif #include "hw/qdev.h" - #include "qemu/osdep.h" #include "sysemu/kvm.h" +#include "sysemu/hax.h" #include "sysemu/sysemu.h" #include "hw/xen/xen.h" #include "qemu/timer.h" @@@ -1566,24 -1648,7 +1649,22 @@@ static void ram_block_add(RAMBlock *new if (kvm_enabled()) { kvm_setup_guest_memory(new_block->host, new_block->max_length); } - } +#ifdef CONFIG_HAX - /* - * In Hax, the qemu allocate the virtual address, and HAX kernel - * populate the memory with physical memory. Currently we have no - * paging, so user should make sure enough free memory in advance - */ - if (hax_enabled()) { - int ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, - new_block->max_length); - if (ret < 0) { - fprintf(stderr, "HAX failed to populate ram\n"); - exit(-1); ++ /* ++ * In Hax, the qemu allocate the virtual address, and HAX kernel ++ * populate the memory with physical memory. Currently we have no ++ * paging, so user should make sure enough free memory in advance ++ */ ++ if (hax_enabled()) { ++ int ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, ++ new_block->max_length); ++ if (ret < 0) { ++ fprintf(stderr, "HAX failed to populate ram\n"); ++ exit(-1); ++ } + } - } +#endif - - return new_block->offset; + } } #ifdef __linux__ diff --cc fsdev/9p-marshal.h index 0000000000,e91b24e9ca..0c262f81b9 mode 000000,100644..100644 --- a/fsdev/9p-marshal.h +++ b/fsdev/9p-marshal.h @@@ -1,0 -1,84 +1,90 @@@ + #ifndef _QEMU_9P_MARSHAL_H + #define _QEMU_9P_MARSHAL_H + ++#ifdef CONFIG_MARU ++#ifdef CONFIG_WIN32 ++#include "tizen/src/resources_win32.h" ++#endif ++#endif ++ + typedef struct V9fsString + { + uint16_t size; + char *data; + } V9fsString; + + typedef struct V9fsQID + { + int8_t type; + int32_t version; + int64_t path; + } V9fsQID; + + typedef struct V9fsStat + { + int16_t size; + int16_t type; + int32_t dev; + V9fsQID qid; + int32_t mode; + int32_t atime; + int32_t mtime; + int64_t length; + V9fsString name; + V9fsString uid; + V9fsString gid; + V9fsString muid; + /* 9p2000.u */ + V9fsString extension; + int32_t n_uid; + int32_t n_gid; + int32_t n_muid; + } V9fsStat; + + typedef struct V9fsIattr + { + int32_t valid; + int32_t mode; + int32_t uid; + int32_t gid; + int64_t size; + int64_t atime_sec; + int64_t atime_nsec; + int64_t mtime_sec; + int64_t mtime_nsec; + } V9fsIattr; + + typedef struct V9fsStatDotl { + uint64_t st_result_mask; + V9fsQID qid; + uint32_t st_mode; + uint32_t st_uid; + uint32_t st_gid; + uint64_t st_nlink; + uint64_t st_rdev; + uint64_t st_size; + uint64_t st_blksize; + uint64_t st_blocks; + uint64_t st_atime_sec; + uint64_t st_atime_nsec; + uint64_t st_mtime_sec; + uint64_t st_mtime_nsec; + uint64_t st_ctime_sec; + uint64_t st_ctime_nsec; + uint64_t st_btime_sec; + uint64_t st_btime_nsec; + uint64_t st_gen; + uint64_t st_data_version; + } V9fsStatDotl; + + static inline void v9fs_string_init(V9fsString *str) + { + str->data = NULL; + str->size = 0; + } + extern void v9fs_string_free(V9fsString *str); + extern void v9fs_string_null(V9fsString *str); + extern void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...); + extern void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs); + + #endif diff --cc hw/9pfs/9p-posix-acl.c index 0000000000,ec003181cd..3783991521 mode 000000,100644..100644 --- a/hw/9pfs/9p-posix-acl.c +++ b/hw/9pfs/9p-posix-acl.c @@@ -1,0 -1,184 +1,212 @@@ + /* + * 9p system.posix* xattr callback + * + * Copyright IBM, Corp. 2010 + * + * Authors: + * Aneesh Kumar K.V + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + + #include "qemu/osdep.h" + #include "qemu/xattr.h" + #include "9p.h" + #include "fsdev/file-op-9p.h" + #include "9p-xattr.h" + + #define MAP_ACL_ACCESS "user.virtfs.system.posix_acl_access" + #define MAP_ACL_DEFAULT "user.virtfs.system.posix_acl_default" + #define ACL_ACCESS "system.posix_acl_access" + #define ACL_DEFAULT "system.posix_acl_default" + + static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path, + const char *name, void *value, size_t size) + { + char *buffer; + ssize_t ret; + + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lgetxattr(buffer, MAP_ACL_ACCESS, value, size); ++#else ++ ret = getxattr(buffer, MAP_ACL_ACCESS, value, size, 0, XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; + } + + static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path, + char *name, void *value, size_t osize) + { + ssize_t len = sizeof(ACL_ACCESS); + + if (!value) { + return len; + } + + if (osize < len) { + errno = ERANGE; + return -1; + } + + /* len includes the trailing NUL */ + memcpy(value, ACL_ACCESS, len); + return 0; + } + + static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name, + void *value, size_t size, int flags) + { + char *buffer; + int ret; + + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lsetxattr(buffer, MAP_ACL_ACCESS, value, size, flags); ++#else ++ ret = setxattr(buffer, MAP_ACL_ACCESS, value, size, 0, flags | XATTR_NOFOLLOW); ++#endif ++ + g_free(buffer); + return ret; + } + + static int mp_pacl_removexattr(FsContext *ctx, + const char *path, const char *name) + { + int ret; + char *buffer; + + buffer = rpath(ctx, path); ++ ++#ifdef CONFIG_LINUX + ret = lremovexattr(buffer, MAP_ACL_ACCESS); ++#else ++ ret = removexattr(buffer, MAP_ACL_ACCESS, XATTR_NOFOLLOW); ++#endif + if (ret == -1 && errno == ENODATA) { + /* + * We don't get ENODATA error when trying to remove a + * posix acl that is not present. So don't throw the error + * even in case of mapped security model + */ + errno = 0; + ret = 0; + } + g_free(buffer); + return ret; + } + + static ssize_t mp_dacl_getxattr(FsContext *ctx, const char *path, + const char *name, void *value, size_t size) + { + char *buffer; + ssize_t ret; + + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lgetxattr(buffer, MAP_ACL_DEFAULT, value, size); ++#else ++ ret = getxattr(buffer, MAP_ACL_DEFAULT, value, size, 0, XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; + } + + static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path, + char *name, void *value, size_t osize) + { + ssize_t len = sizeof(ACL_DEFAULT); + + if (!value) { + return len; + } + + if (osize < len) { + errno = ERANGE; + return -1; + } + + /* len includes the trailing NUL */ + memcpy(value, ACL_DEFAULT, len); + return 0; + } + + static int mp_dacl_setxattr(FsContext *ctx, const char *path, const char *name, + void *value, size_t size, int flags) + { + char *buffer; + int ret; + + buffer = rpath(ctx, path); - ret = lsetxattr(buffer, MAP_ACL_DEFAULT, value, size, flags); ++#ifdef CONFIG_LINUX ++ ret = lsetxattr(buffer, MAP_ACL_DEFAULT, value, ++ size, flags); ++#else ++ ret = setxattr(buffer, MAP_ACL_DEFAULT, value, ++ size, 0, flags | XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; + } + + static int mp_dacl_removexattr(FsContext *ctx, + const char *path, const char *name) + { + int ret; + char *buffer; + + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lremovexattr(buffer, MAP_ACL_DEFAULT); ++#else ++ ret = removexattr(buffer, MAP_ACL_DEFAULT, XATTR_NOFOLLOW); ++#endif + if (ret == -1 && errno == ENODATA) { + /* + * We don't get ENODATA error when trying to remove a + * posix acl that is not present. So don't throw the error + * even in case of mapped security model + */ + errno = 0; + ret = 0; + } + g_free(buffer); + return ret; + } + + + XattrOperations mapped_pacl_xattr = { + .name = "system.posix_acl_access", + .getxattr = mp_pacl_getxattr, + .setxattr = mp_pacl_setxattr, + .listxattr = mp_pacl_listxattr, + .removexattr = mp_pacl_removexattr, + }; + + XattrOperations mapped_dacl_xattr = { + .name = "system.posix_acl_default", + .getxattr = mp_dacl_getxattr, + .setxattr = mp_dacl_setxattr, + .listxattr = mp_dacl_listxattr, + .removexattr = mp_dacl_removexattr, + }; + + XattrOperations passthrough_acl_xattr = { + .name = "system.posix_acl_", + .getxattr = pt_getxattr, + .setxattr = pt_setxattr, + .listxattr = pt_listxattr, + .removexattr = pt_removexattr, + }; + + XattrOperations none_acl_xattr = { + .name = "system.posix_acl_", + .getxattr = notsup_getxattr, + .setxattr = notsup_setxattr, + .listxattr = notsup_listxattr, + .removexattr = notsup_removexattr, + }; diff --cc hw/9pfs/9p-xattr-user.c index 0000000000,f87530c8b5..45e18e9339 mode 000000,100644..100644 --- a/hw/9pfs/9p-xattr-user.c +++ b/hw/9pfs/9p-xattr-user.c @@@ -1,0 -1,127 +1,139 @@@ + /* + * 9p user. xattr callback + * + * Copyright IBM, Corp. 2010 + * + * Authors: + * Aneesh Kumar K.V + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + + #include "qemu/osdep.h" + #include "9p.h" + #include "fsdev/file-op-9p.h" + #include "9p-xattr.h" + + + static ssize_t mp_user_getxattr(FsContext *ctx, const char *path, + const char *name, void *value, size_t size) + { + char *buffer; + ssize_t ret; + + if (strncmp(name, "user.virtfs.", 12) == 0) { + /* + * Don't allow fetch of user.virtfs namesapce + * in case of mapped security + */ + errno = ENOATTR; + return -1; + } + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lgetxattr(buffer, name, value, size); ++#else ++ ret = getxattr(buffer, name, value, size, 0, XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; + } + + static ssize_t mp_user_listxattr(FsContext *ctx, const char *path, + char *name, void *value, size_t size) + { + int name_size = strlen(name) + 1; + if (strncmp(name, "user.virtfs.", 12) == 0) { + + /* check if it is a mapped posix acl */ + if (strncmp(name, "user.virtfs.system.posix_acl_", 29) == 0) { + /* adjust the name and size */ + name += 12; + name_size -= 12; + } else { + /* + * Don't allow fetch of user.virtfs namesapce + * in case of mapped security + */ + return 0; + } + } + if (!value) { + return name_size; + } + + if (size < name_size) { + errno = ERANGE; + return -1; + } + + /* name_size includes the trailing NUL. */ + memcpy(value, name, name_size); + return name_size; + } + + static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name, + void *value, size_t size, int flags) + { + char *buffer; + int ret; + + if (strncmp(name, "user.virtfs.", 12) == 0) { + /* + * Don't allow fetch of user.virtfs namesapce + * in case of mapped security + */ + errno = EACCES; + return -1; + } + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lsetxattr(buffer, name, value, size, flags); ++#else ++ ret = setxattr(buffer, name, value, size, 0, flags | XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; + } + + static int mp_user_removexattr(FsContext *ctx, + const char *path, const char *name) + { + char *buffer; + int ret; + + if (strncmp(name, "user.virtfs.", 12) == 0) { + /* + * Don't allow fetch of user.virtfs namesapce + * in case of mapped security + */ + errno = EACCES; + return -1; + } + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lremovexattr(buffer, name); ++#else ++ ret = removexattr(buffer, name, XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; + } + + XattrOperations mapped_user_xattr = { + .name = "user.", + .getxattr = mp_user_getxattr, + .setxattr = mp_user_setxattr, + .listxattr = mp_user_listxattr, + .removexattr = mp_user_removexattr, + }; + + XattrOperations passthrough_user_xattr = { + .name = "user.", + .getxattr = pt_getxattr, + .setxattr = pt_setxattr, + .listxattr = pt_listxattr, + .removexattr = pt_removexattr, + }; diff --cc hw/9pfs/9p-xattr.c index 0000000000,5d8595ed93..488d3fd5e1 mode 000000,100644..100644 --- a/hw/9pfs/9p-xattr.c +++ b/hw/9pfs/9p-xattr.c @@@ -1,0 -1,164 +1,172 @@@ + /* + * 9p xattr callback + * + * Copyright IBM, Corp. 2010 + * + * Authors: + * Aneesh Kumar K.V + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + + #include "qemu/osdep.h" + #include "9p.h" + #include "fsdev/file-op-9p.h" + #include "9p-xattr.h" + + + static XattrOperations *get_xattr_operations(XattrOperations **h, + const char *name) + { + XattrOperations *xops; + for (xops = *(h)++; xops != NULL; xops = *(h)++) { + if (!strncmp(name, xops->name, strlen(xops->name))) { + return xops; + } + } + return NULL; + } + + ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, + const char *name, void *value, size_t size) + { + XattrOperations *xops = get_xattr_operations(ctx->xops, name); + if (xops) { + return xops->getxattr(ctx, path, name, value, size); + } + errno = EOPNOTSUPP; + return -1; + } + + ssize_t pt_listxattr(FsContext *ctx, const char *path, + char *name, void *value, size_t size) + { + int name_size = strlen(name) + 1; + if (!value) { + return name_size; + } + + if (size < name_size) { + errno = ERANGE; + return -1; + } + + /* no need for strncpy: name_size is strlen(name)+1 */ + memcpy(value, name, name_size); + return name_size; + } + + + /* + * Get the list and pass to each layer to find out whether + * to send the data or not + */ + ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, + void *value, size_t vsize) + { + ssize_t size = 0; + char *buffer; + void *ovalue = value; + XattrOperations *xops; + char *orig_value, *orig_value_start; + ssize_t xattr_len, parsed_len = 0, attr_len; + + /* Get the actual len */ + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + xattr_len = llistxattr(buffer, value, 0); ++#else ++ xattr_len = listxattr(buffer, value, 0, XATTR_NOFOLLOW); ++#endif + if (xattr_len <= 0) { + g_free(buffer); + return xattr_len; + } + + /* Now fetch the xattr and find the actual size */ + orig_value = g_malloc(xattr_len); ++#ifdef CONFIG_LINUX + xattr_len = llistxattr(buffer, orig_value, xattr_len); ++#else ++ xattr_len = listxattr(buffer, orig_value, xattr_len, XATTR_NOFOLLOW); ++#endif + g_free(buffer); + + /* store the orig pointer */ + orig_value_start = orig_value; + while (xattr_len > parsed_len) { + xops = get_xattr_operations(ctx->xops, orig_value); + if (!xops) { + goto next_entry; + } + + if (!value) { + size += xops->listxattr(ctx, path, orig_value, value, vsize); + } else { + size = xops->listxattr(ctx, path, orig_value, value, vsize); + if (size < 0) { + goto err_out; + } + value += size; + vsize -= size; + } + next_entry: + /* Got the next entry */ + attr_len = strlen(orig_value) + 1; + parsed_len += attr_len; + orig_value += attr_len; + } + if (value) { + size = value - ovalue; + } + + err_out: + g_free(orig_value_start); + return size; + } + + int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name, + void *value, size_t size, int flags) + { + XattrOperations *xops = get_xattr_operations(ctx->xops, name); + if (xops) { + return xops->setxattr(ctx, path, name, value, size, flags); + } + errno = EOPNOTSUPP; + return -1; + + } + + int v9fs_remove_xattr(FsContext *ctx, + const char *path, const char *name) + { + XattrOperations *xops = get_xattr_operations(ctx->xops, name); + if (xops) { + return xops->removexattr(ctx, path, name); + } + errno = EOPNOTSUPP; + return -1; + + } + + XattrOperations *mapped_xattr_ops[] = { + &mapped_user_xattr, + &mapped_pacl_xattr, + &mapped_dacl_xattr, + NULL, + }; + + XattrOperations *passthrough_xattr_ops[] = { + &passthrough_user_xattr, + &passthrough_acl_xattr, + NULL, + }; + + /* for .user none model should be same as passthrough */ + XattrOperations *none_xattr_ops[] = { + &passthrough_user_xattr, + &none_acl_xattr, + NULL, + }; diff --cc hw/9pfs/9p-xattr.h index 0000000000,4d39a20262..fe0c9652bc mode 000000,100644..100644 --- a/hw/9pfs/9p-xattr.h +++ b/hw/9pfs/9p-xattr.h @@@ -1,0 -1,120 +1,174 @@@ + /* + * 9p + * + * Copyright IBM, Corp. 2010 + * + * Authors: + * Aneesh Kumar K.V + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + #ifndef _QEMU_9P_XATTR_H + #define _QEMU_9P_XATTR_H + + #include "qemu/xattr.h" + + typedef struct xattr_operations + { + const char *name; + ssize_t (*getxattr)(FsContext *ctx, const char *path, + const char *name, void *value, size_t size); + ssize_t (*listxattr)(FsContext *ctx, const char *path, + char *name, void *value, size_t size); + int (*setxattr)(FsContext *ctx, const char *path, const char *name, + void *value, size_t size, int flags); + int (*removexattr)(FsContext *ctx, + const char *path, const char *name); + } XattrOperations; + + + extern XattrOperations mapped_user_xattr; + extern XattrOperations passthrough_user_xattr; + + extern XattrOperations mapped_pacl_xattr; + extern XattrOperations mapped_dacl_xattr; + extern XattrOperations passthrough_acl_xattr; + extern XattrOperations none_acl_xattr; + + extern XattrOperations *mapped_xattr_ops[]; + extern XattrOperations *passthrough_xattr_ops[]; + extern XattrOperations *none_xattr_ops[]; + + ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name, + void *value, size_t size); + ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value, + size_t vsize); + int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name, + void *value, size_t size, int flags); + int v9fs_remove_xattr(FsContext *ctx, const char *path, const char *name); + ssize_t pt_listxattr(FsContext *ctx, const char *path, char *name, void *value, + size_t size); + + static inline ssize_t pt_getxattr(FsContext *ctx, const char *path, + const char *name, void *value, size_t size) + { ++#ifdef CONFIG_MARU ++#ifndef CONFIG_WIN32 + char *buffer; + ssize_t ret; + + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lgetxattr(buffer, name, value, size); ++#else ++ ret = getxattr(buffer, name, value, size, 0, XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; ++#else ++ return 0; ++#endif ++#else ++ char *buffer; ++ ssize_t ret; ++ ++ buffer = rpath(ctx, path); ++ ret = lgetxattr(buffer, name, value, size); ++ g_free(buffer); ++ return ret; ++#endif + } + + static inline int pt_setxattr(FsContext *ctx, const char *path, + const char *name, void *value, + size_t size, int flags) + { ++#ifdef CONFIG_MARU ++#ifndef CONFIG_WIN32 + char *buffer; + int ret; + + buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX + ret = lsetxattr(buffer, name, value, size, flags); ++#else ++ ret = setxattr(buffer, name, value, size, 0, flags | XATTR_NOFOLLOW); ++#endif + g_free(buffer); + return ret; ++#else ++ return 0; ++#endif ++#else ++ char *buffer; ++ int ret; ++ ++ buffer = rpath(ctx, path); ++ ret = lsetxattr(buffer, name, value, size, flags); ++ g_free(buffer); ++ return ret; ++#endif + } + + static inline int pt_removexattr(FsContext *ctx, + const char *path, const char *name) + { ++#ifdef CONFIG_MARU ++#ifndef CONFIG_WIN32 ++ char *buffer; ++ int ret; ++ ++ buffer = rpath(ctx, path); ++#ifdef CONFIG_LINUX ++ ret = lremovexattr(path, name); ++#else ++ ret = removexattr(path, name, XATTR_NOFOLLOW); ++#endif ++ g_free(buffer); ++ return ret; ++#else ++ return 0; ++#endif ++#else + char *buffer; + int ret; + + buffer = rpath(ctx, path); + ret = lremovexattr(path, name); + g_free(buffer); + return ret; ++#endif + } + + static inline ssize_t notsup_getxattr(FsContext *ctx, const char *path, + const char *name, void *value, + size_t size) + { + errno = ENOTSUP; + return -1; + } + + static inline int notsup_setxattr(FsContext *ctx, const char *path, + const char *name, void *value, + size_t size, int flags) + { + errno = ENOTSUP; + return -1; + } + + static inline ssize_t notsup_listxattr(FsContext *ctx, const char *path, + char *name, void *value, size_t size) + { + return 0; + } + + static inline int notsup_removexattr(FsContext *ctx, + const char *path, const char *name) + { + errno = ENOTSUP; + return -1; + } + + #endif diff --cc hw/9pfs/Makefile.objs index 6bd86c1d30,da0ae0cfdb..ac3e5910d9 --- a/hw/9pfs/Makefile.objs +++ b/hw/9pfs/Makefile.objs @@@ -1,20 -1,9 +1,30 @@@ ++<<<<<<< HEAD +ifeq ($(CONFIG_MARU),y) +common-obj-y = virtio-9p-maru.o +common-obj-y += virtio-9p-local-maru.o +endif + +ifneq ($(CONFIG_MARU),y) +common-obj-y = virtio-9p.o +common-obj-y += virtio-9p-local.o +endif + +common-obj-y += virtio-9p-coth.o cofs.o codir.o cofile.o +ifneq ($(CONFIG_WIN32),y) +common-obj-y += virtio-9p-xattr-user.o virtio-9p-posix-acl.o +common-obj-y += virtio-9p-xattr.o coxattr.o +endif +common-obj-$(CONFIG_LINUX) += virtio-9p-synth.o +common-obj-$(CONFIG_LINUX) += virtio-9p-proxy.o +common-obj-$(CONFIG_OPEN_BY_HANDLE) += virtio-9p-handle.o ++======= + common-obj-y = 9p.o + common-obj-y += 9p-local.o 9p-xattr.o + common-obj-y += 9p-xattr-user.o 9p-posix-acl.o + common-obj-y += coth.o cofs.o codir.o cofile.o + common-obj-y += coxattr.o 9p-synth.o + common-obj-$(CONFIG_OPEN_BY_HANDLE) += 9p-handle.o + common-obj-y += 9p-proxy.o ++>>>>>>> v2.6.0 obj-y += virtio-9p-device.o diff --cc hw/9pfs/cofile.c index 3d3688b053,293483e0c9..9e8a457f8e --- a/hw/9pfs/cofile.c +++ b/hw/9pfs/cofile.c @@@ -15,16 -16,8 +16,16 @@@ #include "fsdev/qemu-fsdev.h" #include "qemu/thread.h" #include "qemu/coroutine.h" - #include "virtio-9p-coth.h" + #include "coth.h" +#ifdef CONFIG_MARU +#ifdef CONFIG_WIN32 +#ifdef fsync +#undef fsync +#endif +#endif +#endif + int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode, V9fsStatDotl *v9stat) { diff --cc hw/acpi/piix4.c index 218fae33dc,16abdf1624..0f4b623db7 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@@ -39,10 -40,6 +40,12 @@@ #include "hw/acpi/acpi_dev_interface.h" #include "hw/xen/xen.h" ++#include "sysemu/hax.h" ++ +#ifdef CONFIG_MARU +#include "tizen/src/hw/maru_pm.h" +#endif + //#define DEBUG #ifdef DEBUG diff --cc hw/i386/pc.c index 7c60417705,99437e0b78..06f89bd09b --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@@ -65,8 -66,8 +66,10 @@@ #include "hw/mem/pc-dimm.h" #include "qapi/visitor.h" #include "qapi-visit.h" + #include "qom/cpu.h" + +#include "sysemu/hax.h" + /* debug PC/ISA interrupts */ //#define DEBUG_IRQ diff --cc hw/i386/pc_piix.c index de01fda284,7f50116bc7..d48a7ec38f --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@@ -181,10 -161,10 +161,10 @@@ static void pc_init1(MachineState *mach } gsi_state = g_malloc0(sizeof(*gsi_state)); - if (kvm_irqchip_in_kernel()) { - kvm_pc_setup_irq_routing(pci_enabled); + if (kvm_ioapic_in_kernel()) { + kvm_pc_setup_irq_routing(pcmc->pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, - GSI_NUM_PINS); + GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } @@@ -289,20 -271,16 +271,25 @@@ PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); } - if (pci_enabled) { + if (pcmc->pci_enabled) { pc_pci_device_init(pci_bus); } + + if (pcms->acpi_nvdimm_state.is_enabled) { + nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, + pcms->fw_cfg, OBJECT(pcms)); + } } +#ifdef CONFIG_MARU +void maru_pc_init(MachineState *machine); + +void maru_pc_init(MachineState *machine) +{ + pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE); +} +#endif + /* Looking for a pc_compat_2_4() function? It doesn't exist. * pc_compat_*() functions that run on machine-init time and * change global QEMU state are deprecated. Please don't create diff --cc include/ui/qemu-pixman.h index ee54668e2e,4a67e01232..d24e35164f --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@@ -16,9 -16,6 +16,8 @@@ #pragma GCC diagnostic pop #endif +#include - #include "qemu/typedefs.h" + /* * pixman image formats are defined to be native endian, * that means host byte order on qemu. So we go define diff --cc net/tap.c index e377aab3ee,740e8a2613..29b1bbf960 --- a/net/tap.c +++ b/net/tap.c @@@ -791,9 -730,10 +792,9 @@@ int net_init_tap(const NetClientOption char ifname[128]; assert(opts->type == NET_CLIENT_OPTIONS_KIND_TAP); - tap = opts->u.tap; + tap = opts->u.tap.data; queues = tap->has_queues ? tap->queues : 1; vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; - /* QEMU vlans does not support multiqueue tap, in this case peer is set. * For -netdev, peer is always NULL. */ if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) { diff --cc target-i386/translate.c index f0abc1a672,1a1214dcb1..99f763b5b0 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@@ -32,8 -28,8 +28,9 @@@ #include "exec/helper-gen.h" #include "trace-tcg.h" + #include "exec/log.h" +#include "sysemu/hax.h" #define PREFIX_REPZ 0x01 #define PREFIX_REPNZ 0x02 diff --cc util/oslib-posix.c index 6f18866cad,6cc4b8f001..7afc05ca7d --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@@ -53,15 -45,14 +45,15 @@@ #include - #include "config-host.h" #include "sysemu/sysemu.h" #include "trace.h" + #include "qapi/error.h" #include "qemu/sockets.h" +#include "qemu/error-report.h" #include #include - #include #include + #include "qemu/cutils.h" #ifdef CONFIG_LINUX #include diff --cc util/oslib-win32.c index 11f528a4df,c926db4a5c..9ab9e21cc8 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@@ -37,7 -37,8 +37,9 @@@ #include "qemu/main-loop.h" #include "trace.h" #include "qemu/sockets.h" + #include "qemu/cutils.h" +#include "qemu/error-report.h" + /* this must come after including "trace.h" */ #include diff --cc util/qemu-sockets.c index a96a8d7960,0d536911c9..5bbc9eee7e --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@@ -360,26 -371,28 +371,36 @@@ static struct addrinfo *inet_parse_conn return NULL; } - if (qemu_opt_get_bool(opts, "ipv4", 0)) { - ai.ai_family = PF_INET; - } - if (qemu_opt_get_bool(opts, "ipv6", 0)) { - ai.ai_family = PF_INET6; + if (saddr->host == NULL || saddr->port == NULL) { + error_setg(errp, "host and/or port not specified"); + return NULL; } +#ifdef CONFIG_MARU + // for lookup loopback interface... + if (addr[0] == '\0') { + ai.ai_flags = 0; + addr = NULL; + } +#endif + /* lookup */ - rc = getaddrinfo(addr, port, &ai, &res); + rc = getaddrinfo(saddr->host, saddr->port, &ai, &res); + + /* At least FreeBSD and OS-X 10.6 declare AI_V4MAPPED but + * then don't implement it in their getaddrinfo(). Detect + * this and retry without the flag since that's preferrable + * to a fatal error + */ + if (rc == EAI_BADFLAGS && + (ai.ai_flags & AI_V4MAPPED)) { + atomic_set(&useV4Mapped, 0); + ai.ai_flags &= ~AI_V4MAPPED; + rc = getaddrinfo(saddr->host, saddr->port, &ai, &res); + } if (rc != 0) { - error_setg(errp, "address resolution failed for %s:%s: %s", addr, port, - gai_strerror(rc)); + error_setg(errp, "address resolution failed for %s:%s: %s", + saddr->host, saddr->port, gai_strerror(rc)); return NULL; } return res; diff --cc vl.c index 36172f6199,5fd22cb2e9..76783f64fe --- a/vl.c +++ b/vl.c @@@ -3053,13 -2951,10 +3041,15 @@@ static void set_memory_options(uint64_ "'%s' option", slots_str ? "maxmem" : "slots"); exit(EXIT_FAILURE); } + + loc_pop(&loc); } +#ifdef CONFIG_MARU +// W/A for preserve larger continuous heap for RAM. +extern void *preallocated_ram_ptr; +extern int preallocated_ram_size; +#endif int main(int argc, char **argv, char **envp) { int i; @@@ -4160,31 -4034,10 +4169,19 @@@ replay_configure(icount_opts); - opts = qemu_get_machine_opts(); - optarg = qemu_opt_get(opts, "type"); - if (optarg) { - machine_class = machine_parse(optarg); - } - - if (machine_class == NULL) { - error_report("No machine specified, and there is no default"); - error_printf("Use -machine help to list supported machines\n"); - exit(1); - } + machine_class = select_machine(); +#if defined(CONFIG_MARU) + if (is_maru_machine(machine_class)) { + preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL); + if (preallocated_ram_ptr) { + preallocated_ram_size = ram_size; + } + } +#endif + set_memory_options(&ram_slots, &maxram_size, machine_class); - loc_set_none(); - os_daemonize(); if (qemu_init_main_loop(&main_loop_err)) { @@@ -4480,13 -4324,10 +4478,8 @@@ exit(1); } - configure_accelerator(current_machine); - if (qtest_chrdev) { - Error *local_err = NULL; - qtest_init(qtest_chrdev, qtest_log, &local_err); - if (local_err) { - error_report_err(local_err); - exit(1); - } + qtest_init(qtest_chrdev, qtest_log, &error_fatal); } machine_opts = qemu_get_machine_opts(); @@@ -4729,38 -4542,8 +4713,39 @@@ device_init_func, NULL, NULL)) { exit(1); } + rom_reset_order_override(); +#if defined(CONFIG_MARU) + if (is_maru_machine(machine_class)) { + prepare_maru_after_device_init(); + } +#endif +#ifdef CONFIG_VIGS + // To support legacy VIGS options + if (vigs_enabled) { + PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL); + PCIDevice *pci_dev = pci_create(pci_bus, -1, "vigs"); + if (vigs_backend) { + qdev_prop_set_string(&pci_dev->qdev, "backend", vigs_backend); + } else { + qdev_prop_set_string(&pci_dev->qdev, "backend", "gl"); + } + qdev_prop_set_string(&pci_dev->qdev, "wsi", "wsi0"); + qdev_init_nofail(&pci_dev->qdev); + } +#endif +#ifdef CONFIG_YAGL + // To support legacy YaGL options + if (yagl_enabled) { + PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL); + PCIDevice *pci_dev = pci_create(pci_bus, -1, "yagl"); + if (vigs_enabled) { + qdev_prop_set_string(&pci_dev->qdev, "wsi", "wsi0"); + } + qdev_init_nofail(&pci_dev->qdev); + } +#endif + /* Did we create any drives that we failed to create a device for? */ drive_check_orphaned(); @@@ -4890,15 -4653,6 +4868,9 @@@ os_setup_post(); - if (is_daemonized()) { - if (!trace_init_backends(trace_events, trace_file)) { - exit(1); - } - } - +#ifdef CONFIG_MARU + enable_print_backtrace_at_normal_exit(); +#endif main_loop(); replay_disable_events();