[Midnightbsd-cvs] src [12309] trunk/sys/xen: sync with FreeBSD 11-stable

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Feb 8 14:29:01 EST 2020


Revision: 12309
          http://svnweb.midnightbsd.org/src/?rev=12309
Author:   laffer1
Date:     2020-02-08 14:29:01 -0500 (Sat, 08 Feb 2020)
Log Message:
-----------
sync with FreeBSD 11-stable

Modified Paths:
--------------
    trunk/sys/xen/blkif.h
    trunk/sys/xen/evtchn.h
    trunk/sys/xen/features.c
    trunk/sys/xen/gnttab.h
    trunk/sys/xen/hvm.h
    trunk/sys/xen/hypervisor.h
    trunk/sys/xen/xen-os.h
    trunk/sys/xen/xen_intr.h
    trunk/sys/xen/xenbus/xenbus.c
    trunk/sys/xen/xenbus/xenbus_if.m
    trunk/sys/xen/xenbus/xenbusb.c
    trunk/sys/xen/xenbus/xenbusb.h
    trunk/sys/xen/xenbus/xenbusb_back.c
    trunk/sys/xen/xenbus/xenbusb_front.c
    trunk/sys/xen/xenbus/xenbusb_if.m
    trunk/sys/xen/xenbus/xenbusvar.h
    trunk/sys/xen/xenstore/xenstore_internal.h
    trunk/sys/xen/xenstore/xenstorevar.h

Added Paths:
-----------
    trunk/sys/xen/error.h
    trunk/sys/xen/privcmd.h
    trunk/sys/xen/xen_msi.h
    trunk/sys/xen/xen_pci.h
    trunk/sys/xen/xen_pv.h

Modified: trunk/sys/xen/blkif.h
===================================================================
--- trunk/sys/xen/blkif.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/blkif.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -18,7 +18,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/blkif.h 285738 2015-07-21 07:22:18Z royger $
+ * $FreeBSD: stable/11/sys/xen/blkif.h 289686 2015-10-21 10:44:07Z royger $
  */
 
 #ifndef __XEN_BLKIF_H__
@@ -121,7 +121,7 @@
 	dst->handle = src->handle;
 	dst->id = src->id;
 	dst->sector_number = src->sector_number;
-	barrier();
+	__compiler_membar();
 	if (n > dst->nr_segments)
 		n = dst->nr_segments;
 	for (i = 0; i < n; i++)
@@ -136,7 +136,7 @@
 	dst->handle = src->handle;
 	dst->id = src->id;
 	dst->sector_number = src->sector_number;
-	barrier();
+	__compiler_membar();
 	if (n > dst->nr_segments)
 		n = dst->nr_segments;
 	for (i = 0; i < n; i++)

Added: trunk/sys/xen/error.h
===================================================================
--- trunk/sys/xen/error.h	                        (rev 0)
+++ trunk/sys/xen/error.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -0,0 +1,102 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2014 Roger Pau Monné <royger at FreeBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/11/sys/xen/error.h 301195 2016-06-02 07:45:01Z royger $
+ */
+
+#ifndef __XEN_ERROR_H__
+#define __XEN_ERROR_H__
+
+#include <xen/interface/errno.h>
+
+/* Translation table */
+static int xen_errors[] =
+{
+	[XEN_EPERM]		= EPERM,
+	[XEN_ENOENT]		= ENOENT,
+	[XEN_ESRCH]		= ESRCH,
+	[XEN_EIO]		= EIO,
+	[XEN_ENXIO]		= ENXIO,
+	[XEN_E2BIG]		= E2BIG,
+	[XEN_ENOEXEC]		= ENOEXEC,
+	[XEN_EBADF]		= EBADF,
+	[XEN_ECHILD]		= ECHILD,
+	[XEN_EAGAIN]		= EAGAIN,
+	[XEN_ENOMEM]		= ENOMEM,
+	[XEN_EACCES]		= EACCES,
+	[XEN_EFAULT]		= EFAULT,
+	[XEN_EBUSY]		= EBUSY,
+	[XEN_EEXIST]		= EEXIST,
+	[XEN_EXDEV]		= EXDEV,
+	[XEN_ENODEV]		= ENODEV,
+	[XEN_EINVAL]		= EINVAL,
+	[XEN_ENFILE]		= ENFILE,
+	[XEN_EMFILE]		= EMFILE,
+	[XEN_ENOSPC]		= ENOSPC,
+	[XEN_EMLINK]		= EMLINK,
+	[XEN_EDOM]		= EDOM,
+	[XEN_ERANGE]		= ERANGE,
+	[XEN_EDEADLK]		= EDEADLK,
+	[XEN_ENAMETOOLONG]	= ENAMETOOLONG,
+	[XEN_ENOLCK]		= ENOLCK,
+	[XEN_ENOSYS]		= ENOSYS,
+	[XEN_ENODATA]		= ENOENT,
+	[XEN_ETIME]		= ETIMEDOUT,
+	[XEN_EBADMSG]		= EBADMSG,
+	[XEN_EOVERFLOW]		= EOVERFLOW,
+	[XEN_EILSEQ]		= EILSEQ,
+	[XEN_ENOTSOCK]		= ENOTSOCK,
+	[XEN_EOPNOTSUPP]	= EOPNOTSUPP,
+	[XEN_EADDRINUSE]	= EADDRINUSE,
+	[XEN_EADDRNOTAVAIL]	= EADDRNOTAVAIL,
+	[XEN_ENOBUFS]		= ENOBUFS,
+	[XEN_EISCONN]		= EISCONN,
+	[XEN_ENOTCONN]		= ENOTCONN,
+	[XEN_ETIMEDOUT]		= ETIMEDOUT,
+};
+
+static inline int
+xen_translate_error(int error)
+{
+	int bsd_error;
+
+	KASSERT((error < 0), ("Value is not a valid Xen error code"));
+
+	if (-error >= nitems(xen_errors)) {
+		/*
+		 * We received an error value that cannot be translated,
+		 * return EINVAL.
+		 */
+		return (EINVAL);
+	}
+
+	bsd_error = xen_errors[-error];
+	KASSERT((bsd_error != 0), ("Unknown Xen error code"));
+
+	return (bsd_error);
+}
+
+#endif /* !__XEN_ERROR_H__ */


Property changes on: trunk/sys/xen/error.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/xen/evtchn.h
===================================================================
--- trunk/sys/xen/evtchn.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/evtchn.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -27,7 +27,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/evtchn.h 255040 2013-08-29 19:52:18Z gibbs $
+ * $FreeBSD: stable/11/sys/xen/evtchn.h 255040 2013-08-29 19:52:18Z gibbs $
  */
 
 #ifndef __XEN_EVTCHN_H__

Modified: trunk/sys/xen/features.c
===================================================================
--- trunk/sys/xen/features.c	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/features.c	2020-02-08 19:29:01 UTC (rev 12309)
@@ -1,6 +1,6 @@
 /* $MidnightBSD$ */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/sys/xen/features.c 255040 2013-08-29 19:52:18Z gibbs $");
+__FBSDID("$FreeBSD: stable/11/sys/xen/features.c 255040 2013-08-29 19:52:18Z gibbs $");
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: trunk/sys/xen/gnttab.h
===================================================================
--- trunk/sys/xen/gnttab.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/gnttab.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -36,6 +36,7 @@
  */
 
 #ifndef __ASM_GNTTAB_H__
+#define __ASM_GNTTAB_H__
 
 #include <xen/xen-os.h>
 #include <xen/hypervisor.h>
@@ -52,8 +53,6 @@
 	uint16_t count;
 };
 
-int gnttab_init(void);
-
 /*
  * Allocate a grant table reference and return it in *result. Returns
  * zero on success or errno on error.
@@ -117,7 +116,7 @@
 				       unsigned long pfn);
 
 int gnttab_suspend(void);
-int gnttab_resume(void);
+int gnttab_resume(device_t);
 
 #if 0
 
@@ -129,10 +128,8 @@
 {
 	if (flags & GNTMAP_contains_pte)
 		map->host_addr = addr;
-	else if (xen_feature(XENFEAT_auto_translated_physmap))
+	else
 		map->host_addr = vtophys(addr);
-	else
-		map->host_addr = addr;
 
 	map->flags = flags;
 	map->ref = ref;
@@ -145,10 +142,8 @@
 {
 	if (flags & GNTMAP_contains_pte)
 		unmap->host_addr = addr;
-	else if (xen_feature(XENFEAT_auto_translated_physmap))
+	else
 		unmap->host_addr = vtophys(addr);
-	else
-		unmap->host_addr = addr;
 
 	unmap->handle = handle;
 	unmap->dev_bus_addr = 0;
@@ -158,13 +153,8 @@
 gnttab_set_replace_op(struct gnttab_unmap_and_replace *unmap, vm_paddr_t addr,
 		      vm_paddr_t new_addr, grant_handle_t handle)
 {
-	if (xen_feature(XENFEAT_auto_translated_physmap)) {
-		unmap->host_addr = vtophys(addr);
-		unmap->new_addr = vtophys(new_addr);
-	} else {
-		unmap->host_addr = addr;
-		unmap->new_addr = new_addr;
-	}
+	unmap->host_addr = vtophys(addr);
+	unmap->new_addr = vtophys(new_addr);
 
 	unmap->handle = handle;
 }

Modified: trunk/sys/xen/hvm.h
===================================================================
--- trunk/sys/xen/hvm.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/hvm.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -18,7 +18,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/hvm.h 255744 2013-09-20 22:59:22Z gibbs $
+ * $FreeBSD: stable/11/sys/xen/hvm.h 255744 2013-09-20 22:59:22Z gibbs $
  */
 
 #ifndef	__XEN_HVM_H__

Modified: trunk/sys/xen/hypervisor.h
===================================================================
--- trunk/sys/xen/hypervisor.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/hypervisor.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -6,28 +6,12 @@
  * 
  * Copyright (c) 2002, K A Fraser
  *
- * $FreeBSD: stable/10/sys/xen/hypervisor.h 196322 2009-08-17 14:38:59Z jhb $
+ * $FreeBSD: stable/11/sys/xen/hypervisor.h 289686 2015-10-21 10:44:07Z royger $
  */
 
 #ifndef __XEN_HYPERVISOR_H__
 #define __XEN_HYPERVISOR_H__
 
-#ifdef XENHVM
-
-#define is_running_on_xen()	(HYPERVISOR_shared_info != NULL)
-
-#else
-
-#define is_running_on_xen() 1
-
-#endif
-
-#ifdef PAE
-#ifndef CONFIG_X86_PAE
-#define CONFIG_X86_PAE
-#endif
-#endif
-
 #include <sys/cdefs.h>
 #include <sys/systm.h>
 #include <xen/interface/xen.h>
@@ -39,32 +23,14 @@
 #include <xen/interface/memory.h>
 #include <machine/xen/hypercall.h>
 
-#if defined(__amd64__)
-#define MULTI_UVMFLAGS_INDEX 2
-#define MULTI_UVMDOMID_INDEX 3
-#else
-#define MULTI_UVMFLAGS_INDEX 3
-#define MULTI_UVMDOMID_INDEX 4
-#endif
-
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
-#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
-#else
-#define is_initial_xendomain() 0
-#endif
-
-extern start_info_t *xen_start_info;
-
 extern uint64_t get_system_time(int ticks);
 
 static inline int 
-HYPERVISOR_console_write(char *str, int count)
+HYPERVISOR_console_write(const char *str, int count)
 {
     return HYPERVISOR_console_io(CONSOLEIO_write, count, str); 
 }
 
-static inline void HYPERVISOR_crash(void) __dead2;
-
 static inline int
 HYPERVISOR_yield(void)
 {
@@ -133,23 +99,4 @@
 	return (rc);
 }
 
-static inline void
-MULTI_update_va_mapping(
-	multicall_entry_t *mcl, unsigned long va,
-        uint64_t new_val, unsigned long flags)
-{
-    mcl->op = __HYPERVISOR_update_va_mapping;
-    mcl->args[0] = va;
-#if defined(__amd64__)
-    mcl->args[1] = new_val;
-#elif defined(PAE)
-    mcl->args[1] = (uint32_t)(new_val & 0xffffffff) ;
-    mcl->args[2] = (uint32_t)(new_val >> 32);
-#else
-    mcl->args[1] = new_val;
-    mcl->args[2] = 0;
-#endif
-    mcl->args[MULTI_UVMFLAGS_INDEX] = flags;
-}
-
 #endif /* __XEN_HYPERVISOR_H__ */

Added: trunk/sys/xen/privcmd.h
===================================================================
--- trunk/sys/xen/privcmd.h	                        (rev 0)
+++ trunk/sys/xen/privcmd.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -0,0 +1,59 @@
+/* $MidnightBSD$ */
+/******************************************************************************
+ * privcmd.h
+ * 
+ * Interface to /proc/xen/privcmd.
+ * 
+ * Copyright (c) 2003-2005, K A Fraser
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * $FreeBSD: stable/11/sys/xen/privcmd.h 273476 2014-10-22 17:07:20Z royger $
+ */
+
+#ifndef __XEN_PRIVCMD_H__
+#define __XEN_PRIVCMD_H__
+
+struct ioctl_privcmd_hypercall
+{
+	unsigned long op; /* hypercall number */
+	unsigned long arg[5]; /* arguments */
+	long retval; /* return value */
+};
+
+struct ioctl_privcmd_mmapbatch {
+	int num;     /* number of pages to populate */
+	domid_t dom; /* target domain */
+	unsigned long addr;  /* virtual address */
+	const xen_pfn_t *arr; /* array of mfns */
+	int *err; /* array of error codes */
+};
+
+#define IOCTL_PRIVCMD_HYPERCALL					\
+	_IOWR('E', 0, struct ioctl_privcmd_hypercall)
+#define IOCTL_PRIVCMD_MMAPBATCH					\
+	_IOWR('E', 1, struct ioctl_privcmd_mmapbatch)
+
+#endif /* !__XEN_PRIVCMD_H__ */


Property changes on: trunk/sys/xen/privcmd.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/xen/xen-os.h
===================================================================
--- trunk/sys/xen/xen-os.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xen-os.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -25,7 +25,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
  * DEALINGS IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/xen-os.h 315676 2017-03-21 09:38:59Z royger $
+ * $FreeBSD: stable/11/sys/xen/xen-os.h 315668 2017-03-21 08:38:12Z royger $
  */
 
 #ifndef _XEN_XEN_OS_H_
@@ -48,15 +48,14 @@
 /* Everything below this point is not included by assembler (.S) files. */
 #ifndef __ASSEMBLY__
 
-/* Force a proper event-channel callback from Xen. */
-void force_evtchn_callback(void);
-
 extern shared_info_t *HYPERVISOR_shared_info;
+extern start_info_t *HYPERVISOR_start_info;
 
-#ifdef XENHVM
+/* XXX: we need to get rid of this and use HYPERVISOR_start_info directly */
+extern char *console_page;
+
 extern int xen_disable_pv_disks;
 extern int xen_disable_pv_nics;
-#endif
 
 extern bool xen_suspend_cancelled;
 
@@ -86,6 +85,54 @@
 	return (xen_domain_type == XEN_HVM_DOMAIN);
 }
 
+static inline bool
+xen_initial_domain(void)
+{
+	return (xen_domain() && HYPERVISOR_start_info != NULL &&
+	    (HYPERVISOR_start_info->flags & SIF_INITDOMAIN) != 0);
+}
+
+/*
+ * Based on ofed/include/linux/bitops.h
+ *
+ * Those helpers are prefixed by xen_ because xen-os.h is widely included
+ * and we don't want the other drivers using them.
+ *
+ */
+#define NBPL (NBBY * sizeof(long))
+
+static inline bool
+xen_test_bit(int bit, volatile long *addr)
+{
+	unsigned long mask = 1UL << (bit % NBPL);
+
+	return !!(atomic_load_acq_long(&addr[bit / NBPL]) & mask);
+}
+
+static inline void
+xen_set_bit(int bit, volatile long *addr)
+{
+	atomic_set_long(&addr[bit / NBPL], 1UL << (bit % NBPL));
+}
+
+static inline void
+xen_clear_bit(int bit, volatile long *addr)
+{
+	atomic_clear_long(&addr[bit / NBPL], 1UL << (bit % NBPL));
+}
+
+#undef NBPL
+
+/*
+ * Functions to allocate/free unused memory in order
+ * to map memory from other domains.
+ */
+struct resource *xenmem_alloc(device_t dev, int *res_id, size_t size);
+int xenmem_free(device_t dev, int res_id, struct resource *res);
+
+/* Debug/emergency function, prints directly to hypervisor console */
+void xc_printf(const char *, ...) __printflike(1, 2);
+
 #ifndef xen_mb
 #define xen_mb() mb()
 #endif

Modified: trunk/sys/xen/xen_intr.h
===================================================================
--- trunk/sys/xen/xen_intr.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xen_intr.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -29,16 +29,12 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/xen_intr.h 255331 2013-09-06 22:17:02Z gibbs $
+ * $FreeBSD: stable/11/sys/xen/xen_intr.h 340016 2018-11-01 18:34:26Z jhb $
  */
 #ifndef _XEN_INTR_H_
 #define _XEN_INTR_H_
 
-#ifndef __XEN_EVTCHN_PORT_DEFINED__
-typedef uint32_t evtchn_port_t;
-DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
-#define __XEN_EVTCHN_PORT_DEFINED__ 1
-#endif
+#include <xen/interface/event_channel.h>
 
 /** Registered Xen interrupt callback handle. */
 typedef void * xen_intr_handle_t;
@@ -46,6 +42,8 @@
 /** If non-zero, the hypervisor has been configured to use a direct vector */
 extern int xen_vector_callback_enabled;
 
+void xen_intr_handle_upcall(struct trapframe *trap_frame);
+
 /**
  * Associate an already allocated local event channel port an interrupt
  * handler.
@@ -146,7 +144,6 @@
  * interupts and, if successful, associate the port with the specified
  * interrupt handler.
  *
- * \param dev       The device making this bind request.
  * \param cpu       The cpu receiving the IPI.
  * \param filter    The interrupt filter servicing this IPI.
  * \param irqflags  Interrupt handler flags.  See sys/bus.h.
@@ -155,11 +152,23 @@
  *
  * \returns  0 on success, otherwise an errno.
  */
-int xen_intr_alloc_and_bind_ipi(device_t dev, u_int cpu,
+int xen_intr_alloc_and_bind_ipi(u_int cpu,
 	driver_filter_t filter, enum intr_type irqflags,
 	xen_intr_handle_t *handlep);
 
 /**
+ * Register a physical interrupt vector and setup the interrupt source.
+ *
+ * \param vector        The global vector to use.
+ * \param trig          Default trigger method.
+ * \param pol           Default polarity of the interrupt.
+ *
+ * \returns  0 on success, otherwise an errno.
+ */
+int xen_register_pirq(int vector, enum intr_trigger trig,
+	enum intr_polarity pol);
+
+/**
  * Unbind an interrupt handler from its interrupt source.
  *
  * \param handlep  A pointer to the opaque handle that was initialized
@@ -213,4 +222,55 @@
  */
 evtchn_port_t xen_intr_port(xen_intr_handle_t handle);
 
+/**
+ * Setup MSI vector interrupt(s).
+ *
+ * \param dev     The device that requests the binding.
+ *
+ * \param vector  Requested initial vector to bind the MSI interrupt(s) to.
+ *
+ * \param count   Number of vectors to allocate.
+ *
+ * \returns  0 on success, otherwise an errno.
+ */
+int xen_register_msi(device_t dev, int vector, int count);
+
+/**
+ * Teardown a MSI vector interrupt.
+ *
+ * \param vector  Requested vector to release.
+ *
+ * \returns  0 on success, otherwise an errno.
+ */
+int xen_release_msi(int vector);
+
+/**
+ * Bind an event channel port with a handler
+ *
+ * \param dev       The device making this bind request.
+ * \param filter    An interrupt filter handler.  Specify NULL
+ *                  to always dispatch to the ithread handler.
+ * \param handler   An interrupt ithread handler.  Optional (can
+ *                  specify NULL) if all necessary event actions
+ *                  are performed by filter.
+ * \param arg       Argument to present to both filter and handler.
+ * \param irqflags  Interrupt handler flags.  See sys/bus.h.
+ * \param handle    Opaque handle used to manage this registration.
+ *
+ * \returns  0 on success, otherwise an errno.
+ */
+int xen_intr_add_handler(const char *name, driver_filter_t filter,
+	driver_intr_t handler, void *arg, enum intr_type flags,
+	xen_intr_handle_t handle);
+
+/**
+ * Register the IO-APIC PIRQs when running in legacy PVH Dom0 mode.
+ *
+ * \param pic	    PIC instance.
+ *
+ * NB: this should be removed together with the support for legacy PVH mode.
+ */
+struct pic;
+void xenpv_register_pirqs(struct pic *pic);
+
 #endif /* _XEN_INTR_H_ */

Added: trunk/sys/xen/xen_msi.h
===================================================================
--- trunk/sys/xen/xen_msi.h	                        (rev 0)
+++ trunk/sys/xen/xen_msi.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -0,0 +1,40 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 Roger Pau Monné <roger.pau at citrix.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/11/sys/xen/xen_msi.h 276767 2015-01-06 21:26:35Z imp $
+ */
+
+#ifndef __XEN_MSI_H__
+#define __XEN_MSI_H__
+
+void	xen_msi_init(void);
+int	xen_msi_map(int irq, uint64_t *addr, uint32_t *data);
+int	xen_msi_alloc(device_t dev, int count, int maxcount, int *irqs);
+int	xen_msi_release(int *irqs, int count);
+int	xen_msix_alloc(device_t dev, int *irq);
+int	xen_msix_release(int irq);
+
+#endif /* !__XEN_MSI_H__ */


Property changes on: trunk/sys/xen/xen_msi.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/xen/xen_pci.h
===================================================================
--- trunk/sys/xen/xen_pci.h	                        (rev 0)
+++ trunk/sys/xen/xen_pci.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -0,0 +1,38 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 Roger Pau Monné <roger.pau at citrix.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/11/sys/xen/xen_pci.h 275649 2014-12-09 18:03:25Z royger $
+ */
+
+#ifndef __XEN_PCI_H__
+#define __XEN_PCI_H__
+
+void xen_pci_enable_msi_method(device_t dev, device_t child, uint64_t address,
+     uint16_t data);
+void xen_pci_disable_msi_method(device_t dev, device_t child);
+void xen_pci_child_added_method(device_t dev, device_t child);
+
+#endif /* !__XEN_PCI_H__ */


Property changes on: trunk/sys/xen/xen_pci.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/xen/xen_pv.h
===================================================================
--- trunk/sys/xen/xen_pv.h	                        (rev 0)
+++ trunk/sys/xen/xen_pv.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -0,0 +1,35 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2014 Roger Pau Monné <roger.pau at citrix.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/11/sys/xen/xen_pv.h 267536 2014-06-16 08:54:04Z royger $
+ */
+
+#ifndef __XEN_PV_H__
+#define __XEN_PV_H__
+
+extern struct apic_ops xen_apic_ops;
+
+#endif


Property changes on: trunk/sys/xen/xen_pv.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/xen/xenbus/xenbus.c
===================================================================
--- trunk/sys/xen/xenbus/xenbus.c	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbus.c	2020-02-08 19:29:01 UTC (rev 12309)
@@ -41,7 +41,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/sys/xen/xenbus/xenbus.c 255040 2013-08-29 19:52:18Z gibbs $");
+__FBSDID("$FreeBSD: stable/11/sys/xen/xenbus/xenbus.c 255040 2013-08-29 19:52:18Z gibbs $");
 
 #include <sys/cdefs.h>
 #include <sys/param.h>

Modified: trunk/sys/xen/xenbus/xenbus_if.m
===================================================================
--- trunk/sys/xen/xenbus/xenbus_if.m	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbus_if.m	2020-02-08 19:29:01 UTC (rev 12309)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 #-
 # Copyright (c) 2008 Doug Rabson
 # All rights reserved.
@@ -23,8 +24,8 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: stable/10/sys/xen/xenbus/xenbus_if.m 255040 2013-08-29 19:52:18Z gibbs $
-# $MidnightBSD$
+# $FreeBSD: stable/11/sys/xen/xenbus/xenbus_if.m 255040 2013-08-29 19:52:18Z gibbs $
+#
 
 #include <sys/bus.h>
 

Modified: trunk/sys/xen/xenbus/xenbusb.c
===================================================================
--- trunk/sys/xen/xenbus/xenbusb.c	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbusb.c	2020-02-08 19:29:01 UTC (rev 12309)
@@ -53,7 +53,7 @@
  *                        xnb1
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/sys/xen/xenbus/xenbusb.c 315676 2017-03-21 09:38:59Z royger $");
+__FBSDID("$FreeBSD: stable/11/sys/xen/xenbus/xenbusb.c 315668 2017-03-21 08:38:12Z royger $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -331,7 +331,7 @@
 	default:
 		return (EINVAL);
 	}
-	return (SYSCTL_OUT(req, value, strlen(value)));
+	return (SYSCTL_OUT_STR(req, value));
 }
 
 /**

Modified: trunk/sys/xen/xenbus/xenbusb.h
===================================================================
--- trunk/sys/xen/xenbus/xenbusb.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbusb.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -31,7 +31,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $FreeBSD: stable/10/sys/xen/xenbus/xenbusb.h 222975 2011-06-11 04:59:01Z gibbs $
+ * $FreeBSD: stable/11/sys/xen/xenbus/xenbusb.h 222975 2011-06-11 04:59:01Z gibbs $
  */
 #ifndef _XEN_XENBUS_XENBUSB_H
 #define _XEN_XENBUS_XENBUSB_H

Modified: trunk/sys/xen/xenbus/xenbusb_back.c
===================================================================
--- trunk/sys/xen/xenbus/xenbusb_back.c	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbusb_back.c	2020-02-08 19:29:01 UTC (rev 12309)
@@ -37,7 +37,7 @@
  * Xen split devices.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/sys/xen/xenbus/xenbusb_back.c 225704 2011-09-20 23:44:34Z gibbs $");
+__FBSDID("$FreeBSD: stable/11/sys/xen/xenbus/xenbusb_back.c 225704 2011-09-20 23:44:34Z gibbs $");
 
 #include <sys/param.h>
 #include <sys/bus.h>

Modified: trunk/sys/xen/xenbus/xenbusb_front.c
===================================================================
--- trunk/sys/xen/xenbus/xenbusb_front.c	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbusb_front.c	2020-02-08 19:29:01 UTC (rev 12309)
@@ -37,7 +37,7 @@
  * Xen split devices.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/sys/xen/xenbus/xenbusb_front.c 255040 2013-08-29 19:52:18Z gibbs $");
+__FBSDID("$FreeBSD: stable/11/sys/xen/xenbus/xenbusb_front.c 255040 2013-08-29 19:52:18Z gibbs $");
 
 #include <sys/param.h>
 #include <sys/bus.h>

Modified: trunk/sys/xen/xenbus/xenbusb_if.m
===================================================================
--- trunk/sys/xen/xenbus/xenbusb_if.m	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbusb_if.m	2020-02-08 19:29:01 UTC (rev 12309)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 #-
 # Copyright (c) 2010 Spectra Logic Corporation
 # All rights reserved.
@@ -27,8 +28,8 @@
 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGES.
 #
-# $FreeBSD: stable/10/sys/xen/xenbus/xenbusb_if.m 222975 2011-06-11 04:59:01Z gibbs $
-# $MidnightBSD$
+# $FreeBSD: stable/11/sys/xen/xenbus/xenbusb_if.m 222975 2011-06-11 04:59:01Z gibbs $
+#
 
 #include <sys/bus.h>
 #include <sys/lock.h>

Modified: trunk/sys/xen/xenbus/xenbusvar.h
===================================================================
--- trunk/sys/xen/xenbus/xenbusvar.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenbus/xenbusvar.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -24,7 +24,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/xenbus/xenbusvar.h 255040 2013-08-29 19:52:18Z gibbs $
+ * $FreeBSD: stable/11/sys/xen/xenbus/xenbusvar.h 294090 2016-01-15 14:34:31Z royger $
  */
 
 /**
@@ -83,7 +83,13 @@
 };
 
 /**
- * Simplified accessors for xenbus devices
+ * Simplified accessors for xenbus devices:
+ *
+ * xenbus_get_node
+ * xenbus_get_type
+ * xenbus_get_state
+ * xenbus_get_otherend_id
+ * xenbus_get_otherend_path
  */
 #define	XENBUS_ACCESSOR(var, ivar, type) \
 	__BUS_ACCESSOR(xenbus, var, XENBUS, ivar, type)

Modified: trunk/sys/xen/xenstore/xenstore_internal.h
===================================================================
--- trunk/sys/xen/xenstore/xenstore_internal.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenstore/xenstore_internal.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -30,11 +30,8 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $FreeBSD: stable/10/sys/xen/xenstore/xenstore_internal.h 214077 2010-10-19 20:53:30Z gibbs $
+ * $FreeBSD: stable/11/sys/xen/xenstore/xenstore_internal.h 272318 2014-09-30 17:31:04Z royger $
  */
 
-/* Initialize support for userspace access to the XenStore. */
-void xs_dev_init(void);
-
 /* Used by the XenStore character device to borrow kernel's store connection. */
 int xs_dev_request_and_reply(struct xsd_sockmsg *msg, void **result);

Modified: trunk/sys/xen/xenstore/xenstorevar.h
===================================================================
--- trunk/sys/xen/xenstore/xenstorevar.h	2020-02-08 19:28:55 UTC (rev 12308)
+++ trunk/sys/xen/xenstore/xenstorevar.h	2020-02-08 19:29:01 UTC (rev 12309)
@@ -29,7 +29,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  *
- * $FreeBSD: stable/10/sys/xen/xenstore/xenstorevar.h 315675 2017-03-21 09:27:24Z royger $
+ * $FreeBSD: stable/11/sys/xen/xenstore/xenstorevar.h 315667 2017-03-21 08:36:25Z royger $
  */
 
 #ifndef _XEN_XENSTORE_XENSTOREVAR_H



More information about the Midnightbsd-cvs mailing list