summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-08-15 04:00:44 +0000
committerkmacy <kmacy@FreeBSD.org>2008-08-15 04:00:44 +0000
commitb65933479a786637c87bc614705959a36c45e7db (patch)
tree0721ec70e83fbe8cb95ceccec819f561a2f3958b /sys
parent35aef144acd461cbfe1b0e6a8aa1dfcfcbafcb2e (diff)
downloadFreeBSD-src-b65933479a786637c87bc614705959a36c45e7db.zip
FreeBSD-src-b65933479a786637c87bc614705959a36c45e7db.tar.gz
Compile fixes for xen build.
MFC after: 1 month.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/xen/console/console.c3
-rw-r--r--sys/dev/xen/console/xencons_ring.c1
-rw-r--r--sys/i386/include/xen/xen-os.h25
-rw-r--r--sys/i386/include/xen/xenpmap.h3
-rw-r--r--sys/i386/xen/clock.c132
-rw-r--r--sys/i386/xen/locore.s4
-rw-r--r--sys/i386/xen/pmap.c115
-rw-r--r--sys/i386/xen/xen_machdep.c98
-rw-r--r--sys/xen/evtchn/evtchn.c1
-rw-r--r--sys/xen/xenbus/xenbus_client.c2
-rw-r--r--sys/xen/xenbus/xenbus_comms.c1
-rw-r--r--sys/xen/xenbus/xenbus_dev.c1
-rw-r--r--sys/xen/xenbus/xenbus_probe.c1
-rw-r--r--sys/xen/xenbus/xenbus_probe_backend.c1
-rw-r--r--sys/xen/xenbus/xenbus_xs.c1
15 files changed, 223 insertions, 166 deletions
diff --git a/sys/dev/xen/console/console.c b/sys/dev/xen/console/console.c
index dc9fe6f..252878d 100644
--- a/sys/dev/xen/console/console.c
+++ b/sys/dev/xen/console/console.c
@@ -276,7 +276,6 @@ xc_attach(device_t dev)
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
printf("xencons: shutdown event registration failed!\n");
- TRACE_EXIT;
return (0);
}
@@ -368,7 +367,6 @@ xcopen(struct cdev *dev, int flag, int mode, struct thread *td)
if (sc == NULL)
return (ENXIO);
- TRACE_ENTER;
tp = dev->si_tty;
s = spltty();
if (!ISTTYOPEN(tp)) {
@@ -390,7 +388,6 @@ xcopen(struct cdev *dev, int flag, int mode, struct thread *td)
xen_console_up = 1;
error = (*linesw[tp->t_line]->l_open)(dev, tp);
- TRACE_EXIT;
return error;
}
diff --git a/sys/dev/xen/console/xencons_ring.c b/sys/dev/xen/console/xencons_ring.c
index c9b60ac..3d232376 100644
--- a/sys/dev/xen/console/xencons_ring.c
+++ b/sys/dev/xen/console/xencons_ring.c
@@ -119,7 +119,6 @@ xencons_ring_init(void)
"xencons", xencons_handle_input, NULL,
INTR_TYPE_MISC | INTR_MPSAFE, NULL);
if (err) {
- XENPRINTF("XEN console request irq failed %i\n", err);
return err;
}
diff --git a/sys/i386/include/xen/xen-os.h b/sys/i386/include/xen/xen-os.h
index f325d35..92ba5e7 100644
--- a/sys/i386/include/xen/xen-os.h
+++ b/sys/i386/include/xen/xen-os.h
@@ -7,23 +7,41 @@
#ifndef _XEN_OS_H_
#define _XEN_OS_H_
#include <machine/param.h>
+
#ifdef PAE
#define CONFIG_X86_PAE
#endif
+#if defined(XEN) && !defined(__XEN_INTERFACE_VERSION__)
+/*
+ * Can update to a more recent version when we implement
+ * the hypercall page
+ */
+#define __XEN_INTERFACE_VERSION__ 0x00030204
+#endif
+
#include <xen/interface/xen.h>
/* Force a proper event-channel callback from Xen. */
void force_evtchn_callback(void);
+#define likely(x) __builtin_expect((x),1)
+#define unlikely(x) __builtin_expect((x),0)
+
+#ifndef vtophys
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+#endif
+
#ifdef SMP
#include <sys/time.h> /* XXX for pcpu.h */
#include <sys/pcpu.h> /* XXX for PCPU_GET */
-extern int gdt_set;
+extern int gdtset;
static inline int
smp_processor_id(void)
{
- if (likely(gdt_set))
+ if (likely(gdtset))
return PCPU_GET(cpuid);
return 0;
}
@@ -92,9 +110,6 @@ extern int preemptable;
* the enable bit is set, there may be pending events to be handled.
* We may therefore call into do_hypervisor_callback() directly.
*/
-#define likely(x) __builtin_expect((x),1)
-#define unlikely(x) __builtin_expect((x),0)
-
#define __cli() \
diff --git a/sys/i386/include/xen/xenpmap.h b/sys/i386/include/xen/xenpmap.h
index 163b780..62197a4 100644
--- a/sys/i386/include/xen/xenpmap.h
+++ b/sys/i386/include/xen/xenpmap.h
@@ -35,12 +35,9 @@
#ifndef _XEN_XENPMAP_H_
#define _XEN_XENPMAP_H_
-void xen_invlpg(vm_offset_t);
-void xen_load_cr3(vm_paddr_t);
void _xen_queue_pt_update(vm_paddr_t, vm_paddr_t, char *, int);
void xen_pt_switch(vm_paddr_t);
void xen_set_ldt(vm_paddr_t, unsigned long);
-void xen_tlb_flush(void);
void xen_pgdpt_pin(vm_paddr_t);
void xen_pgd_pin(vm_paddr_t);
void xen_pgd_unpin(vm_paddr_t);
diff --git a/sys/i386/xen/clock.c b/sys/i386/xen/clock.c
index a01770f..7361c72 100644
--- a/sys/i386/xen/clock.c
+++ b/sys/i386/xen/clock.c
@@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$");
#define ACQUIRED 2
#define ACQUIRE_PENDING 3
+struct mtx clock_lock;
#define RTC_LOCK_INIT \
mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_NOPROFILE)
#define RTC_LOCK mtx_lock_spin(&clock_lock)
@@ -126,12 +127,9 @@ static int independent_wallclock;
static int xen_disable_rtc_set;
static u_long cached_gtm; /* cached quotient for TSC -> microseconds */
static u_long cyc2ns_scale;
-static u_char timer2_state = RELEASED;
static struct timespec shadow_tv;
static uint32_t shadow_tv_version; /* XXX: lazy locking */
static uint64_t processed_system_time; /* stime (ns) at last processing. */
-static struct mtx clock_lock;
-static int rtc_reg;
static const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
@@ -456,12 +454,6 @@ DELAY(int n)
}
-int
-sysbeep(int pitch, int period)
-{
- return (0);
-}
-
/*
* Restore all the timers non-atomically (XXX: should be atomically).
*
@@ -529,21 +521,6 @@ startrtclock()
* RTC support routines
*/
-int
-rtcin(reg)
- int reg;
-{
- u_char val;
-
- RTC_LOCK;
- outb(IO_RTC, reg);
- inb(0x84);
- val = inb(IO_RTC + 1);
- inb(0x84);
- RTC_UNLOCK;
- return (val);
-}
-
static __inline int
readrtc(int port)
@@ -551,21 +528,6 @@ readrtc(int port)
return(bcd2bin(rtcin(port)));
}
-void
-writertc(int reg, u_char val)
-{
-
- RTC_LOCK;
- if (rtc_reg != reg) {
- inb(0x84);
- outb(IO_RTC, reg);
- rtc_reg = reg;
- inb(0x84);
- }
- outb(IO_RTC + 1, val);
- inb(0x84);
- RTC_UNLOCK;
-}
#ifdef XEN_PRIVILEGED_GUEST
@@ -718,7 +680,6 @@ inittodr(time_t base)
}
-
/*
* Write system time back to RTC
*/
@@ -781,75 +742,8 @@ resettodr()
writertc(RTC_STATUSB, RTCSB_24HR);
rtcin(RTC_INTR);
}
-#else
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(time_t base)
-{
- int s, y;
- struct timespec ts;
-
- s = splclock();
- if (base) {
- ts.tv_sec = base;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- }
-
- y = time_second - shadow_tv.tv_sec;
- if (y <= -2 || y >= 2) {
- /* badly off, adjust it */
- ts.tv_sec = shadow_tv.tv_sec;
- ts.tv_nsec = shadow_tv.tv_nsec * 1000000000; /* :-/ */
- tc_setclock(&ts);
- }
- splx(s);
-}
-
-/*
- * Write system time back to RTC. Not supported for guest domains.
- */
-void
-resettodr()
-{
-}
#endif
-
-int
-acquire_timer2(int mode)
-{
-
- if (timer2_state != RELEASED)
- return (-1);
- timer2_state = ACQUIRED;
-
- /*
- * This access to the timer registers is as atomic as possible
- * because it is a single instruction. We could do better if we
- * knew the rate. Use of splclock() limits glitches to 10-100us,
- * and this is probably good enough for timer2, so we aren't as
- * careful with it as with timer0.
- */
- outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f));
-
- return (0);
-}
-
-int
-release_timer2()
-{
-
- if (timer2_state != ACQUIRED)
- return (-1);
- timer2_state = RELEASED;
- outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT);
- return (0);
-}
-
static struct vcpu_set_periodic_timer xen_set_periodic_tick;
/*
@@ -974,3 +868,27 @@ idle_block(void)
PANIC_IF(HYPERVISOR_set_timer_op(processed_system_time + NS_PER_TICK) != 0);
HYPERVISOR_sched_op(SCHEDOP_block, 0);
}
+
+int
+timer_spkr_acquire(void)
+{
+
+ return (0);
+}
+
+int
+timer_spkr_release(void)
+{
+
+ return (0);
+}
+
+void
+timer_spkr_setfreq(int freq)
+{
+
+}
+
+
+
+
diff --git a/sys/i386/xen/locore.s b/sys/i386/xen/locore.s
index 634405d..a218d7b 100644
--- a/sys/i386/xen/locore.s
+++ b/sys/i386/xen/locore.s
@@ -159,6 +159,10 @@ IdlePDPT: .long 0 /* phys addr of kernel PDPT */
.globl KPTphys
#endif
KPTphys: .long 0 /* phys addr of kernel page tables */
+#ifdef SMP
+ .globl gdtset
+#endif
+gdtset: .long 0 /* GDT is valid */
.globl proc0kstack
proc0uarea: .long 0 /* address of proc 0 uarea (unused)*/
diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c
index d57a02f..14fe014 100644
--- a/sys/i386/xen/pmap.c
+++ b/sys/i386/xen/pmap.c
@@ -184,6 +184,9 @@ __FBSDID("$FreeBSD$");
#define PV_STAT(x) do { } while (0)
#endif
+#define pa_index(pa) ((pa) >> PDRSHIFT)
+#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
+
/*
* Get PDEs and PTEs for user/kernel address space
*/
@@ -223,6 +226,7 @@ static uma_zone_t pdptzone;
* Data for the pv entry allocation mechanism
*/
static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
+static struct md_page *pv_table;
static int shpgperproc = PMAP_SHPGPERPROC;
struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */
@@ -270,6 +274,16 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchanged, CTLFLAG_RD,
"Number of times pmap_pte_quick didn't change PMAP1");
static struct mtx PMAP2mutex;
+SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
+static int pg_ps_enabled;
+SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0,
+ "Are large page mappings enabled?");
+
+SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0,
+ "Max number of PV entries");
+SYSCTL_INT(_vm_pmap, OID_AUTO, shpgperproc, CTLFLAG_RD, &shpgperproc, 0,
+ "Page share factor per proc");
+
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
@@ -294,6 +308,8 @@ static void pmap_pte_release(pt_entry_t *pte);
static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t *);
static vm_offset_t pmap_kmem_choose(vm_offset_t addr);
static boolean_t pmap_is_prefaultable_locked(pmap_t pmap, vm_offset_t addr);
+static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
+
#if defined(PAE) && !defined(XEN)
static void *pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait);
@@ -671,8 +687,25 @@ pmap_ptelist_init(vm_offset_t *head, void *base, int npages)
void
pmap_init(void)
{
+ vm_page_t mpte;
+ vm_size_t s;
+ int i, pv_npg;
+
/*
+ * Initialize the vm page array entries for the kernel pmap's
+ * page table pages.
+ */
+ for (i = 0; i < nkpt; i++) {
+ mpte = PHYS_TO_VM_PAGE(PTD[i + KPTDI] & PG_FRAME);
+ KASSERT(mpte >= vm_page_array &&
+ mpte < &vm_page_array[vm_page_array_size],
+ ("pmap_init: page table page is out of range"));
+ mpte->pindex = i + KPTDI;
+ mpte->phys_addr = PTD[i + KPTDI] & PG_FRAME;
+ }
+
+ /*
* Initialize the address space (zone) for the pv entries. Set a
* high water mark so that the system can recover from excessive
* numbers of pv entries.
@@ -683,6 +716,26 @@ pmap_init(void)
pv_entry_max = roundup(pv_entry_max, _NPCPV);
pv_entry_high_water = 9 * (pv_entry_max / 10);
+ /*
+ * Are large page mappings enabled?
+ */
+ TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
+
+ /*
+ * Calculate the size of the pv head table for superpages.
+ */
+ for (i = 0; phys_avail[i + 1]; i += 2);
+ pv_npg = round_4mpage(phys_avail[(i - 2) + 1]) / NBPDR;
+
+ /*
+ * Allocate memory for the pv head table for superpages.
+ */
+ s = (vm_size_t)(pv_npg * sizeof(struct md_page));
+ s = round_page(s);
+ pv_table = (struct md_page *)kmem_alloc(kernel_map, s);
+ for (i = 0; i < pv_npg; i++)
+ TAILQ_INIT(&pv_table[i].pv_list);
+
pv_maxchunks = MAX(pv_entry_max / _NPCPV, maxproc);
pv_chunkbase = (struct pv_chunk *)kmem_alloc_nofault(kernel_map,
PAGE_SIZE * pv_maxchunks);
@@ -698,12 +751,6 @@ pmap_init(void)
}
-SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
-SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0,
- "Max number of PV entries");
-SYSCTL_INT(_vm_pmap, OID_AUTO, shpgperproc, CTLFLAG_RD, &shpgperproc, 0,
- "Page share factor per proc");
-
/***************************************************
* Low level helper routines.....
***************************************************/
@@ -1171,13 +1218,13 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
* Add a wired page to the kva.
* Note: not SMP coherent.
*/
-PMAP_INLINE void
+void
pmap_kenter(vm_offset_t va, vm_paddr_t pa)
{
PT_SET_MA(va, xpmap_ptom(pa)| PG_RW | PG_V | pgeflag);
}
-PMAP_INLINE void
+void
pmap_kenter_ma(vm_offset_t va, vm_paddr_t ma)
{
pt_entry_t *pte;
@@ -1187,7 +1234,7 @@ pmap_kenter_ma(vm_offset_t va, vm_paddr_t ma)
}
-PMAP_INLINE void
+static __inline void
pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode)
{
PT_SET_MA(va, pa | PG_RW | PG_V | pgeflag | pmap_cache_bits(mode, 0));
@@ -2859,6 +2906,7 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
PMAP_UNLOCK(pmap);
}
+#ifdef notyet
void
pmap_enter_quick_range(pmap_t pmap, vm_offset_t *addrs, vm_page_t *pages, vm_prot_t *prots, int count)
{
@@ -2886,6 +2934,7 @@ pmap_enter_quick_range(pmap_t pmap, vm_offset_t *addrs, vm_page_t *pages, vm_pro
PMAP_UNLOCK(pmap);
}
+#endif
static vm_page_t
pmap_enter_quick_locked(multicall_entry_t **mclpp, int *count, pmap_t pmap, vm_offset_t va, vm_page_t m,
@@ -3413,6 +3462,25 @@ pmap_page_wired_mappings(vm_page_t m)
}
/*
+ * Returns TRUE if the given page is mapped individually or as part of
+ * a 4mpage. Otherwise, returns FALSE.
+ */
+boolean_t
+pmap_page_is_mapped(vm_page_t m)
+{
+ struct md_page *pvh;
+
+ if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
+ return (FALSE);
+ mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+ if (TAILQ_EMPTY(&m->md.pv_list)) {
+ pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
+ return (!TAILQ_EMPTY(&pvh->pv_list));
+ } else
+ return (TRUE);
+}
+
+/*
* Remove all pages from specified address space
* this aids process exit speeds. Also, this code
* is special cased for current process only, but
@@ -4005,19 +4073,30 @@ pmap_activate(struct thread *td)
critical_exit();
}
-vm_offset_t
-pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
+/*
+ * Increase the starting virtual address of the given mapping if a
+ * different alignment might result in more superpage mappings.
+ */
+void
+pmap_align_superpage(vm_object_t object, vm_ooffset_t offset,
+ vm_offset_t *addr, vm_size_t size)
{
+ vm_offset_t superpage_offset;
- if ((obj == NULL) || (size < NBPDR) || (obj->type != OBJT_DEVICE)) {
- return addr;
- }
-
- addr = (addr + PDRMASK) & ~PDRMASK;
- return addr;
+ if (size < NBPDR)
+ return;
+ if (object != NULL && (object->flags & OBJ_COLORED) != 0)
+ offset += ptoa(object->pg_color);
+ superpage_offset = offset & PDRMASK;
+ if (size - ((NBPDR - superpage_offset) & PDRMASK) < NBPDR ||
+ (*addr & PDRMASK) == superpage_offset)
+ return;
+ if ((*addr & PDRMASK) < superpage_offset)
+ *addr = (*addr & ~PDRMASK) + superpage_offset;
+ else
+ *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset;
}
-
#if defined(PMAP_DEBUG)
pmap_pid_dump(int pid)
{
diff --git a/sys/i386/xen/xen_machdep.c b/sys/i386/xen/xen_machdep.c
index 6dd6bf6..a25fe66 100644
--- a/sys/i386/xen/xen_machdep.c
+++ b/sys/i386/xen/xen_machdep.c
@@ -69,6 +69,9 @@ __FBSDID("$FreeBSD$");
#include <machine/privatespace.h>
#endif
+#include <vm/vm_page.h>
+
+
#define IDTVEC(name) __CONCAT(X,name)
extern inthand_t
@@ -78,6 +81,7 @@ IDTVEC(div), IDTVEC(dbg), IDTVEC(nmi), IDTVEC(bpt), IDTVEC(ofl),
IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align),
IDTVEC(xmm), IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall);
+
int xendebug_flags;
start_info_t *xen_start_info;
shared_info_t *HYPERVISOR_shared_info;
@@ -85,7 +89,6 @@ xen_pfn_t *xen_machine_phys = machine_to_phys_mapping;
xen_pfn_t *xen_phys_machine;
int preemptable, init_first;
extern unsigned int avail_space;
-extern int gdt_set;
void ni_cli(void);
void ni_sti(void);
@@ -183,6 +186,12 @@ printk(const char *fmt, ...)
#define XPQUEUE_SIZE 128
+
+struct mmu_log {
+ char *file;
+ int line;
+};
+
#ifdef SMP
/* per-cpu queues and indices */
static mmu_update_t xpq_queue[MAX_VIRT_CPUS][XPQUEUE_SIZE];
@@ -191,11 +200,10 @@ static int xpq_idx[MAX_VIRT_CPUS];
#define XPQ_QUEUE xpq_queue[vcpu]
#define XPQ_IDX xpq_idx[vcpu]
#define SET_VCPU() int vcpu = smp_processor_id()
+static struct mmu_log xpq_queue_log[MAX_VIRT_CPUS][XPQUEUE_SIZE];
+
+#define XPQ_QUEUE_LOG xpq_queue_log[vcpu]
#else
-struct mmu_log {
- char *file;
- int line;
-};
static mmu_update_t xpq_queue[XPQUEUE_SIZE];
static struct mmu_log xpq_queue_log[XPQUEUE_SIZE];
@@ -204,7 +212,8 @@ static int xpq_idx = 0;
#define XPQ_QUEUE xpq_queue
#define XPQ_IDX xpq_idx
#define SET_VCPU()
-#endif
+#endif /* !SMP */
+
#define XPQ_IDX_INC atomic_add_int(&XPQ_IDX, 1);
#if 0
@@ -233,7 +242,7 @@ _xen_flush_queue(void)
int error, i;
/* window of vulnerability here? */
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
critical_enter();
XPQ_IDX = 0;
/* Make sure index is cleared first to avoid double updates. */
@@ -241,7 +250,7 @@ _xen_flush_queue(void)
_xpq_idx, NULL, DOMID_SELF);
#if 0
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
for (i = _xpq_idx; i > 0;) {
if (i >= 3) {
CTR6(KTR_PMAP, "mmu:val: %lx ptr: %lx val: %lx ptr: %lx val: %lx ptr: %lx",
@@ -261,7 +270,7 @@ _xen_flush_queue(void)
}
}
#endif
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
critical_exit();
if (__predict_false(error < 0)) {
for (i = 0; i < _xpq_idx; i++)
@@ -291,6 +300,8 @@ xen_increment_idx(void)
void
xen_check_queue(void)
{
+ SET_VCPU();
+
KASSERT(XPQ_IDX == 0, ("pending operations XPQ_IDX=%d", XPQ_IDX));
}
@@ -304,10 +315,11 @@ xen_invlpg(vm_offset_t va)
}
void
-xen_load_cr3(vm_paddr_t val)
+xen_load_cr3(u_int val)
{
struct mmuext_op op;
-
+ SET_VCPU();
+
KASSERT(XPQ_IDX == 0, ("pending operations XPQ_IDX=%d", XPQ_IDX));
op.cmd = MMUEXT_NEW_BASEPTR;
op.arg1.mfn = xpmap_ptom(val) >> PAGE_SHIFT;
@@ -315,41 +327,67 @@ xen_load_cr3(vm_paddr_t val)
}
void
-_xen_machphys_update(unsigned long mfn, unsigned long pfn, char *file, int line)
+xen_restore_flags(u_int eflags)
{
- if (__predict_true(gdt_set))
- critical_enter();
+ __restore_flags(eflags);
+}
+
+void
+xen_save_and_cli(u_int *eflags)
+{
+
+ __save_and_cli((*eflags));
+}
+
+void
+xen_cli(void)
+{
+ __cli();
+}
+
+void
+xen_sti(void)
+{
+ __sti();
+}
+
+void
+_xen_machphys_update(unsigned long mfn, unsigned long pfn, char *file, int line)
+{
SET_VCPU();
+
+ if (__predict_true(gdtset))
+ critical_enter();
XPQ_QUEUE[XPQ_IDX].ptr = (mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
XPQ_QUEUE[XPQ_IDX].val = pfn;
#ifdef INVARIANTS
- xpq_queue_log[XPQ_IDX].file = file;
- xpq_queue_log[XPQ_IDX].line = line;
+ XPQ_QUEUE_LOG[XPQ_IDX].file = file;
+ XPQ_QUEUE_LOG[XPQ_IDX].line = line;
#endif
xen_increment_idx();
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
critical_exit();
}
void
_xen_queue_pt_update(vm_paddr_t ptr, vm_paddr_t val, char *file, int line)
{
+ SET_VCPU();
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
critical_enter();
- SET_VCPU();
XPQ_QUEUE[XPQ_IDX].ptr = ((uint64_t)ptr) | MMU_NORMAL_PT_UPDATE;
XPQ_QUEUE[XPQ_IDX].val = (uint64_t)val;
#ifdef INVARIANTS
- xpq_queue_log[XPQ_IDX].file = file;
- xpq_queue_log[XPQ_IDX].line = line;
+ XPQ_QUEUE_LOG[XPQ_IDX].file = file;
+ XPQ_QUEUE_LOG[XPQ_IDX].line = line;
#endif
xen_increment_idx();
- if (__predict_true(gdt_set))
+ if (__predict_true(gdtset))
critical_exit();
}
@@ -742,7 +780,7 @@ shift_phys_machine(unsigned long *phys_machine, int nr_pages)
memset(phys_machine, INVALID_P2M_ENTRY, PAGE_SIZE);
}
-#endif
+#endif /* ADD_ISA_HOLE */
extern unsigned long physfree;
void
@@ -880,7 +918,8 @@ initvalues(start_info_t *startinfo)
PT_SET_MA(IdlePDPTnew, IdlePDPTnewma | PG_V);
xen_pt_unpin(IdlePDPTma);
-#endif
+#endif /* PAE */
+
#ifndef PAE
xen_queue_pt_update(IdlePTDma + PTDPTDI*sizeof(vm_paddr_t),
pdir_shadow_ma | PG_KERNEL);
@@ -995,7 +1034,7 @@ initvalues(start_info_t *startinfo)
xpmap_ptom(VTOP(cur_space) | PG_V | PG_A));
#endif
xen_flush_queue();
-#endif
+#endif /* 0 */
cur_space += PAGE_SIZE;
printk("#6\n");
@@ -1127,7 +1166,8 @@ setup_shutdown_watcher(void *unused)
}
-SYSINIT(shutdown, SI_SUB_PSEUDO, SI_ORDER_ANY, setup_shutdown_watcher, NULL)
+SYSINIT(shutdown, SI_SUB_PSEUDO, SI_ORDER_ANY, setup_shutdown_watcher, NULL);
+
#ifdef notyet
static void
@@ -1182,7 +1222,7 @@ xen_suspend(void *ignore)
cpu_set(i, prev_online_cpus);
}
}
-#endif
+#endif /* CONFIG_SMP */
preempt_disable();
@@ -1264,7 +1304,7 @@ xen_suspend(void *ignore)
return err;
}
-#endif
+#endif /* notyet */
/********** CODE WORTH KEEPING ABOVE HERE *****************/
void xen_failsafe_handler(void);
diff --git a/sys/xen/evtchn/evtchn.c b/sys/xen/evtchn/evtchn.c
index e7a40a2..1d4b688 100644
--- a/sys/xen/evtchn/evtchn.c
+++ b/sys/xen/evtchn/evtchn.c
@@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$");
#include <machine/xen/hypervisor.h>
+
/* linux helper functions that got sucked in
* rename and move XXX
*/
diff --git a/sys/xen/xenbus/xenbus_client.c b/sys/xen/xenbus/xenbus_client.c
index 45a5eb6..ef0c930 100644
--- a/sys/xen/xenbus/xenbus_client.c
+++ b/sys/xen/xenbus/xenbus_client.c
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/malloc.h>
#include <sys/libkern.h>
+
+#include <machine/xen/xen-os.h>
#include <machine/xen/evtchn.h>
#include <xen/gnttab.h>
#include <machine/xen/xenbus.h>
diff --git a/sys/xen/xenbus/xenbus_comms.c b/sys/xen/xenbus/xenbus_comms.c
index 50acef3..6fd3440 100644
--- a/sys/xen/xenbus/xenbus_comms.c
+++ b/sys/xen/xenbus/xenbus_comms.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
+#include <machine/xen/xen-os.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/evtchn.h>
#include <machine/xen/xenbus.h>
diff --git a/sys/xen/xenbus/xenbus_dev.c b/sys/xen/xenbus/xenbus_dev.c
index b1c72d9..3eb6408 100644
--- a/sys/xen/xenbus/xenbus_dev.c
+++ b/sys/xen/xenbus/xenbus_dev.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
+#include <machine/xen/xen-os.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/xenbus.h>
#include <machine/xen/hypervisor.h>
diff --git a/sys/xen/xenbus/xenbus_probe.c b/sys/xen/xenbus/xenbus_probe.c
index 1b718c5..85a3e57 100644
--- a/sys/xen/xenbus/xenbus_probe.c
+++ b/sys/xen/xenbus/xenbus_probe.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/sx.h>
+#include <machine/xen/xen-os.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/xenbus.h>
#include <machine/xen/evtchn.h>
diff --git a/sys/xen/xenbus/xenbus_probe_backend.c b/sys/xen/xenbus/xenbus_probe_backend.c
index 5629c53..8ef66ce 100644
--- a/sys/xen/xenbus/xenbus_probe_backend.c
+++ b/sys/xen/xenbus/xenbus_probe_backend.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/sx.h>
+#include <machine/xen/xen-os.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/xenbus.h>
#include <machine/xen/evtchn.h>
diff --git a/sys/xen/xenbus/xenbus_xs.c b/sys/xen/xenbus/xenbus_xs.c
index 67a7fe8..61a9779 100644
--- a/sys/xen/xenbus/xenbus_xs.c
+++ b/sys/xen/xenbus/xenbus_xs.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/kthread.h>
+#include <machine/xen/xen-os.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/xenbus.h>
#include <machine/stdarg.h>
OpenPOWER on IntegriCloud