CVS commit: [netbsd-5] src/sys/arch/xen/x86

2010-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Nov 22 01:43:59 UTC 2010

Modified Files:
src/sys/arch/xen/x86 [netbsd-5]: cpu.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1475):
sys/arch/xen/x86/cpu.c: revision 1.52
Boot vs AP processors don't make sense for physical CPUs, these are
handled by the hypervisor and all CPUs are running when the dom0 is started.
In addition, we don't have a reliable way to determine the boot CPU as
- we may not be running on the boot CPU
- we don't have access to the lapic id
So simplify by ignoring the information and assign phycpu_info_primary to the
first attached CPU.


To generate a diff of this commit:
cvs rdiff -u -r1.28.4.2 -r1.28.4.3 src/sys/arch/xen/x86/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.28.4.2 src/sys/arch/xen/x86/cpu.c:1.28.4.3
--- src/sys/arch/xen/x86/cpu.c:1.28.4.2	Thu Apr 22 20:02:49 2010
+++ src/sys/arch/xen/x86/cpu.c	Mon Nov 22 01:43:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.28.4.2 2010/04/22 20:02:49 snj Exp $	*/
+/*	$NetBSD: cpu.c,v 1.28.4.3 2010/11/22 01:43:58 riz Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.28.4.2 2010/04/22 20:02:49 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.28.4.3 2010/11/22 01:43:58 riz Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -231,26 +231,22 @@
 	struct cpu_softc *sc = device_private(self);
 	struct cpu_attach_args *caa = aux;
 	struct cpu_info *ci;
-	int cpunum = caa->cpu_number;
+	static int nphycpu = 0;
 
 	sc->sc_dev = self;
 
 	/*
-	 * If we're an Application Processor, allocate a cpu_info
-	 * structure, otherwise use the primary's.
+	 * If we're the first attached CPU use the primary cpu_info,
+	 * otherwise allocate a new one.
 	 */
-	if (caa->cpu_role == CPU_ROLE_AP) {
+	if (nphycpu > 0) {
 		ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
 		ci->ci_curldt = -1;
-		if (phycpu_info[cpunum] != NULL)
-			panic("cpu at apic id %d already attached?", cpunum);
-		phycpu_info[cpunum] = ci;
+		if (phycpu_info[nphycpu] != NULL)
+			panic("cpu%d already attached?", nphycpu);
+		phycpu_info[nphycpu] = ci;
 	} else {
 		ci = &phycpu_info_primary;
-		if (cpunum != 0) {
-			phycpu_info[0] = NULL;
-			phycpu_info[cpunum] = ci;
-		}
 	}
 
 	ci->ci_self = ci;
@@ -259,29 +255,9 @@
 	ci->ci_dev = self;
 	ci->ci_cpuid = caa->cpu_number;
 	ci->ci_vcpu = NULL;
+	ci->ci_index = nphycpu++;
 
-	printf(": ");
-	switch (caa->cpu_role) {
-	case CPU_ROLE_SP:
-		printf("(uniprocessor)\n");
-		ci->ci_flags |= CPUF_PRESENT | CPUF_SP | CPUF_PRIMARY;
-		break;
-
-	case CPU_ROLE_BP:
-		printf("(boot processor)\n");
-		ci->ci_flags |= CPUF_PRESENT | CPUF_BSP | CPUF_PRIMARY;
-		break;
-
-	case CPU_ROLE_AP:
-		/*
-		 * report on an AP
-		 */
-		printf("(application processor)\n");
-		break;
-
-	default:
-		panic("unknown processor type??\n");
-	}
+	printf("\n");
 	return;
 #else
 	cpu_attach_common(parent, self, aux);



CVS commit: [netbsd-5] src/sys/arch/xen/x86

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Mar 29 00:23:12 UTC 2010

Modified Files:
src/sys/arch/xen/x86 [netbsd-5]: xen_bus_dma.c

Log Message:
Pull up following revision(s) (requested by jym in ticket #1334):
sys/arch/xen/x86/xen_bus_dma.c: revision 1.20
Although Xen's documentation states that the address_bits field is not used
by XENMEM_decrease_reservation, it is checked by the hypervisor. In certain
circumstances (stack leak), the field could have an improper value, leading
to a fail of the hypercall.
Set it to 0 ("no addressing restriction") to avoid that.
Patch tested by Sam Fourman and h...@.
This should fix the rare "failed allocating DMA memory" encountered
under NetBSD dom0.


To generate a diff of this commit:
cvs rdiff -u -r1.11.8.1 -r1.11.8.2 src/sys/arch/xen/x86/xen_bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/x86/xen_bus_dma.c
diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.1 src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.2
--- src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.1	Sat Jan 30 19:14:20 2010
+++ src/sys/arch/xen/x86/xen_bus_dma.c	Mon Mar 29 00:23:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_bus_dma.c,v 1.11.8.1 2010/01/30 19:14:20 snj Exp $	*/
+/*	$NetBSD: xen_bus_dma.c,v 1.11.8.2 2010/03/29 00:23:12 snj Exp $	*/
 /*	NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.11.8.1 2010/01/30 19:14:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.11.8.2 2010/03/29 00:23:12 snj Exp $");
 
 #include 
 #include 
@@ -99,6 +99,7 @@
 		res.extent_start = &mfn;
 		res.nr_extents = 1;
 		res.extent_order = 0;
+		res.address_bits = 0;
 		res.domid = DOMID_SELF;
 		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation, &res)
 		< 0) {