Received: from eggs.gnu.org ([140.186.70.92]:36463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXgw1-0005Yp-UE for qemu-devel@nongnu.org; Mon, 05 Dec 2011 17:22:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXgvz-0000yl-Cu for qemu-devel@nongnu.org; Mon, 05 Dec 2011 17:22:53 -0500 Received: from gw.ac.upc.edu ([147.83.30.3]:60656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXgvy-0000yJ-Jq for qemu-devel@nongnu.org; Mon, 05 Dec 2011 17:22:51 -0500 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Mon, 05 Dec 2011 23:22:41 +0100 Message-ID: <20111205222240.31271.78109.stgit@ginnungagap.bsc.es> In-Reply-To: <20111205222208.31271.65662.stgit@ginnungagap.bsc.es> References: <20111205222208.31271.65662.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 2/5] backdoor: Add build infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Zhi Yong Wu Signed-off-by: Llu=C3=ADs Vilanova --- Makefile | 4 +++- Makefile.objs | 18 ++++++++++++++++++ Makefile.target | 4 +++- backdoor/qemu/qemu-backdoor.h | 31 +++++++++++++++++++++++++++++++ configure | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 backdoor/qemu/qemu-backdoor.h diff --git a/Makefile b/Makefile index 301c75e..5f89058 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,9 @@ else DOCS=3D endif =20 -SUBDIR_MAKEFLAGS=3D$(if $(V),,--no-print-directory) BUILD_DIR=3D$(BUILD_= DIR) +SUBDIR_MAKEFLAGS_=3D$(if $(V),,--no-print-directory) BUILD_DIR=3D$(BUILD= _DIR) +# make sure the variable is available to makes in sub-directories +SUBDIR_MAKEFLAGS=3D$(SUBDIR_MAKEFLAGS_) SUBDIR_MAKEFLAGS=3D"$(SUBDIR_MAK= EFLAGS_)" SUBDIR_DEVICES_MAK=3D$(patsubst %, %/config-devices.mak, $(TARGET_DIRS)) SUBDIR_DEVICES_MAK_DEP=3D$(patsubst %, %/config-devices.mak.d, $(TARGET_= DIRS)) =20 diff --git a/Makefile.objs b/Makefile.objs index d7a6539..df943e9 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -398,6 +398,24 @@ trace-obj-y +=3D $(addprefix trace/, $(trace-nested-= y)) $(trace-obj-y): $(GENERATED_HEADERS) =20 ###################################################################### +# backdoor + +backdoor-obj-y +=3D $(addprefix backdoor/qemu/, $(backdoor-nested-y)) + +ifdef CONFIG_BACKDOOR +LIBBACKDOOR =3D libbackdoor/libbackdoor.a + +.PHONY: force +force: + +$(LIBBACKDOOR): $(dir $(LIBBACKDOOR))/Makefile force + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) \ + QEMU_CFLAGS=3D"$(QEMU_CFLAGS) -I$(BUILD_DIR)" \ + TARGET_DIR=3D"$(TARGET_DIR)$(dir $@)/" VPATH=3D"$(VPATH)" \ + SRC_PATH=3D"$(SRC_PATH)" V=3D"$(V)" "$(notdir $@)") +endif + +###################################################################### # smartcard =20 libcacard-y =3D cac.o event.o vcard.o vreader.o vcard_emul_nss.o vcard_e= mul_type.o card_7816.o diff --git a/Makefile.target b/Makefile.target index e244040..9533469 100644 --- a/Makefile.target +++ b/Makefile.target @@ -90,6 +90,8 @@ libobj-$(CONFIG_TCI_DIS) +=3D tci-dis.o =20 tci-dis.o: QEMU_CFLAGS +=3D -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci =20 +libobj-$(CONFIG_BACKDOOR) +=3D $(backdoor-obj-y) + $(libobj-y): $(GENERATED_HEADERS) =20 # libqemu @@ -413,7 +415,7 @@ endif # CONFIG_LINUX_USER =20 obj-$(CONFIG_GDBSTUB_XML) +=3D gdbstub-xml.o =20 -$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) +$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(LIBBACKDOOR) $(call LINK,$^) =20 =20 diff --git a/backdoor/qemu/qemu-backdoor.h b/backdoor/qemu/qemu-backdoor.= h new file mode 100644 index 0000000..05e960d --- /dev/null +++ b/backdoor/qemu/qemu-backdoor.h @@ -0,0 +1,31 @@ +/* + * QEMU-side user-provided callbacks for the backdoor communication chan= nel. + * + * Copyright (C) 2011 Llu=C3=ADs Vilanova + * + * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. + * See the COPYING file in the top-level directory. + */ + +#include +#include + + +/** + * Initialize the backdoor channel. + * + * @param data_size Size of the data channel. + */ +void qemu_backdoor_init(uint64_t data_size); + +/** + * Handle an invocation of the backdoor channel. + * + * The command argument can be used to achieve concurrency among differe= nt + * clients (e.g., threads in the guest system) of the backdoor channel (= e.g., + * different clients write to different parts of the data channel). + * + * @param cmd Command to invoke. + * @param data Pointer to the beginning of the data channel. + */ +void qemu_backdoor(uint64_t cmd, void *data); diff --git a/configure b/configure index ac4840d..f362ef6 100755 --- a/configure +++ b/configure @@ -176,6 +176,7 @@ pie=3D"" zero_malloc=3D"" trace_backend=3D"nop" trace_file=3D"trace" +backdoor=3D"" spice=3D"" rbd=3D"" smartcard=3D"" @@ -549,6 +550,8 @@ for opt do ;; --with-trace-file=3D*) trace_file=3D"$optarg" ;; + --with-backdoor=3D*) backdoor=3D"$optarg" + ;; --enable-gprof) gprof=3D"yes" ;; --static) @@ -1062,6 +1065,7 @@ echo " --enable-trace-backend=3DB Set trace backen= d" echo " Available backends:" $("$source_path"/s= cripts/tracetool --list-backends) echo " --with-trace-file=3DNAME Full PATH,NAME of file to store trace= s" echo " Default:trace-" +echo " --with-backdoor=3DPATH Directory to build user-provided back= door library" echo " --disable-spice disable spice" echo " --enable-spice enable spice" echo " --enable-rbd enable building the rados block device = (rbd)" @@ -2619,6 +2623,20 @@ if test "$trace_backend" =3D "dtrace"; then fi =20 ########################################## +# check for a valid directory for backdoor +if test -n "$backdoor"; then + if test ! -f "$backdoor/Makefile"; then + echo + echo "Error: cannot make into '$backdoor'" + echo "Please choose a directory where I can run 'make'" + echo + exit 1 + fi + backdoor=3D`readlink -f "$backdoor"` +fi + + +########################################## # __sync_fetch_and_and requires at least -march=3Di486. Many toolchains # use i686 as default anyway, but for those that don't, an explicit # specification is necessary @@ -2838,6 +2856,9 @@ echo "uuid support $uuid" echo "vhost-net support $vhost_net" echo "Trace backend $trace_backend" echo "Trace output file $trace_file-" +if test -n "$backdoor"; then + echo "Backdoor lib dir $backdoor" +fi echo "spice support $spice" echo "rbd support $rbd" echo "xfsctl support $xfs" @@ -3231,6 +3252,13 @@ if test "$trace_default" =3D "yes"; then echo "CONFIG_TRACE_DEFAULT=3Dy" >> $config_host_mak fi =20 +# backdoor channel +if test -n "$backdoor"; then + echo "CONFIG_BACKDOOR=3Dy" >> $config_host_mak + echo "BACKDOOR_PATH=3D\"$backdoor\"" >> $config_host_mak + QEMU_CFLAGS=3D"-I\"$backdoor\" $QEMU_CFLAGS" +fi + echo "TOOLS=3D$tools" >> $config_host_mak echo "CHECKS=3D$checks" >> $config_host_mak echo "ROMS=3D$roms" >> $config_host_mak @@ -3342,6 +3370,10 @@ if test "$target" =3D "arm-linux-user" -o "$target= " =3D "armeb-linux-user" -o "$targ mkdir -p $target_dir/nwfpe fi symlink $source_path/Makefile.target $target_dir/Makefile +if test -n "$backdoor"; then + mkdir -p $target_dir/libbackdoor + symlink $backdoor/Makefile $target_dir/libbackdoor/Makefile +fi =20 =20 echo "# Automatically generated by configure - do not modify" > $config_= target_mak