common-obj-y += qdev-monitor.o device-hotplug.o
common-obj-$(CONFIG_WIN32) += os-win32.o
common-obj-$(CONFIG_POSIX) += os-posix.o
-
-common-obj-$(CONFIG_LINUX) += fsdev/
+common-obj-y += fsdev/
- common-obj-y += migration.o migration-tcp.o
- common-obj-y += vmstate.o
- common-obj-y += qemu-file.o qemu-file-unix.o qemu-file-stdio.o
- common-obj-$(CONFIG_RDMA) += migration-rdma.o
+ common-obj-y += migration/
common-obj-y += qemu-char.o #aio.o
- common-obj-y += block-migration.o
- common-obj-y += page_cache.o xbzrle.o
-
- common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
+ common-obj-y += page_cache.o
+ common-obj-y += qjson.o
common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
return info;
}
- /* Stub function that's gets run on the vcpu when its brought out of the
- VM to run inside qemu via async_run_on_cpu()*/
- static void mig_sleep_cpu(void *opq)
- {
- qemu_mutex_unlock_iothread();
- g_usleep(30*1000);
- qemu_mutex_lock_iothread();
- }
-
- /* To reduce the dirty rate explicitly disallow the VCPUs from spending
- much time in the VM. The migration thread will try to catchup.
- Workload will experience a performance drop.
- */
- static void mig_throttle_guest_down(void)
- {
- CPUState *cpu;
-
- qemu_mutex_lock_iothread();
- CPU_FOREACH(cpu) {
- async_run_on_cpu(cpu, mig_sleep_cpu, NULL);
- }
- qemu_mutex_unlock_iothread();
- }
-
- static void check_guest_throttling(void)
- {
- static int64_t t0;
- int64_t t1;
-
- if (!mig_throttle_on) {
- return;
- }
-
- if (!t0) {
- t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
- return;
- }
-
- t1 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
-
- /* If it has been more than 40 ms since the last time the guest
- * was throttled then do it again.
- */
- if (40 < (t1-t0)/1000000) {
- mig_throttle_guest_down();
- t0 = t1;
- }
- }
-
+
+int hax_available(void)
+{
+#ifdef CONFIG_HAX
+ return 1;
+#else
+ return 0;
+#endif
+}
tpm="yes"
libssh2=""
vhdx=""
- quorum=""
numa=""
+ tcmalloc="no"
+
++yagl="no"
++yagl_stats="no"
++glx=""
++vigs="no"
++libtizenusb="no"
++
+# for TIZEN-maru
+winver="0x501"
+java_ui="no"
+maru="no"
+shm="no"
+libav=""
+libpng="no"
+dxva2=""
+vaapi=""
+qt="no"
+qtabi="5.0"
+extension_path=""
+#
+
# parse CC options first
for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
;;
--enable-numa) numa="yes"
;;
+ --disable-tcmalloc) tcmalloc="no"
+ ;;
+ --enable-tcmalloc) tcmalloc="yes"
+ ;;
+# for TIZEN-maru
+ --enable-maru) maru="yes"
+ ;;
+ --winver=*) winver="$optarg"
+ ;;
+ --enable-java-ui) java_ui="yes"
+ ;;
+ --enable-shm) shm="yes"
+ ;;
+ --enable-libav) libav="yes"
+ ;;
+ --disable-libav) libav="no"
+ ;;
+ --enable-libpng) libpng="yes"
+ ;;
+ --enable-dxva2) dxva2="yes"
+ ;;
+ --disable-dxva2) dxva2="no"
+ ;;
+ --enable-vaapi) vaapi="yes"
+ ;;
+ --disable-vaapi) vaapi="no"
+ ;;
+ --disable-qt) qt="no"
+ ;;
+ --enable-qt) qt="yes"
+ ;;
+ --extension-path=*) extension_path="$optarg"
+ ;;
+#
*)
echo "ERROR: unknown option $opt"
echo "Try '$0 --help' for more information"
Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
- --disable-spice disable spice
- --enable-spice enable spice
- --enable-rbd enable building the rados block device (rbd)
- --disable-libiscsi disable iscsi support
- --enable-libiscsi enable iscsi support
- --disable-libnfs disable nfs support
- --enable-libnfs enable nfs support
- --disable-smartcard-nss disable smartcard nss support
- --enable-smartcard-nss enable smartcard nss support
- --disable-libusb disable libusb (for usb passthrough)
- --enable-libusb enable libusb (for usb passthrough)
- --disable-usb-redir disable usb network redirection support
- --enable-usb-redir enable usb network redirection support
- --enable-lzo enable the support of lzo compression library
- --enable-snappy enable the support of snappy compression library
- --disable-guest-agent disable building of the QEMU Guest Agent
- --enable-guest-agent enable building of the QEMU Guest Agent
- --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
- --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
- --disable-seccomp disable seccomp support
- --enable-seccomp enable seccomp support
+ --disable-slirp disable SLIRP userspace network connectivity
+ --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
+ --oss-lib path to OSS library
+ --cpu=CPU Build for host CPU [$cpu]
--with-coroutine=BACKEND coroutine backend. Supported options:
gthread, ucontext, sigaltstack, windows
- --disable-coroutine-pool disable coroutine freelist (worse performance)
- --enable-coroutine-pool enable coroutine freelist (better performance)
- --enable-glusterfs enable GlusterFS backend
- --disable-glusterfs disable GlusterFS backend
- --enable-archipelago enable Archipelago backend
- --disable-archipelago disable Archipelago backend
--enable-gcov enable test coverage analysis with gcov
--gcov=GCOV use specified gcov [$gcov_tool]
- --disable-tpm disable TPM support
- --enable-tpm enable TPM support
- --disable-libssh2 disable ssh block device support
- --enable-libssh2 enable ssh block device support
- --disable-vhdx disable support for the Microsoft VHDX image format
- --enable-vhdx enable support for the Microsoft VHDX image format
- --disable-quorum disable quorum block filter support
- --enable-quorum enable quorum block filter support
- --disable-numa disable libnuma support
- --enable-numa enable libnuma support
-
- --disable-hax disable HAX acceleration support
- --enable-hax enable HAX acceleration support
- --enable-yagl enable YaGL device
- --disable-yagl disable YaGL device
- --enable-yagl-stats enable YaGL stats
- --disable-yagl-stats disable YaGL stats
- --enable-vigs enable VIGS device
- --disable-vigs disable VIGS device
+ --disable-blobs disable installing provided firmware blobs
+ --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
+ --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
+
+ Optional features, enabled with --enable-FEATURE and
+ disabled with --disable-FEATURE, default is enabled if available:
+
+ system all system emulation targets
+ user supported user emulation targets
+ linux-user all linux usermode emulation targets
+ bsd-user all BSD usermode emulation targets
+ guest-base GUEST_BASE support for usermode emulation targets
+ docs build documentation
+ guest-agent build the QEMU Guest Agent
+ guest-agent-msi build guest agent Windows MSI installation package
+ pie Position Independent Executables
+ modules modules support
+ debug-tcg TCG debugging (default is disabled)
+ debug-info debugging information
+ sparse sparse checker
+
+ gnutls GNUTLS cryptography support
+ sdl SDL UI
+ --with-sdlabi select preferred SDL ABI 1.2 or 2.0
+ gtk gtk UI
+ --with-gtkabi select preferred GTK ABI 2.0 or 3.0
+ vte vte support for the gtk UI
+ curses curses UI
+ vnc VNC UI support
+ vnc-tls TLS encryption for VNC server
+ vnc-sasl SASL encryption for VNC server
+ vnc-jpeg JPEG lossy compression for VNC server
+ vnc-png PNG compression for VNC server
+ cocoa Cocoa UI (Mac OS X only)
+ virtfs VirtFS
+ xen xen backend driver support
+ xen-pci-passthrough
+ brlapi BrlAPI (Braile)
+ curl curl connectivity
+ fdt fdt device tree
+ bluez bluez stack connectivity
+ kvm KVM acceleration support
+ rdma RDMA-based migration support
+ uuid uuid support
+ vde support for vde network
+ netmap support for netmap network
+ linux-aio Linux AIO support
+ cap-ng libcap-ng support
+ attr attr and xattr support
+ vhost-net vhost-net acceleration support
+ spice spice
+ rbd rados block device (rbd)
+ libiscsi iscsi support
+ libnfs nfs support
+ smartcard-nss smartcard nss support
+ libusb libusb (for usb passthrough)
+ usb-redir usb network redirection support
+ lzo support of lzo compression library
+ snappy support of snappy compression library
+ bzip2 support of bzip2 compression library
+ (for reading bzip2-compressed dmg images)
+ seccomp seccomp support
+ coroutine-pool coroutine freelist (better performance)
+ glusterfs GlusterFS backend
+ archipelago Archipelago backend
+ tpm TPM support
+ libssh2 ssh block device support
+ vhdx support for the Microsoft VHDX image format
+ numa libnuma support
+ tcmalloc tcmalloc support
++ qt Qt5 UI
++ hax HAX acceleration support
++ yagl YaGL device
++ yagl-stats YaGL stats
++ vigs VIGS device
+
+TIZEN-maru options:
+ --winver=WINVER set WINVER
+ --enable-maru enable maru board
+ --enable-java-ui enable java UI
+ --enable-shm enable shared memory for framebuffer
+ --enable-libav enable libav library
+ --disable-libav disable libav library
+ --enable-libpng enable png library
+ --enable-dxva2 enable dxva2 support
+ --disable-dxva2 disable dxva2 support
+ --ensable-vaapi enable vaapi support
+ --disable-vaapi disable vaapi support
+ --extension-path=PATH set extension path
NOTE: The object files are built at the place where configure is launched
EOF
fi
########################################
- ##########################################
- # End of CC checks
- # After here, no more $cc or $ld runs
-
- if test "$gcov" = "yes" ; then
- CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
- LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
- elif test "$debug" = "no" ; then
- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
- fi
-
- ##########################################
- # Do we have libnfs
- if test "$libnfs" != "no" ; then
- if $pkg_config --atleast-version=1.9.3 libnfs; then
- libnfs="yes"
- libnfs_libs=$($pkg_config --libs libnfs)
- LIBS="$LIBS $libnfs_libs"
- else
- if test "$libnfs" = "yes" ; then
- feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
- fi
- libnfs="no"
- fi
- fi
+ # check if ccache is interfering with
+ # semantic analysis of macros
+
+ ccache_cpp2=no
+ cat > $TMPC << EOF
+ static const int Z = 1;
+ #define fn() ({ Z; })
+ #define TAUT(X) ((X) == Z)
+ #define PAREN(X, Y) (X == Y)
+ #define ID(X) (X)
+ int main(int argc, char *argv[])
+ {
+ int x = 0, y = 0;
+ x = ID(x);
+ x = fn();
+ fn();
+ if (PAREN(x, y)) return 0;
+ if (TAUT(Z)) return 0;
+ return 0;
+ }
+ EOF
+
+ if ! compile_object "-Werror"; then
+ ccache_cpp2=yes
+ fi
+
+ ##########################################
+ # End of CC checks
+ # After here, no more $cc or $ld runs
+
+ if test "$gcov" = "yes" ; then
+ CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
+ LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
+ elif test "$debug" = "no" ; then
+ CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
+ fi
+
+ ##########################################
+ # Do we have libnfs
+ if test "$libnfs" != "no" ; then
+ if $pkg_config --atleast-version=1.9.3 libnfs; then
+ libnfs="yes"
+ libnfs_libs=$($pkg_config --libs libnfs)
+ LIBS="$LIBS $libnfs_libs"
+ else
+ if test "$libnfs" = "yes" ; then
+ feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
+ fi
+ libnfs="no"
+ fi
+ fi
+
++########################################
+# check if dxva2 is available.
+
+check_dxva2() {
+
+cat > $TMPC << EOF
+#include <d3d9.h>
+#include <dxva2api.h>
+int main(void) {
+#if !defined(IDirect3D9_CreateDevice) || \
+ !defined(IDirect3DDeviceManager9_ResetDevice)
+#error No DXVA2 support
+#endif
+ return 0;
+}
+EOF
+if compile_prog "" "" ; then
+ dxva2="yes"
+else
+ dxva2="no"
+fi
+
+}
+
+if test "$dxva2" = "yes" ; then
+ if test "$mingw32" = "yes" ; then
+ check_dxva2
+ if test "$dxva2" != "yes" ; then
+ feature_not_found "dxva2"
+ fi
+ else
+ error_exit "DXVA2 is supported only on Windows"
+ fi
+else
+ if test "$dxva2" != "no" ; then
+ check_dxva2
+ fi
+fi
+
+########################################
+# check if vaapi is available.
+
+check_vaapi() {
+
+if $pkg_config libva --exists; then
+ libva_cflags=`$pkg_config --cflags libva`
+ libva_libs=`$pkg_config --libs libva`
+ vaapi="yes"
+else
+ vaapi="no"
+fi
+
+if $pkg_config libva-x11 --exists; then
+ libva_x11_cflags=`$pkg_config --cflags libva-x11`
+ libva_x11_libs=`$pkg_config --libs libva-x11`
+ libs_softmmu="$libva_libs $libva_x11_libs $libs_softmmu"
+ vaapi="yes"
+else
+ vaapi="no"
+fi
+
+}
+
+if test "$vaapi" = "yes" ; then
+ if test "$linux" = "yes" ; then
+ check_vaapi
+ if test "$vaapi" != "yes" ; then
+ feature_not_found "vaapi"
+ fi
+ else
+ error_exit "VAAPI is supported only on Linux"
+ fi
+else
+ if test "$vaapi" != "no" ; then
+ check_vaapi
+ fi
+fi
+
+########################################
+# set WINVER
+
+if test "$mingw32" = "yes" ; then
+ QEMU_CFLAGS="-DWINVER=$winver $QEMU_CFLAGS"
+fi
+
+########################################
+# check extension path
+
+if [ ! -d "$source_path/tizen/src/$extension_path" ] ; then
+ error_exit "Extension path is not valid $source_path/tizen/src/$extension_path"
+fi
+
+##########################################
+# libav probe
+
+libavcodec_package="libavcodec"
+libavcodec_version="54.35.0"
+libavutil_package="libavutil"
+libavutil_version="52.3.0"
+libavformat_package="libavformat"
+libavformat_version="54.20.3"
+libavresample_package="libavresample"
+libavresample_version="1.0.1"
+libx264_package="x264"
+
+check_libav() {
+# echo "check $1"
+
+if $pkg_config --exists "$1 >= $2" ; then
+ libav_cflags=`$pkg_config --cflags $1`
+ libav_libs=`$pkg_config --libs $1`
+ libs_softmmu="$libav_libs $libs_softmmu"
+ libav="yes"
+else
+ libav="no"
+fi
+
+}
+
+if test "$libav" = "yes"; then
+ check_libav $libavcodec_package $libavcodec_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
+
+ check_libav $libavformat_package $libavformat_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
+
+ check_libav $libavutil_package $libavutil_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
+
+ check_libav $libavresample_package $libavresample_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
+else
+ if test "$libav" != "no"; then
+ check_libav $libavcodec_package $libavcodec_version
+
+ check_libav $libavformat_package $libavformat_version
+
+ check_libav $libavutil_package $libavutil_version
+
+ check_libav $libavresample_package $libavresample_version
+ fi
+fi
+if $pkg_config --exists "$libx264_package" ; then
+ libav_libs="$libav_libs `$pkg_config --libs $libx264_package`"
+ libav="yes"
+else
+ libav="no"
+fi
+
+##########################################
+# libpng probe
+
+if test "$libpng" != "no"; then
+ libpng_package="libpng"
+
+ if $pkg_config --exists "$libpng_package" ; then
+ libpng_cflags=`$pkg_config --cflags $libpng_package`
+ libpng_libs=`$pkg_config --libs $libpng_package`
+ libs_softmmu="$libpng_libs $libs_softmmu"
+ libpng="yes"
+ else
+ if test "$libpng" = "yes" ; then
+ feature_not_found "libpng"
+ fi
+ libpng="no"
+ fi
+fi
+
+
# Disable zero malloc errors for official releases unless explicitly told to
# enable/disable
if test -z "$zero_malloc" ; then
echo "TPM passthrough $tpm_passthrough"
echo "QOM debugging $qom_cast_debug"
echo "vhdx $vhdx"
- echo "Quorum $quorum"
echo "lzo support $lzo"
echo "snappy support $snappy"
+ echo "bzip2 support $bzip2"
echo "NUMA host support $numa"
+ echo "tcmalloc support $tcmalloc"
++echo "Qt support $qt"
+echo "HAX support $hax"
+echo "YaGL support $yagl"
+echo "YaGL stats $yagl_stats"
+echo "VIGS support $vigs"
+
+# for TIZEN-maru
+echo "TIZEN-maru options:"
+echo "maru enabled $maru"
+if test "$mingw32" = "yes"; then
+echo "WINVER $winver"
+fi
+echo "Java UI enabled $java_ui"
+echo "shared framebuffer enabled $shm"
+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"
+#
+
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
fi
echo "CONFIG_NUMA=y" >> $config_host_mak
fi
-
+ if test "$ccache_cpp2" = "yes"; then
+ echo "export CCACHE_CPP2=y" >> $config_host_mak
+ fi
+
+# for TIZEN-maru
+if test "$maru" = "yes" ; then
+ echo "CONFIG_MARU=y" >> $config_host_mak
+fi
+# java ui is deprecated
+if test "$java_ui" = "yes" ; then
+ if test "$shm" = "yes" || test "$sdl" = "yes" ; then
+ echo "CONFIG_JAVA_UI=y" >> $config_host_mak
+ else
+ error_exit "Java UI is only available with SDL or SHM"
+ fi
+fi
+if test "$shm" = "yes" ; then
+ if test "$java_ui" = "yes" ; then
+ echo "CONFIG_USE_SHM=y" >> $config_host_mak
+ else
+ error_exit "SHM is only available whith Java UI"
+ fi
+fi
+if test "$libav" = "yes" ; then
+ echo "CONFIG_LIBAV=y" >> $config_host_mak
+ echo "LIBAV_CFLAGS=$libav_cflags" >> $config_host_mak
+ echo "LIBAV_LIBS=$libav_libs" >> $config_host_mak
+fi
+if test "$libpng" = "yes" ; then
+ echo "CONFIG_PNG=y" >> $config_host_mak
+ echo "LIBPNG_CFLAGS=$libpng_cflags" >> $config_host_mak
+fi
+if test "$dxva2" = "yes" ; then
+ echo "CONFIG_DXVA2=y" >> $config_host_mak
+fi
+if test "$vaapi" = "yes" ; then
+ echo "CONFIG_VAAPI=y" >> $config_host_mak
+ echo "LIBVA_CFLAGS=$libva_cflags $libva_x11_cflags" >> $config_host_mak
+fi
+if test "$libtizenusb" = "yes" ; then
+ echo "CONFIG_TIZENUSB=y" >> $config_host_mak
+fi
+if [ ! -z "$extension_path" ] ; then
+ echo "CONFIG_EXTENSION_PATH=$extension_path" >> $config_host_mak
+fi
+
# build tree in object directory in case the source is not in the current directory
DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
DIRS="$DIRS fsdev"
#include "qemu/atomic.h"
#include "sysemu/qtest.h"
#include "qemu/timer.h"
+ #include "exec/address-spaces.h"
+ #include "exec/memory-internal.h"
+ #include "qemu/rcu.h"
+ #include "exec/tb-hash.h"
+#include "sysemu/hax.h"
/* -icount align implementation. */
}
}
+#ifdef CONFIG_HAX
+ if (hax_enabled() && !hax_vcpu_exec(cpu))
+ longjmp(cpu->jmp_env, 1);
+#endif
+
next_tb = 0; /* force lookup of first TB */
for(;;) {
- interrupt_request = need_handle_intr_request(cpu);
+ interrupt_request = cpu->interrupt_request;
if (unlikely(interrupt_request)) {
if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) {
/* Mask out external interrupts for this step. */
return current_cpu && qemu_cpu_is_self(current_cpu);
}
+ static __thread bool iothread_locked = false;
+
+ bool qemu_mutex_iothread_locked(void)
+ {
+ return iothread_locked;
+ }
+
void qemu_mutex_lock_iothread(void)
{
- if ((hax_enabled() && hax_ug_platform()) || !tcg_enabled()) {
+ atomic_inc(&iothread_requesting_mutex);
+ /* In the simple case there is no need to bump the VCPU thread out of
+ * TCG code execution.
+ */
+#ifdef CONFIG_HAX
- if (!tcg_enabled()) {
++ if (!tcg_enabled() || qemu_in_vcpu_thread() ||
++ !first_cpu || !first_cpu->thread ||
++ (hax_enabled() && hax_ug_platform())) {
+#else
+ if (!tcg_enabled() || qemu_in_vcpu_thread() ||
+ !first_cpu || !first_cpu->thread) {
+#endif
qemu_mutex_lock(&qemu_global_mutex);
+ atomic_dec(&iothread_requesting_mutex);
} else {
- iothread_requesting_mutex = true;
if (qemu_mutex_trylock(&qemu_global_mutex)) {
qemu_cpu_kick_thread(first_cpu);
qemu_mutex_lock(&qemu_global_mutex);
old_ram_size, new_ram_size);
}
}
- cpu_physical_memory_set_dirty_range(new_block->offset, new_block->length);
-
- qemu_ram_setup_dump(new_block->host, new_block->length);
- qemu_madvise(new_block->host, new_block->length, QEMU_MADV_HUGEPAGE);
- qemu_madvise(new_block->host, new_block->length, QEMU_MADV_DONTFORK);
+ cpu_physical_memory_set_dirty_range(new_block->offset,
+ new_block->used_length,
+ DIRTY_CLIENTS_ALL);
- if (kvm_enabled()) {
- kvm_setup_guest_memory(new_block->host, new_block->length);
+ if (new_block->host) {
+ qemu_ram_setup_dump(new_block->host, new_block->max_length);
+ qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
+ qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
+ 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->length);
+ if (ret < 0) {
+ fprintf(stderr, "HAX failed to populate ram\n");
+ exit(-1);
+ }
+ }
+#endif
return new_block->offset;
}
void hmp_ringbuf_read(Monitor *mon, const QDict *qdict);
void hmp_cont(Monitor *mon, const QDict *qdict);
void hmp_system_wakeup(Monitor *mon, const QDict *qdict);
- void hmp_inject_nmi(Monitor *mon, const QDict *qdict);
+ void hmp_nmi(Monitor *mon, const QDict *qdict);
void hmp_set_link(Monitor *mon, const QDict *qdict);
+void hmp_get_link(Monitor *mon, const QDict *qdict);
void hmp_block_passwd(Monitor *mon, const QDict *qdict);
void hmp_balloon(Monitor *mon, const QDict *qdict);
void hmp_block_resize(Monitor *mon, const QDict *qdict);
#include <dirent.h>
#include <sys/time.h>
#include <utime.h>
+#ifdef CONFIG_MARU
+#ifndef CONFIG_WIN32
#include <sys/resource.h>
+#endif
+#else
+#include <sys/resource.h>
+#endif
#include <glib.h>
+ #include "standard-headers/linux/virtio_9p.h"
#include "hw/virtio/virtio.h"
+ #include "hw/virtio/virtio-9p.h"
#include "fsdev/file-op-9p.h"
#include "fsdev/virtio-9p-marshal.h"
#include "qemu/thread.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "hw/acpi/acpi.h"
+ #include "hw/acpi/tco.h"
#include "sysemu/kvm.h"
+#include "sysemu/hax.h"
#include "exec/address-spaces.h"
#include "hw/i386/ich9.h"
acpi_pm_tmr_init(&s->ar, pm_tmr_timer, &s->io);
acpi_pm1_evt_init(&s->ar, pm_tmr_timer, &s->io);
- acpi_pm1_cnt_init(&s->ar, &s->io, s->s4_val);
+ acpi_pm1_cnt_init(&s->ar, &s->io, s->disable_s3, s->disable_s4, s->s4_val);
acpi_gpe_init(&s->ar, GPE_LEN);
+#ifdef CONFIG_MARU
+ acpi_maru_pm_init(&s->ar, pm_tmr_timer);
+#endif
s->powerdown_notifier.notify = piix4_pm_powerdown_req;
qemu_register_powerdown_notifier(&s->powerdown_notifier);
}
}
- static void pc_init_pci(MachineState *machine)
+ static void pc_compat_2_3(MachineState *machine)
{
- pc_init1(machine, 1, 1);
+ PCMachineState *pcms = PC_MACHINE(machine);
+ savevm_skip_section_footers();
+ if (kvm_enabled()) {
+ pcms->smm = ON_OFF_AUTO_OFF;
+ }
+ global_state_set_optional();
+ savevm_skip_configuration();
+ }
+
+ static void pc_compat_2_2(MachineState *machine)
+ {
+ pc_compat_2_3(machine);
+ rsdp_in_ram = false;
+ x86_cpu_compat_set_features("kvm64", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("kvm32", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Conroe", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Penryn", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Nehalem", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Westmere", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("SandyBridge", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Haswell", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Broadwell", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Opteron_G1", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Opteron_G2", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Opteron_G3", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Opteron_G4", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Opteron_G5", FEAT_1_EDX, 0, CPUID_VME);
+ x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
+ x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
+ x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
+ x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
+ machine->suppress_vmdesc = true;
}
+#ifdef CONFIG_MARU
+void maru_pc_init_pci(MachineState *machine);
+
+void maru_pc_init_pci(MachineState *machine)
+{
+ pc_init_pci(machine);
+}
+#endif
+
static void pc_compat_2_1(MachineState *machine)
{
PCMachineState *pcms = PC_MACHINE(machine);
ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
if (ret != 0) {
bios_error:
- fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
+// CONFIG_MARU MODIFICATION
+// fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
+ error_report("qemu: could not load PC BIOS '%s'\n", bios_name);
exit(1);
}
- if (filename) {
- g_free(filename);
- }
+ g_free(filename);
/* map the last 128KB of the BIOS in ISA space */
isa_bios_size = bios_size;
#include "ui/console.h"
#include "ui/input.h"
#include "sysemu/sysemu.h"
-
+ #include "trace.h"
+#ifdef CONFIG_MARU
+/* to guarantee safe serialization of input event by Munkyu Im */
+#include "qemu/thread.h"
+static QemuMutex mutex;
+#endif
++
/* debug PC keyboard */
//#define DEBUG_KBD
typedef enum {
VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
++<<<<<<< HEAD
+ VGA_TCX, VGA_CG3, VGA_DEVICE,
++=======
+ VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
++>>>>>>> v2.4.0
} VGAInterfaceType;
extern int vga_interface_type;
#include "qapi-types.h"
#include "qapi/error.h"
+ #ifdef CONFIG_OPENGL
+ # include <epoxy/gl.h>
+ #endif
+
+#if defined(CONFIG_MARU) && defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI)
+#define SDL_THREAD
+#endif
+
/* keyboard/mouse support */
#define MOUSE_EVENT_LBUTTON 0x01
int index_from_key(const char *key);
/* gtk.c */
- void early_gtk_display_init(void);
+ void early_gtk_display_init(int opengl);
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);
-
#endif
#define PATH_NET_TUN "/dev/net/tun"
+#if defined(CONFIG_MARU)
+static int launch_openvpn(bool ismake, const char *ifname)
+{
+ int pid, status;
+ const char* args[] = {
+ "/usr/bin/sudo",
+ "/usr/sbin/openvpn",
+ "--mktun",
+ "--dev",
+ ifname,
+ NULL
+ };
+ if (ismake) {
+ fprintf(stdout, "launch_openvpn make tap: %s\n", ifname);
+ } else {
+ fprintf(stdout, "launch_openvpn remove tap: %s\n", ifname);
+ args[2] = "--rmtun";
+ }
+ /* try to launch network script */
+ pid = fork();
+ if (pid == 0) {
+ execv(args[0], (char**)args);
+ _exit(1);
+ } else if (pid > 0) {
+ while (waitpid(pid, &status, 0) != pid) {
+ /* loop */
+ }
+
+ if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+ return 0;
+ }
+ }
+ fprintf(stderr, "Could not launch openvpn\n");
+ return -1;
+}
+
+static int tap_cleanup(void)
+{
+ int fd, ret;
+ struct ifreq ifr;
+ char dname[100];
+ int port = get_emul_vm_base_port() + 10;
+
+ TFR(fd = open(PATH_NET_TUN, O_RDWR));
+ if (fd < 0) {
+ error_report("could not open %s: %m", PATH_NET_TUN);
+ return -1;
+ }
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
+
+ for ( ; port < 26200; port += 10) {
+ snprintf(dname, sizeof(dname), "tap%d", port);
+ pstrcpy(ifr.ifr_name, IFNAMSIZ, dname);
+ ret = ioctl(fd, TUNSETIFF, (void *) &ifr);
+ if (ret == 0) {
+ close(fd);
+ if (launch_openvpn(false, dname)) {
+ fprintf(stderr, "Failed to remove %s device. It can be used on the other emulator\n", dname);
+ }
+ TFR(fd = open(PATH_NET_TUN, O_RDWR));
+ if (fd < 0) {
+ error_report("could not open %s: %m", PATH_NET_TUN);
+ return -1;
+ }
+ } else {
+ close(fd);
+ }
+ }
+ return 0;
+}
+
+#endif
+
int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
- int vnet_hdr_required, int mq_required)
+ int vnet_hdr_required, int mq_required, Error **errp)
{
struct ifreq ifr;
int fd, ret;
int len = sizeof(struct virtio_net_hdr);
unsigned int features;
-
+#if defined(CONFIG_MARU)
+ if (tap_cleanup() < 0) {
+ return -1;
+ }
+#endif
TFR(fd = open(PATH_NET_TUN, O_RDWR));
if (fd < 0) {
- error_report("could not open %s: %m", PATH_NET_TUN);
+ error_setg_errno(errp, errno, "could not open %s", PATH_NET_TUN);
return -1;
}
memset(&ifr, 0, sizeof(ifr));
return s;
}
- static int launch_script(const char *setup_script, const char *ifname, int fd)
+#if !defined(CONFIG_WIN32) && defined(CONFIG_MARU)
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+#define BRIDGE_NAME "bridge1"
+static char *get_interface_name_from_ip(void)
+{
+ struct ifaddrs *ifaddrs, *ifaddr;
+ struct sockaddr_in *sa;
+ char *addr;
+
+ getifaddrs(&ifaddrs);
+ for (ifaddr = ifaddrs; ifaddr; ifaddr = ifaddr->ifa_next) {
+ if (ifaddr->ifa_addr->sa_family == AF_INET) {
+ sa = (struct sockaddr_in *) ifaddr->ifa_addr;
+ addr = inet_ntoa(sa->sin_addr);
+ if (0 == strcmp(addr, get_emul_host_ip())) {
+ freeifaddrs(ifaddrs);
+ if (0 == strcmp(addr, BRIDGE_NAME)) {
+ fprintf(stdout, "interface is bridge\n");
+ return NULL;
+ }
+ return ifaddr->ifa_name;
+ }
+ }
+ }
+
+ freeifaddrs(ifaddrs);
+ return NULL;
+}
+#endif
+
+ static void launch_script(const char *setup_script, const char *ifname,
+ int fd, Error **errp)
{
int pid, status;
+#if !defined(CONFIG_WIN32) && defined(CONFIG_MARU)
+ const char* sudo_path = "/usr/bin/sudo";
+ char *host_ifname = get_interface_name_from_ip();
+ fprintf(stdout, "host_ifname: %s\n", host_ifname);
+ int arg_cnt = 0;
+ if (host_ifname == NULL) {
+ arg_cnt = 4;
+ } else {
+ arg_cnt = 5;
+ }
+ char *args[arg_cnt];
+#else
char *args[3];
+#endif
char **parg;
/* try to launch network script */
}
}
parg = args;
+#if !defined(CONFIG_WIN32) && defined(CONFIG_MARU)
+ *parg++ = (char *)sudo_path;
+#endif
*parg++ = (char *)setup_script;
*parg++ = (char *)ifname;
+ if (host_ifname) {
+ *parg++ = (char *)host_ifname;
+ }
*parg = NULL;
+
+#if !defined(CONFIG_WIN32) && defined(CONFIG_MARU)
+ execv(sudo_path, args);
+#else
execv(setup_script, args);
+#endif
_exit(1);
- } else if (pid > 0) {
+ } else {
while (waitpid(pid, &status, 0) != pid) {
/* loop */
}
/* label relocation processing */
static void tcg_out_reloc(TCGContext *s, tcg_insn_unit *code_ptr, int type,
- int label_index, intptr_t addend)
+ TCGLabel *l, intptr_t addend)
{
- TCGLabel *l;
TCGRelocation *r;
- l = &s->labels[label_index];
if (l->has_value) {
/* FIXME: This may break relocations on RISC targets that
- modify instruction fields in place. The caller may not have
+ modify instruction fields in place. The caller may not have
written the initial value. */
patch_reloc(code_ptr, type, l->u.value, addend);
} else {
if (!opts) {
return;
}
+
+#ifdef CONFIG_MARU
+ port = get_emul_spice_port();
+#else
port = qemu_opt_get_number(opts, "port", 0);
+#endif
tls_port = qemu_opt_get_number(opts, "tls-port", 0);
- if (!port && !tls_port) {
- error_report("neither port nor tls-port specified for spice");
- exit(1);
- }
if (port < 0 || port > 65535) {
error_report("spice port is out of range");
exit(1);
static const int blksize = 32;
int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize;
int dirty_top[blocks];
- int y, yoff, x, xoff, blk, bw;
+ int y, yoff1, yoff2, x, xoff, blk, bw;
int bpp = surface_bytes_per_pixel(ssd->ds);
uint8_t *guest, *mirror;
+#endif
if (qemu_spice_rect_is_empty(&ssd->dirty)) {
return;
#include <stdio.h>
#include "monitor/monitor.h"
+ #include "qemu/error-report.h"
+#ifdef CONFIG_MARU
+static QLIST_HEAD(, ErrorReporter) error_reporters =
+ QLIST_HEAD_INITIALIZER(error_reporters);
+
+void add_error_reporter(ErrorReporter *new_reporter)
+{
+ QLIST_INSERT_HEAD(&error_reporters, new_reporter, node);
+}
+
+static void report_to_clients(const char *fmt, va_list ap)
+{
+ ErrorReporter *reporter;
+ QLIST_FOREACH(reporter, &error_reporters, node) {
+ if (reporter->report) {
+ (*(reporter->report))(fmt, ap);
+ }
+ }
+}
+#endif
+
/*
* Print to current monitor if we have one, else to stderr.
* TODO should return int, so callers can calculate width, but that
#define main qemu_main
#endif /* CONFIG_COCOA */
+#ifdef CONFIG_MARU
+#ifdef main
+#undef main
+#endif
+int qemu_main(int argc, char **argv, char **envp);
+#define main qemu_main
+#endif
+
#include <glib.h>
+ #include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "qapi/opts-visitor.h"
#include "qom/object_interfaces.h"
#include "qapi-event.h"
+ #include "exec/semihost.h"
+ #include "crypto/init.h"
- #define DEFAULT_RAM_SIZE 128
-
+#ifdef CONFIG_MARU
+#include "tizen/src/emulator.h"
+#include "tizen/src/emul_state.h"
+#include "tizen/src/ui/qt5.h"
+#include "tizen/src/util/ui_operations.h"
+#include "tizen/src/ecs/ecs.h"
+#include "tizen/src/util/error_handler.h"
+# ifdef CONFIG_JAVA_UI
+#include "tizen/src/display/maru_display.h"
+# endif
+#endif
+
#define MAX_VIRTIO_CONSOLES 1
#define MAX_SCLP_CONSOLES 1
opts = nextopt;
}
#else
- fprintf(stderr, "GTK support is disabled\n");
+ error_report("GTK support is disabled");
exit(1);
#endif
+#ifdef CONFIG_MARU
+ } else if (strstart(p, "maru_sdl", &opts)) {
+# if defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI)
+ display = DT_MARU_SDL;
+# else
+ fprintf(stderr, "maru_sdl support is disabled\n");
+ exit(1);
+# endif
+ } else if (strstart(p, "maru_shm", &opts)) {
+# if defined(CONFIG_USE_SHM) && defined(CONFIG_JAVA_UI)
+ display = DT_MARU_SHM;
+# else
+ fprintf(stderr, "maru_shm is disabled\n");
+ exit(1);
+# endif
+ } else if (strstart(p, "maru_qt", &opts)) {
+# ifdef CONFIG_QT
+ display = DT_MARU_QT_ONSCREEN;
+ while (*opts) {
+ const char *nextopt;
+ if (strstart(opts, ",rendering=", &nextopt)) {
+ opts = nextopt;
+ if (strstart(opts, "onscreen", &nextopt)) {
+ display = DT_MARU_QT_ONSCREEN;
+ } else if (strstart(opts, "offscreen", &nextopt)) {
+ display = DT_MARU_QT_OFFSCREEN;
+ } else {
+ goto invalid_maru_qt_args;
+ }
+ } else if (strstart(opts, ",resolution=", &nextopt)) {
+ opts = nextopt;
+ char *endptr = NULL;
+ // Resolution should be formed "640x480" or "640*480".
+ int width = (int)g_ascii_strtoll(opts, &endptr, 10);
+ int height = (int)g_ascii_strtoll(++endptr, &endptr, 10);
+ if (width <= 0 || height <= 0) {
+ goto invalid_maru_qt_args;
+ }
+ set_initial_display_resolution(width, height);
+ nextopt = endptr;
+ } else if (strstart(opts, ",dpi=", &nextopt)) {
+ opts = nextopt;
+ char *endptr = NULL;
+ int dpi = (int)g_ascii_strtoll(opts, &endptr, 10);
+ if (dpi <= 0) {
+ goto invalid_maru_qt_args;
+ }
+ set_display_pixel_density(dpi);
+ nextopt = endptr;
+ } else {
+ invalid_maru_qt_args:
+ fprintf(stderr, "Invalid maru_qt option string: %s\n", p);
+ exit(1);
+ }
+ opts = nextopt;
+ }
+# else
+ error_report("maru_qt is disabled.\n");
+
+ exit(1);
+# endif
+#endif /* CONFIG_MARU */
} else if (strstart(p, "none", &opts)) {
display = DT_NONE;
} else {
return 0;
}
-
+ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
+ MachineClass *mc)
+ {
+ uint64_t sz;
+ const char *mem_str;
+ const char *maxmem_str, *slots_str;
+ const ram_addr_t default_ram_size = mc->default_ram_size;
+ QemuOpts *opts = qemu_find_opts_singleton("memory");
+
+ sz = 0;
+ mem_str = qemu_opt_get(opts, "size");
+ if (mem_str) {
+ if (!*mem_str) {
+ error_report("missing 'size' option value");
+ exit(EXIT_FAILURE);
+ }
+
+ sz = qemu_opt_get_size(opts, "size", ram_size);
+
+ /* Fix up legacy suffix-less format */
+ if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {
+ uint64_t overflow_check = sz;
+
+ sz <<= 20;
+ if ((sz >> 20) != overflow_check) {
+ error_report("too large 'size' option value");
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
+
+ /* backward compatibility behaviour for case "-m 0" */
+ if (sz == 0) {
+ sz = default_ram_size;
+ }
+
+ sz = QEMU_ALIGN_UP(sz, 8192);
+ ram_size = sz;
+ if (ram_size != sz) {
+ error_report("ram size too large");
+ exit(EXIT_FAILURE);
+ }
+
+ /* store value for the future use */
+ qemu_opt_set_number(opts, "size", ram_size, &error_abort);
+ *maxram_size = ram_size;
+
+ maxmem_str = qemu_opt_get(opts, "maxmem");
+ slots_str = qemu_opt_get(opts, "slots");
+ if (maxmem_str && slots_str) {
+ uint64_t slots;
+
+ sz = qemu_opt_get_size(opts, "maxmem", 0);
+ slots = qemu_opt_get_number(opts, "slots", 0);
+ if (sz < ram_size) {
+ error_report("invalid value of -m option maxmem: "
+ "maximum memory size (0x%" PRIx64 ") must be at least "
+ "the initial memory size (0x" RAM_ADDR_FMT ")",
+ sz, ram_size);
+ exit(EXIT_FAILURE);
+ } else if (sz > ram_size) {
+ if (!slots) {
+ error_report("invalid value of -m option: maxmem was "
+ "specified, but no hotplug slots were specified");
+ exit(EXIT_FAILURE);
+ }
+ } else if (slots) {
+ error_report("invalid value of -m option maxmem: "
+ "memory slots were specified but maximum memory size "
+ "(0x%" PRIx64 ") is equal to the initial memory size "
+ "(0x" RAM_ADDR_FMT ")", sz, ram_size);
+ exit(EXIT_FAILURE);
+ }
+
+ *maxram_size = sz;
+ *ram_slots = slots;
+ } else if ((!maxmem_str && slots_str) ||
+ (maxmem_str && !slots_str)) {
+ error_report("invalid -m option value: missing "
+ "'%s' option", slots_str ? "maxmem" : "slots");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+#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;
uint64_t ram_slots = 0;
FILE *vmstate_dump_file = NULL;
Error *main_loop_err = NULL;
+ Error *err = NULL;
+#ifdef CONFIG_YAGL
+ static bool yagl_enabled = false;
+#endif /* CONFIG_YAGL */
+#ifdef CONFIG_VIGS
+ static bool vigs_enabled = false;
+ static char *vigs_backend = NULL;
+#endif /* CONFIG_VIGS */
+#if defined(CONFIG_MARU) && defined(CONFIG_JAVA_UI)
+ static bool skin_enabled = true;
+#endif /* CONFIG_MARU */
+ qemu_init_cpu_loop();
+ qemu_mutex_lock_iothread();
+
atexit(qemu_run_exit_notifiers);
error_set_progname(argv[0]);
qemu_init_exec_dir(argv[0]);
}
do_smbios_option(opts);
break;
+ case QEMU_OPTION_fwcfg:
+ opts = qemu_opts_parse_noisily(qemu_find_opts("fw_cfg"),
+ optarg, true);
+ if (opts == NULL) {
+ exit(1);
+ }
+ break;
case QEMU_OPTION_enable_kvm:
olist = qemu_find_opts("machine");
- qemu_opts_parse(olist, "accel=kvm", 0);
+ qemu_opts_parse_noisily(olist, "accel=kvm", false);
break;
+ case QEMU_OPTION_enable_yagl:
+#if defined(CONFIG_YAGL)
+ yagl_enabled = true;
+#else
+ fprintf(stderr, "YaGL openGLES passthrough support is disabled,"
+ " ignoring -enable-yagl\n");
+#endif
+ break;
+ case QEMU_OPTION_enable_vigs:
+#if defined(CONFIG_VIGS)
+ vigs_enabled = true;
+#else
+ fprintf(stderr, "VIGS support is disabled,"
+ " ignoring -enable-vigs\n");
+#endif
+ break;
+ case QEMU_OPTION_vigs_backend:
+#if defined(CONFIG_VIGS)
+ vigs_backend = g_strdup(optarg);
+#else
+ fprintf(stderr, "VIGS support is disabled,"
+ " ignoring -vigs-backend\n");
+#endif
+ break;
+ case QEMU_OPTION_M:
case QEMU_OPTION_machine:
olist = qemu_find_opts("machine");
- opts = qemu_opts_parse(olist, optarg, 1);
+ opts = qemu_opts_parse_noisily(olist, optarg, true);
if (!opts) {
exit(1);
}
exit(1);
}
break;
+ case QEMU_OPTION_enable_hax:
+ olist = qemu_find_opts("machine");
+ qemu_opts_parse(olist, "accel=hax", 0);
+ break;
case QEMU_OPTION_add_fd:
#ifndef _WIN32
- opts = qemu_opts_parse(qemu_find_opts("add-fd"), optarg, 0);
+ opts = qemu_opts_parse_noisily(qemu_find_opts("add-fd"),
+ optarg, false);
if (!opts) {
exit(1);
}
exit(1);
#endif
break;
+#if defined(CONFIG_MARU) && defined(CONFIG_JAVA_UI)
+ case QEMU_OPTION_disable_skin:
+ skin_enabled = false;
+ break;
+ case QEMU_OPTION_enable_suspend:
+ ecs_set_suspend_state(SUSPEND_UNLOCK);
+ break;
+#endif
case QEMU_OPTION_object:
- opts = qemu_opts_parse(qemu_find_opts("object"), optarg, 1);
+ opts = qemu_opts_parse_noisily(qemu_find_opts("object"),
+ optarg, true);
if (!opts) {
exit(1);
}
exit(0);
}
- /* Open the logfile at this point, if necessary. We can't open the logfile
- * when encountering either of the logging options (-d or -D) because the
- * other one may be encountered later on the command line, changing the
- * location or level of logging.
+#if defined(CONFIG_MARU)
+ preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL);
+ if (preallocated_ram_ptr) {
+ preallocated_ram_size = ram_size;
+ }
+
+ kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append");
+ // Returned variable points different address from input variable.
+ kernel_cmdline = prepare_maru(kernel_cmdline);
+ qemu_opt_set(qemu_get_machine_opts(), "append", kernel_cmdline);
+#endif
+
+ /* Open the logfile at this point and set the log mask if necessary.
*/
+ if (log_file) {
+ qemu_set_log_filename(log_file);
+ }
+
if (log_mask) {
int mask;
- if (log_file) {
- qemu_set_log_filename(log_file);
- }
-
mask = qemu_str_to_log_mask(log_mask);
if (!mask) {
qemu_print_log_usage(stdout);
}
}
+ #if defined(CONFIG_VNC)
+ if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
+ display_remote++;
+ }
+ #endif
if (display_type == DT_DEFAULT && !display_remote) {
-#if defined(CONFIG_GTK)
+#if defined(CONFIG_MARU)
+ // If no display_type is specified,
+ // we use DT_MARU_QT_OFFSCREEN
+#if defined(CONFIG_QT)
+ display_type = DT_MARU_QT_OFFSCREEN;
+#elif defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI)
+ display_type = DT_MARU_SDL;
+#elif defined(CONFIG_USE_SHM) && defined(CONFIG_JAVA_UI)
+ display_type = DT_MARU_SHM;
+#endif
+#elif defined(CONFIG_GTK)
display_type = DT_GTK;
#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
display_type = DT_SDL;
#if defined(CONFIG_GTK)
if (display_type == DT_GTK) {
- early_gtk_display_init();
+ early_gtk_display_init(request_opengl);
}
#endif
+ #if defined(CONFIG_SDL)
+ if (display_type == DT_SDL) {
+ sdl_display_early_init(request_opengl);
+ }
+ #endif
+ if (request_opengl == 1 && display_opengl == 0) {
+ #if defined(CONFIG_OPENGL)
+ fprintf(stderr, "OpenGL is not supported by the display.\n");
+ #else
+ fprintf(stderr, "QEMU was built without opengl support.\n");
+ #endif
+ exit(1);
+ }
+#ifdef CONFIG_MARU
+# if defined(CONFIG_QT)
+ if (display_type == DT_MARU_QT_ONSCREEN) {
+ maru_early_qt5_display_init(true);
+ } else if (display_type == DT_MARU_QT_OFFSCREEN) {
+ maru_early_qt5_display_init(false);
+ }
+# endif
+#endif
+
socket_init();
- if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0)
+ if (qemu_opts_foreach(qemu_find_opts("object"),
+ object_create,
+ object_create_initial, NULL)) {
exit(1);
+ }
+
+ if (qemu_opts_foreach(qemu_find_opts("chardev"),
+ chardev_init_func, NULL, NULL)) {
+ exit(1);
+ }
+
#ifdef CONFIG_VIRTFS
- if (qemu_opts_foreach(qemu_find_opts("fsdev"), fsdev_init_func, NULL, 1) != 0) {
+ if (qemu_opts_foreach(qemu_find_opts("fsdev"),
+ fsdev_init_func, NULL, NULL)) {
exit(1);
}
#endif
cpu_synchronize_all_post_init();
- set_numa_modes();
+ numa_post_machine_init();
+
+ if (qemu_opts_foreach(qemu_find_opts("fw_cfg"),
+ parse_fw_cfg, fw_cfg_find(), NULL) != 0) {
+ exit(1);
+ }
+ if (hax_enabled()) {
+ hax_sync_vcpus();
+ }
+
/* init USB devices */
- if (usb_enabled(false)) {
+ if (usb_enabled()) {
if (foreach_device_config(DEV_USB, usb_parse) < 0)
exit(1);
}
/* init generic devices */
- if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0)
+ if (qemu_opts_foreach(qemu_find_opts("device"),
+ device_init_func, NULL, NULL)) {
exit(1);
+ }
+#if defined(CONFIG_MARU)
+ 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();