diff options
author | kmacy <kmacy@FreeBSD.org> | 2008-12-29 06:31:03 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2008-12-29 06:31:03 +0000 |
commit | 9198d09682e0ff9e4b99c1a500c60ec311f33516 (patch) | |
tree | 78f4ff4cfc0d598fd6e8ccc01fa628fc8ded089f /sys/i386/include/xen | |
parent | e46dfc4a1843e8da9da2fceed45ebc43d45d62b1 (diff) | |
download | FreeBSD-src-9198d09682e0ff9e4b99c1a500c60ec311f33516.zip FreeBSD-src-9198d09682e0ff9e4b99c1a500c60ec311f33516.tar.gz |
merge 186535, 186537, and 186538 from releng_7_xen
Log:
- merge in latest xenbus from dfr's xenhvm
- fix race condition in xs_read_reply by converting tsleep to mtx_sleep
Log:
unmask evtchn in bind_{virq, ipi}_to_irq
Log:
- remove code for handling case of not being able to sleep
- eliminate tsleep - make sleeps atomic
Diffstat (limited to 'sys/i386/include/xen')
-rw-r--r-- | sys/i386/include/xen/evtchn.h | 94 | ||||
-rw-r--r-- | sys/i386/include/xen/hypervisor.h | 143 | ||||
-rw-r--r-- | sys/i386/include/xen/xen_intr.h | 74 | ||||
-rw-r--r-- | sys/i386/include/xen/xenfunc.h | 2 |
4 files changed, 1 insertions, 312 deletions
diff --git a/sys/i386/include/xen/evtchn.h b/sys/i386/include/xen/evtchn.h deleted file mode 100644 index f86a8ab..0000000 --- a/sys/i386/include/xen/evtchn.h +++ /dev/null @@ -1,94 +0,0 @@ -/****************************************************************************** - * evtchn.h - * - * Communication via Xen event channels. - * Also definitions for the device that demuxes notifications to userspace. - * - * Copyright (c) 2004, K A Fraser - * - * $FreeBSD$ - */ - -#ifndef __ASM_EVTCHN_H__ -#define __ASM_EVTCHN_H__ -#include <machine/pcpu.h> -#include <machine/xen/hypervisor.h> -#include <machine/xen/synch_bitops.h> -#include <machine/frame.h> - -/* - * LOW-LEVEL DEFINITIONS - */ - -/* - * Unlike notify_remote_via_evtchn(), this is safe to use across - * save/restore. Notifications on a broken connection are silently dropped. - */ -void notify_remote_via_irq(int irq); - - -/* Entry point for notifications into Linux subsystems. */ -void evtchn_do_upcall(struct trapframe *frame); - -/* Entry point for notifications into the userland character device. */ -void evtchn_device_upcall(int port); - -void mask_evtchn(int port); - -void unmask_evtchn(int port); - -#ifdef SMP -void rebind_evtchn_to_cpu(int port, unsigned int cpu); -#else -#define rebind_evtchn_to_cpu(port, cpu) ((void)0) -#endif - -static inline -int test_and_set_evtchn_mask(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - return synch_test_and_set_bit(port, s->evtchn_mask); -} - -static inline void -clear_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - synch_clear_bit(port, &s->evtchn_pending[0]); -} - -static inline void -notify_remote_via_evtchn(int port) -{ - struct evtchn_send send = { .port = port }; - (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send); -} - -/* - * Use these to access the event channel underlying the IRQ handle returned - * by bind_*_to_irqhandler(). - */ -int irq_to_evtchn_port(int irq); - -void ipi_pcpu(unsigned int cpu, int vector); - -/* - * CHARACTER-DEVICE DEFINITIONS - */ - -#define PORT_NORMAL 0x0000 -#define PORT_EXCEPTION 0x8000 -#define PORTIDX_MASK 0x7fff - -/* /dev/xen/evtchn resides at device number major=10, minor=200 */ -#define EVTCHN_MINOR 200 - -/* /dev/xen/evtchn ioctls: */ -/* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */ -#define EVTCHN_RESET _IO('E', 1) -/* EVTCHN_BIND: Bind to the specified event-channel port. */ -#define EVTCHN_BIND _IO('E', 2) -/* EVTCHN_UNBIND: Unbind from the specified event-channel port. */ -#define EVTCHN_UNBIND _IO('E', 3) - -#endif /* __ASM_EVTCHN_H__ */ diff --git a/sys/i386/include/xen/hypervisor.h b/sys/i386/include/xen/hypervisor.h deleted file mode 100644 index 7f7ca20..0000000 --- a/sys/i386/include/xen/hypervisor.h +++ /dev/null @@ -1,143 +0,0 @@ -/****************************************************************************** - * hypervisor.h - * - * Linux-specific hypervisor handling. - * - * Copyright (c) 2002, K A Fraser - */ - -#ifndef __HYPERVISOR_H__ -#define __HYPERVISOR_H__ - -#define is_running_on_xen() 1 - -#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> -#include <xen/interface/platform.h> -#include <xen/interface/event_channel.h> -#include <xen/interface/physdev.h> -#include <xen/interface/sched.h> -#include <xen/interface/callback.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) -{ - return HYPERVISOR_console_io(CONSOLEIO_write, count, str); -} - -static inline void HYPERVISOR_crash(void) __dead2; - -static inline int -HYPERVISOR_yield(void) -{ - int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL); - -#if CONFIG_XEN_COMPAT <= 0x030002 - if (rc == -ENOXENSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); -#endif - return (rc); -} - -static inline int -HYPERVISOR_block( - void) -{ - int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL); - -#if CONFIG_XEN_COMPAT <= 0x030002 - if (rc == -ENOXENSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0); -#endif - return (rc); -} - - -static inline void -HYPERVISOR_shutdown(unsigned int reason) -{ - struct sched_shutdown sched_shutdown = { - .reason = reason - }; - - HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); -#if CONFIG_XEN_COMPAT <= 0x030002 - HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason); -#endif -} - -static inline void -HYPERVISOR_crash(void) -{ - HYPERVISOR_shutdown(SHUTDOWN_crash); - /* NEVER REACHED */ - for (;;) ; /* eliminate noreturn error */ -} - -/* Transfer control to hypervisor until an event is detected on one */ -/* of the specified ports or the specified number of ticks elapse */ -static inline int -HYPERVISOR_poll( - evtchn_port_t *ports, unsigned int nr_ports, int ticks) -{ - int rc; - struct sched_poll sched_poll = { - .nr_ports = nr_ports, - .timeout = get_system_time(ticks) - }; - set_xen_guest_handle(sched_poll.ports, ports); - - rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); -#if CONFIG_XEN_COMPAT <= 0x030002 - if (rc == -ENOXENSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); -#endif - 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.pte; -#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 /* __HYPERVISOR_H__ */ diff --git a/sys/i386/include/xen/xen_intr.h b/sys/i386/include/xen/xen_intr.h deleted file mode 100644 index a0e6c88..0000000 --- a/sys/i386/include/xen/xen_intr.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- */ -#ifndef _XEN_INTR_H_ -#define _XEN_INTR_H_ - -/* -* The flat IRQ space is divided into two regions: -* 1. A one-to-one mapping of real physical IRQs. This space is only used -* if we have physical device-access privilege. This region is at the -* start of the IRQ space so that existing device drivers do not need -* to be modified to translate physical IRQ numbers into our IRQ space. -* 3. A dynamic mapping of inter-domain and Xen-sourced virtual IRQs. These -* are bound using the provided bind/unbind functions. -* -* -* $FreeBSD$ -*/ - -#define PIRQ_BASE 0 -#define NR_PIRQS 128 - -#define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS) -#define NR_DYNIRQS 128 - -#define NR_IRQS (NR_PIRQS + NR_DYNIRQS) - -#define pirq_to_irq(_x) ((_x) + PIRQ_BASE) -#define irq_to_pirq(_x) ((_x) - PIRQ_BASE) - -#define dynirq_to_irq(_x) ((_x) + DYNIRQ_BASE) -#define irq_to_dynirq(_x) ((_x) - DYNIRQ_BASE) - -/* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */ -extern void unbind_from_irq(int irq); - -extern int bind_caller_port_to_irqhandler(unsigned int caller_port, - const char *devname, driver_intr_t handler, void *arg, - unsigned long irqflags, void **cookiep); -extern int bind_listening_port_to_irqhandler(unsigned int remote_domain, - const char *devname, driver_intr_t handler, void *arg, unsigned long irqflags, - void **cookiep); -extern int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, const char *devname, - driver_filter_t filter, driver_intr_t handler, unsigned long irqflags); -extern int bind_ipi_to_irqhandler(unsigned int ipi, - unsigned int cpu, - const char *devname, - driver_filter_t handler, - unsigned long irqflags); - -extern int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, - unsigned int remote_port, - const char *devname, - driver_filter_t filter, - driver_intr_t handler, - unsigned long irqflags); - - - -extern void unbind_from_irqhandler(unsigned int evtchn, void *dev_id); -static __inline__ int irq_cannonicalize(int irq) -{ - return (irq == 2) ? 9 : irq; -} - -extern void disable_irq(unsigned int); -extern void disable_irq_nosync(unsigned int); -extern void enable_irq(unsigned int); - -extern void irq_suspend(void); -extern void irq_resume(void); - -extern void idle_block(void); -extern int ap_cpu_initclocks(int cpu); - -#endif /* _XEN_INTR_H_ */ diff --git a/sys/i386/include/xen/xenfunc.h b/sys/i386/include/xen/xenfunc.h index e1a707d..2851709 100644 --- a/sys/i386/include/xen/xenfunc.h +++ b/sys/i386/include/xen/xenfunc.h @@ -33,7 +33,7 @@ #define _XEN_XENFUNC_H_ #include <machine/xen/xen-os.h> -#include <machine/xen/hypervisor.h> +#include <xen/hypervisor.h> #include <machine/xen/xenpmap.h> #include <machine/segments.h> #include <sys/pcpu.h> |