xen/privcmd: implement the dm op ioctlUse an interface compatible with the Linux one so that the user-spacelibraries already using the Linux interface can be used without muchmodifications.This
xen/privcmd: implement the dm op ioctlUse an interface compatible with the Linux one so that the user-spacelibraries already using the Linux interface can be used without muchmodifications.This allows user-space to make use of the dm_op family of hypercalls,which are used by device models.Sponsored by: Citrix Systems R&D
show more ...
x86/xen: Consolidate xen-os.h in a single placeamd64 and i386 platform code contain very similar xen/xen-os.hThe only differences are: - Functions/variables/types which were unused in i386/xen/x
x86/xen: Consolidate xen-os.h in a single placeamd64 and i386 platform code contain very similar xen/xen-os.hThe only differences are: - Functions/variables/types which were unused in i386/xen/xen-os.h: * xen_xchg * __xchg_dummy * __xg * __xchg * atomic_t * atomic_inc * rdtscllThe functions/variables/types unused in xen-os.h can be dropped and thereis no more differences betwen amd64 and i386.The new header is placed in x86/include/xen and each platform will havedummy headers include x86/xen/*.h. This is to be able to includemachine/xen/*.h in the PV drivers.Submitted by: Julien Grall <[email protected]>Reviewed by: roygerDifferential Revision: https://reviews.freebsd.org/D3880Sponsored by: Citrix Systems R&D
xen/console: Introduce a new console driver for Xen guestThe current Xen console driver is crashing very quickly when using it onan ARM guest. This is because the console lock is recursive and it
xen/console: Introduce a new console driver for Xen guestThe current Xen console driver is crashing very quickly when using it onan ARM guest. This is because the console lock is recursive and it maylead to recursion on the tty lock and/or corrupt the ring pointer.Furthermore, the console lock is not always taken where it should be and hasto be released too early because of the way the console has been designed.Over the years, code has been modified to support various new features butthe driver has not been reworked.This new driver has been rewritten with the idea of only having a small setof specific function to write either via the shared ring or the hypercallinterface.Note that HVM support has been left aside for now because it requiresadditional features which are not yet supported. A follow-up patch will besent with HVM guest support.List of items that may be good to have but not mandatory: - Avoid to flush for each character written when using the tty - Support multiple consolesSubmitted by: Julien Grall <[email protected]>Reviewed by: roygerDifferential Revision: https://reviews.freebsd.org/D3698Sponsored by: Citrix Systems R&D
Remove some more vestiges of the Xen PV domu support. Specifically,use vtophys() directly instead of vtomach() and retire the no-longer-usedheaders <machine/xenfunc.h> and <machine/xenvar.h>.Rep
Remove some more vestiges of the Xen PV domu support. Specifically,use vtophys() directly instead of vtomach() and retire the no-longer-usedheaders <machine/xenfunc.h> and <machine/xenvar.h>.Reported by: bde (stale bits in <machine/xenfunc.h>)Reviewed by: royger (earlier version)Differential Revision: https://reviews.freebsd.org/D3266
Remove support for Xen PV domU kernels. Support for HVM domU kernelsremains. Xen is planning to phase out support for PV upstream since itis harder to maintain and has more overhead. Modern x86
Remove support for Xen PV domU kernels. Support for HVM domU kernelsremains. Xen is planning to phase out support for PV upstream since itis harder to maintain and has more overhead. Modern x86 CPUs includevirtualization extensions that support HVM guests instead of PV guests.In addition, the PV code was i386 only and not as well maintained recentlyas the HVM code.- Remove the i386-only NATIVE option that was used to disable certain components for PV kernels. These components are now standard as they are on amd64.- Remove !XENHVM bits from PV drivers.- Remove various shims required for XEN (e.g. PT_UPDATES_FLUSH, LOAD_CR3, etc.)- Remove duplicate copy of <xen/features.h>.- Remove unused, i386-only xenstored.h.Differential Revision: https://reviews.freebsd.org/D2362Reviewed by: roygerTested by: royger (i386/amd64 HVM domU and amd64 PVH dom0)Relnotes: yes
xen: implement the privcmd user-space deviceThis device is only attached to priviledged domains, and allows thetoolstack to interact with Xen. The two functions of the privcmdinterface is to allo
xen: implement the privcmd user-space deviceThis device is only attached to priviledged domains, and allows thetoolstack to interact with Xen. The two functions of the privcmdinterface is to allow the execution of hypercalls from user-space, andthe mapping of foreign domain memory.Sponsored by: Citrix Systems R&Di386/include/xen/hypercall.h:amd64/include/xen/hypercall.h: - Introduce a function to make generic hypercalls into Xen.xen/interface/xen.h:xen/interface/memory.h: - Import the new hypercall XENMEM_add_to_physmap_range used by auto-translated guests to map memory from foreign domains.dev/xen/privcmd/privcmd.c: - This device has the following functions: - Allow user-space applications to make hypercalls into Xen. - Allow user-space applications to map memory from foreign domains, this is accomplished using the newly introduced hypercall (XENMEM_add_to_physmap_range).xen/privcmd.h: - Public ioctl interface for the privcmd device.x86/xen/hvm.c: - Remove declaration of hypercall_page, now it's declared in hypercall.h.conf/files: - Add the privcmd device to the build process.
xen: use the same hypercall mechanism for XEN and XENHVMCurrently XEN (PV) and XENHVM (PVHVM) ports use different ways toissue hypercalls, unify this by filling the hypercall_page under HVMalso.
xen: use the same hypercall mechanism for XEN and XENHVMCurrently XEN (PV) and XENHVM (PVHVM) ports use different ways toissue hypercalls, unify this by filling the hypercall_page under HVMalso.Approved by: gibbsSponsored by: Citrix Systems R&Damd64/include/xen/hypercall.h: - Unify Xen hypercall code by always using the PV way.i386/i386/locore.s: - Define hypercall_page on i386 XENHVM.x86/xen/hvm.c: - Fill hypercall_page on XENHVM kernels using the HVM method (only when running as an HVM guest).
Implement vector callback for PVHVM and unify event channel implementationsRe-structure Xen HVM support so that: - Xen is detected and hypercalls can be performed very early in system startup.
Implement vector callback for PVHVM and unify event channel implementationsRe-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 CorporationUnification of PV & HVM interrupt infrastructure, bug fixes,and misc Xen cleanups:Submitted by: Roger Pau MonnéSponsored by: Citrix Systems R&Dsys/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.csys/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.
Upgrade Xen interface headers to Xen 4.2.1.Move FreeBSD from interface version 0x00030204 to 0x00030208.Updates are required to our grant table implementation before wecan bump this further.sys
Upgrade Xen interface headers to Xen 4.2.1.Move FreeBSD from interface version 0x00030204 to 0x00030208.Updates are required to our grant table implementation before wecan bump this further.sys/xen/hvm.h: Replace the implementation of hvm_get_parameter(), formerly located in sys/xen/interface/hvm/params.h. Linux has a similar file which primarily stores this function.sys/xen/xenstore/xenstore.c: Include new xen/hvm.h header file to get hvm_get_parameter().sys/amd64/include/xen/xen-os.h:sys/i386/include/xen/xen-os.h: Correctly protect function definition and variables from being included into assembly files in xen-os.h Xen memory barriers are now prefixed with "xen_" to avoid conflicts with OS native primatives. Define Xen memory barriers in terms of the native FreeBSD primatives.Sponsored by: Spectra Logic CorporationReviewed by: Roger Pau MonnéTested by: Roger Pau MonnéObtained from: Roger Pau Monné (bug fixes)
- Correct spelling in commentsSubmitted by: Christoph Mallon <[email protected]> (via private mail)
Switch to our preferred 2-clause BSD license.Approved by: kmacy
Merge in support for Xen HVM on amd64 architecture.