xen: drop support for Xen 4.1 and older.

Xen 4.2 become unsupported upstream in 09/2015 (see
http://wiki.xen.org/wiki/Xen_Release_Features). However as far as the
interfaces provided by the toolstack libraries go 4.2 and 4.3 are
indistinguishable.

Therefore drop support for Xen 4.1 and earlier which removes a whole
pile of compatibility code which makes future work (to use stable
library interfaces provided by upstream) more difficult. In particular
all supported versions now use a pointer as a libxc handle (4.1 and
earlier used an integer, resulting in various shim layers).

Also Xen 4.2 was the first version of Xen to formally support upstream
QEMU (as a preview) so that makes sense as a cut-off now.

This change drops all the configure-y and resulting ifdefs in a mostly
mechanical way. A follow up will refactor wrappers which are now
unused.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
Ian Campbell 2016-02-10 11:07:01 +00:00 committed by Stefano Stabellini
parent f075c89f0a
commit edfb07ed22
5 changed files with 7 additions and 267 deletions

101
configure vendored
View File

@ -2111,100 +2111,10 @@ EOF
xen_ctrl_version=420
xen=yes
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xs.h>
#include <stdint.h>
#include <xen/hvm/hvm_info_table.h>
#if !defined(HVM_MAX_VCPUS)
# error HVM_MAX_VCPUS not defined
#endif
int main(void) {
xs_daemon_open();
xc_interface_open(0, 0, 0);
xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
xc_gnttab_open(NULL, 0);
xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=410
xen=yes
# Xen 4.0.0
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xs.h>
#include <stdint.h>
#include <xen/hvm/hvm_info_table.h>
#if !defined(HVM_MAX_VCPUS)
# error HVM_MAX_VCPUS not defined
#endif
int main(void) {
struct xen_add_to_physmap xatp = {
.domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
};
xs_daemon_open();
xc_interface_open();
xc_gnttab_open();
xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=400
xen=yes
# Xen 3.4.0
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xs.h>
int main(void) {
struct xen_add_to_physmap xatp = {
.domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
};
xs_daemon_open();
xc_interface_open();
xc_gnttab_open();
xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=340
xen=yes
# Xen 3.3.0
elif
cat > $TMPC <<EOF &&
#include <xenctrl.h>
#include <xs.h>
int main(void) {
xs_daemon_open();
xc_interface_open();
xc_gnttab_open();
xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
return 0;
}
EOF
compile_prog "" "$xen_libs"
then
xen_ctrl_version=330
xen=yes
# Xen version unsupported
else
if test "$xen" = "yes" ; then
feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
feature_not_found "xen (unsupported version)" \
"Install a supported xen (xen 4.2 or newer)"
fi
xen=no
fi
@ -2218,15 +2128,10 @@ EOF
fi
if test "$xen_pci_passthrough" != "no"; then
if test "$xen" = "yes" && test "$linux" = "yes" &&
test "$xen_ctrl_version" -ge 340; then
if test "$xen" = "yes" && test "$linux" = "yes"; then
xen_pci_passthrough=yes
else
if test "$xen_pci_passthrough" = "yes"; then
if test "$xen_ctrl_version" -lt 340; then
error_exit "User requested feature Xen PCI Passthrough" \
"This feature does not work with Xen 3.3"
fi
error_exit "User requested feature Xen PCI Passthrough" \
" but this feature requires /sys from Linux"
fi

View File

@ -44,11 +44,7 @@ static void xen_apic_realize(DeviceState *dev, Error **errp)
s->vapic_control = 0;
memory_region_init_io(&s->io_memory, OBJECT(s), &xen_apic_io_ops, s,
"xen-apic-msi", APIC_SPACE_SIZE);
#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \
&& CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420
msi_supported = true;
#endif
}
static void xen_apic_set_base(APICCommonState *s, uint64_t val)

View File

@ -48,8 +48,4 @@ void xen_modified_memory(ram_addr_t start, ram_addr_t length);
void xen_register_framebuffer(struct MemoryRegion *mr);
#if defined(CONFIG_XEN) && CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
# define HVM_MAX_VCPUS 32
#endif
#endif /* QEMU_HW_XEN_H */

View File

@ -16,11 +16,7 @@
#undef XC_WANT_COMPAT_MAP_FOREIGN_API
#include <xenctrl.h>
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 420
# include <xs.h>
#else
# include <xenstore.h>
#endif
#include <xenstore.h>
#include <xen/io/xenbus.h>
#include "hw/hw.h"
@ -30,129 +26,11 @@
#include "trace.h"
/*
* We don't support Xen prior to 3.3.0.
* We don't support Xen prior to 4.2.0.
*/
/* Xen before 4.0 */
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
static inline void *xc_map_foreign_bulk(int xc_handle, uint32_t dom, int prot,
xen_pfn_t *arr, int *err,
unsigned int num)
{
return xc_map_foreign_batch(xc_handle, dom, prot, arr, num);
}
#endif
/* Xen before 4.1 */
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 410
typedef int XenXC;
typedef int xenevtchn_handle;
typedef int xengnttab_handle;
typedef int xenforeignmemory_handle;
# define XC_INTERFACE_FMT "%i"
# define XC_HANDLER_INITIAL_VALUE -1
static inline xenevtchn_handle *xenevtchn_open(void *logger,
unsigned int open_flags)
{
xenevtchn_handle *h = malloc(sizeof(*h));
if (!h) {
return NULL;
}
*h = xc_evtchn_open();
if (*h == -1) {
free(h);
h = NULL;
}
return h;
}
static inline int xenevtchn_close(xenevtchn_handle *h)
{
int rc = xc_evtchn_close(*h);
free(h);
return rc;
}
#define xenevtchn_fd(h) xc_evtchn_fd(*h)
#define xenevtchn_pending(h) xc_evtchn_pending(*h)
#define xenevtchn_notify(h, p) xc_evtchn_notify(*h, p)
#define xenevtchn_bind_interdomain(h, d, p) xc_evtchn_bind_interdomain(*h, d, p)
#define xenevtchn_unmask(h, p) xc_evtchn_unmask(*h, p)
#define xenevtchn_unbind(h, p) xc_evtchn_unmask(*h, p)
static inline xengnttab_handle *xengnttab_open(void *logger,
unsigned int open_flags)
{
xengnttab_handle *h = malloc(sizeof(*h));
if (!h) {
return NULL;
}
*h = xc_gnttab_open();
if (*h == -1) {
free(h);
h = NULL;
}
return h;
}
static inline int xengnttab_close(xengnttab_handle *h)
{
int rc = xc_gnttab_close(*h);
free(h);
return rc;
}
#define xengnttab_set_max_grants(h, n) xc_gnttab_set_max_grants(*h, n)
#define xengnttab_map_grant_ref(h, d, r, p) xc_gnttab_map_grant_ref(*h, d, r, p)
#define xengnttab_map_grant_refs(h, c, d, r, p) \
xc_gnttab_map_grant_refs(*h, c, d, r, p)
#define xengnttab_unmap(h, a, n) xc_gnttab_munmap(*h, a, n)
static inline XenXC xen_xc_interface_open(void *logger, void *dombuild_logger,
unsigned int open_flags)
{
return xc_interface_open();
}
/* See below for xenforeignmemory_* APIs */
static inline int xc_domain_populate_physmap_exact
(XenXC xc_handle, uint32_t domid, unsigned long nr_extents,
unsigned int extent_order, unsigned int mem_flags, xen_pfn_t *extent_start)
{
return xc_domain_memory_populate_physmap
(xc_handle, domid, nr_extents, extent_order, mem_flags, extent_start);
}
static inline int xc_domain_add_to_physmap(int xc_handle, uint32_t domid,
unsigned int space, unsigned long idx,
xen_pfn_t gpfn)
{
struct xen_add_to_physmap xatp = {
.domid = domid,
.space = space,
.idx = idx,
.gpfn = gpfn,
};
return xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp);
}
static inline struct xs_handle *xs_open(unsigned long flags)
{
return xs_daemon_open();
}
static inline void xs_close(struct xs_handle *xsh)
{
if (xsh != NULL) {
xs_daemon_close(xsh);
}
}
/* Xen 4.1 thru 4.6 */
#elif CONFIG_XEN_CTRL_INTERFACE_VERSION < 471
/* Xen 4.2 thru 4.6 */
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 471
typedef xc_interface *XenXC;
typedef xc_interface *xenforeignmemory_handle;
@ -205,27 +83,11 @@ static inline XenXC xen_xc_interface_open(void *logger, void *dombuild_logger,
}
#endif
/* Xen before 4.2 */
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 420
static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom,
uint64_t addr, uint32_t data)
{
return -ENOSYS;
}
/* The followings are only to compile op_discard related code on older
* Xen releases. */
#define BLKIF_OP_DISCARD 5
struct blkif_request_discard {
uint64_t nr_sectors;
uint64_t sector_number;
};
#else
static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom,
uint64_t addr, uint32_t data)
{
return xc_hvm_inject_msi(xen_xc, dom, addr, data);
}
#endif
void destroy_hvm_domain(bool reboot);

View File

@ -316,7 +316,6 @@ static hwaddr xen_phys_offset_to_gaddr(hwaddr start_addr,
return start_addr;
}
#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 340
static int xen_add_to_physmap(XenIOState *state,
hwaddr start_addr,
ram_addr_t size,
@ -451,24 +450,6 @@ static int xen_remove_from_physmap(XenIOState *state,
return 0;
}
#else
static int xen_add_to_physmap(XenIOState *state,
hwaddr start_addr,
ram_addr_t size,
MemoryRegion *mr,
hwaddr offset_within_region)
{
return -ENOSYS;
}
static int xen_remove_from_physmap(XenIOState *state,
hwaddr start_addr,
ram_addr_t size)
{
return -ENOSYS;
}
#endif
static void xen_set_memory(struct MemoryListener *listener,
MemoryRegionSection *section,
bool add)