Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170421-v…
Browse files Browse the repository at this point in the history
…2-tag' into staging

Xen 2017/04/21 + fix

# gpg: Signature made Tue 25 Apr 2017 19:10:37 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <[email protected]>"
# gpg:                 aka "Stefano Stabellini <[email protected]>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20170421-v2-tag: (21 commits)
  move xen-mapcache.c to hw/i386/xen/
  move xen-hvm.c to hw/i386/xen/
  move xen-common.c to hw/xen/
  add xen-9p-backend to MAINTAINERS under Xen
  xen/9pfs: build and register Xen 9pfs backend
  xen/9pfs: send responses back to the frontend
  xen/9pfs: implement in/out_iov_from_pdu and vmarshal/vunmarshal
  xen/9pfs: receive requests from the frontend
  xen/9pfs: connect to the frontend
  xen/9pfs: introduce Xen 9pfs backend
  9p: introduce a type for the 9p header
  xen: import ring.h from xen
  configure: use pkg-config for obtaining xen version
  xen: additionally restrict xenforeignmemory operations
  xen: use libxendevice model to restrict operations
  xen: use 5 digit xen versions
  xen: use libxendevicemodel when available
  configure: detect presence of libxendevicemodel
  xen: create wrappers for all other uses of xc_hvm_XXX() functions
  xen: rename xen_modified_memory() to xen_hvm_modified_memory()
  ...

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed Apr 26, 2017
2 parents fe491fa + 28b99f4 commit 52e94ea
Show file tree
Hide file tree
Showing 33 changed files with 1,435 additions and 193 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ L: [email protected]
S: Supported
F: xen-*
F: */xen*
F: hw/9pfs/xen-9p-backend.c
F: hw/char/xen_console.c
F: hw/display/xenfb.c
F: hw/net/xen_nic.c
Expand Down
6 changes: 0 additions & 6 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ obj-y += dump.o
obj-y += migration/ram.o migration/savevm.o
LIBS := $(libs_softmmu) $(LIBS)

# xen support
obj-$(CONFIG_XEN) += xen-common.o
obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o

# Hardware support
ifeq ($(TARGET_NAME), sparc64)
obj-y += hw/sparc64/
Expand Down
164 changes: 100 additions & 64 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1997,30 +1997,65 @@ fi
# xen probe

if test "$xen" != "no" ; then
xen_libs="-lxenstore -lxenctrl -lxenguest"
xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
# Check whether Xen library path is specified via --extra-ldflags to avoid
# overriding this setting with pkg-config output. If not, try pkg-config
# to obtain all needed flags.

if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
$pkg_config --exists xencontrol ; then
xen_ctrl_version="$(printf '%d%02d%02d' \
$($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
xen=yes
xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
xen_pc="$xen_pc xenevtchn xendevicemodel"
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
else

# First we test whether Xen headers and libraries are available.
# If no, we are done and there is no Xen support.
# If yes, more tests are run to detect the Xen version.
xen_libs="-lxenstore -lxenctrl -lxenguest"
xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"

# Xen (any)
cat > $TMPC <<EOF
# First we test whether Xen headers and libraries are available.
# If no, we are done and there is no Xen support.
# If yes, more tests are run to detect the Xen version.

# Xen (any)
cat > $TMPC <<EOF
#include <xenctrl.h>
int main(void) {
return 0;
}
EOF
if ! compile_prog "" "$xen_libs" ; then
# Xen not found
if test "$xen" = "yes" ; then
feature_not_found "xen" "Install xen devel"
fi
xen=no
if ! compile_prog "" "$xen_libs" ; then
# Xen not found
if test "$xen" = "yes" ; then
feature_not_found "xen" "Install xen devel"
fi
xen=no

# Xen unstable
elif
cat > $TMPC <<EOF &&
#undef XC_WANT_COMPAT_DEVICEMODEL_API
#define __XEN_TOOLS__
#include <xendevicemodel.h>
int main(void) {
xendevicemodel_handle *xd;
# Xen unstable
elif
cat > $TMPC <<EOF &&
xd = xendevicemodel_open(0, 0);
xendevicemodel_close(xd);
return 0;
}
EOF
compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
then
xen_stable_libs="-lxendevicemodel $xen_stable_libs"
xen_ctrl_version=40900
xen=yes
elif
cat > $TMPC <<EOF &&
/*
* If we have stable libs the we don't want the libxc compat
* layers, regardless of what CFLAGS we may have been given.
Expand Down Expand Up @@ -2070,12 +2105,12 @@ int main(void) {
return 0;
}
EOF
compile_prog "" "$xen_libs $xen_stable_libs"
then
xen_ctrl_version=480
xen=yes
elif
cat > $TMPC <<EOF &&
compile_prog "" "$xen_libs $xen_stable_libs"
then
xen_ctrl_version=40800
xen=yes
elif
cat > $TMPC <<EOF &&
/*
* If we have stable libs the we don't want the libxc compat
* layers, regardless of what CFLAGS we may have been given.
Expand Down Expand Up @@ -2121,12 +2156,12 @@ int main(void) {
return 0;
}
EOF
compile_prog "" "$xen_libs $xen_stable_libs"
then
xen_ctrl_version=471
xen=yes
elif
cat > $TMPC <<EOF &&
compile_prog "" "$xen_libs $xen_stable_libs"
then
xen_ctrl_version=40701
xen=yes
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <stdint.h>
int main(void) {
Expand All @@ -2136,14 +2171,14 @@ int main(void) {
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=470
xen=yes

# Xen 4.6
elif
cat > $TMPC <<EOF &&
compile_prog "" "$xen_libs"
then
xen_ctrl_version=40700
xen=yes

# Xen 4.6
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xenstore.h>
#include <stdint.h>
Expand All @@ -2164,14 +2199,14 @@ int main(void) {
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=460
xen=yes

# Xen 4.5
elif
cat > $TMPC <<EOF &&
compile_prog "" "$xen_libs"
then
xen_ctrl_version=40600
xen=yes

# Xen 4.5
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xenstore.h>
#include <stdint.h>
Expand All @@ -2191,13 +2226,13 @@ int main(void) {
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=450
xen=yes
compile_prog "" "$xen_libs"
then
xen_ctrl_version=40500
xen=yes

elif
cat > $TMPC <<EOF &&
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xenstore.h>
#include <stdint.h>
Expand All @@ -2216,24 +2251,25 @@ int main(void) {
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=420
xen=yes
compile_prog "" "$xen_libs"
then
xen_ctrl_version=40200
xen=yes

else
if test "$xen" = "yes" ; then
feature_not_found "xen (unsupported version)" \
"Install a supported xen (xen 4.2 or newer)"
else
if test "$xen" = "yes" ; then
feature_not_found "xen (unsupported version)" \
"Install a supported xen (xen 4.2 or newer)"
fi
xen=no
fi
xen=no
fi

if test "$xen" = yes; then
if test $xen_ctrl_version -ge 471 ; then
libs_softmmu="$xen_stable_libs $libs_softmmu"
if test "$xen" = yes; then
if test $xen_ctrl_version -ge 40701 ; then
libs_softmmu="$xen_stable_libs $libs_softmmu"
fi
libs_softmmu="$xen_libs $libs_softmmu"
fi
libs_softmmu="$xen_libs $libs_softmmu"
fi
fi

Expand Down
1 change: 0 additions & 1 deletion default-configs/i386-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ CONFIG_TPM_TIS=$(CONFIG_TPM)
CONFIG_MC146818RTC=y
CONFIG_PCI_PIIX=y
CONFIG_WDT_IB700=y
CONFIG_XEN_I386=$(CONFIG_XEN)
CONFIG_ISA_DEBUG=y
CONFIG_ISA_TESTDEV=y
CONFIG_VMPORT=y
Expand Down
1 change: 0 additions & 1 deletion default-configs/x86_64-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ CONFIG_TPM_TIS=$(CONFIG_TPM)
CONFIG_MC146818RTC=y
CONFIG_PCI_PIIX=y
CONFIG_WDT_IB700=y
CONFIG_XEN_I386=$(CONFIG_XEN)
CONFIG_ISA_DEBUG=y
CONFIG_ISA_TESTDEV=y
CONFIG_VMPORT=y
Expand Down
6 changes: 6 additions & 0 deletions hw/9pfs/9p.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ static inline char *rpath(FsContext *ctx, const char *path)
typedef struct V9fsPDU V9fsPDU;
struct V9fsState;

typedef struct {
uint32_t size_le;
uint8_t id;
uint16_t tag_le;
} QEMU_PACKED P9MsgHeader;

struct V9fsPDU
{
uint32_t size;
Expand Down
1 change: 1 addition & 0 deletions hw/9pfs/Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ 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
common-obj-$(CONFIG_XEN) += xen-9p-backend.o

obj-y += virtio-9p-device.o
6 changes: 1 addition & 5 deletions hw/9pfs/virtio-9p-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ static void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq)
VirtQueueElement *elem;

while ((pdu = pdu_alloc(s))) {
struct {
uint32_t size_le;
uint8_t id;
uint16_t tag_le;
} QEMU_PACKED out;
P9MsgHeader out;

elem = virtqueue_pop(vq, sizeof(VirtQueueElement));
if (!elem) {
Expand Down
Loading

0 comments on commit 52e94ea

Please sign in to comment.