2009-03-11 15:30:12 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* hypercall.h
|
|
|
|
*
|
Implement vector callback for PVHVM and unify event channel implementations
Re-structure Xen HVM support so that:
- Xen is detected and hypercalls can be performed very
early in system startup.
- Xen interrupt services are implemented using FreeBSD's native
interrupt delivery infrastructure.
- the Xen interrupt service implementation is shared between PV
and HVM guests.
- Xen interrupt handlers can optionally use a filter handler
in order to avoid the overhead of dispatch to an interrupt
thread.
- interrupt load can be distributed among all available CPUs.
- the overhead of accessing the emulated local and I/O apics
on HVM is removed for event channel port events.
- a similar optimization can eventually, and fairly easily,
be used to optimize MSI.
Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure,
and misc Xen cleanups:
Sponsored by: Spectra Logic Corporation
Unification of PV & HVM interrupt infrastructure, bug fixes,
and misc Xen cleanups:
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
sys/x86/x86/local_apic.c:
sys/amd64/include/apicvar.h:
sys/i386/include/apicvar.h:
sys/amd64/amd64/apic_vector.S:
sys/i386/i386/apic_vector.s:
sys/amd64/amd64/machdep.c:
sys/i386/i386/machdep.c:
sys/i386/xen/exception.s:
sys/x86/include/segments.h:
Reserve IDT vector 0x93 for the Xen event channel upcall
interrupt handler. On Hypervisors that support the direct
vector callback feature, we can request that this vector be
called directly by an injected HVM interrupt event, instead
of a simulated PCI interrupt on the Xen platform PCI device.
This avoids all of the overhead of dealing with the emulated
I/O APIC and local APIC. It also means that the Hypervisor
can inject these events on any CPU, allowing upcalls for
different ports to be handled in parallel.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
Map Xen per-vcpu area during AP startup.
sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
Increase the FreeBSD IRQ vector table to include space
for event channel interrupt sources.
sys/amd64/include/pcpu.h:
sys/i386/include/pcpu.h:
Remove Xen HVM per-cpu variable data. These fields are now
allocated via the dynamic per-cpu scheme. See xen_intr.c
for details.
sys/amd64/include/xen/hypercall.h:
sys/dev/xen/blkback/blkback.c:
sys/i386/include/xen/xenvar.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/xen/gnttab.c:
Prefer FreeBSD primatives to Linux ones in Xen support code.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
sys/dev/xen/balloon/balloon.c:
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/console/xencons_ring.c:
sys/dev/xen/control/control.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/xenpci/xenpci.c:
sys/i386/i386/machdep.c:
sys/i386/include/pmap.h:
sys/i386/include/xen/xenfunc.h:
sys/i386/isa/npx.c:
sys/i386/xen/clock.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/mptable.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/xen_rtc.c:
sys/xen/evtchn/evtchn_dev.c:
sys/xen/features.c:
sys/xen/gnttab.c:
sys/xen/gnttab.h:
sys/xen/hvm.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstore.c:
sys/xen/xenstore/xenstore_dev.c:
sys/xen/xenstore/xenstorevar.h:
Pull common Xen OS support functions/settings into xen/xen-os.h.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
Remove constants, macros, and functions unused in FreeBSD's Xen
support.
sys/xen/xen-os.h:
sys/i386/xen/xen_machdep.c:
sys/x86/xen/hvm.c:
Introduce new functions xen_domain(), xen_pv_domain(), and
xen_hvm_domain(). These are used in favor of #ifdefs so that
FreeBSD can dynamically detect and adapt to the presence of
a hypervisor. The goal is to have an HVM optimized GENERIC,
but more is necessary before this is possible.
sys/amd64/amd64/machdep.c:
sys/dev/xen/xenpci/xenpcivar.h:
sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/sys/kernel.h:
Refactor magic ioport, Hypercall table and Hypervisor shared
information page setup, and move it to a dedicated HVM support
module.
HVM mode initialization is now triggered during the
SI_SUB_HYPERVISOR phase of system startup. This currently
occurs just after the kernel VM is fully setup which is
just enough infrastructure to allow the hypercall table
and shared info page to be properly mapped.
sys/xen/hvm.h:
sys/x86/xen/hvm.c:
Add definitions and a method for configuring Hypervisor event
delievery via a direct vector callback.
sys/amd64/include/xen/xen-os.h:
sys/x86/xen/hvm.c:
sys/conf/files:
sys/conf/files.amd64:
sys/conf/files.i386:
Adjust kernel build to reflect the refactoring of early
Xen startup code and Xen interrupt services.
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
sys/dev/xen/control/control.c:
sys/dev/xen/evtchn/evtchn_dev.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/xen/xenstore/xenstore.c:
sys/xen/evtchn/evtchn_dev.c:
sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c
Adjust drivers to use new xen_intr_*() API.
sys/dev/xen/blkback/blkback.c:
Since blkback defers all event handling to a taskqueue,
convert this task queue to a "fast" taskqueue, and schedule
it via an interrupt filter. This avoids an unnecessary
ithread context switch.
sys/xen/xenstore/xenstore.c:
The xenstore driver is MPSAFE. Indicate as much when
registering its interrupt handler.
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusvar.h:
Remove unused event channel APIs.
sys/xen/evtchn.h:
Remove all kernel Xen interrupt service API definitions
from this file. It is now only used for structure and
ioctl definitions related to the event channel userland
device driver.
Update the definitions in this file to match those from
NetBSD. Implementing this interface will be necessary for
Dom0 support.
sys/xen/evtchn/evtchnvar.h:
Add a header file for implemenation internal APIs related
to managing event channels event delivery. This is used
to allow, for example, the event channel userland device
driver to access low-level routines that typical kernel
consumers of event channel services should never access.
sys/xen/interface/event_channel.h:
sys/xen/xen_intr.h:
Standardize on the evtchn_port_t type for referring to
an event channel port id. In order to prevent low-level
event channel APIs from leaking to kernel consumers who
should not have access to this data, the type is defined
twice: Once in the Xen provided event_channel.h, and again
in xen/xen_intr.h. The double declaration is protected by
__XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared
twice within a given compilation unit.
sys/xen/xen_intr.h:
sys/xen/evtchn/evtchn.c:
sys/x86/xen/xen_intr.c:
sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/xenpci/xenpcivar.h:
New implementation of Xen interrupt services. This is
similar in many respects to the i386 PV implementation with
the exception that events for bound to event channel ports
(i.e. not IPI, virtual IRQ, or physical IRQ) are further
optimized to avoid mask/unmask operations that aren't
necessary for these edge triggered events.
Stubs exist for supporting physical IRQ binding, but will
need additional work before this implementation can be
fully shared between PV and HVM.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
sys/i386/xen/mp_machdep.c
sys/x86/xen/hvm.c:
Add support for placing vcpu_info into an arbritary memory
page instead of using HYPERVISOR_shared_info->vcpu_info.
This allows the creation of domains with more than 32 vcpus.
sys/i386/i386/machdep.c:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/exception.s:
Add support for new event channle implementation.
2013-08-29 19:52:18 +00:00
|
|
|
* FreeBSD-specific hypervisor handling.
|
2009-03-11 15:30:12 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 2002-2004, K A Fraser
|
|
|
|
*
|
|
|
|
* 64-bit updates:
|
|
|
|
* Benjamin Liu <benjamin.liu@intel.com>
|
|
|
|
* Jun Nakajima <jun.nakajima@intel.com>
|
|
|
|
*
|
|
|
|
* 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.
|
Implement vector callback for PVHVM and unify event channel implementations
Re-structure Xen HVM support so that:
- Xen is detected and hypercalls can be performed very
early in system startup.
- Xen interrupt services are implemented using FreeBSD's native
interrupt delivery infrastructure.
- the Xen interrupt service implementation is shared between PV
and HVM guests.
- Xen interrupt handlers can optionally use a filter handler
in order to avoid the overhead of dispatch to an interrupt
thread.
- interrupt load can be distributed among all available CPUs.
- the overhead of accessing the emulated local and I/O apics
on HVM is removed for event channel port events.
- a similar optimization can eventually, and fairly easily,
be used to optimize MSI.
Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure,
and misc Xen cleanups:
Sponsored by: Spectra Logic Corporation
Unification of PV & HVM interrupt infrastructure, bug fixes,
and misc Xen cleanups:
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
sys/x86/x86/local_apic.c:
sys/amd64/include/apicvar.h:
sys/i386/include/apicvar.h:
sys/amd64/amd64/apic_vector.S:
sys/i386/i386/apic_vector.s:
sys/amd64/amd64/machdep.c:
sys/i386/i386/machdep.c:
sys/i386/xen/exception.s:
sys/x86/include/segments.h:
Reserve IDT vector 0x93 for the Xen event channel upcall
interrupt handler. On Hypervisors that support the direct
vector callback feature, we can request that this vector be
called directly by an injected HVM interrupt event, instead
of a simulated PCI interrupt on the Xen platform PCI device.
This avoids all of the overhead of dealing with the emulated
I/O APIC and local APIC. It also means that the Hypervisor
can inject these events on any CPU, allowing upcalls for
different ports to be handled in parallel.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
Map Xen per-vcpu area during AP startup.
sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
Increase the FreeBSD IRQ vector table to include space
for event channel interrupt sources.
sys/amd64/include/pcpu.h:
sys/i386/include/pcpu.h:
Remove Xen HVM per-cpu variable data. These fields are now
allocated via the dynamic per-cpu scheme. See xen_intr.c
for details.
sys/amd64/include/xen/hypercall.h:
sys/dev/xen/blkback/blkback.c:
sys/i386/include/xen/xenvar.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/xen/gnttab.c:
Prefer FreeBSD primatives to Linux ones in Xen support code.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
sys/dev/xen/balloon/balloon.c:
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/console/xencons_ring.c:
sys/dev/xen/control/control.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/xenpci/xenpci.c:
sys/i386/i386/machdep.c:
sys/i386/include/pmap.h:
sys/i386/include/xen/xenfunc.h:
sys/i386/isa/npx.c:
sys/i386/xen/clock.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/mptable.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/xen_rtc.c:
sys/xen/evtchn/evtchn_dev.c:
sys/xen/features.c:
sys/xen/gnttab.c:
sys/xen/gnttab.h:
sys/xen/hvm.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstore.c:
sys/xen/xenstore/xenstore_dev.c:
sys/xen/xenstore/xenstorevar.h:
Pull common Xen OS support functions/settings into xen/xen-os.h.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
Remove constants, macros, and functions unused in FreeBSD's Xen
support.
sys/xen/xen-os.h:
sys/i386/xen/xen_machdep.c:
sys/x86/xen/hvm.c:
Introduce new functions xen_domain(), xen_pv_domain(), and
xen_hvm_domain(). These are used in favor of #ifdefs so that
FreeBSD can dynamically detect and adapt to the presence of
a hypervisor. The goal is to have an HVM optimized GENERIC,
but more is necessary before this is possible.
sys/amd64/amd64/machdep.c:
sys/dev/xen/xenpci/xenpcivar.h:
sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/sys/kernel.h:
Refactor magic ioport, Hypercall table and Hypervisor shared
information page setup, and move it to a dedicated HVM support
module.
HVM mode initialization is now triggered during the
SI_SUB_HYPERVISOR phase of system startup. This currently
occurs just after the kernel VM is fully setup which is
just enough infrastructure to allow the hypercall table
and shared info page to be properly mapped.
sys/xen/hvm.h:
sys/x86/xen/hvm.c:
Add definitions and a method for configuring Hypervisor event
delievery via a direct vector callback.
sys/amd64/include/xen/xen-os.h:
sys/x86/xen/hvm.c:
sys/conf/files:
sys/conf/files.amd64:
sys/conf/files.i386:
Adjust kernel build to reflect the refactoring of early
Xen startup code and Xen interrupt services.
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
sys/dev/xen/control/control.c:
sys/dev/xen/evtchn/evtchn_dev.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/xen/xenstore/xenstore.c:
sys/xen/evtchn/evtchn_dev.c:
sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c
Adjust drivers to use new xen_intr_*() API.
sys/dev/xen/blkback/blkback.c:
Since blkback defers all event handling to a taskqueue,
convert this task queue to a "fast" taskqueue, and schedule
it via an interrupt filter. This avoids an unnecessary
ithread context switch.
sys/xen/xenstore/xenstore.c:
The xenstore driver is MPSAFE. Indicate as much when
registering its interrupt handler.
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusvar.h:
Remove unused event channel APIs.
sys/xen/evtchn.h:
Remove all kernel Xen interrupt service API definitions
from this file. It is now only used for structure and
ioctl definitions related to the event channel userland
device driver.
Update the definitions in this file to match those from
NetBSD. Implementing this interface will be necessary for
Dom0 support.
sys/xen/evtchn/evtchnvar.h:
Add a header file for implemenation internal APIs related
to managing event channels event delivery. This is used
to allow, for example, the event channel userland device
driver to access low-level routines that typical kernel
consumers of event channel services should never access.
sys/xen/interface/event_channel.h:
sys/xen/xen_intr.h:
Standardize on the evtchn_port_t type for referring to
an event channel port id. In order to prevent low-level
event channel APIs from leaking to kernel consumers who
should not have access to this data, the type is defined
twice: Once in the Xen provided event_channel.h, and again
in xen/xen_intr.h. The double declaration is protected by
__XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared
twice within a given compilation unit.
sys/xen/xen_intr.h:
sys/xen/evtchn/evtchn.c:
sys/x86/xen/xen_intr.c:
sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/xenpci/xenpcivar.h:
New implementation of Xen interrupt services. This is
similar in many respects to the i386 PV implementation with
the exception that events for bound to event channel ports
(i.e. not IPI, virtual IRQ, or physical IRQ) are further
optimized to avoid mask/unmask operations that aren't
necessary for these edge triggered events.
Stubs exist for supporting physical IRQ binding, but will
need additional work before this implementation can be
fully shared between PV and HVM.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
sys/i386/xen/mp_machdep.c
sys/x86/xen/hvm.c:
Add support for placing vcpu_info into an arbritary memory
page instead of using HYPERVISOR_shared_info->vcpu_info.
This allows the creation of domains with more than 32 vcpus.
sys/i386/i386/machdep.c:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/exception.s:
Add support for new event channle implementation.
2013-08-29 19:52:18 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
2009-03-11 15:30:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MACHINE_XEN_HYPERCALL_H__
|
|
|
|
#define __MACHINE_XEN_HYPERCALL_H__
|
|
|
|
|
|
|
|
#include <sys/systm.h>
|
|
|
|
|
|
|
|
#ifndef __XEN_HYPERVISOR_H__
|
|
|
|
# error "please don't include this file directly"
|
|
|
|
#endif
|
|
|
|
|
2014-10-22 17:07:20 +00:00
|
|
|
extern char *hypercall_page;
|
|
|
|
|
2009-03-11 15:30:12 +00:00
|
|
|
#define __STR(x) #x
|
|
|
|
#define STR(x) __STR(x)
|
|
|
|
#define ENOXENSYS 38
|
|
|
|
#define CONFIG_XEN_COMPAT 0x030002
|
|
|
|
#define __must_check
|
|
|
|
|
|
|
|
#define HYPERCALL_STR(name) \
|
|
|
|
"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
|
|
|
|
|
|
|
|
#define _hypercall0(type, name) \
|
|
|
|
({ \
|
|
|
|
type __res; \
|
|
|
|
__asm__ volatile ( \
|
|
|
|
HYPERCALL_STR(name) \
|
|
|
|
: "=a" (__res) \
|
|
|
|
: \
|
|
|
|
: "memory" ); \
|
|
|
|
__res; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define _hypercall1(type, name, a1) \
|
|
|
|
({ \
|
|
|
|
type __res; \
|
|
|
|
long __ign1; \
|
|
|
|
__asm__ volatile ( \
|
|
|
|
HYPERCALL_STR(name) \
|
|
|
|
: "=a" (__res), "=D" (__ign1) \
|
|
|
|
: "1" ((long)(a1)) \
|
|
|
|
: "memory" ); \
|
|
|
|
__res; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define _hypercall2(type, name, a1, a2) \
|
|
|
|
({ \
|
|
|
|
type __res; \
|
|
|
|
long __ign1, __ign2; \
|
|
|
|
__asm__ volatile ( \
|
|
|
|
HYPERCALL_STR(name) \
|
|
|
|
: "=a" (__res), "=D" (__ign1), "=S" (__ign2) \
|
|
|
|
: "1" ((long)(a1)), "2" ((long)(a2)) \
|
|
|
|
: "memory" ); \
|
|
|
|
__res; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define _hypercall3(type, name, a1, a2, a3) \
|
|
|
|
({ \
|
|
|
|
type __res; \
|
|
|
|
long __ign1, __ign2, __ign3; \
|
|
|
|
__asm__ volatile ( \
|
|
|
|
HYPERCALL_STR(name) \
|
|
|
|
: "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
|
|
|
|
"=d" (__ign3) \
|
|
|
|
: "1" ((long)(a1)), "2" ((long)(a2)), \
|
|
|
|
"3" ((long)(a3)) \
|
|
|
|
: "memory" ); \
|
|
|
|
__res; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define _hypercall4(type, name, a1, a2, a3, a4) \
|
|
|
|
({ \
|
|
|
|
type __res; \
|
|
|
|
long __ign1, __ign2, __ign3; \
|
|
|
|
register long __arg4 __asm__("r10") = (long)(a4); \
|
|
|
|
__asm__ volatile ( \
|
|
|
|
HYPERCALL_STR(name) \
|
|
|
|
: "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
|
|
|
|
"=d" (__ign3), "+r" (__arg4) \
|
|
|
|
: "1" ((long)(a1)), "2" ((long)(a2)), \
|
|
|
|
"3" ((long)(a3)) \
|
|
|
|
: "memory" ); \
|
|
|
|
__res; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
|
|
|
|
({ \
|
|
|
|
type __res; \
|
|
|
|
long __ign1, __ign2, __ign3; \
|
|
|
|
register long __arg4 __asm__("r10") = (long)(a4); \
|
|
|
|
register long __arg5 __asm__("r8") = (long)(a5); \
|
|
|
|
__asm__ volatile ( \
|
|
|
|
HYPERCALL_STR(name) \
|
|
|
|
: "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
|
|
|
|
"=d" (__ign3), "+r" (__arg4), "+r" (__arg5) \
|
|
|
|
: "1" ((long)(a1)), "2" ((long)(a2)), \
|
|
|
|
"3" ((long)(a3)) \
|
|
|
|
: "memory" ); \
|
|
|
|
__res; \
|
|
|
|
})
|
|
|
|
|
2014-10-22 17:07:20 +00:00
|
|
|
static inline int
|
|
|
|
privcmd_hypercall(long op, long a1, long a2, long a3, long a4, long a5)
|
|
|
|
{
|
|
|
|
int __res;
|
|
|
|
long __ign1, __ign2, __ign3;
|
|
|
|
register long __arg4 __asm__("r10") = (long)(a4);
|
|
|
|
register long __arg5 __asm__("r8") = (long)(a5);
|
|
|
|
long __call = (long)&hypercall_page + (op * 32);
|
|
|
|
|
|
|
|
__asm__ volatile (
|
|
|
|
"call *%[call]"
|
|
|
|
: "=a" (__res), "=D" (__ign1), "=S" (__ign2),
|
|
|
|
"=d" (__ign3), "+r" (__arg4), "+r" (__arg5)
|
|
|
|
: "1" ((long)(a1)), "2" ((long)(a2)),
|
|
|
|
"3" ((long)(a3)), [call] "a" (__call)
|
|
|
|
: "memory" );
|
|
|
|
|
|
|
|
return (__res);
|
|
|
|
}
|
|
|
|
|
2009-03-11 15:30:12 +00:00
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_set_trap_table(
|
|
|
|
const trap_info_t *table)
|
|
|
|
{
|
|
|
|
return _hypercall1(int, set_trap_table, table);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_mmu_update(
|
|
|
|
mmu_update_t *req, unsigned int count, unsigned int *success_count,
|
|
|
|
domid_t domid)
|
|
|
|
{
|
|
|
|
return _hypercall4(int, mmu_update, req, count, success_count, domid);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_mmuext_op(
|
|
|
|
struct mmuext_op *op, unsigned int count, unsigned int *success_count,
|
|
|
|
domid_t domid)
|
|
|
|
{
|
|
|
|
return _hypercall4(int, mmuext_op, op, count, success_count, domid);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_set_gdt(
|
|
|
|
unsigned long *frame_list, unsigned int entries)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, set_gdt, frame_list, entries);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_stack_switch(
|
|
|
|
unsigned long ss, unsigned long esp)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, stack_switch, ss, esp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_set_callbacks(
|
|
|
|
unsigned long event_address, unsigned long failsafe_address,
|
|
|
|
unsigned long syscall_address)
|
|
|
|
{
|
|
|
|
return _hypercall3(int, set_callbacks,
|
|
|
|
event_address, failsafe_address, syscall_address);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
HYPERVISOR_fpu_taskswitch(
|
|
|
|
int set)
|
|
|
|
{
|
|
|
|
return _hypercall1(int, fpu_taskswitch, set);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_sched_op_compat(
|
|
|
|
int cmd, unsigned long arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, sched_op_compat, cmd, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_sched_op(
|
|
|
|
int cmd, void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, sched_op, cmd, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __must_check
|
|
|
|
HYPERVISOR_set_timer_op(
|
|
|
|
uint64_t timeout)
|
|
|
|
{
|
|
|
|
return _hypercall1(long, set_timer_op, timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_platform_op(
|
|
|
|
struct xen_platform_op *platform_op)
|
|
|
|
{
|
|
|
|
platform_op->interface_version = XENPF_INTERFACE_VERSION;
|
|
|
|
return _hypercall1(int, platform_op, platform_op);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_set_debugreg(
|
|
|
|
unsigned int reg, unsigned long value)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, set_debugreg, reg, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long __must_check
|
|
|
|
HYPERVISOR_get_debugreg(
|
|
|
|
unsigned int reg)
|
|
|
|
{
|
|
|
|
return _hypercall1(unsigned long, get_debugreg, reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_update_descriptor(
|
|
|
|
unsigned long ma, unsigned long word)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, update_descriptor, ma, word);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_memory_op(
|
|
|
|
unsigned int cmd, void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, memory_op, cmd, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_multicall(
|
|
|
|
multicall_entry_t *call_list, unsigned int nr_calls)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, multicall, call_list, nr_calls);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_update_va_mapping(
|
|
|
|
unsigned long va, uint64_t new_val, unsigned long flags)
|
|
|
|
{
|
|
|
|
return _hypercall3(int, update_va_mapping, va, new_val, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_event_channel_op(
|
|
|
|
int cmd, void *arg)
|
|
|
|
{
|
|
|
|
int rc = _hypercall2(int, event_channel_op, cmd, arg);
|
|
|
|
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
Implement vector callback for PVHVM and unify event channel implementations
Re-structure Xen HVM support so that:
- Xen is detected and hypercalls can be performed very
early in system startup.
- Xen interrupt services are implemented using FreeBSD's native
interrupt delivery infrastructure.
- the Xen interrupt service implementation is shared between PV
and HVM guests.
- Xen interrupt handlers can optionally use a filter handler
in order to avoid the overhead of dispatch to an interrupt
thread.
- interrupt load can be distributed among all available CPUs.
- the overhead of accessing the emulated local and I/O apics
on HVM is removed for event channel port events.
- a similar optimization can eventually, and fairly easily,
be used to optimize MSI.
Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure,
and misc Xen cleanups:
Sponsored by: Spectra Logic Corporation
Unification of PV & HVM interrupt infrastructure, bug fixes,
and misc Xen cleanups:
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
sys/x86/x86/local_apic.c:
sys/amd64/include/apicvar.h:
sys/i386/include/apicvar.h:
sys/amd64/amd64/apic_vector.S:
sys/i386/i386/apic_vector.s:
sys/amd64/amd64/machdep.c:
sys/i386/i386/machdep.c:
sys/i386/xen/exception.s:
sys/x86/include/segments.h:
Reserve IDT vector 0x93 for the Xen event channel upcall
interrupt handler. On Hypervisors that support the direct
vector callback feature, we can request that this vector be
called directly by an injected HVM interrupt event, instead
of a simulated PCI interrupt on the Xen platform PCI device.
This avoids all of the overhead of dealing with the emulated
I/O APIC and local APIC. It also means that the Hypervisor
can inject these events on any CPU, allowing upcalls for
different ports to be handled in parallel.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
Map Xen per-vcpu area during AP startup.
sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
Increase the FreeBSD IRQ vector table to include space
for event channel interrupt sources.
sys/amd64/include/pcpu.h:
sys/i386/include/pcpu.h:
Remove Xen HVM per-cpu variable data. These fields are now
allocated via the dynamic per-cpu scheme. See xen_intr.c
for details.
sys/amd64/include/xen/hypercall.h:
sys/dev/xen/blkback/blkback.c:
sys/i386/include/xen/xenvar.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/xen/gnttab.c:
Prefer FreeBSD primatives to Linux ones in Xen support code.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
sys/dev/xen/balloon/balloon.c:
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/console/xencons_ring.c:
sys/dev/xen/control/control.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/xenpci/xenpci.c:
sys/i386/i386/machdep.c:
sys/i386/include/pmap.h:
sys/i386/include/xen/xenfunc.h:
sys/i386/isa/npx.c:
sys/i386/xen/clock.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/mptable.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/xen_rtc.c:
sys/xen/evtchn/evtchn_dev.c:
sys/xen/features.c:
sys/xen/gnttab.c:
sys/xen/gnttab.h:
sys/xen/hvm.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstore.c:
sys/xen/xenstore/xenstore_dev.c:
sys/xen/xenstore/xenstorevar.h:
Pull common Xen OS support functions/settings into xen/xen-os.h.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
Remove constants, macros, and functions unused in FreeBSD's Xen
support.
sys/xen/xen-os.h:
sys/i386/xen/xen_machdep.c:
sys/x86/xen/hvm.c:
Introduce new functions xen_domain(), xen_pv_domain(), and
xen_hvm_domain(). These are used in favor of #ifdefs so that
FreeBSD can dynamically detect and adapt to the presence of
a hypervisor. The goal is to have an HVM optimized GENERIC,
but more is necessary before this is possible.
sys/amd64/amd64/machdep.c:
sys/dev/xen/xenpci/xenpcivar.h:
sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/sys/kernel.h:
Refactor magic ioport, Hypercall table and Hypervisor shared
information page setup, and move it to a dedicated HVM support
module.
HVM mode initialization is now triggered during the
SI_SUB_HYPERVISOR phase of system startup. This currently
occurs just after the kernel VM is fully setup which is
just enough infrastructure to allow the hypercall table
and shared info page to be properly mapped.
sys/xen/hvm.h:
sys/x86/xen/hvm.c:
Add definitions and a method for configuring Hypervisor event
delievery via a direct vector callback.
sys/amd64/include/xen/xen-os.h:
sys/x86/xen/hvm.c:
sys/conf/files:
sys/conf/files.amd64:
sys/conf/files.i386:
Adjust kernel build to reflect the refactoring of early
Xen startup code and Xen interrupt services.
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
sys/dev/xen/control/control.c:
sys/dev/xen/evtchn/evtchn_dev.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/xen/xenstore/xenstore.c:
sys/xen/evtchn/evtchn_dev.c:
sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c
Adjust drivers to use new xen_intr_*() API.
sys/dev/xen/blkback/blkback.c:
Since blkback defers all event handling to a taskqueue,
convert this task queue to a "fast" taskqueue, and schedule
it via an interrupt filter. This avoids an unnecessary
ithread context switch.
sys/xen/xenstore/xenstore.c:
The xenstore driver is MPSAFE. Indicate as much when
registering its interrupt handler.
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusvar.h:
Remove unused event channel APIs.
sys/xen/evtchn.h:
Remove all kernel Xen interrupt service API definitions
from this file. It is now only used for structure and
ioctl definitions related to the event channel userland
device driver.
Update the definitions in this file to match those from
NetBSD. Implementing this interface will be necessary for
Dom0 support.
sys/xen/evtchn/evtchnvar.h:
Add a header file for implemenation internal APIs related
to managing event channels event delivery. This is used
to allow, for example, the event channel userland device
driver to access low-level routines that typical kernel
consumers of event channel services should never access.
sys/xen/interface/event_channel.h:
sys/xen/xen_intr.h:
Standardize on the evtchn_port_t type for referring to
an event channel port id. In order to prevent low-level
event channel APIs from leaking to kernel consumers who
should not have access to this data, the type is defined
twice: Once in the Xen provided event_channel.h, and again
in xen/xen_intr.h. The double declaration is protected by
__XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared
twice within a given compilation unit.
sys/xen/xen_intr.h:
sys/xen/evtchn/evtchn.c:
sys/x86/xen/xen_intr.c:
sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/xenpci/xenpcivar.h:
New implementation of Xen interrupt services. This is
similar in many respects to the i386 PV implementation with
the exception that events for bound to event channel ports
(i.e. not IPI, virtual IRQ, or physical IRQ) are further
optimized to avoid mask/unmask operations that aren't
necessary for these edge triggered events.
Stubs exist for supporting physical IRQ binding, but will
need additional work before this implementation can be
fully shared between PV and HVM.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
sys/i386/xen/mp_machdep.c
sys/x86/xen/hvm.c:
Add support for placing vcpu_info into an arbritary memory
page instead of using HYPERVISOR_shared_info->vcpu_info.
This allows the creation of domains with more than 32 vcpus.
sys/i386/i386/machdep.c:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/exception.s:
Add support for new event channle implementation.
2013-08-29 19:52:18 +00:00
|
|
|
if (__predict_false(rc == -ENOXENSYS)) {
|
2009-03-11 15:30:12 +00:00
|
|
|
struct evtchn_op op;
|
|
|
|
op.cmd = cmd;
|
|
|
|
memcpy(&op.u, arg, sizeof(op.u));
|
|
|
|
rc = _hypercall1(int, event_channel_op_compat, &op);
|
|
|
|
memcpy(arg, &op.u, sizeof(op.u));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_xen_version(
|
|
|
|
int cmd, void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, xen_version, cmd, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_console_io(
|
|
|
|
int cmd, unsigned int count, char *str)
|
|
|
|
{
|
|
|
|
return _hypercall3(int, console_io, cmd, count, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_physdev_op(
|
|
|
|
int cmd, void *arg)
|
|
|
|
{
|
|
|
|
int rc = _hypercall2(int, physdev_op, cmd, arg);
|
|
|
|
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
Implement vector callback for PVHVM and unify event channel implementations
Re-structure Xen HVM support so that:
- Xen is detected and hypercalls can be performed very
early in system startup.
- Xen interrupt services are implemented using FreeBSD's native
interrupt delivery infrastructure.
- the Xen interrupt service implementation is shared between PV
and HVM guests.
- Xen interrupt handlers can optionally use a filter handler
in order to avoid the overhead of dispatch to an interrupt
thread.
- interrupt load can be distributed among all available CPUs.
- the overhead of accessing the emulated local and I/O apics
on HVM is removed for event channel port events.
- a similar optimization can eventually, and fairly easily,
be used to optimize MSI.
Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure,
and misc Xen cleanups:
Sponsored by: Spectra Logic Corporation
Unification of PV & HVM interrupt infrastructure, bug fixes,
and misc Xen cleanups:
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
sys/x86/x86/local_apic.c:
sys/amd64/include/apicvar.h:
sys/i386/include/apicvar.h:
sys/amd64/amd64/apic_vector.S:
sys/i386/i386/apic_vector.s:
sys/amd64/amd64/machdep.c:
sys/i386/i386/machdep.c:
sys/i386/xen/exception.s:
sys/x86/include/segments.h:
Reserve IDT vector 0x93 for the Xen event channel upcall
interrupt handler. On Hypervisors that support the direct
vector callback feature, we can request that this vector be
called directly by an injected HVM interrupt event, instead
of a simulated PCI interrupt on the Xen platform PCI device.
This avoids all of the overhead of dealing with the emulated
I/O APIC and local APIC. It also means that the Hypervisor
can inject these events on any CPU, allowing upcalls for
different ports to be handled in parallel.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
Map Xen per-vcpu area during AP startup.
sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
Increase the FreeBSD IRQ vector table to include space
for event channel interrupt sources.
sys/amd64/include/pcpu.h:
sys/i386/include/pcpu.h:
Remove Xen HVM per-cpu variable data. These fields are now
allocated via the dynamic per-cpu scheme. See xen_intr.c
for details.
sys/amd64/include/xen/hypercall.h:
sys/dev/xen/blkback/blkback.c:
sys/i386/include/xen/xenvar.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/xen/gnttab.c:
Prefer FreeBSD primatives to Linux ones in Xen support code.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
sys/dev/xen/balloon/balloon.c:
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/console/xencons_ring.c:
sys/dev/xen/control/control.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/xenpci/xenpci.c:
sys/i386/i386/machdep.c:
sys/i386/include/pmap.h:
sys/i386/include/xen/xenfunc.h:
sys/i386/isa/npx.c:
sys/i386/xen/clock.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/mptable.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/xen_rtc.c:
sys/xen/evtchn/evtchn_dev.c:
sys/xen/features.c:
sys/xen/gnttab.c:
sys/xen/gnttab.h:
sys/xen/hvm.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstore.c:
sys/xen/xenstore/xenstore_dev.c:
sys/xen/xenstore/xenstorevar.h:
Pull common Xen OS support functions/settings into xen/xen-os.h.
sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
Remove constants, macros, and functions unused in FreeBSD's Xen
support.
sys/xen/xen-os.h:
sys/i386/xen/xen_machdep.c:
sys/x86/xen/hvm.c:
Introduce new functions xen_domain(), xen_pv_domain(), and
xen_hvm_domain(). These are used in favor of #ifdefs so that
FreeBSD can dynamically detect and adapt to the presence of
a hypervisor. The goal is to have an HVM optimized GENERIC,
but more is necessary before this is possible.
sys/amd64/amd64/machdep.c:
sys/dev/xen/xenpci/xenpcivar.h:
sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/sys/kernel.h:
Refactor magic ioport, Hypercall table and Hypervisor shared
information page setup, and move it to a dedicated HVM support
module.
HVM mode initialization is now triggered during the
SI_SUB_HYPERVISOR phase of system startup. This currently
occurs just after the kernel VM is fully setup which is
just enough infrastructure to allow the hypercall table
and shared info page to be properly mapped.
sys/xen/hvm.h:
sys/x86/xen/hvm.c:
Add definitions and a method for configuring Hypervisor event
delievery via a direct vector callback.
sys/amd64/include/xen/xen-os.h:
sys/x86/xen/hvm.c:
sys/conf/files:
sys/conf/files.amd64:
sys/conf/files.i386:
Adjust kernel build to reflect the refactoring of early
Xen startup code and Xen interrupt services.
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
sys/dev/xen/control/control.c:
sys/dev/xen/evtchn/evtchn_dev.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/xen/xenstore/xenstore.c:
sys/xen/evtchn/evtchn_dev.c:
sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c
Adjust drivers to use new xen_intr_*() API.
sys/dev/xen/blkback/blkback.c:
Since blkback defers all event handling to a taskqueue,
convert this task queue to a "fast" taskqueue, and schedule
it via an interrupt filter. This avoids an unnecessary
ithread context switch.
sys/xen/xenstore/xenstore.c:
The xenstore driver is MPSAFE. Indicate as much when
registering its interrupt handler.
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusvar.h:
Remove unused event channel APIs.
sys/xen/evtchn.h:
Remove all kernel Xen interrupt service API definitions
from this file. It is now only used for structure and
ioctl definitions related to the event channel userland
device driver.
Update the definitions in this file to match those from
NetBSD. Implementing this interface will be necessary for
Dom0 support.
sys/xen/evtchn/evtchnvar.h:
Add a header file for implemenation internal APIs related
to managing event channels event delivery. This is used
to allow, for example, the event channel userland device
driver to access low-level routines that typical kernel
consumers of event channel services should never access.
sys/xen/interface/event_channel.h:
sys/xen/xen_intr.h:
Standardize on the evtchn_port_t type for referring to
an event channel port id. In order to prevent low-level
event channel APIs from leaking to kernel consumers who
should not have access to this data, the type is defined
twice: Once in the Xen provided event_channel.h, and again
in xen/xen_intr.h. The double declaration is protected by
__XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared
twice within a given compilation unit.
sys/xen/xen_intr.h:
sys/xen/evtchn/evtchn.c:
sys/x86/xen/xen_intr.c:
sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/xenpci/xenpcivar.h:
New implementation of Xen interrupt services. This is
similar in many respects to the i386 PV implementation with
the exception that events for bound to event channel ports
(i.e. not IPI, virtual IRQ, or physical IRQ) are further
optimized to avoid mask/unmask operations that aren't
necessary for these edge triggered events.
Stubs exist for supporting physical IRQ binding, but will
need additional work before this implementation can be
fully shared between PV and HVM.
sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
sys/i386/xen/mp_machdep.c
sys/x86/xen/hvm.c:
Add support for placing vcpu_info into an arbritary memory
page instead of using HYPERVISOR_shared_info->vcpu_info.
This allows the creation of domains with more than 32 vcpus.
sys/i386/i386/machdep.c:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/exception.s:
Add support for new event channle implementation.
2013-08-29 19:52:18 +00:00
|
|
|
if (__predict_false(rc == -ENOXENSYS)) {
|
2009-03-11 15:30:12 +00:00
|
|
|
struct physdev_op op;
|
|
|
|
op.cmd = cmd;
|
|
|
|
memcpy(&op.u, arg, sizeof(op.u));
|
|
|
|
rc = _hypercall1(int, physdev_op_compat, &op);
|
|
|
|
memcpy(arg, &op.u, sizeof(op.u));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_grant_table_op(
|
|
|
|
unsigned int cmd, void *uop, unsigned int count)
|
|
|
|
{
|
|
|
|
return _hypercall3(int, grant_table_op, cmd, uop, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_update_va_mapping_otherdomain(
|
|
|
|
unsigned long va, uint64_t new_val, unsigned long flags, domid_t domid)
|
|
|
|
{
|
|
|
|
return _hypercall4(int, update_va_mapping_otherdomain, va,
|
|
|
|
new_val, flags, domid);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_vm_assist(
|
|
|
|
unsigned int cmd, unsigned int type)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, vm_assist, cmd, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_vcpu_op(
|
|
|
|
int cmd, unsigned int vcpuid, void *extra_args)
|
|
|
|
{
|
|
|
|
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_set_segment_base(
|
|
|
|
int reg, unsigned long value)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, set_segment_base, reg, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_suspend(
|
|
|
|
unsigned long srec)
|
|
|
|
{
|
|
|
|
struct sched_shutdown sched_shutdown = {
|
|
|
|
.reason = SHUTDOWN_suspend
|
|
|
|
};
|
|
|
|
|
|
|
|
int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
|
|
|
|
&sched_shutdown, srec);
|
|
|
|
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
|
|
if (rc == -ENOXENSYS)
|
|
|
|
rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
|
|
|
|
SHUTDOWN_suspend, srec);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
|
|
static inline int
|
|
|
|
HYPERVISOR_nmi_op(
|
|
|
|
unsigned long op, void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, nmi_op, op, arg);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIG_XEN
|
|
|
|
static inline unsigned long __must_check
|
|
|
|
HYPERVISOR_hvm_op(
|
|
|
|
int op, void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(unsigned long, hvm_op, op, arg);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_callback_op(
|
|
|
|
int cmd, const void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, callback_op, cmd, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_xenoprof_op(
|
|
|
|
int op, void *arg)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, xenoprof_op, op, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
HYPERVISOR_kexec_op(
|
|
|
|
unsigned long op, void *args)
|
|
|
|
{
|
|
|
|
return _hypercall2(int, kexec_op, op, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef __must_check
|
|
|
|
|
|
|
|
#endif /* __MACHINE_XEN_HYPERCALL_H__ */
|