svn commit: r184024 - in projects/release_6_3_xen/sys: conf
i386/i386 i386/xen libkern sys xen xen/evtchn xen/xenbus
Kip Macy
kmacy at FreeBSD.org
Sat Oct 18 06:56:08 UTC 2008
Author: kmacy
Date: Sat Oct 18 06:56:07 2008
New Revision: 184024
URL: http://svn.freebsd.org/changeset/base/184024
Log:
- Merge fixes to sys/xen
- change pcpu usage back to 6.3
- import strcspn support
Added:
projects/release_6_3_xen/sys/libkern/strcspn.c
Modified:
projects/release_6_3_xen/sys/conf/files
projects/release_6_3_xen/sys/i386/i386/machdep.c
projects/release_6_3_xen/sys/i386/xen/locore.s
projects/release_6_3_xen/sys/i386/xen/mp_machdep.c
projects/release_6_3_xen/sys/sys/libkern.h
projects/release_6_3_xen/sys/xen/evtchn/evtchn.c
projects/release_6_3_xen/sys/xen/gnttab.c
projects/release_6_3_xen/sys/xen/gnttab.h
projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c
Modified: projects/release_6_3_xen/sys/conf/files
==============================================================================
--- projects/release_6_3_xen/sys/conf/files Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/conf/files Sat Oct 18 06:56:07 2008 (r184024)
@@ -1463,6 +1463,7 @@ libkern/strcasecmp.c standard
libkern/strcat.c standard
libkern/strcmp.c standard
libkern/strcpy.c standard
+libkern/strcspn.c standard
libkern/strdup.c standard
libkern/strlcat.c standard
libkern/strlcpy.c standard
Modified: projects/release_6_3_xen/sys/i386/i386/machdep.c
==============================================================================
--- projects/release_6_3_xen/sys/i386/i386/machdep.c Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/i386/i386/machdep.c Sat Oct 18 06:56:07 2008 (r184024)
@@ -2205,7 +2205,11 @@ init386(int first)
gdt_segs[GUDATA_SEL].ssd_limit = atop(HYPERVISOR_VIRT_START + MTOPSIZE);
gdt_segs[GBIOSLOWMEM_SEL].ssd_limit = atop(HYPERVISOR_VIRT_START + MTOPSIZE);
- pc = &__pcpu[0];
+#ifdef SMP
+ pc = &SMP_prvspace[0].pcpu;
+#else
+ pc = &__pcpu;
+#endif
gdt_segs[GPRIV_SEL].ssd_base = (int) pc;
gdt_segs[GPROC0_SEL].ssd_base = (int) &pc->pc_common_tss;
Modified: projects/release_6_3_xen/sys/i386/xen/locore.s
==============================================================================
--- projects/release_6_3_xen/sys/i386/xen/locore.s Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/i386/xen/locore.s Sat Oct 18 06:56:07 2008 (r184024)
@@ -110,7 +110,16 @@
.set PTmap,(PTDPTDI << PDRSHIFT)
.set PTD,PTmap + (PTDPTDI * PAGE_SIZE)
.set PTDpde,PTD + (PTDPTDI * PDESIZE)
-
+#ifdef SMP
+/*
+ * Define layout of per-cpu address space.
+ * This is "constructed" in locore.s on the BSP and in mp_machdep.c
+ * for each AP. DO NOT REORDER THESE WITHOUT UPDATING THE REST!
+ */
+ .globl SMP_prvspace
+ .set SMP_prvspace,(MPPTDI << PDRSHIFT)
+#endif /* SMP */
+
/*
* Compiled KERNBASE location and the kernel load address
*/
Modified: projects/release_6_3_xen/sys/i386/xen/mp_machdep.c
==============================================================================
--- projects/release_6_3_xen/sys/i386/xen/mp_machdep.c Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/i386/xen/mp_machdep.c Sat Oct 18 06:56:07 2008 (r184024)
@@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$");
#include <machine/smp.h>
#include <machine/smptests.h> /** COUNT_XINVLTLB_HITS */
#include <machine/specialreg.h>
+#include <machine/privatespace.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/evtchn.h>
@@ -622,7 +623,7 @@ start_all_aps(void)
bootAPgdt = gdt + (512*cpu);
/* Get per-cpu data */
- pc = &__pcpu[bootAP];
+ pc = &SMP_prvspace[bootAP].pcpu;
pcpu_init(pc, bootAP, sizeof(struct pcpu));
pc->pc_apic_id = cpu_apic_ids[bootAP];
pc->pc_prvspace = pc;
Added: projects/release_6_3_xen/sys/libkern/strcspn.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/release_6_3_xen/sys/libkern/strcspn.c Sat Oct 18 06:56:07 2008 (r184024)
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 2005 David Schultz <das at FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/libkern.h>
+#include <sys/types.h>
+#include <sys/limits.h>
+
+#define IDX(c) ((u_char)(c) / LONG_BIT)
+#define BIT(c) ((u_long)1 << ((u_char)(c) % LONG_BIT))
+
+size_t
+strcspn(const char *s, const char *charset)
+{
+ /*
+ * NB: idx and bit are temporaries whose use causes gcc 3.4.2 to
+ * generate better code. Without them, gcc gets a little confused.
+ */
+ const char *s1;
+ u_long bit;
+ u_long tbl[(UCHAR_MAX + 1) / LONG_BIT];
+ int idx;
+
+ if(*s == '\0')
+ return (0);
+
+#if LONG_BIT == 64 /* always better to unroll on 64-bit architectures */
+ tbl[0] = 1;
+ tbl[3] = tbl[2] = tbl[1] = 0;
+#else
+ for (tbl[0] = idx = 1; idx < sizeof(tbl) / sizeof(tbl[0]); idx++)
+ tbl[idx] = 0;
+#endif
+ for (; *charset != '\0'; charset++) {
+ idx = IDX(*charset);
+ bit = BIT(*charset);
+ tbl[idx] |= bit;
+ }
+
+ for(s1 = s; ; s1++) {
+ idx = IDX(*s1);
+ bit = BIT(*s1);
+ if ((tbl[idx] & bit) != 0)
+ break;
+ }
+ return (s1 - s);
+}
Modified: projects/release_6_3_xen/sys/sys/libkern.h
==============================================================================
--- projects/release_6_3_xen/sys/sys/libkern.h Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/sys/libkern.h Sat Oct 18 06:56:07 2008 (r184024)
@@ -98,6 +98,7 @@ void srandom(u_long);
int strcasecmp(const char *, const char *);
char *strcat(char * __restrict, const char * __restrict);
int strcmp(const char *, const char *);
+size_t strcspn(const char *s, const char *charset);
char *strcpy(char * __restrict, const char * __restrict);
char *strdup(const char *__restrict, struct malloc_type *);
size_t strlcat(char *, const char *, size_t);
@@ -151,6 +152,18 @@ memset(void *b, int c, size_t len)
return (b);
}
+static __inline char *
+strchr(const char *p, int ch)
+{
+ return (index(p, ch));
+}
+
+static __inline char *
+strrchr(const char *p, int ch)
+{
+ return (rindex(p, ch));
+}
+
/* fnmatch() return values. */
#define FNM_NOMATCH 1 /* Match failed. */
Modified: projects/release_6_3_xen/sys/xen/evtchn/evtchn.c
==============================================================================
--- projects/release_6_3_xen/sys/xen/evtchn/evtchn.c Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/xen/evtchn/evtchn.c Sat Oct 18 06:56:07 2008 (r184024)
@@ -21,7 +21,9 @@ __FBSDID("$FreeBSD$");
#include <machine/cpufunc.h>
#include <machine/intr_machdep.h>
+
#include <machine/xen/xen-os.h>
+#include <machine/xen/xenvar.h>
#include <machine/xen/xen_intr.h>
#include <machine/xen/synch_bitops.h>
#include <machine/xen/evtchn.h>
@@ -178,7 +180,7 @@ void force_evtchn_callback(void)
}
void
-evtchn_do_upcall(struct trapframe *frame)
+evtchn_do_upcall(struct intrframe *frame)
{
unsigned long l1, l2;
unsigned int l1i, l2i, port;
@@ -434,7 +436,7 @@ bind_caller_port_to_irqhandler(unsigned
irq = bind_caller_port_to_irq(caller_port);
intr_register_source(&xp->xp_pins[irq].xp_intsrc);
- retval = intr_add_handler(devname, irq, NULL, handler, arg, irqflags, cookiep);
+ retval = intr_add_handler(devname, irq, handler, arg, irqflags, cookiep);
if (retval != 0) {
unbind_from_irq(irq);
return -retval;
@@ -457,7 +459,7 @@ bind_listening_port_to_irqhandler(
irq = bind_listening_port_to_irq(remote_domain);
intr_register_source(&xp->xp_pins[irq].xp_intsrc);
- retval = intr_add_handler(devname, irq, NULL, handler, arg, irqflags, cookiep);
+ retval = intr_add_handler(devname, irq, handler, arg, irqflags, cookiep);
if (retval != 0) {
unbind_from_irq(irq);
return -retval;
@@ -471,7 +473,6 @@ 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)
{
@@ -480,7 +481,7 @@ bind_interdomain_evtchn_to_irqhandler(
irq = bind_interdomain_evtchn_to_irq(remote_domain, remote_port);
intr_register_source(&xp->xp_pins[irq].xp_intsrc);
- retval = intr_add_handler(devname, irq, filter, handler, NULL, irqflags, NULL);
+ retval = intr_add_handler(devname, irq, handler, NULL, irqflags, NULL);
if (retval != 0) {
unbind_from_irq(irq);
return -retval;
@@ -493,7 +494,6 @@ 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)
{
@@ -502,7 +502,7 @@ bind_virq_to_irqhandler(unsigned int vir
irq = bind_virq_to_irq(virq, cpu);
intr_register_source(&xp->xp_pins[irq].xp_intsrc);
- retval = intr_add_handler(devname, irq, filter, handler, NULL, irqflags, NULL);
+ retval = intr_add_handler(devname, irq, handler, NULL, irqflags, NULL);
if (retval != 0) {
unbind_from_irq(irq);
return -retval;
@@ -523,7 +523,7 @@ bind_ipi_to_irqhandler(unsigned int ipi,
irq = bind_ipi_to_irq(ipi, cpu);
intr_register_source(&xp->xp_pins[irq].xp_intsrc);
- retval = intr_add_handler(devname, irq, NULL, handler, NULL, irqflags, NULL);
+ retval = intr_add_handler(devname, irq, handler, NULL, irqflags, NULL);
if (retval != 0) {
unbind_from_irq(irq);
return -retval;
@@ -592,13 +592,11 @@ static void xenpic_dynirq_enable_sou
static void xenpic_dynirq_disable_source(struct intsrc *isrc, int);
static void xenpic_dynirq_eoi_source(struct intsrc *isrc);
static void xenpic_dynirq_enable_intr(struct intsrc *isrc);
-static void xenpic_dynirq_disable_intr(struct intsrc *isrc);
static void xenpic_pirq_enable_source(struct intsrc *isrc);
static void xenpic_pirq_disable_source(struct intsrc *isrc, int);
static void xenpic_pirq_eoi_source(struct intsrc *isrc);
static void xenpic_pirq_enable_intr(struct intsrc *isrc);
-static void xenpic_pirq_disable_intr(struct intsrc *isrc);
static int xenpic_vector(struct intsrc *isrc);
@@ -613,7 +611,6 @@ struct pic xenpic_dynirq_template = {
.pic_disable_source = xenpic_dynirq_disable_source,
.pic_eoi_source = xenpic_dynirq_eoi_source,
.pic_enable_intr = xenpic_dynirq_enable_intr,
- .pic_disable_intr = xenpic_dynirq_disable_intr,
.pic_vector = xenpic_vector,
.pic_source_pending = xenpic_source_pending,
.pic_suspend = xenpic_suspend,
@@ -625,7 +622,6 @@ struct pic xenpic_pirq_template = {
.pic_disable_source = xenpic_pirq_disable_source,
.pic_eoi_source = xenpic_pirq_eoi_source,
.pic_enable_intr = xenpic_pirq_enable_intr,
- .pic_disable_intr = xenpic_pirq_disable_intr,
.pic_vector = xenpic_vector,
.pic_source_pending = xenpic_source_pending,
.pic_suspend = xenpic_suspend,
@@ -684,20 +680,6 @@ xenpic_dynirq_enable_intr(struct intsrc
}
static void
-xenpic_dynirq_disable_intr(struct intsrc *isrc)
-{
- unsigned int irq;
- struct xenpic_intsrc *xp;
-
- xp = (struct xenpic_intsrc *)isrc;
- mtx_lock_spin(&irq_mapping_update_lock);
- xp->xp_masked = 1;
- irq = xenpic_vector(isrc);
- mask_evtchn(evtchn_from_irq(irq));
- mtx_unlock_spin(&irq_mapping_update_lock);
-}
-
-static void
xenpic_dynirq_eoi_source(struct intsrc *isrc)
{
unsigned int irq;
@@ -830,32 +812,6 @@ xenpic_pirq_enable_intr(struct intsrc *i
}
static void
-xenpic_pirq_disable_intr(struct intsrc *isrc)
-{
- unsigned int irq;
- int evtchn;
- struct evtchn_close close;
-
- mtx_lock_spin(&irq_mapping_update_lock);
- irq = xenpic_vector(isrc);
- evtchn = evtchn_from_irq(irq);
-
- if (!VALID_EVTCHN(evtchn))
- goto done;
-
- mask_evtchn(evtchn);
-
- close.port = evtchn;
- PANIC_IF(HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0);
-
- bind_evtchn_to_cpu(evtchn, 0);
- evtchn_to_irq[evtchn] = -1;
- irq_info[irq] = IRQ_UNBOUND;
- done:
- mtx_unlock_spin(&irq_mapping_update_lock);
-}
-
-static void
xenpic_pirq_enable_source(struct intsrc *isrc)
{
int evtchn;
Modified: projects/release_6_3_xen/sys/xen/gnttab.c
==============================================================================
--- projects/release_6_3_xen/sys/xen/gnttab.c Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/xen/gnttab.c Sat Oct 18 06:56:07 2008 (r184024)
@@ -25,11 +25,6 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mman.h>
-#include <vm/vm.h>
-#include <vm/vm_extern.h>
-
-#include <vm/vm_page.h>
-#include <vm/vm_kern.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/synch_bitops.h>
Modified: projects/release_6_3_xen/sys/xen/gnttab.h
==============================================================================
--- projects/release_6_3_xen/sys/xen/gnttab.h Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/xen/gnttab.h Sat Oct 18 06:56:07 2008 (r184024)
@@ -36,12 +36,16 @@
#ifndef __ASM_GNTTAB_H__
+#include <vm/vm.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_page.h>
+#include <vm/vm_kern.h>
+
#include <machine/xen/hypervisor.h>
#include <xen/interface/grant_table.h>
#include <machine/xen/xen-os.h>
#include <machine/xen/hypervisor.h>
#include <machine/xen/features.h>
-
struct gnttab_free_callback {
struct gnttab_free_callback *next;
void (*fn)(void *);
Modified: projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c
==============================================================================
--- projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c Sat Oct 18 06:37:43 2008 (r184023)
+++ projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c Sat Oct 18 06:56:07 2008 (r184024)
@@ -883,7 +883,7 @@ static void xenbus_thread(void *unused)
DELAY(10000);
xenbus_running = 1;
- pause("xenbus", hz/10);
+ tsleep(&lbolt, 0, "xenbus", hz/10);
for (;;) {
err = xs_process_msg(&type);
@@ -922,13 +922,13 @@ int xs_init(void)
if (err)
return err;
- err = kproc_create(xenwatch_thread, NULL, &p,
+ err = kthread_create(xenwatch_thread, NULL, &p,
RFHIGHPID, 0, "xenwatch");
if (err)
return err;
xenwatch_pid = p->p_pid;
- err = kproc_create(xenbus_thread, NULL, NULL,
+ err = kthread_create(xenbus_thread, NULL, NULL,
RFHIGHPID, 0, "xenbus");
return err;
More information about the svn-src-projects
mailing list