head 1.2; access; symbols pkgsrc-2016Q4:1.1.1.1.0.46 pkgsrc-2016Q4-base:1.1.1.1 pkgsrc-2016Q3:1.1.1.1.0.44 pkgsrc-2016Q3-base:1.1.1.1 pkgsrc-2016Q2:1.1.1.1.0.42 pkgsrc-2016Q2-base:1.1.1.1 pkgsrc-2016Q1:1.1.1.1.0.40 pkgsrc-2016Q1-base:1.1.1.1 pkgsrc-2015Q4:1.1.1.1.0.38 pkgsrc-2015Q4-base:1.1.1.1 pkgsrc-2015Q3:1.1.1.1.0.36 pkgsrc-2015Q3-base:1.1.1.1 pkgsrc-2015Q2:1.1.1.1.0.34 pkgsrc-2015Q2-base:1.1.1.1 pkgsrc-2015Q1:1.1.1.1.0.32 pkgsrc-2015Q1-base:1.1.1.1 pkgsrc-2014Q4:1.1.1.1.0.30 pkgsrc-2014Q4-base:1.1.1.1 pkgsrc-2014Q3:1.1.1.1.0.28 pkgsrc-2014Q3-base:1.1.1.1 pkgsrc-2014Q2:1.1.1.1.0.26 pkgsrc-2014Q2-base:1.1.1.1 pkgsrc-2014Q1:1.1.1.1.0.24 pkgsrc-2014Q1-base:1.1.1.1 pkgsrc-2013Q4:1.1.1.1.0.22 pkgsrc-2013Q4-base:1.1.1.1 pkgsrc-2013Q3:1.1.1.1.0.20 pkgsrc-2013Q3-base:1.1.1.1 pkgsrc-2013Q2:1.1.1.1.0.18 pkgsrc-2013Q2-base:1.1.1.1 pkgsrc-2013Q1:1.1.1.1.0.16 pkgsrc-2013Q1-base:1.1.1.1 pkgsrc-2012Q4:1.1.1.1.0.14 pkgsrc-2012Q4-base:1.1.1.1 pkgsrc-2012Q3:1.1.1.1.0.12 pkgsrc-2012Q3-base:1.1.1.1 pkgsrc-2012Q2:1.1.1.1.0.10 pkgsrc-2012Q2-base:1.1.1.1 pkgsrc-2012Q1:1.1.1.1.0.8 pkgsrc-2012Q1-base:1.1.1.1 pkgsrc-2011Q4:1.1.1.1.0.6 pkgsrc-2011Q4-base:1.1.1.1 pkgsrc-2011Q3:1.1.1.1.0.4 pkgsrc-2011Q3-base:1.1.1.1 pkgsrc-2011Q2:1.1.1.1.0.2 pkgsrc-2011Q2-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.2 date 2016.12.29.19.13.03; author wiz; state dead; branches; next 1.1; commitid kFYPk8EnajcmFUzz; 1.1 date 2011.04.06.09.10.27; author cegger; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2011.04.06.09.10.27; author cegger; state Exp; branches; next ; desc @@ 1.2 log @Remove xenkernel and tools versions 3, 33, and 41. As discussed on pkgsrc-users. @ text @$NetBSD: patch-bb,v 1.1 2011/04/06 09:10:27 cegger Exp $ --- libxc/xc_netbsd.c.orig 2011-03-29 17:09:58.000000000 +0000 +++ libxc/xc_netbsd.c @@@@ -21,6 +21,7 @@@@ #include "xc_private.h" #include +#include #include #include @@@@ -351,7 +352,189 @@@@ void discard_file_cache(xc_interface *xc errno = saved_errno; } -static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type) +#define DEVXEN "/dev/xen/" + +static xc_osdep_handle +netbsd_gnttab_open(xc_gnttab *xcg) +{ + int fd; + + fd = open(DEVXEN "gntdev", O_RDWR); + if (fd == -1) + return XC_OSDEP_OPEN_ERROR; + + return (xc_osdep_handle)fd; +} + +static int +netbsd_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h) +{ + int fd = (int)h; + return close(fd); +} + +static void * +netbsd_gnttab_map_grant_ref(xc_gnttab *xch, xc_osdep_handle h, + uint32_t domid, uint32_t ref, int prot) +{ + int fd = (int)h; + struct ioctl_gntdev_map_grant_ref map; + void *addr; + + map.count = 1; + map.refs[0].domid = domid; + map.refs[0].ref = ref; + + if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) { + PERROR("netbsd_gnttab_map_grant_ref: ioctl MAP_GRANT_REF failed"); + return NULL; + } + +mmap_again: + addr = mmap(NULL, XC_PAGE_SIZE, prot, MAP_SHARED, fd, map.index); + if ( addr == MAP_FAILED ) + { + int saved_errno = errno; + struct ioctl_gntdev_unmap_grant_ref unmap_grant; + + if ( saved_errno == EAGAIN ) + { + usleep(1000); + goto mmap_again; + } + /* Unmap the driver slots used to store the grant information. */ + PERROR("netbsd_gnttab_map_grant_ref: mmap failed"); + unmap_grant.index = map.index; + unmap_grant.count = 1; + ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant); + errno = saved_errno; + return NULL; + } + + return addr; +} + +static void * +do_gnttab_map_grant_refs(xc_gnttab *xch, xc_osdep_handle h, + uint32_t count, uint32_t *domids, int domids_stride, + uint32_t *refs, int prot) +{ + int fd = (int)h; + struct ioctl_gntdev_map_grant_ref *map; + void *addr = NULL; + int i; + + map = malloc(sizeof(*map) + + (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref)); + if ( map == NULL ) + return NULL; + + for ( i = 0; i < count; i++ ) + { + map->refs[i].domid = domids[i * domids_stride]; + map->refs[i].ref = refs[i]; + } + + map->count = count; + + if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) { + PERROR("xc_gnttab_map_grant_refs: ioctl MAP_GRANT_REF failed"); + goto out; + } + + addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd, + map->index); + if ( addr == MAP_FAILED ) + { + int saved_errno = errno; + struct ioctl_gntdev_unmap_grant_ref unmap_grant; + + /* Unmap the driver slots used to store the grant information. */ + PERROR("xc_gnttab_map_grant_refs: mmap failed"); + unmap_grant.index = map->index; + unmap_grant.count = count; + ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant); + errno = saved_errno; + addr = NULL; + } + + out: + free(map); + + return addr; +} + +static void * +netbsd_gnttab_map_grant_refs(xc_gnttab *xcg, xc_osdep_handle h, + uint32_t count, uint32_t *domids, uint32_t *refs, int prot) +{ + return do_gnttab_map_grant_refs(xcg, h, count, domids, 1, refs, prot); +} + +static void * +netbsd_gnttab_map_domain_grant_refs(xc_gnttab *xcg, xc_osdep_handle h, + uint32_t count, uint32_t domid, uint32_t *refs, int prot) +{ + return do_gnttab_map_grant_refs(xcg, h, count, &domid, 0, refs, prot); +} + +static int +netbsd_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h, + void *start_address, uint32_t count) +{ + int fd = (int)h; + struct ioctl_gntdev_get_offset_for_vaddr get_offset; + struct ioctl_gntdev_unmap_grant_ref unmap_grant; + int rc; + + if ( start_address == NULL ) + { + errno = EINVAL; + return -1; + } + + /* First, it is necessary to get the offset which was initially used to + * mmap() the pages. + */ + get_offset.vaddr = (unsigned long)start_address; + rc = ioctl(fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR, &get_offset); + if ( rc ) + return rc; + + if ( get_offset.count != count ) + { + errno = EINVAL; + return -1; + } + + /* Next, unmap the memory. */ + rc = munmap(start_address, count * getpagesize()); + if ( rc ) + return rc; + + /* Finally, unmap the driver slots used to store the grant information. */ + unmap_grant.index = get_offset.offset; + unmap_grant.count = count; + rc = ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant); + if ( rc ) + return rc; + return 0; +} + +static struct xc_osdep_ops netbsd_gnttab_ops = { + .open = &netbsd_gnttab_open, + .close = &netbsd_gnttab_close, + + .u.gnttab = { + .map_grant_ref = &netbsd_gnttab_map_grant_ref, + .map_grant_refs = &netbsd_gnttab_map_grant_refs, + .map_domain_grant_refs = &netbsd_gnttab_map_domain_grant_refs, + .munmap = &netbsd_gnttab_munmap, + }, +}; + +static struct xc_osdep_ops * +netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type) { switch ( type ) { @@@@ -360,8 +543,7 @@@@ static struct xc_osdep_ops *netbsd_osdep case XC_OSDEP_EVTCHN: return &netbsd_evtchn_ops; case XC_OSDEP_GNTTAB: - ERROR("GNTTAB interface not supported on this platform"); - return NULL; + return &netbsd_gnttab_ops; default: return NULL; } @ 1.1 log @Initial revision @ text @d1 1 a1 1 $NetBSD$ @ 1.1.1.1 log @The Xen virtual machine monitor allows running several virtual machines on a single physical machine. The xentools41 package contains the tools to create, destroy and control the virtual machines. This package contains the tools for Xen 4.1.x Release notes: The Xen team is pleased to announce the release of Xen 4.1. The result of nearly 12 months of development, new features include: * A re-architected and improved XL toolstack replacing XM/XEND * Prototype credit2 scheduler designed for latency-sensitive workloads and very large systems. * CPU Pools for advanced partitioning. * Support for large systems (>255 processors) * Support for x86 Advanced Vector eXtension (AVX). * New Memory Access API enabling integration of 3rd party security solutions into Xen virtualized environments. * Many IOMMU fixes (both Intel VT-d IOMMU and AMD IOMMU). * Many toolstack and buildsystem fixes for Linux and NetBSD hosts. * Thirdparty libs: libvirt driver for libxl has been merged to upstream libvirt. * HVM guest PXE boot enhancements, replacing gPXE with iPXE. * Even better stability through our new automated regression tests. Detailed release notes, including a more extensive feature list: http://wiki.xen.org/xenwiki/Xen4.1 To download tarballs: http://xen.org/products/xen_source.html Or the Mercurial source repository (tag 'RELEASE-4.1.0'): http://xenbits.xen.org/xen-unstable.hg And the announcement on the Xen blog: http://blog.xen.org/index.php/2011/03/25/xen-4-1-releases/ Thanks to the many people who have contributed to this release! Regards, The Xen Team @ text @@