Re: [Xen-devel] [PATCH XEN v4 09/23] tools: Refactor hypercall calling wrappers into libxencall.

2015-10-29 Thread Wei Liu
On Wed, Oct 21, 2015 at 04:23:16PM +0100, Ian Campbell wrote:
> libxencall will provide a stable API and ABI for calling hypercalls
> (although those hypercalls themselves may not have a stable API). As
> well as the hypercall buffer infrastructure needed in order to safely
> provide pointer arguments to hypercalls.
> 
> libxenctrl encapsulates a instance of this interface, so users of that
> library are not currently subjected to any actual changes. However all
> hypercalls made internally by libxc now use the correct interface. It
> is expected that most users of this library will be other libraries
> providing a higher level interface, rather than applications directly.
> 
> Only the basic functionality to allocate hypercall safe memory is
> moved, the type safe stuff and bounce buffers remain in libxc.
> 
> Note that the functionality to map foreign pages using privcmd is not
> yet moved, meaning that an xc_interface will now contain two open
> privcmd file descriptors. Foreign memory mapping is logically separate
> functionality and will be moved into its own library.
> 
> The new library uses a version script to ensure that only expected
> symbols are exported and to version them such that ABI guarantees can
> be kept in the future.
> 
> Signed-off-by: Ian Campbell 

Acked-by: Wei Liu 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH XEN v4 09/23] tools: Refactor hypercall calling wrappers into libxencall.

2015-10-21 Thread Ian Campbell
libxencall will provide a stable API and ABI for calling hypercalls
(although those hypercalls themselves may not have a stable API). As
well as the hypercall buffer infrastructure needed in order to safely
provide pointer arguments to hypercalls.

libxenctrl encapsulates a instance of this interface, so users of that
library are not currently subjected to any actual changes. However all
hypercalls made internally by libxc now use the correct interface. It
is expected that most users of this library will be other libraries
providing a higher level interface, rather than applications directly.

Only the basic functionality to allocate hypercall safe memory is
moved, the type safe stuff and bounce buffers remain in libxc.

Note that the functionality to map foreign pages using privcmd is not
yet moved, meaning that an xc_interface will now contain two open
privcmd file descriptors. Foreign memory mapping is logically separate
functionality and will be moved into its own library.

The new library uses a version script to ensure that only expected
symbols are exported and to version them such that ABI guarantees can
be kept in the future.

Signed-off-by: Ian Campbell 
---

Must be applied with:
  - "qemu-xen-traditional: Add libxencall to rpath-link" and a
corresponding QEMU_TAG update folded here.
  - "mini-os: Include libxencall with libxc" and a corresponding bump
to MINIOS_UPSTREAM_REVISION folded in here.

v3: Moved to tools/libs/call
Ported new wrappers (altp2m)

fixup! port altp2m to libxencall
---
 .gitignore|   2 +
 stubdom/Makefile  |  20 +++-
 tools/Makefile|   1 +
 tools/Rules.mk|   7 +-
 tools/libs/Makefile   |   1 +
 tools/libs/call/Makefile  |  67 +
 tools/libs/call/buffer.c  | 192 ++
 tools/libs/call/core.c| 144 
 tools/libs/call/freebsd.c | 140 +++
 tools/libs/call/include/xencall.h |  84 +
 tools/libs/call/libxencall.map|  19 
 tools/libs/call/linux.c   | 132 ++
 tools/libs/call/minios.c  |  81 
 tools/libs/call/netbsd.c  | 121 
 tools/libs/call/private.h |  68 ++
 tools/libs/call/solaris.c |  97 +++
 tools/libxc/Makefile  |   7 +-
 tools/libxc/xc_altp2m.c   |  64 -
 tools/libxc/xc_domain.c   | 105 +++--
 tools/libxc/xc_evtchn.c   |   9 +-
 tools/libxc/xc_flask.c|   8 +-
 tools/libxc/xc_freebsd_osdep.c|  47 --
 tools/libxc/xc_gnttab.c   |   9 +-
 tools/libxc/xc_hcall_buf.c| 138 ++-
 tools/libxc/xc_kexec.c|  36 +++
 tools/libxc/xc_linux_osdep.c  |  49 --
 tools/libxc/xc_minios.c   |  32 ---
 tools/libxc/xc_misc.c |  79 ++--
 tools/libxc/xc_netbsd.c   |  40 
 tools/libxc/xc_private.c  |  64 +
 tools/libxc/xc_private.h  |  76 +--
 tools/libxc/xc_solaris.c  |  16 
 tools/libxc/xc_tmem.c |   7 +-
 tools/misc/Makefile   |   4 +-
 tools/xcutils/Makefile|   2 +-
 tools/xenpaging/Makefile  |   2 +-
 36 files changed, 1338 insertions(+), 632 deletions(-)
 create mode 100644 tools/libs/call/Makefile
 create mode 100644 tools/libs/call/buffer.c
 create mode 100644 tools/libs/call/core.c
 create mode 100644 tools/libs/call/freebsd.c
 create mode 100644 tools/libs/call/include/xencall.h
 create mode 100644 tools/libs/call/libxencall.map
 create mode 100644 tools/libs/call/linux.c
 create mode 100644 tools/libs/call/minios.c
 create mode 100644 tools/libs/call/netbsd.c
 create mode 100644 tools/libs/call/private.h
 create mode 100644 tools/libs/call/solaris.c

diff --git a/.gitignore b/.gitignore
index 9241c54..2899852 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,6 +61,7 @@ stubdom/xenstore
 stubdom/libxentoollog-*
 stubdom/libxenevtchn-*
 stubdom/libxengnttab-*
+stubdom/libxencall-*
 stubdom/libxc-*
 stubdom/lwip-*
 stubdom/mini-os-*
@@ -90,6 +91,7 @@ config/Docs.mk
 tools/libs/toollog/headers.chk
 tools/libs/evtchn/headers.chk
 tools/libs/gnttab/headers.chk
+tools/libs/call/headers.chk
 tools/blktap2/daemon/blktapctrl
 tools/blktap2/drivers/img2qcow
 tools/blktap2/drivers/lock-util
diff --git a/stubdom/Makefile b/stubdom/Makefile
index d4576eb..24f0e0f 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -330,6 +330,12 @@ mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET)
  ln -sf $(XEN_ROOT)/tools/libs/gnttab/include/*.h include/ && \
  ln -sf $(XEN_ROOT)/tools/libs/gnttab/*.c . && \
  ln -sf $(XEN_ROOT)/tools/libs/gnttab/Makefile . )
+   mkdir -p libs-$(XEN_TARGET_ARCH)/call/inc