CVS commit: src/sys/arch/xen/x86

2019-06-07 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Jun  7 12:43:52 UTC 2019

Modified Files:
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Fix build for the XEN3_PVHVM kernel by conditoinally compiling
redundant functions x86_enable_intr()/x86_disable_intr()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/x86/xen_intr.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_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.16 src/sys/arch/xen/x86/xen_intr.c:1.17
--- src/sys/arch/xen/x86/xen_intr.c:1.16	Thu May  9 17:09:51 2019
+++ src/sys/arch/xen/x86/xen_intr.c	Fri Jun  7 12:43:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.16 2019/05/09 17:09:51 bouyer Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.17 2019/06/07 12:43:52 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.16 2019/05/09 17:09:51 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.17 2019/06/07 12:43:52 cherry Exp $");
 
 #include 
 #include 
@@ -99,6 +99,7 @@ xen_spllower(int nlevel)
 }
 
 
+#if !defined(XENPVHVM)
 void
 x86_disable_intr(void)
 {
@@ -117,6 +118,8 @@ x86_enable_intr(void)
 		hypervisor_force_callback();
 }
 
+#endif /* !XENPVHVM */
+
 u_long
 xen_read_psl(void)
 {



CVS commit: src/sys/arch/xen/x86

2019-06-07 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Jun  7 12:43:52 UTC 2019

Modified Files:
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Fix build for the XEN3_PVHVM kernel by conditoinally compiling
redundant functions x86_enable_intr()/x86_disable_intr()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/x86/xen_intr.c

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



CVS commit: src/sys/arch

2019-02-14 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 08:18:26 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S machdep.c spl.S vector.S
src/sys/arch/amd64/include: frame.h
src/sys/arch/i386/i386: machdep.c vector.S
src/sys/arch/i386/include: frame.h frameasm.h
src/sys/arch/x86/include: cpu.h intr.h
src/sys/arch/x86/x86: cpu.c intr.c mainbus.c pmap.c x86_machdep.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: xen_intr.c xen_mainbus.c
src/sys/arch/xen/xen: hypervisor.c if_xennet_xenbus.c
Added Files:
src/sys/arch/amd64/conf: XEN3_PVHVM
src/sys/arch/i386/conf: XEN3PAE_PVHVM

Log Message:
Welcome XENPVHVM mode.

It is UP only, has xbd(4) and xennet(4) as PV drivers.

The console is com0 at isa and the native portion is very
rudimentary AT architecture, so is probably suboptimal to
run without PV support.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.325 -r1.326 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/conf/XEN3_PVHVM
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/conf/XEN3PAE_PVHVM
cvs rdiff -u -r1.815 -r1.816 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/mainbus.c
cvs rdiff -u -r1.322 -r1.323 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/xen_mainbus.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/if_xennet_xenbus.c

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



CVS commit: src/sys/arch

2019-02-14 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 08:18:26 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S machdep.c spl.S vector.S
src/sys/arch/amd64/include: frame.h
src/sys/arch/i386/i386: machdep.c vector.S
src/sys/arch/i386/include: frame.h frameasm.h
src/sys/arch/x86/include: cpu.h intr.h
src/sys/arch/x86/x86: cpu.c intr.c mainbus.c pmap.c x86_machdep.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: xen_intr.c xen_mainbus.c
src/sys/arch/xen/xen: hypervisor.c if_xennet_xenbus.c
Added Files:
src/sys/arch/amd64/conf: XEN3_PVHVM
src/sys/arch/i386/conf: XEN3PAE_PVHVM

Log Message:
Welcome XENPVHVM mode.

It is UP only, has xbd(4) and xennet(4) as PV drivers.

The console is com0 at isa and the native portion is very
rudimentary AT architecture, so is probably suboptimal to
run without PV support.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.325 -r1.326 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/conf/XEN3_PVHVM
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/conf/XEN3PAE_PVHVM
cvs rdiff -u -r1.815 -r1.816 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/mainbus.c
cvs rdiff -u -r1.322 -r1.323 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/xen_mainbus.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/if_xennet_xenbus.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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.177 src/sys/arch/amd64/amd64/locore.S:1.178
--- src/sys/arch/amd64/amd64/locore.S:1.177	Wed Feb 13 05:36:59 2019
+++ src/sys/arch/amd64/amd64/locore.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.177 2019/02/13 05:36:59 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.178 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1112,7 +1112,7 @@ ENTRY(cpu_switchto)
 .Lskip_svs:
 #endif
 
-#ifndef XENPV
+#ifndef XEN
 	movq	%r13,%rdi
 	movq	%r12,%rsi
 	callq	_C_LABEL(speculation_barrier)

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.325 src/sys/arch/amd64/amd64/machdep.c:1.326
--- src/sys/arch/amd64/amd64/machdep.c:1.325	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.325 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.326 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.325 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -193,7 +193,9 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
-#endif
+#include 
+#include 
+#endif /* XEN */
 
 #ifdef DDB
 #include 
@@ -1693,7 +1695,7 @@ init_x86_64(paddr_t first_avail)
 	svs_init();
 #endif
 	cpu_init_msrs(_info_primary, true);
-#ifndef XENPV
+#ifndef XEN
 	cpu_speculation_init(_info_primary);
 #endif
 
@@ -1905,6 +1907,7 @@ init_x86_64(paddr_t first_avail)
 	(unsigned long) Xsyscall))
 		panic("HYPERVISOR_set_callbacks() failed");
 #endif /* XENPV */
+
 	cpu_init_idt();
 
 	init_x86_64_ksyms();

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.39 src/sys/arch/amd64/amd64/spl.S:1.40
--- src/sys/arch/amd64/amd64/spl.S:1.39	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/spl.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.39 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.40 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -211,7 +211,9 @@ IDTVEC(resume_preempt)
 	cli
 	jmp	*%r13			/* back to Xdoreti */
 IDTVEC_END(resume_preempt)
+#endif /* XEN */
 
+#ifndef XENPV
 /*
  * void 

CVS commit: src/sys/arch

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 07:12:40 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c db_interface.c
src/sys/arch/i386/i386: db_interface.c
src/sys/arch/x86/x86: cpu.c

Log Message:
Fix NLAPIC, NISA and NIOAPIC related conditional compile errors.

This will allow us to now compile an amd64 kernel without PCI.

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/x86/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/amd64/amd64/amd64_mainbus.c
diff -u src/sys/arch/amd64/amd64/amd64_mainbus.c:1.4 src/sys/arch/amd64/amd64/amd64_mainbus.c:1.5
--- src/sys/arch/amd64/amd64/amd64_mainbus.c:1.4	Sat Dec 22 08:35:04 2018
+++ src/sys/arch/amd64/amd64/amd64_mainbus.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $	*/
+/*	$NetBSD: amd64_mainbus.c,v 1.5 2019/02/14 07:12:40 cherry Exp $	*/
 /*	NetBSD: mainbus.c,v 1.39 2018/12/02 08:19:44 cherry Exp 	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.5 2019/02/14 07:12:40 cherry Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ amd64_mainbus_match(device_t parent, cfd
 void
 amd64_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-#if NPCI > 0 || NACPICA > 0 || NIPMI > 0
+#if NISA > 0 || NPCI > 0 || NACPICA > 0 || NIPMI > 0
 	union amd64_mainbus_attach_args mba;
 #endif
 

Index: src/sys/arch/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.35 src/sys/arch/amd64/amd64/db_interface.c:1.36
--- src/sys/arch/amd64/amd64/db_interface.c:1.35	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/db_interface.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.35 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.36 2019/02/14 07:12:40 cherry Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.35 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.36 2019/02/14 07:12:40 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -52,9 +52,13 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include 
 #include 
 #include 
+#if NIOAPIC > 0
 #include 
+#endif
+#if NLAPIC > 0
 #include 
 #include 
+#endif
 
 #include 
 #include 
@@ -145,7 +149,9 @@ db_suspend_others(void)
 #ifdef XENPV
 		xen_broadcast_ipi(XEN_IPI_DDB);
 #else
+#if NLAPIC > 0
 		x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
+#endif
 #endif /* XENPV */
 	}
 	ddb_mp_online = x86_mp_online;

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.83 src/sys/arch/i386/i386/db_interface.c:1.84
--- src/sys/arch/i386/i386/db_interface.c:1.83	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/db_interface.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.83 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.84 2019/02/14 07:12:40 cherry Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.83 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.84 2019/02/14 07:12:40 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -150,7 +150,9 @@ db_suspend_others(void)
 #ifdef XENPV
 		xen_broadcast_ipi(XEN_IPI_DDB);
 #else
+#if NLAPIC > 0		
 		x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
+#endif		
 #endif /* XENPV */
 	}
 	ddb_mp_online = x86_mp_online;

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.164 src/sys/arch/x86/x86/cpu.c:1.165
--- src/sys/arch/x86/x86/cpu.c:1.164	Tue Dec  4 19:27:22 2018
+++ src/sys/arch/x86/x86/cpu.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.164 2018/12/04 19:27:22 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.165 2019/02/14 07:12:40 cherry Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.164 2018/12/04 19:27:22 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.165 2019/02/14 07:12:40 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -754,12 +754,14 @@ cpu_init_idle_lwps(void)
 void
 cpu_start_secondary(struct cpu_info *ci)
 {
-	paddr_t mp_pdirpa;
 	u_long psl;
 	int i;
 
+#if NLAPIC > 0
+	paddr_t mp_pdirpa;
 	mp_pdirpa = pmap_init_tmp_pgtbl(mp_trampoline_paddr);
 	cpu_copy_trampoline(mp_pdirpa);

CVS commit: src/sys/arch

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 07:12:40 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c db_interface.c
src/sys/arch/i386/i386: db_interface.c
src/sys/arch/x86/x86: cpu.c

Log Message:
Fix NLAPIC, NISA and NIOAPIC related conditional compile errors.

This will allow us to now compile an amd64 kernel without PCI.

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/x86/x86/cpu.c

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



CVS commit: src/sys/arch/xen

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 06:59:25 UTC 2019

Modified Files:
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/include: bus_private.h
src/sys/arch/xen/include/amd64: vmparam.h

Log Message:
Snag the final bits of PV only code to conditionally compile under
-DXENPV

This completes the bifurcation.

The next step is to add -DXENPVHVM code.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/bus_private.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/include/amd64/vmparam.h

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



CVS commit: src/sys/arch/xen

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 06:59:25 UTC 2019

Modified Files:
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/include: bus_private.h
src/sys/arch/xen/include/amd64: vmparam.h

Log Message:
Snag the final bits of PV only code to conditionally compile under
-DXENPV

This completes the bifurcation.

The next step is to add -DXENPVHVM code.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/bus_private.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/include/amd64/vmparam.h

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/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.176 src/sys/arch/xen/conf/files.xen:1.177
--- src/sys/arch/xen/conf/files.xen:1.176	Sun Jan 27 02:08:39 2019
+++ src/sys/arch/xen/conf/files.xen	Thu Feb 14 06:59:24 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.176 2019/01/27 02:08:39 pgoyette Exp $
+#	$NetBSD: files.xen,v 1.177 2019/02/14 06:59:24 cherry Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -36,7 +36,7 @@ defflag opt_pcifixup.h	PCI_ADDR_FIXUP PC
 
 defparam		PCI_CONF_MODE
 
-file	arch/xen/x86/autoconf.c
+file	arch/xen/x86/autoconf.c		xenpv
 ifdef i386
 file	arch/i386/i386/aout_machdep.c	exec_aout
 file	arch/i386/i386/busfunc.S
@@ -86,10 +86,10 @@ file	arch/xen/x86/hypervisor_machdep.c
 file	arch/x86/x86/kgdb_machdep.c	kgdb
 # file 	arch/x86/x86/mtrr_i686.c	mtrr
 file	arch/x86/x86/syscall.c
-file	arch/xen/x86/x86_xpmap.c
-file	arch/xen/x86/xen_pmap.c
+file	arch/xen/x86/x86_xpmap.c	xenpv
+file	arch/xen/x86/xen_pmap.c		xenpv
 file	arch/xen/x86/xen_intr.c
-file	arch/xen/x86/xenfunc.c
+file	arch/xen/x86/xenfunc.c		xenpv
 
 file	arch/x86/x86/cpu_ucode.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	dom0ops & cpu_ucode needs-flag
@@ -97,9 +97,9 @@ file	arch/x86/x86/cpu_ucode_intel.c	dom0
 file	arch/x86/x86/compat_60_cpu_ucode.c  compat_60 & dom0ops & cpu_ucode
 
 
-file	arch/xen/xen/xen_machdep.c
+file	arch/xen/xen/xen_machdep.c	xenpv
 
-file	arch/xen/xen/clock.c
+file	arch/xen/xen/clock.c		xenpv
 file	arch/x86/isa/rtc.c		dom0ops
 file	arch/xen/xen/evtchn.c
 
@@ -133,12 +133,12 @@ file	dev/md_root.c			memory_disk_hooks
 
 file	arch/x86/x86/bus_dma.c		machdep
 file	arch/x86/x86/core_machdep.c	coredump
-file	arch/xen/x86/xen_bus_dma.c	machdep
+file	arch/xen/x86/xen_bus_dma.c	machdep & xenpv
 file	arch/x86/x86/bus_space.c	machdep
-file	arch/xen/x86/consinit.c		machdep
+file	arch/xen/x86/consinit.c		machdep & xenpv
 file	arch/x86/x86/identcpu.c		machdep
-file	arch/xen/x86/pintr.c		machdep & dom0ops
-file	arch/xen/x86/xen_ipi.c		multiprocessor
+file	arch/xen/x86/pintr.c		machdep & dom0ops & xenpv
+file	arch/xen/x86/xen_ipi.c		multiprocessor & xenpv
 file	arch/x86/x86/idt.c		machdep
 file	arch/x86/x86/pmap.c		machdep
 file	arch/x86/x86/x86_tlb.c		machdep
@@ -253,7 +253,7 @@ device	fdc {drive = -1} #XXX
 include "dev/apm/files.apm"
 
 include "dev/acpi/files.acpi"
-file	arch/xen/xen/xen_acpi_machdep.c	acpi
+file	arch/xen/xen/xen_acpi_machdep.c	acpi & xenpv
 file	arch/x86/x86/mpacpi.c		acpi
 file	arch/x86/x86/i8259.c		dom0ops
 
@@ -289,8 +289,7 @@ attach cpu at cpubus
 
 device vcpu
 attach vcpu at xendevbus
-
-file	arch/xen/x86/cpu.c		cpu | vcpu
+file	arch/xen/x86/cpu.c		xenpv & vcpu
 
 # CPU features
 #

Index: src/sys/arch/xen/include/bus_private.h
diff -u src/sys/arch/xen/include/bus_private.h:1.9 src/sys/arch/xen/include/bus_private.h:1.10
--- src/sys/arch/xen/include/bus_private.h:1.9	Wed Jan 23 19:46:45 2008
+++ src/sys/arch/xen/include/bus_private.h	Thu Feb 14 06:59:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_private.h,v 1.9 2008/01/23 19:46:45 bouyer Exp $	*/
+/*	$NetBSD: bus_private.h,v 1.10 2019/02/14 06:59:24 cherry Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -29,6 +29,7 @@
 #include 
 #include "opt_xen.h"
 
+#ifdef XENPV
 #define	_BUS_PHYS_TO_BUS(pa)	((bus_addr_t)xpmap_ptom(pa))
 #define	_BUS_BUS_TO_PHYS(ba)	((paddr_t)xpmap_mtop(ba))
 #define	_BUS_VIRT_TO_BUS(pm, va) _bus_virt_to_bus((pm), (va))
@@ -65,5 +66,6 @@ int _xen_bus_dmamem_alloc_range(bus_dma_
 #else
 #define _BUS_AVAIL_END ((bus_addr_t)0x)
 #endif
-
+#endif /* XENPV */
 #include 
+

Index: src/sys/arch/xen/include/amd64/vmparam.h
diff -u src/sys/arch/xen/include/amd64/vmparam.h:1.2 src/sys/arch/xen/include/amd64/vmparam.h:1.3
--- src/sys/arch/xen/include/amd64/vmparam.h:1.2	Thu Nov 22 16:17:02 2007
+++ src/sys/arch/xen/include/amd64/vmparam.h	Thu Feb 14 06:59:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.2 2007/11/22 16:17:02 bouyer Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.3 2019/02/14 06:59:24 cherry Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -29,10 +29,13 @@
 #if !defined(_VMPARAM_H_)
 #include 
 
+#ifdef XENPV

CVS commit: src/sys/arch/xen/x86

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 09:57:46 UTC 2019

Modified Files:
src/sys/arch/xen/x86: xen_mainbus.c

Log Message:
Conditionally compile a conditionally used variable.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/xen/x86/xen_mainbus.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_mainbus.c
diff -u src/sys/arch/xen/x86/xen_mainbus.c:1.4 src/sys/arch/xen/x86/xen_mainbus.c:1.5
--- src/sys/arch/xen/x86/xen_mainbus.c:1.4	Sat Dec 22 08:35:04 2018
+++ src/sys/arch/xen/x86/xen_mainbus.c	Wed Feb 13 09:57:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $	*/
+/*	$NetBSD: xen_mainbus.c,v 1.5 2019/02/13 09:57:46 cherry Exp $	*/
 /*	NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp 	*/
 /*	NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp 	*/
 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.5 2019/02/13 09:57:46 cherry Exp $");
 
 #include 
 #include 
@@ -130,7 +130,9 @@ xen_mainbus_match(device_t parent, cfdat
 void
 xen_mainbus_attach(device_t parent, device_t self, void *aux)
 {
+#if NIPMI > 0 || NHYPERVISOR > 0
 	union xen_mainbus_attach_args mba;
+#endif
 
 #if NIPMI > 0
 	memset(_ipmi, 0, sizeof(mba.mba_ipmi));



CVS commit: src/sys/arch/xen/x86

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 09:57:46 UTC 2019

Modified Files:
src/sys/arch/xen/x86: xen_mainbus.c

Log Message:
Conditionally compile a conditionally used variable.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/xen/x86/xen_mainbus.c

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



Re: CVS commit: src/sys/arch/x86

2019-02-13 Thread Cherry G . Mathew
(resent to source-changes-d@)

"Maxime Villard"  writes:


[...]

>
> Contrary to AMD-SVM, Intel-VMX uses a different set of PTE bits from
> native, and this has three important consequences:
>
>  - We can't use the native PTE bits, so each time we want to modify the
>page tables, we need to know whether we're dealing with a native pmap
>or an EPT pmap. This is accomplished with callbacks, that handle
>everything PTE-related.
>

I like this approach - perhaps it's a way to separate out other similar
pmaps (OT).

>  - There is no recursive slot possible, so we can't use pmap_map_ptes().
>Rather, we walk down the EPT trees via the direct map, and that's
>actually a lot simpler (and probably faster too...).
>

Does this mean that nvmm hosts have to have __HAVE_DIRECT_MAP ?
If so, it might be worth having a separate kernel conf rather than
GENERIC (I don't know how this works now). I recently built an amd64
kernel without __HAVE_DIRECT_MAP and was quite impressed that it
actually booted. That's a nice to have feature.

>  - The kernel is never mapped in an EPT pmap. An EPT pmap cannot be loaded
>on the host. This has two sub-consequences: at creation time we must
>zero out all of the top-level PTEs, and at destruction time we force
>the page out of the pool cache and into the pool, to ensure that a next
>allocation will invoke pmap_pdp_ctor() to create a native pmap and not
>recycle some stale EPT entries.

Can you not use a separate poolcache ? This could isolate host/guest
related memory pressure as well ?

-- 
~cherry


CVS commit: src/sys/arch/xen

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 06:52:43 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/xen: evtchn.c hypervisor.c xen_machdep.c

Log Message:
Further restrict the scope of XENPV to relevant parts.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/xen_machdep.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/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.40 src/sys/arch/xen/include/xenpmap.h:1.41
--- src/sys/arch/xen/include/xenpmap.h:1.40	Thu Jul 26 17:20:08 2018
+++ src/sys/arch/xen/include/xenpmap.h	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.40 2018/07/26 17:20:08 maxv Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.41 2019/02/13 06:52:43 cherry Exp $	*/
 
 /*
  *
@@ -72,6 +72,7 @@ void xen_kpm_sync(struct pmap *, int);
 #define xpq_queue_pin_l4_table(pa)	\
 	xpq_queue_pin_table(pa, MMUEXT_PIN_L4_TABLE)
 
+#ifdef XENPV
 extern unsigned long *xpmap_phys_to_machine_mapping;
 
 static __inline paddr_t
@@ -121,6 +122,8 @@ xpmap_ptom_isvalid(paddr_t ppa)
 	!= INVALID_P2M_ENTRY);
 }
 
+#endif /* XENPV */
+
 static inline void
 MULTI_update_va_mapping(
 	multicall_entry_t *mcl, vaddr_t va,

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.84 src/sys/arch/xen/xen/evtchn.c:1.85
--- src/sys/arch/xen/xen/evtchn.c:1.84	Wed Feb 13 05:01:58 2019
+++ src/sys/arch/xen/xen/evtchn.c	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.84 2019/02/13 05:01:58 cherry Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.85 2019/02/13 06:52:43 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.84 2019/02/13 05:01:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.85 2019/02/13 06:52:43 cherry Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -256,6 +256,7 @@ void
 events_init(void)
 {
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
+#ifdef XENPV
 	debug_port = bind_virq_to_evtch(VIRQ_DEBUG);
 
 	KASSERT(debug_port != -1);
@@ -273,6 +274,7 @@ events_init(void)
 #if NPCI > 0 || NISA > 0
 	hypervisor_ack_pirq_event(debug_port);
 #endif /* NPCI > 0 || NISA > 0 */
+#endif /* XENPV */
 	x86_enable_intr();		/* at long last... */
 }
 
@@ -1080,6 +1082,7 @@ xen_debug_handler(void *arg)
 	return 0;
 }
 
+#ifdef XENPV
 static struct evtsource *
 event_get_handler(const char *intrid)
 {
@@ -1207,3 +1210,4 @@ interrupt_construct_intrids(const kcpuse
 
 	return ii_handler;
 }
+#endif /* XENPV */

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.70 src/sys/arch/xen/xen/hypervisor.c:1.71
--- src/sys/arch/xen/xen/hypervisor.c:1.70	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/xen/hypervisor.c	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.70 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.70 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $");
 
 #include 
 #include 
@@ -373,20 +373,22 @@ hypervisor_attach(device_t parent, devic
 static bool
 hypervisor_suspend(device_t dev, const pmf_qual_t *qual)
 {
+#ifdef XENPV
 	events_suspend();
 	xengnt_suspend();
-
+#endif
 	return true;
 }
 
 static bool
 hypervisor_resume(device_t dev, const pmf_qual_t *qual)
 {
+#ifdef XENPV
 	hypervisor_machdep_resume();
 
 	xengnt_resume();
 	events_resume();
-
+#endif
 	return true;
 }
 

Index: src/sys/arch/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.20 src/sys/arch/xen/xen/xen_machdep.c:1.21
--- src/sys/arch/xen/xen/xen_machdep.c:1.20	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/xen/xen_machdep.c	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.20 2019/02/02 12:32:55 cherry Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.21 2019/02/13 06:52:43 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.20 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.21 2019/02/13 06:52:43 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -80,6 +80,7 @@ u_int	tsc_get_timecount(struct timecount
 
 bool xen_suspend_allow;
 
+#ifdef XENPV
 extern uint64_t tsc_freq;	/* XXX */
 
 static int sysctl_xen_suspend(SYSCTLFN_ARGS);
@@ -419,6 +420,7 @@ xen_suspend_domain(void)
 	aprint_verbose("domain resumed\n");
 
 }
+#endif /* XENPV */
 
 #define PRINTK_BUFSIZE 1024
 void



CVS commit: src/sys/arch/xen

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 06:52:43 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/xen: evtchn.c hypervisor.c xen_machdep.c

Log Message:
Further restrict the scope of XENPV to relevant parts.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/xen_machdep.c

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



CVS commit: src/sys/arch/xen/x86

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 06:15:51 UTC 2019

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
Catchup with struct intrstub; unification.

This should fix dom0 build breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/pintr.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/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.9 src/sys/arch/xen/x86/pintr.c:1.10
--- src/sys/arch/xen/x86/pintr.c:1.9	Wed Oct 10 02:34:08 2018
+++ src/sys/arch/xen/x86/pintr.c	Wed Feb 13 06:15:51 2019
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.9 2018/10/10 02:34:08 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.10 2019/02/13 06:15:51 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -135,17 +135,19 @@ __KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.
 /* XXX: todo - compat with lapic.c and XEN for x2apic */
 bool x2apic_mode __read_mostly = false;
 /* for x86/i8259.c */
-struct intrstub legacy_stubs[NUM_LEGACY_IRQS] = {{0,0}};
+struct intrstub legacy_stubs[NUM_LEGACY_IRQS] = {{0,0,0}};
 /* for x86/ioapic.c */
-struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
-struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};
-struct intrstub x2apic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
-struct intrstub x2apic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};
+struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
+struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
+struct intrstub x2apic_edge_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
+struct intrstub x2apic_level_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
 #include 
+#endif /* NIOAPIC */
+
 int irq2port[NR_EVENT_CHANNELS] = {0}; /* actually port + 1, so that 0 is invaid */
 static int irq2vect[256] = {0};
 static int vect2irq[256] = {0};
-#endif /* NIOAPIC */
+
 #if NACPICA > 0
 #include 
 #include 



CVS commit: src/sys/arch/xen/x86

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 06:15:51 UTC 2019

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
Catchup with struct intrstub; unification.

This should fix dom0 build breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/pintr.c

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



CVS commit: src/sys/arch

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:36:59 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S

Log Message:
Rig the hypercall callback page such that when the kernel happens to
run without a XEN domain loader having previously overwritten the
hypercall page with its hypercall trampoline machine code, we still
get to detect its presence by calling the xen_version hypercall stub.

We use this hack to detect the presence or absence of the hypervisor,
without relying on the MSR support on HVM domains.

This works as an added sanity check that the hypercall page
registration has indeed succeeded in HVM mode.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/i386/i386/locore.S

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



CVS commit: src/sys/arch

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:36:59 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S

Log Message:
Rig the hypercall callback page such that when the kernel happens to
run without a XEN domain loader having previously overwritten the
hypercall page with its hypercall trampoline machine code, we still
get to detect its presence by calling the xen_version hypercall stub.

We use this hack to detect the presence or absence of the hypervisor,
without relying on the MSR support on HVM domains.

This works as an added sanity check that the hypercall page
registration has indeed succeeded in HVM mode.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/i386/i386/locore.S

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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.176 src/sys/arch/amd64/amd64/locore.S:1.177
--- src/sys/arch/amd64/amd64/locore.S:1.176	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/locore.S	Wed Feb 13 05:36:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.176 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.177 2019/02/13 05:36:59 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -278,6 +278,8 @@
 #define __ASSEMBLY__
 #include 
 #include 
+#endif	/* XEN */
+
 #ifdef XENPV	
 #define ELFNOTE(name, type, desctype, descdata...) \
 .pushsection .note.name			;	\
@@ -312,7 +314,6 @@
 	ELFNOTE(Xen, XEN_ELFNOTE_BSD_SYMTAB, .asciz, "yes")
 #endif
 #endif  /* XENPV */	
-#endif	/* XEN */
 
 /*
  * Initialization
@@ -979,9 +980,12 @@ END(start)
 #if defined(XEN)
 /* space for the hypercall call page */
 #define HYPERCALL_PAGE_OFFSET 0x1000
-.org HYPERCALL_PAGE_OFFSET
-ENTRY(hypercall_page)
-.skip 0x1000
+.align HYPERCALL_PAGE_OFFSET
+ENTRY(hypercall_page) /* Returns -1, on HYPERVISOR_xen_version() */
+.skip	(__HYPERVISOR_xen_version*32), 0x90
+	movq	$-1, %rax
+	retq
+.align HYPERCALL_PAGE_OFFSET, 0x90
 END(hypercall_page)
 #endif /* XEN */
 

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.163 src/sys/arch/i386/i386/locore.S:1.164
--- src/sys/arch/i386/i386/locore.S:1.163	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/locore.S	Wed Feb 13 05:36:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.163 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.164 2019/02/13 05:36:59 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.163 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.164 2019/02/13 05:36:59 cherry Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -242,6 +242,20 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 	loop	1b			;
 
 
+#ifdef XEN
+/*
+ * Unfortunately, the Xen codebase uses nonstandard preprocessing tools.
+ * See: https://xenbits.xen.org/gitweb/?p=xen.git=search=HEAD=grep=__UnDeF__
+ * for a fine selection of examples.
+ *
+ * What this means for us here is that we can't include the standard
+ * xen.h header in assembler code.
+ *
+ * So we have to manually define, and keep track of the values we need, ourselves.
+ */
+#define __HYPERVISOR_xen_version  17
+#endif	/* XEN */
+
 #ifdef XENPV
 /*
  * Xen guest identifier and loader selection
@@ -916,9 +930,12 @@ END(start)
 #if defined(XEN)
 /* space for the hypercall call page */
 #define HYPERCALL_PAGE_OFFSET 0x1000
-.org HYPERCALL_PAGE_OFFSET
-ENTRY(hypercall_page)
-.skip 0x1000
+.align HYPERCALL_PAGE_OFFSET
+ENTRY(hypercall_page) /* Returns -1, on HYPERVISOR_xen_version() */
+.skip	(__HYPERVISOR_xen_version*32), 0x90
+	movl	$-1, %eax
+	retl
+.align HYPERCALL_PAGE_OFFSET, 0x90
 END(hypercall_page)
 
 #ifdef XENPV



CVS commit: src/sys/arch/x86/include

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:28:50 UTC 2019

Modified Files:
src/sys/arch/x86/include: intr.h

Log Message:
Missed the crucial header file in previous commit.

struct intrstub; is now uniform across native and XEN

This should fix the XEN builds.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/include/intr.h

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



CVS commit: src/sys/arch/x86/include

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:28:50 UTC 2019

Modified Files:
src/sys/arch/x86/include: intr.h

Log Message:
Missed the crucial header file in previous commit.

struct intrstub; is now uniform across native and XEN

This should fix the XEN builds.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/include/intr.h

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/x86/include/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.58 src/sys/arch/x86/include/intr.h:1.59
--- src/sys/arch/x86/include/intr.h:1.58	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/x86/include/intr.h	Wed Feb 13 05:28:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.58 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: intr.h,v 1.59 2019/02/13 05:28:50 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -71,9 +71,7 @@
  */
 
 struct intrstub {
-#if !defined(XENPV)
 	void *ist_entry;
-#endif
 	void *ist_recurse;
 	void *ist_resume;
 };



CVS commit: src/sys/arch

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:01:58 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: vector.S
src/sys/arch/i386/i386: vector.S
src/sys/arch/xen/xen: evtchn.c

Log Message:
In preparation for debut-ing PVHVM mode:

 - Make the struct intrstub uniform across native and XEN.
 - Introduce vector callback entrypoints for PVHVM mode.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/xen/evtchn.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/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.66 src/sys/arch/amd64/amd64/vector.S:1.67
--- src/sys/arch/amd64/amd64/vector.S:1.66	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/vector.S	Wed Feb 13 05:01:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.66 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: vector.S,v 1.67 2019/02/13 05:01:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -631,19 +631,7 @@ LABEL(name ## _stubs); \
 	INTRSTUB_ENTRY(name ## 31)		; \
 END(name ## _stubs)
 
-	.section .rodata
-
-INTRSTUB_ARRAY_16(legacy)
-
-#if NIOAPIC > 0
-INTRSTUB_ARRAY_32(ioapic_edge)
-INTRSTUB_ARRAY_32(ioapic_level)
-
-INTRSTUB_ARRAY_32(x2apic_edge)
-INTRSTUB_ARRAY_32(x2apic_level)
-#endif
-
-#endif /* !defined(XENPV) */
+#endif /* !XENPV */
 
 #if defined(XEN)
 /* Resume/recurse procedures for spl() */
@@ -715,39 +703,49 @@ XENINTRSTUB(xenev,29,voidop,voidop,voido
 XENINTRSTUB(xenev,30,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
 XENINTRSTUB(xenev,31,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
 
+/* On Xen, the xenev_stubs are purely for spl entry, since there is no
+ * vector based mechanism. We however provide the entrypoint to ensure
+ * that native and Xen struct intrstub ; definitions are uniform.
+ */
+panicmsg:	.ascii "vector Xen event entry path entered."
+LABEL(entry_xenev)
+	movq $panicmsg, %rdi
+	callq _C_LABEL(panic)
+END(entry_xenev)
+
 LABEL(xenev_stubs)
-	.quad _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0)
-	.quad _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1)
-	.quad _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2)
-	.quad _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3)
-	.quad _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4)
-	.quad _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5)
-	.quad _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6)
-	.quad _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7)
-	.quad _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8)
-	.quad _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9)
-	.quad _C_LABEL(Xrecurse_xenev10), _C_LABEL(Xresume_xenev10)
-	.quad _C_LABEL(Xrecurse_xenev11), _C_LABEL(Xresume_xenev11)
-	.quad _C_LABEL(Xrecurse_xenev12), _C_LABEL(Xresume_xenev12)
-	.quad _C_LABEL(Xrecurse_xenev13), _C_LABEL(Xresume_xenev13)
-	.quad _C_LABEL(Xrecurse_xenev14), _C_LABEL(Xresume_xenev14)
-	.quad _C_LABEL(Xrecurse_xenev15), _C_LABEL(Xresume_xenev15)
-	.quad _C_LABEL(Xrecurse_xenev16), _C_LABEL(Xresume_xenev16)
-	.quad _C_LABEL(Xrecurse_xenev17), _C_LABEL(Xresume_xenev17)
-	.quad _C_LABEL(Xrecurse_xenev18), _C_LABEL(Xresume_xenev18)
-	.quad _C_LABEL(Xrecurse_xenev19), _C_LABEL(Xresume_xenev19)
-	.quad _C_LABEL(Xrecurse_xenev20), _C_LABEL(Xresume_xenev20)
-	.quad _C_LABEL(Xrecurse_xenev21), _C_LABEL(Xresume_xenev21)
-	.quad _C_LABEL(Xrecurse_xenev22), _C_LABEL(Xresume_xenev22)
-	.quad _C_LABEL(Xrecurse_xenev23), _C_LABEL(Xresume_xenev23)
-	.quad _C_LABEL(Xrecurse_xenev24), _C_LABEL(Xresume_xenev24)
-	.quad _C_LABEL(Xrecurse_xenev25), _C_LABEL(Xresume_xenev25)
-	.quad _C_LABEL(Xrecurse_xenev26), _C_LABEL(Xresume_xenev26)
-	.quad _C_LABEL(Xrecurse_xenev27), _C_LABEL(Xresume_xenev27)
-	.quad _C_LABEL(Xrecurse_xenev28), _C_LABEL(Xresume_xenev28)
-	.quad _C_LABEL(Xrecurse_xenev29), _C_LABEL(Xresume_xenev29)
-	.quad _C_LABEL(Xrecurse_xenev30), _C_LABEL(Xresume_xenev30)
-	.quad _C_LABEL(Xrecurse_xenev31), _C_LABEL(Xresume_xenev31)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev10), 

CVS commit: src/sys/arch

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:01:58 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: vector.S
src/sys/arch/i386/i386: vector.S
src/sys/arch/xen/xen: evtchn.c

Log Message:
In preparation for debut-ing PVHVM mode:

 - Make the struct intrstub uniform across native and XEN.
 - Introduce vector callback entrypoints for PVHVM mode.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/xen/evtchn.c

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



CVS commit: src/sys/arch/xen

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 08:04:53 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenfunc.h
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Move xen event related code which interfaces with the NetBSD interrupt
subsystem into a separate namespace where it can co-exist with the
native equivalent in PVHVM mode.

On PV, we alias and export the native symbols - this means that
although the namespace is different, the semantics must be identical.

Eg: xen_intr_establish_xname() vs. intr_establish_xname().

The specific functions we need in PVHVM are:

 - spllower, xen_spllower (for native as well as XEN event spl
   despatch/defer)
 - xen_disable_intr()/xen_enable_intr() ,
   x86_disable_intr()/x86_enable_intr()
 - xen_read_psl()/xen_write_psl(),
   x86_read_psl()/x86_write_psl()
 - intr_establish() et. al, xen_intr_establish() et. al.

This gives us the ability to manage Paravirtualised drivers such as
xbd(4) as well as fully emulated ones such as wd(4)., for eg


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/xenfunc.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/x86/xen_intr.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/include/xenfunc.h
diff -u src/sys/arch/xen/include/xenfunc.h:1.16 src/sys/arch/xen/include/xenfunc.h:1.17
--- src/sys/arch/xen/include/xenfunc.h:1.16	Thu Jul 26 15:46:09 2018
+++ src/sys/arch/xen/include/xenfunc.h	Tue Feb 12 08:04:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenfunc.h,v 1.16 2018/07/26 15:46:09 maxv Exp $	*/
+/*	$NetBSD: xenfunc.h,v 1.17 2019/02/12 08:04:53 cherry Exp $	*/
 
 /*
  *
@@ -36,5 +36,10 @@
 #include 
 #include 
 
+void xen_disable_intr(void);
+void xen_enable_intr(void);
+u_long xen_read_psl(void);
+void xen_write_psl(u_long);
+
 void xen_set_ldt(vaddr_t, uint32_t);
 #endif /* _XEN_XENFUNC_H_ */

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.13 src/sys/arch/xen/x86/xen_intr.c:1.14
--- src/sys/arch/xen/x86/xen_intr.c:1.13	Wed Dec 26 11:12:57 2018
+++ src/sys/arch/xen/x86/xen_intr.c	Tue Feb 12 08:04:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.14 2019/02/12 08:04:53 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.14 2019/02/12 08:04:53 cherry Exp $");
 
 #include 
 #include 
@@ -66,17 +66,14 @@ __KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v
 #include 
 #endif
 
-void xen_disable_intr(void);
-void xen_enable_intr(void);
-u_long xen_read_psl(void);
-void xen_write_psl(u_long);
-
 /*
  * Restore a value to cpl (unmasking interrupts).  If any unmasked
  * interrupts are pending, call Xspllower() to process them.
  */
+void xen_spllower(int nlevel);
+
 void
-spllower(int nlevel)
+xen_spllower(int nlevel)
 {
 	struct cpu_info *ci = curcpu();
 	uint32_t xmask;
@@ -186,7 +183,7 @@ xen_intr_establish_xname(int legacy_irq,
 		return rih;
 	} 	/* Else we assume pintr */
 
-#if NPCI > 0 || NISA > 0
+#if (NPCI > 0 || NISA > 0) && defined(XENPV) /* XXX: support PVHVM pirq */
 	struct pintrhand *pih;
 	int gsi;
 	int vector, evtchn;
@@ -306,8 +303,9 @@ redzone_const_or_zero(int x)
 }
 #endif
 
+void xen_cpu_intr_init(struct cpu_info *);
 void
-cpu_intr_init(struct cpu_info *ci)
+xen_cpu_intr_init(struct cpu_info *ci)
 {
 	int i; /* XXX: duplicate */
 
@@ -393,8 +391,10 @@ legacy_intr_string(int ih, char *buf, si
 	return buf;
 }
 
+const char * xintr_string(intr_handle_t ih, char *buf, size_t len);
+
 const char *
-intr_string(intr_handle_t ih, char *buf, size_t len)
+xintr_string(intr_handle_t ih, char *buf, size_t len)
 {
 #if NIOAPIC > 0
 	struct ioapic_softc *pic;
@@ -420,7 +420,7 @@ intr_string(intr_handle_t ih, char *buf,
 		snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
 
 #elif NLAPIC > 0
-	snprintf(buf, len, "irq %d" APIC_IRQ_LEGACY_IRQ(ih));
+	snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
 #else
 	snprintf(buf, len, "irq %d", (int) ih);
 #endif
@@ -432,8 +432,11 @@ intr_string(intr_handle_t ih, char *buf,
  * Create an interrupt id such as "ioapic0 pin 9". This interrupt id is used
  * by MI code and intrctl(8).
  */
+const char * xen_intr_create_intrid(int legacy_irq, struct pic *pic,
+int pin, char *buf, size_t len);
+
 const char *
-intr_create_intrid(int legacy_irq, struct pic *pic, int pin, char *buf, size_t len)
+xen_intr_create_intrid(int legacy_irq, struct pic *pic, int pin, char *buf, size_t len)
 {
 	int ih = 0;
 
@@ -487,14 +490,19 @@ intr_create_intrid(int legacy_irq, struc
 	return NULL; /* No pic found! */
 }
 
-__weak_alias(x86_disable_intr, xen_disable_intr);
-__weak_alias(x86_enable_intr, xen_enable_intr);
-__weak_alias(x86_read_psl, 

CVS commit: src/sys/arch/xen

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 08:04:53 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenfunc.h
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Move xen event related code which interfaces with the NetBSD interrupt
subsystem into a separate namespace where it can co-exist with the
native equivalent in PVHVM mode.

On PV, we alias and export the native symbols - this means that
although the namespace is different, the semantics must be identical.

Eg: xen_intr_establish_xname() vs. intr_establish_xname().

The specific functions we need in PVHVM are:

 - spllower, xen_spllower (for native as well as XEN event spl
   despatch/defer)
 - xen_disable_intr()/xen_enable_intr() ,
   x86_disable_intr()/x86_enable_intr()
 - xen_read_psl()/xen_write_psl(),
   x86_read_psl()/x86_write_psl()
 - intr_establish() et. al, xen_intr_establish() et. al.

This gives us the ability to manage Paravirtualised drivers such as
xbd(4) as well as fully emulated ones such as wd(4)., for eg


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/xenfunc.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/x86/xen_intr.c

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



CVS commit: src/sys/arch/xen

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 07:58:26 UTC 2019

Modified Files:
src/sys/arch/xen/include: pci_machdep.h
src/sys/arch/xen/x86: hypervisor_machdep.c

Log Message:
conditionally include XENPV specific code.

This explicitly excludes PV only functionality that would be wrong to
attempt to use in other modes, for eg: p2m table management.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/include/pci_machdep.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/x86/hypervisor_machdep.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/include/pci_machdep.h
diff -u src/sys/arch/xen/include/pci_machdep.h:1.19 src/sys/arch/xen/include/pci_machdep.h:1.20
--- src/sys/arch/xen/include/pci_machdep.h:1.19	Sun Jul 16 06:14:24 2017
+++ src/sys/arch/xen/include/pci_machdep.h	Tue Feb 12 07:58:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.19 2017/07/16 06:14:24 cherry Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.20 2019/02/12 07:58:26 cherry Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -66,7 +66,7 @@ typedef intr_handle_t pci_intr_handle_t;
 
 #include "opt_xen.h"
 
-#ifndef DOM0OPS
+#if !defined(DOM0OPS) && defined(XENPV)
 int		xpci_enumerate_bus(struct pci_softc *, const int *,
 		   int (*)(const struct pci_attach_args *),
 		   struct pci_attach_args *);

Index: src/sys/arch/xen/x86/hypervisor_machdep.c
diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.34 src/sys/arch/xen/x86/hypervisor_machdep.c:1.35
--- src/sys/arch/xen/x86/hypervisor_machdep.c:1.34	Tue Dec 25 06:50:12 2018
+++ src/sys/arch/xen/x86/hypervisor_machdep.c	Tue Feb 12 07:58:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor_machdep.c,v 1.34 2018/12/25 06:50:12 cherry Exp $	*/
+/*	$NetBSD: hypervisor_machdep.c,v 1.35 2019/02/12 07:58:26 cherry Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.34 2018/12/25 06:50:12 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.35 2019/02/12 07:58:26 cherry Exp $");
 
 #include 
 #include 
@@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor_m
 #include "isa.h"
 #include "pci.h"
 
+#ifdef XENPV
 /*
  * arch-dependent p2m frame lists list (L3 and L2)
  * used by Xen for save/restore mappings
@@ -85,6 +86,8 @@ static int l2_p2m_page_size; /* size of 
 static void build_p2m_frame_list_list(void);
 static void update_p2m_frame_list_list(void);
 
+#endif
+
 // #define PORT_DEBUG 4
 // #define EARLY_DEBUG_EVENT
 
@@ -434,21 +437,26 @@ hypervisor_set_ipending(uint32_t iplmask
 void
 hypervisor_machdep_attach(void)
 {
+#ifdef XENPV
  	/* dom0 does not require the arch-dependent P2M translation table */
 	if (!xendomain_is_dom0()) {
 		build_p2m_frame_list_list();
 		sysctl_xen_suspend_setup();
 	}
+#endif
 }
 
 void
 hypervisor_machdep_resume(void)
 {
+#ifdef XENPV
 	/* dom0 does not require the arch-dependent P2M translation table */
 	if (!xendomain_is_dom0())
 		update_p2m_frame_list_list();
+#endif
 }
 
+#ifdef XENPV
 /*
  * Generate the p2m_frame_list_list table,
  * needed for guest save/restore
@@ -532,3 +540,4 @@ update_p2m_frame_list_list(void)
 HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
 
 }
+#endif /* XENPV */



CVS commit: src/sys/arch/xen

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 07:58:26 UTC 2019

Modified Files:
src/sys/arch/xen/include: pci_machdep.h
src/sys/arch/xen/x86: hypervisor_machdep.c

Log Message:
conditionally include XENPV specific code.

This explicitly excludes PV only functionality that would be wrong to
attempt to use in other modes, for eg: p2m table management.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/include/pci_machdep.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/x86/hypervisor_machdep.c

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



CVS commit: src/sys/arch/x86/x86

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 03:13:50 UTC 2019

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Fix typo: Parameters are seperated by ','.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/x86/x86/intr.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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.141 src/sys/arch/x86/x86/intr.c:1.142
--- src/sys/arch/x86/x86/intr.c:1.141	Tue Dec 25 06:50:12 2018
+++ src/sys/arch/x86/x86/intr.c	Tue Feb 12 03:13:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.141 2018/12/25 06:50:12 cherry Exp $	*/
+/*	$NetBSD: intr.c,v 1.142 2019/02/12 03:13:50 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.141 2018/12/25 06:50:12 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.142 2019/02/12 03:13:50 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1131,7 +1131,7 @@ intr_string(intr_handle_t ih, char *buf,
 		snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
 
 #elif NLAPIC > 0
-	snprintf(buf, len, "irq %d" APIC_IRQ_LEGACY_IRQ(ih));
+	snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
 #else
 	snprintf(buf, len, "irq %d", (int) ih);
 #endif



CVS commit: src/sys/arch/x86/x86

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 03:13:50 UTC 2019

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Fix typo: Parameters are seperated by ','.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/x86/x86/intr.c

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



CVS commit: src/sys/arch/x86/x86

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb 11 18:50:15 UTC 2019

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Detect and report running in a XEN hvm container.

This allows the lapic code to apply its x2apic probe logic while
running in a XEN hvm container.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.87 src/sys/arch/x86/x86/identcpu.c:1.88
--- src/sys/arch/x86/x86/identcpu.c:1.87	Mon Feb 11 14:59:33 2019
+++ src/sys/arch/x86/x86/identcpu.c	Mon Feb 11 18:50:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.87 2019/02/11 14:59:33 cherry Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.88 2019/02/11 18:50:15 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.87 2019/02/11 14:59:33 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.88 2019/02/11 18:50:15 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -1125,6 +1125,8 @@ identify_hypervisor(void)
 vm_guest = VM_GUEST_HV;
 			else if (memcmp(hv_vendor, "KVMKVMKVM\0\0\0", 12) == 0)
 vm_guest = VM_GUEST_KVM;
+			else if (memcmp(hv_vendor, "XenVMMXenVMM", 12) == 0)
+vm_guest = VM_GUEST_XEN;
 			/* FreeBSD bhyve: "bhyve bhyve " */
 			/* OpenBSD vmm:   "OpenBSDVMM58" */
 			/* NetBSD nvmm:   "___ NVMM ___" */



CVS commit: src/sys/arch/x86/x86

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb 11 18:50:15 UTC 2019

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Detect and report running in a XEN hvm container.

This allows the lapic code to apply its x2apic probe logic while
running in a XEN hvm container.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/x86/x86/identcpu.c

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



CVS commit: src/sys/arch/i386/i386

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb 11 17:28:52 UTC 2019

Modified Files:
src/sys/arch/i386/i386: i386_trap.S

Log Message:
Remove redundant conditional IDT_VEC() entries.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/i386/i386_trap.S

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/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.17 src/sys/arch/i386/i386/i386_trap.S:1.18
--- src/sys/arch/i386/i386/i386_trap.S:1.17	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/i386_trap.S	Mon Feb 11 17:28:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.17 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.18 2019/02/11 17:28:52 cherry Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.17 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.18 2019/02/11 17:28:52 cherry Exp $");
 #endif
 
 /*
@@ -345,13 +345,8 @@ IDTVEC_END(trap17)
 IDTVEC_END(trap16)
 IDTVEC_END(trap15)
 IDTVEC_END(trap14)
-#ifndef XENPV
 IDTVEC_END(trap13)
 IDTVEC_END(trap12)
-#else
-IDTVEC_END(trap13)
-IDTVEC_END(trap12)
-#endif
 IDTVEC_END(trap11)
 
 IDTVEC(exceptions)



CVS commit: src/sys/arch/i386/i386

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb 11 17:28:52 UTC 2019

Modified Files:
src/sys/arch/i386/i386: i386_trap.S

Log Message:
Remove redundant conditional IDT_VEC() entries.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/i386/i386_trap.S

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



CVS commit: src/sys/arch

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb 11 14:59:33 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S cpufunc.S db_interface.c gdt.c
genassym.cf lock_stubs.S locore.S machdep.c process_machdep.c spl.S
trap.c vector.S
src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU
src/sys/arch/amd64/include: cpu.h frame.h frameasm.h param.h pmap.h
profile.h segments.h types.h vmparam.h
src/sys/arch/i386/conf: XEN3PAE_DOM0 XEN3PAE_DOMU
src/sys/arch/i386/i386: cpufunc.S db_interface.c gdt.c genassym.cf
i386_trap.S lock_stubs.S locore.S machdep.c spl.S trap.c vector.S
src/sys/arch/i386/include: cpu.h frame.h frameasm.h pmap.h segments.h
vmparam.h
src/sys/arch/x86/acpi: acpi_machdep.c
src/sys/arch/x86/include: cpu.h cpuvar.h intr.h intrdefs.h pmap.h
specialreg.h
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/x86/pci: pci_intr_machdep.c pci_machdep.c pcib.c
src/sys/arch/x86/x86: bios32.c bus_space.c cpu_ucode.c fpu.c i8259.c
identcpu.c idt.c pmap.c sys_machdep.c vm_machdep.c x86_machdep.c
x86_tlb.c

Log Message:
We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/amd64/amd64/amd64_trap.S \
src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.324 -r1.325 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/amd64/process_machdep.c \
src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amd64/include/pmap.h \
src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/include/profile.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/include/segments.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/amd64/include/vmparam.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/conf/XEN3PAE_DOMU
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.814 -r1.815 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.297 -r1.298 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.180 -r1.181 src/sys/arch/i386/include/cpu.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/i386/include/pmap.h
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/i386/include/vmparam.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/acpi/acpi_machdep.c
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/include/cpuvar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/pcib.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/bios32.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/x86/bus_space.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.49 -r1.50 

CVS commit: src/sys/arch

2019-02-11 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb 11 14:59:33 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S cpufunc.S db_interface.c gdt.c
genassym.cf lock_stubs.S locore.S machdep.c process_machdep.c spl.S
trap.c vector.S
src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU
src/sys/arch/amd64/include: cpu.h frame.h frameasm.h param.h pmap.h
profile.h segments.h types.h vmparam.h
src/sys/arch/i386/conf: XEN3PAE_DOM0 XEN3PAE_DOMU
src/sys/arch/i386/i386: cpufunc.S db_interface.c gdt.c genassym.cf
i386_trap.S lock_stubs.S locore.S machdep.c spl.S trap.c vector.S
src/sys/arch/i386/include: cpu.h frame.h frameasm.h pmap.h segments.h
vmparam.h
src/sys/arch/x86/acpi: acpi_machdep.c
src/sys/arch/x86/include: cpu.h cpuvar.h intr.h intrdefs.h pmap.h
specialreg.h
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/x86/pci: pci_intr_machdep.c pci_machdep.c pcib.c
src/sys/arch/x86/x86: bios32.c bus_space.c cpu_ucode.c fpu.c i8259.c
identcpu.c idt.c pmap.c sys_machdep.c vm_machdep.c x86_machdep.c
x86_tlb.c

Log Message:
We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/amd64/amd64/amd64_trap.S \
src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.324 -r1.325 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/amd64/process_machdep.c \
src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amd64/include/pmap.h \
src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/include/profile.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/include/segments.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/amd64/include/vmparam.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/conf/XEN3PAE_DOMU
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.814 -r1.815 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.297 -r1.298 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.180 -r1.181 src/sys/arch/i386/include/cpu.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/i386/include/pmap.h
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/i386/include/vmparam.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/acpi/acpi_machdep.c
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/include/cpuvar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/pcib.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/bios32.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/x86/bus_space.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.49 -r1.50 

CVS commit: src/sys/arch/xen/include

2019-02-10 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Feb 10 11:10:34 UTC 2019

Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h

Log Message:
Catchup hypercall interfaces for HYPERVISOR_sched_op which use
arguments to __XEN_INTERFACE_VERSION__ >= 0x00030201

We've been using the sched_op_compat API with sched_op arguments.

fixes PR port-xen/53965


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/include/i386/hypercalls.h

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/include/amd64/hypercalls.h
diff -u src/sys/arch/xen/include/amd64/hypercalls.h:1.11 src/sys/arch/xen/include/amd64/hypercalls.h:1.12
--- src/sys/arch/xen/include/amd64/hypercalls.h:1.11	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/include/amd64/hypercalls.h	Sun Feb 10 11:10:34 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hypercalls.h,v 1.11 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: hypercalls.h,v 1.12 2019/02/10 11:10:34 cherry Exp $ */
 /**
  * hypercall.h
  * 
@@ -320,8 +320,18 @@ static inline int
 HYPERVISOR_suspend(
 	unsigned long srec)
 {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+	struct sched_shutdown shutdown_reason = {
+		.reason = SHUTDOWN_suspend,
+	};
+
+	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
+	_reason, srec);
+#else
 	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
  SHUTDOWN_suspend, srec);
+#endif
 }
 
 static inline long
@@ -342,21 +352,51 @@ static inline long
 HYPERVISOR_shutdown(
 	void)
 {
-	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+	struct sched_shutdown shutdown_reason = {
+		.reason = SHUTDOWN_poweroff,
+	};
+
+	return _hypercall2(int, sched_op, SCHEDOP_shutdown,
+	_reason);
+#else
+-	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
+#endif
 }
 
 static inline long
 HYPERVISOR_crash(
 	void)
 {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+	struct sched_shutdown shutdown_reason = {
+		.reason = SHUTDOWN_crash,
+	};
+
+	return _hypercall2(int, sched_op, SCHEDOP_shutdown,
+	_reason);
+#else
 	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_crash);
+#endif
 }
 
 static inline long
 HYPERVISOR_reboot(
 	void)
 {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+	struct sched_shutdown shutdown_reason = {
+		.reason = SHUTDOWN_reboot,
+	};
+
+	return _hypercall2(int, sched_op, SCHEDOP_shutdown,
+	_reason);
+#else
 	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_reboot);
+#endif
 }
 
 static inline int

Index: src/sys/arch/xen/include/i386/hypercalls.h
diff -u src/sys/arch/xen/include/i386/hypercalls.h:1.18 src/sys/arch/xen/include/i386/hypercalls.h:1.19
--- src/sys/arch/xen/include/i386/hypercalls.h:1.18	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/include/i386/hypercalls.h	Sun Feb 10 11:10:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypercalls.h,v 1.18 2019/02/02 12:32:55 cherry Exp $	*/
+/*	$NetBSD: hypercalls.h,v 1.19 2019/02/10 11:10:34 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -368,9 +368,21 @@ HYPERVISOR_shutdown(void)
 long ret;
 unsigned long ign1, ign2;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+struct sched_shutdown shutdown_reason = {
+	.reason = SHUTDOWN_poweroff
+};
+
 _hypercall(__HYPERVISOR_sched_op,
-	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_poweroff)),
+	_harg("1" (SCHEDOP_shutdown), "2"  (_reason)),
 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#else
+ _hypercall(__HYPERVISOR_sched_op,
+	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_poweroff)),
+ 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+
+#endif	
 
 return ret;
 }
@@ -381,9 +393,20 @@ HYPERVISOR_crash(void)
 long ret;
 unsigned long ign1, ign2;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+struct sched_shutdown shutdown_reason = {
+	.reason = SHUTDOWN_crash
+};
+
+_hypercall(__HYPERVISOR_sched_op,
+	_harg("1" (SCHEDOP_shutdown), "2"  (_reason)),
+	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#else
 _hypercall(__HYPERVISOR_sched_op,
 	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_crash)),
 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#endif
 
 return ret;
 }
@@ -394,9 +417,20 @@ HYPERVISOR_reboot(void)
 long ret;
 unsigned long ign1, ign2;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+struct sched_shutdown shutdown_reason = {
+	.reason = SHUTDOWN_reboot
+};
+
+_hypercall(__HYPERVISOR_sched_op,
+	_harg("1" (SCHEDOP_shutdown), "2"  (_reason)),
+	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#else
 _hypercall(__HYPERVISOR_sched_op,
 	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_reboot)),
 	_harg("=a" 

CVS commit: src/sys/arch/xen/include

2019-02-10 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Feb 10 11:10:34 UTC 2019

Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h

Log Message:
Catchup hypercall interfaces for HYPERVISOR_sched_op which use
arguments to __XEN_INTERFACE_VERSION__ >= 0x00030201

We've been using the sched_op_compat API with sched_op arguments.

fixes PR port-xen/53965


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/include/i386/hypercalls.h

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



CVS commit: src/sys/arch/xen/xen

2019-02-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb  6 12:24:46 UTC 2019

Modified Files:
src/sys/arch/xen/xen: xengnt.c

Log Message:
Add the codepath for grant table updates for VMs with an auto
translated physmap.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/xen/xengnt.c

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



CVS commit: src/sys/arch/xen/xen

2019-02-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb  6 12:24:46 UTC 2019

Modified Files:
src/sys/arch/xen/xen: xengnt.c

Log Message:
Add the codepath for grant table updates for VMs with an auto
translated physmap.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/xen/xengnt.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/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.25 src/sys/arch/xen/xen/xengnt.c:1.26
--- src/sys/arch/xen/xen/xengnt.c:1.25	Wed Oct 24 13:07:46 2012
+++ src/sys/arch/xen/xen/xengnt.c	Wed Feb  6 12:24:46 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: xengnt.c,v 1.25 2012/10/24 13:07:46 royger Exp $  */
+/*  $NetBSD: xengnt.c,v 1.26 2019/02/06 12:24:46 cherry Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.25 2012/10/24 13:07:46 royger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.26 2019/02/06 12:24:46 cherry Exp $");
 
 #include 
 #include 
@@ -174,22 +174,44 @@ xengnt_more_entries(void)
 	if (pages == NULL)
 		return ENOMEM;
 
-	setup.dom = DOMID_SELF;
-	setup.nr_frames = nframes_new;
-	set_xen_guest_handle(setup.frame_list, pages);
-
-	/*
-	 * setup the grant table, made of nframes_new frames
-	 * and return the list of their virtual addresses
-	 * in 'pages'
-	 */
-	if (HYPERVISOR_grant_table_op(GNTTABOP_setup_table, , 1) != 0)
-		panic("%s: setup table failed", __func__);
-	if (setup.status != GNTST_okay) {
-		aprint_error("%s: setup table returned %d\n",
-		__func__, setup.status);
-		free(pages, M_DEVBUF);
-		return ENOMEM;
+	if (xen_feature(XENFEAT_auto_translated_physmap)) {
+		/*
+		 * Note: Although we allocate space for the entire
+		 * table, in this mode we only update one entry at a
+		 * time.
+		 */
+		struct vm_page *pg;
+		struct xen_add_to_physmap xmap;
+
+		pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE|UVM_PGA_ZERO);
+		pages[gnt_nr_grant_frames] = atop(uvm_vm_page_to_phys(pg));
+
+		xmap.domid = DOMID_SELF;
+		xmap.space = XENMAPSPACE_grant_table;
+		xmap.idx = gnt_nr_grant_frames;
+		xmap.gpfn = pages[gnt_nr_grant_frames];
+
+		if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, ) < 0)
+			panic("%s: Unable to register HYPERVISOR_shared_info\n", __func__);
+
+	} else {
+		setup.dom = DOMID_SELF;
+		setup.nr_frames = nframes_new;
+		set_xen_guest_handle(setup.frame_list, pages);
+
+		/*
+		 * setup the grant table, made of nframes_new frames
+		 * and return the list of their virtual addresses
+		 * in 'pages'
+		 */
+		if (HYPERVISOR_grant_table_op(GNTTABOP_setup_table, , 1) != 0)
+			panic("%s: setup table failed", __func__);
+		if (setup.status != GNTST_okay) {
+			aprint_error("%s: setup table returned %d\n",
+			__func__, setup.status);
+			free(pages, M_DEVBUF);
+			return ENOMEM;
+		}
 	}
 
 	DPRINTF(("xengnt_more_entries: map 0x%lx -> %p\n",



CVS commit: src/sys/arch

2019-02-04 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb  4 18:14:54 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: std.xen
src/sys/arch/xen/conf: std.xen
src/sys/arch/xen/include: hypervisor.h xen.h
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Bump up XEN source API compatibility to 0x00030208 from 0x00030201,

but maintain backwards source API compilation compatibility.

ie; sources with config(5)
options __XEN_INTERFACE_VERSION__=0x00030201 # Xen 3.1 interface

should compile and run without problems.

Not that API version 0x00030201 is the lowest version we support now.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/conf/std.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/conf/std.xen
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/x86/x86_xpmap.c

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



CVS commit: src/sys/arch

2019-02-04 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Feb  4 18:14:54 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: std.xen
src/sys/arch/xen/conf: std.xen
src/sys/arch/xen/include: hypervisor.h xen.h
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Bump up XEN source API compatibility to 0x00030208 from 0x00030201,

but maintain backwards source API compilation compatibility.

ie; sources with config(5)
options __XEN_INTERFACE_VERSION__=0x00030201 # Xen 3.1 interface

should compile and run without problems.

Not that API version 0x00030201 is the lowest version we support now.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/conf/std.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/conf/std.xen
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/x86/x86_xpmap.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/amd64/conf/std.xen
diff -u src/sys/arch/amd64/conf/std.xen:1.10 src/sys/arch/amd64/conf/std.xen:1.11
--- src/sys/arch/amd64/conf/std.xen:1.10	Sat Feb  2 12:32:54 2019
+++ src/sys/arch/amd64/conf/std.xen	Mon Feb  4 18:14:53 2019
@@ -1,4 +1,4 @@
-# $NetBSD: std.xen,v 1.10 2019/02/02 12:32:54 cherry Exp $
+# $NetBSD: std.xen,v 1.11 2019/02/04 18:14:53 cherry Exp $
 # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp 
 #
 # standard, required NetBSD/i386 'options'
@@ -7,7 +7,7 @@ machine xen amd64
 include 	"conf/std"	# MI standard options
 
 options 	XEN	#Xen support
-options 	__XEN_INTERFACE_VERSION__=0x00030201 # Xen 3.1 interface
+options 	__XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface
 #options 	__XEN_INTERFACE_VERSION__=0x00030205 # Xen 3.1 interface
 
 options 	CPU_IN_CKSUM

Index: src/sys/arch/xen/conf/std.xen
diff -u src/sys/arch/xen/conf/std.xen:1.9 src/sys/arch/xen/conf/std.xen:1.10
--- src/sys/arch/xen/conf/std.xen:1.9	Sat Feb  2 12:32:54 2019
+++ src/sys/arch/xen/conf/std.xen	Mon Feb  4 18:14:53 2019
@@ -1,4 +1,4 @@
-# $NetBSD: std.xen,v 1.9 2019/02/02 12:32:54 cherry Exp $
+# $NetBSD: std.xen,v 1.10 2019/02/04 18:14:53 cherry Exp $
 # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp 
 #
 # standard, required NetBSD/i386 'options'
@@ -6,7 +6,7 @@
 machine xen i386
 include		"conf/std"	# MI standard options
 
-options 	__XEN_INTERFACE_VERSION__=0x00030201 # Xen 3.1 interface
+options 	__XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface
 
 options 	EXEC_AOUT	# exec a.out binaries
 options 	EXEC_ELF32	# exec ELF binaries

Index: src/sys/arch/xen/include/hypervisor.h
diff -u src/sys/arch/xen/include/hypervisor.h:1.48 src/sys/arch/xen/include/hypervisor.h:1.49
--- src/sys/arch/xen/include/hypervisor.h:1.48	Sat Feb  2 14:50:15 2019
+++ src/sys/arch/xen/include/hypervisor.h	Mon Feb  4 18:14:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor.h,v 1.48 2019/02/02 14:50:15 cherry Exp $	*/
+/*	$NetBSD: hypervisor.h,v 1.49 2019/02/04 18:14:53 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -94,6 +94,7 @@ struct xen_npx_attach_args {
 #include 
 #include 
 
+#if __XEN_INTERFACE_VERSION < 0x00030208
 /* Undo namespace damage from xen/include/public/io/ring.h
  * The proper fix is to get upstream to stop assuming that all OSs use
  * mb(), rmb(), wmb().
@@ -105,6 +106,7 @@ struct xen_npx_attach_args {
 #define xen_mb()  membar_sync()
 #define xen_rmb() membar_producer()
 #define xen_wmb() membar_consumer()
+#endif /* __XEN_INTERFACE_VERSION */
 
 #include 
 

Index: src/sys/arch/xen/include/xen.h
diff -u src/sys/arch/xen/include/xen.h:1.42 src/sys/arch/xen/include/xen.h:1.43
--- src/sys/arch/xen/include/xen.h:1.42	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/include/xen.h	Mon Feb  4 18:14:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen.h,v 1.42 2019/02/02 12:32:55 cherry Exp $	*/
+/*	$NetBSD: xen.h,v 1.43 2019/02/04 18:14:53 cherry Exp $	*/
 
 /*
  *
@@ -122,6 +122,12 @@ void printk(const char *, ...);
 /* Everything below this point is not included by assembler (.S) files. */
 #ifndef _LOCORE
 
+/* Version Specific Glue */
+#if __XEN_INTERFACE_VERSION__ >= 0x00030203
+#define console_mfnconsole.domU.mfn
+#define console_evtchn console.domU.evtchn
+#endif
+
 /* some function prototypes */
 void trap_init(void);
 void xpq_flush_cache(void);

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.81 src/sys/arch/xen/x86/x86_xpmap.c:1.82
--- src/sys/arch/xen/x86/x86_xpmap.c:1.81	Sun Jul 29 08:02:24 2018
+++ src/sys/arch/xen/x86/x86_xpmap.c	Mon Feb  4 18:14:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.81 2018/07/29 08:02:24 maxv Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.82 2019/02/04 18:14:53 cherry Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.81 

CVS commit: src/sys/arch/amd64/conf

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 15:13:54 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0

Log Message:
Re-enable ixg(4) on NetBSD/xen dom0

Namespace conflicts have been resolved.

Note that driver still has an incorrect us of __asm() gnu primitives
via

#if __FreeBSD_version < 80
...
#endif

Since __FreeBSD_version is undefined and thus equates to 0 and thus
satisfies the inequality.

Needs fixing by driver maintainer.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/amd64/conf/XEN3_DOM0

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/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.163 src/sys/arch/amd64/conf/XEN3_DOM0:1.164
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.163	Sat Feb  2 12:05:09 2019
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Feb  2 15:13:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.163 2019/02/02 12:05:09 cherry Exp $
+# $NetBSD: XEN3_DOM0,v 1.164 2019/02/02 15:13:54 cherry Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.163 $"
+#ident		"XEN3_DOM0-$Revision: 1.164 $"
 
 maxusers	32		# estimated number of users
 
@@ -371,7 +371,7 @@ ipw*	at pci? dev ? function ?	# Intel PR
 iwi*	at pci? dev ? function ?	# Intel PRO/Wireless 2200BG
 iwn*	at pci? dev ? function ?	# Intel PRO/Wireless 4965AGN
 iwm*	at pci? dev ? function ?	# Intel Wireless WiFi Link 7xxx
-#ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
+ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
 jme*	at pci? dev ? function ?	# JMicron JMC2[56]0 ethernet
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet



CVS commit: src/sys/arch/amd64/conf

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 15:13:54 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0

Log Message:
Re-enable ixg(4) on NetBSD/xen dom0

Namespace conflicts have been resolved.

Note that driver still has an incorrect us of __asm() gnu primitives
via

#if __FreeBSD_version < 80
...
#endif

Since __FreeBSD_version is undefined and thus equates to 0 and thus
satisfies the inequality.

Needs fixing by driver maintainer.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/amd64/conf/XEN3_DOM0

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



CVS commit: src/sys/arch/xen/include

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 15:09:32 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenring.h

Log Message:
Fix build. A multiline macro needs 'line continuation'.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/include/xenring.h

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/include/xenring.h
diff -u src/sys/arch/xen/include/xenring.h:1.2 src/sys/arch/xen/include/xenring.h:1.3
--- src/sys/arch/xen/include/xenring.h:1.2	Sat Feb  2 14:50:15 2019
+++ src/sys/arch/xen/include/xenring.h	Sat Feb  2 15:09:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: xenring.h,v 1.2 2019/02/02 14:50:15 cherry Exp $ */
+/* $NetBSD: xenring.h,v 1.3 2019/02/02 15:09:32 cherry Exp $ */
 
 /*
  * Glue goop for xbd ring request/response protocol structures.
@@ -10,7 +10,7 @@
 #ifndef _XEN_RING_H
 #define _XEN_RING_H
 
-#if (__XEN_INTERFACE_VERSION__ >= 0x00030201) &&
+#if (__XEN_INTERFACE_VERSION__ >= 0x00030201) && \
 	(__XEN_INTERFACE_VERSION < 0x00030208)
 
 #include 



CVS commit: src/sys/arch/xen/include

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 15:09:32 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenring.h

Log Message:
Fix build. A multiline macro needs 'line continuation'.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/include/xenring.h

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



CVS commit: src/sys/arch/xen/include

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 14:50:15 UTC 2019

Modified Files:
src/sys/arch/xen/include: hypervisor.h xenring.h

Log Message:
Remove mb(), rmb() and wmb() from the kernel namespace.

These are introduced by external/bsd/common/include/asm/barrier.h

The purpose of barrier.h is to bridge the use of linux API calls
within code which uses them, such as drm code. The XEN api implicitly
uses these calls which are linuxisms within io/ring.h

This diff undos the damage.

The correct fix is to modify io/ring.h to not assume that all OSs that
XEN runs on has these functions, and to appropriately conditionally via
#ifdef __NetBSD__/#endif use the appropriate NetBSD functions. These
changes then need to be pushed upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/include/xenring.h

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



CVS commit: src/sys/arch/xen/include

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 14:50:15 UTC 2019

Modified Files:
src/sys/arch/xen/include: hypervisor.h xenring.h

Log Message:
Remove mb(), rmb() and wmb() from the kernel namespace.

These are introduced by external/bsd/common/include/asm/barrier.h

The purpose of barrier.h is to bridge the use of linux API calls
within code which uses them, such as drm code. The XEN api implicitly
uses these calls which are linuxisms within io/ring.h

This diff undos the damage.

The correct fix is to modify io/ring.h to not assume that all OSs that
XEN runs on has these functions, and to appropriately conditionally via
#ifdef __NetBSD__/#endif use the appropriate NetBSD functions. These
changes then need to be pushed upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/include/xenring.h

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/include/hypervisor.h
diff -u src/sys/arch/xen/include/hypervisor.h:1.47 src/sys/arch/xen/include/hypervisor.h:1.48
--- src/sys/arch/xen/include/hypervisor.h:1.47	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/include/hypervisor.h	Sat Feb  2 14:50:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor.h,v 1.47 2019/02/02 12:32:55 cherry Exp $	*/
+/*	$NetBSD: hypervisor.h,v 1.48 2019/02/02 14:50:15 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -80,7 +80,7 @@ struct xen_npx_attach_args {
 #define	s32 int32_t
 #define	s64 int64_t
 
-#include  /* Linux mb() and friends */
+#include 
 
 #include 
 #include 
@@ -94,6 +94,18 @@ struct xen_npx_attach_args {
 #include 
 #include 
 
+/* Undo namespace damage from xen/include/public/io/ring.h
+ * The proper fix is to get upstream to stop assuming that all OSs use
+ * mb(), rmb(), wmb().
+ */
+#undef xen_mb
+#undef xen_rmb
+#undef xen_wmb
+
+#define xen_mb()  membar_sync()
+#define xen_rmb() membar_producer()
+#define xen_wmb() membar_consumer()
+
 #include 
 
 #undef u8

Index: src/sys/arch/xen/include/xenring.h
diff -u src/sys/arch/xen/include/xenring.h:1.1 src/sys/arch/xen/include/xenring.h:1.2
--- src/sys/arch/xen/include/xenring.h:1.1	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/include/xenring.h	Sat Feb  2 14:50:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: xenring.h,v 1.1 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: xenring.h,v 1.2 2019/02/02 14:50:15 cherry Exp $ */
 
 /*
  * Glue goop for xbd ring request/response protocol structures.
@@ -10,10 +10,28 @@
 #ifndef _XEN_RING_H
 #define _XEN_RING_H
 
-#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+#if (__XEN_INTERFACE_VERSION__ >= 0x00030201) &&
+	(__XEN_INTERFACE_VERSION < 0x00030208)
 
 #include 
 
+/*
+ * Undo namespace damage from xen/include/public/io/ring.h
+ * The proper fix is to get upstream to stop assuming that all OSs use
+ * mb(), rmb(), wmb().
+ */
+#undef xen_mb
+#undef xen_rmb
+#undef xen_wmb
+
+#define xen_mb()  membar_sync()
+#define xen_rmb() membar_producer()
+#define xen_wmb() membar_consumer()
+
+/*
+ * Define ring types. These were previously part of the public API.
+ * Not anymore.
+ */
 DEFINE_RING_TYPES(blkif_x86_32, struct blkif_request, struct blkif_response);
 DEFINE_RING_TYPES(blkif_x86_64, struct blkif_request, struct blkif_response);
 
@@ -30,5 +48,6 @@ union blkif_back_ring_proto {
 };
 typedef union blkif_back_ring_proto blkif_back_ring_proto_t;
 
-#endif /* __XEN_INTERFACE_VERSION__ >= 0x00030201 */
+#endif /* __XEN_INTERFACE_VERSION__ */
+
 #endif /* _XEN_RING_H_ */



CVS commit: src/sys/arch/xen/include/xen-public

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 12:40:32 UTC 2019

Removed Files:
src/sys/arch/xen/include/xen-public: COPYING arch-ia64.h arch-x86_32.h
arch-x86_64.h callback.h dom0_ops.h domctl.h elfnote.h elfstructs.h
event_channel.h features.h grant_table.h kexec.h libelf.h
mem_event.h memory.h nmi.h physdev.h platform.h sched.h sysctl.h
tmem.h trace.h vcpu.h version.h xen-compat.h xen.h xencomm.h
xenoprof.h
src/sys/arch/xen/include/xen-public/arch-ia64: debug_op.h sioemu.h
src/sys/arch/xen/include/xen-public/arch-ia64/hvm: memmap.h save.h
src/sys/arch/xen/include/xen-public/arch-x86: cpuid.h xen-mca.h
xen-x86_32.h xen-x86_64.h xen.h
src/sys/arch/xen/include/xen-public/arch-x86/hvm: save.h
src/sys/arch/xen/include/xen-public/hvm: e820.h hvm_info_table.h
hvm_op.h ioreq.h params.h save.h vmx_assist.h
src/sys/arch/xen/include/xen-public/io: blkif.h console.h fbif.h fsif.h
kbdif.h netif.h pciif.h protocols.h ring.h tpmif.h usbif.h
vscsiif.h xenbus.h xs_wire.h
src/sys/arch/xen/include/xen-public/xsm: acm.h acm_ops.h flask_op.h

Log Message:
Remove legacy XEN source public API from source.

These have now been moved to sys/external/mit/xen-include-public/dist


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r0 src/sys/arch/xen/include/xen-public/COPYING \
src/sys/arch/xen/include/xen-public/arch-ia64.h \
src/sys/arch/xen/include/xen-public/callback.h \
src/sys/arch/xen/include/xen-public/elfnote.h \
src/sys/arch/xen/include/xen-public/features.h \
src/sys/arch/xen/include/xen-public/kexec.h \
src/sys/arch/xen/include/xen-public/memory.h \
src/sys/arch/xen/include/xen-public/nmi.h \
src/sys/arch/xen/include/xen-public/platform.h \
src/sys/arch/xen/include/xen-public/sched.h \
src/sys/arch/xen/include/xen-public/vcpu.h \
src/sys/arch/xen/include/xen-public/version.h \
src/sys/arch/xen/include/xen-public/xen-compat.h \
src/sys/arch/xen/include/xen-public/xencomm.h \
src/sys/arch/xen/include/xen-public/xenoprof.h
cvs rdiff -u -r1.5 -r0 src/sys/arch/xen/include/xen-public/arch-x86_32.h \
src/sys/arch/xen/include/xen-public/arch-x86_64.h \
src/sys/arch/xen/include/xen-public/dom0_ops.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/xen/include/xen-public/domctl.h \
src/sys/arch/xen/include/xen-public/elfstructs.h \
src/sys/arch/xen/include/xen-public/sysctl.h
cvs rdiff -u -r1.6 -r0 src/sys/arch/xen/include/xen-public/event_channel.h \
src/sys/arch/xen/include/xen-public/grant_table.h \
src/sys/arch/xen/include/xen-public/trace.h
cvs rdiff -u -r1.1.1.1 -r0 src/sys/arch/xen/include/xen-public/libelf.h \
src/sys/arch/xen/include/xen-public/mem_event.h \
src/sys/arch/xen/include/xen-public/tmem.h
cvs rdiff -u -r1.7 -r0 src/sys/arch/xen/include/xen-public/physdev.h
cvs rdiff -u -r1.11 -r0 src/sys/arch/xen/include/xen-public/xen.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-ia64/debug_op.h \
src/sys/arch/xen/include/xen-public/arch-ia64/sioemu.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-ia64/hvm/memmap.h \
src/sys/arch/xen/include/xen-public/arch-ia64/hvm/save.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-x86/cpuid.h \
src/sys/arch/xen/include/xen-public/arch-x86/xen-x86_64.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/xen/include/xen-public/arch-x86/xen-mca.h \
src/sys/arch/xen/include/xen-public/arch-x86/xen-x86_32.h \
src/sys/arch/xen/include/xen-public/arch-x86/xen.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-x86/hvm/save.h
cvs rdiff -u -r1.1.1.2 -r0 src/sys/arch/xen/include/xen-public/hvm/e820.h \
src/sys/arch/xen/include/xen-public/hvm/hvm_info_table.h \
src/sys/arch/xen/include/xen-public/hvm/hvm_op.h \
src/sys/arch/xen/include/xen-public/hvm/ioreq.h \
src/sys/arch/xen/include/xen-public/hvm/params.h \
src/sys/arch/xen/include/xen-public/hvm/save.h
cvs rdiff -u -r1.1.1.1 -r0 \
src/sys/arch/xen/include/xen-public/hvm/vmx_assist.h
cvs rdiff -u -r1.7 -r0 src/sys/arch/xen/include/xen-public/io/blkif.h
cvs rdiff -u -r1.1.1.2 -r0 src/sys/arch/xen/include/xen-public/io/console.h \
src/sys/arch/xen/include/xen-public/io/fbif.h \
src/sys/arch/xen/include/xen-public/io/fsif.h \
src/sys/arch/xen/include/xen-public/io/kbdif.h \
src/sys/arch/xen/include/xen-public/io/pciif.h \
src/sys/arch/xen/include/xen-public/io/protocols.h \
src/sys/arch/xen/include/xen-public/io/tpmif.h \
src/sys/arch/xen/include/xen-public/io/xenbus.h
cvs rdiff -u -r1.6 -r0 src/sys/arch/xen/include/xen-public/io/netif.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/xen/include/xen-public/io/ring.h
cvs rdiff -u -r1.1.1.1 -r0 src/sys/arch/xen/include/xen-public/io/usbif.h \

CVS commit: src/sys/arch/xen/include/xen-public

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 12:40:32 UTC 2019

Removed Files:
src/sys/arch/xen/include/xen-public: COPYING arch-ia64.h arch-x86_32.h
arch-x86_64.h callback.h dom0_ops.h domctl.h elfnote.h elfstructs.h
event_channel.h features.h grant_table.h kexec.h libelf.h
mem_event.h memory.h nmi.h physdev.h platform.h sched.h sysctl.h
tmem.h trace.h vcpu.h version.h xen-compat.h xen.h xencomm.h
xenoprof.h
src/sys/arch/xen/include/xen-public/arch-ia64: debug_op.h sioemu.h
src/sys/arch/xen/include/xen-public/arch-ia64/hvm: memmap.h save.h
src/sys/arch/xen/include/xen-public/arch-x86: cpuid.h xen-mca.h
xen-x86_32.h xen-x86_64.h xen.h
src/sys/arch/xen/include/xen-public/arch-x86/hvm: save.h
src/sys/arch/xen/include/xen-public/hvm: e820.h hvm_info_table.h
hvm_op.h ioreq.h params.h save.h vmx_assist.h
src/sys/arch/xen/include/xen-public/io: blkif.h console.h fbif.h fsif.h
kbdif.h netif.h pciif.h protocols.h ring.h tpmif.h usbif.h
vscsiif.h xenbus.h xs_wire.h
src/sys/arch/xen/include/xen-public/xsm: acm.h acm_ops.h flask_op.h

Log Message:
Remove legacy XEN source public API from source.

These have now been moved to sys/external/mit/xen-include-public/dist


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r0 src/sys/arch/xen/include/xen-public/COPYING \
src/sys/arch/xen/include/xen-public/arch-ia64.h \
src/sys/arch/xen/include/xen-public/callback.h \
src/sys/arch/xen/include/xen-public/elfnote.h \
src/sys/arch/xen/include/xen-public/features.h \
src/sys/arch/xen/include/xen-public/kexec.h \
src/sys/arch/xen/include/xen-public/memory.h \
src/sys/arch/xen/include/xen-public/nmi.h \
src/sys/arch/xen/include/xen-public/platform.h \
src/sys/arch/xen/include/xen-public/sched.h \
src/sys/arch/xen/include/xen-public/vcpu.h \
src/sys/arch/xen/include/xen-public/version.h \
src/sys/arch/xen/include/xen-public/xen-compat.h \
src/sys/arch/xen/include/xen-public/xencomm.h \
src/sys/arch/xen/include/xen-public/xenoprof.h
cvs rdiff -u -r1.5 -r0 src/sys/arch/xen/include/xen-public/arch-x86_32.h \
src/sys/arch/xen/include/xen-public/arch-x86_64.h \
src/sys/arch/xen/include/xen-public/dom0_ops.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/xen/include/xen-public/domctl.h \
src/sys/arch/xen/include/xen-public/elfstructs.h \
src/sys/arch/xen/include/xen-public/sysctl.h
cvs rdiff -u -r1.6 -r0 src/sys/arch/xen/include/xen-public/event_channel.h \
src/sys/arch/xen/include/xen-public/grant_table.h \
src/sys/arch/xen/include/xen-public/trace.h
cvs rdiff -u -r1.1.1.1 -r0 src/sys/arch/xen/include/xen-public/libelf.h \
src/sys/arch/xen/include/xen-public/mem_event.h \
src/sys/arch/xen/include/xen-public/tmem.h
cvs rdiff -u -r1.7 -r0 src/sys/arch/xen/include/xen-public/physdev.h
cvs rdiff -u -r1.11 -r0 src/sys/arch/xen/include/xen-public/xen.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-ia64/debug_op.h \
src/sys/arch/xen/include/xen-public/arch-ia64/sioemu.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-ia64/hvm/memmap.h \
src/sys/arch/xen/include/xen-public/arch-ia64/hvm/save.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-x86/cpuid.h \
src/sys/arch/xen/include/xen-public/arch-x86/xen-x86_64.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/xen/include/xen-public/arch-x86/xen-mca.h \
src/sys/arch/xen/include/xen-public/arch-x86/xen-x86_32.h \
src/sys/arch/xen/include/xen-public/arch-x86/xen.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/arch/xen/include/xen-public/arch-x86/hvm/save.h
cvs rdiff -u -r1.1.1.2 -r0 src/sys/arch/xen/include/xen-public/hvm/e820.h \
src/sys/arch/xen/include/xen-public/hvm/hvm_info_table.h \
src/sys/arch/xen/include/xen-public/hvm/hvm_op.h \
src/sys/arch/xen/include/xen-public/hvm/ioreq.h \
src/sys/arch/xen/include/xen-public/hvm/params.h \
src/sys/arch/xen/include/xen-public/hvm/save.h
cvs rdiff -u -r1.1.1.1 -r0 \
src/sys/arch/xen/include/xen-public/hvm/vmx_assist.h
cvs rdiff -u -r1.7 -r0 src/sys/arch/xen/include/xen-public/io/blkif.h
cvs rdiff -u -r1.1.1.2 -r0 src/sys/arch/xen/include/xen-public/io/console.h \
src/sys/arch/xen/include/xen-public/io/fbif.h \
src/sys/arch/xen/include/xen-public/io/fsif.h \
src/sys/arch/xen/include/xen-public/io/kbdif.h \
src/sys/arch/xen/include/xen-public/io/pciif.h \
src/sys/arch/xen/include/xen-public/io/protocols.h \
src/sys/arch/xen/include/xen-public/io/tpmif.h \
src/sys/arch/xen/include/xen-public/io/xenbus.h
cvs rdiff -u -r1.6 -r0 src/sys/arch/xen/include/xen-public/io/netif.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/xen/include/xen-public/io/ring.h
cvs rdiff -u -r1.1.1.1 -r0 src/sys/arch/xen/include/xen-public/io/usbif.h \

CVS commit: src/sys/arch

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 12:32:55 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf locore.S
src/sys/arch/amd64/conf: std.xen
src/sys/arch/i386/i386: genassym.cf
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: cpu_ucode.c pmap.c
src/sys/arch/xen/conf: Makefile.xen std.xen
src/sys/arch/xen/include: granttables.h hypervisor.h intr.h xen.h
xenbus.h
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h
src/sys/arch/xen/x86: cpu.c xen_ipi.c xen_pmap.c
src/sys/arch/xen/xen: clock.c hypervisor.c if_xennet_xenbus.c pciback.c
xbd_xenbus.c xbdback_xenbus.c xen_machdep.c xencons.c xpci_xenbus.c
Added Files:
src/sys/arch/xen/include: xenring.h

Log Message:
Switch NetBSD/xen to use XEN api tag RELEASE-4.11.1

The headers for this api are in sys/external/mit/xen-include-public/dist/


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.174 -r1.175 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amd64/conf/std.xen
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.319 -r1.320 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/conf/Makefile.xen
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/conf/std.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/granttables.h
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/xen/include/xenring.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/include/i386/hypercalls.h
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/x86/xen_pmap.c
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/xen/xen_machdep.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/xen/xencons.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/xen/xen/xpci_xenbus.c

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



CVS commit: src/sys/arch

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 12:32:55 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf locore.S
src/sys/arch/amd64/conf: std.xen
src/sys/arch/i386/i386: genassym.cf
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: cpu_ucode.c pmap.c
src/sys/arch/xen/conf: Makefile.xen std.xen
src/sys/arch/xen/include: granttables.h hypervisor.h intr.h xen.h
xenbus.h
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h
src/sys/arch/xen/x86: cpu.c xen_ipi.c xen_pmap.c
src/sys/arch/xen/xen: clock.c hypervisor.c if_xennet_xenbus.c pciback.c
xbd_xenbus.c xbdback_xenbus.c xen_machdep.c xencons.c xpci_xenbus.c
Added Files:
src/sys/arch/xen/include: xenring.h

Log Message:
Switch NetBSD/xen to use XEN api tag RELEASE-4.11.1

The headers for this api are in sys/external/mit/xen-include-public/dist/


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.174 -r1.175 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amd64/conf/std.xen
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.319 -r1.320 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/conf/Makefile.xen
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/conf/std.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/granttables.h
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/xen/include/xenring.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/include/i386/hypercalls.h
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/x86/xen_pmap.c
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/xen/xen_machdep.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/xen/xencons.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/xen/xen/xpci_xenbus.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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.71 src/sys/arch/amd64/amd64/genassym.cf:1.72
--- src/sys/arch/amd64/amd64/genassym.cf:1.71	Tue Dec 25 06:50:11 2018
+++ src/sys/arch/amd64/amd64/genassym.cf	Sat Feb  2 12:32:54 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.71 2018/12/25 06:50:11 cherry Exp $
+#	$NetBSD: genassym.cf,v 1.72 2019/02/02 12:32:54 cherry Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@ include 
 endif
 
 ifdef XEN
-include 
+include 
 endif  
 
 include 

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.174 src/sys/arch/amd64/amd64/locore.S:1.175
--- src/sys/arch/amd64/amd64/locore.S:1.174	Sun Aug 12 15:31:01 2018
+++ src/sys/arch/amd64/amd64/locore.S	Sat Feb  2 12:32:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.174 2018/08/12 15:31:01 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.175 2019/02/02 12:32:54 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -276,8 +276,8 @@
 
 #ifdef XEN
 #define __ASSEMBLY__
-#include 
-#include 
+#include 
+#include 
 #define ELFNOTE(name, type, desctype, descdata...) \
 .pushsection .note.name			;	\
   .align 4;	\

Index: src/sys/arch/amd64/conf/std.xen
diff -u src/sys/arch/amd64/conf/std.xen:1.9 src/sys/arch/amd64/conf/std.xen:1.10
--- src/sys/arch/amd64/conf/std.xen:1.9	Thu Jan 12 05:24:36 2017
+++ src/sys/arch/amd64/conf/std.xen	Sat Feb  2 12:32:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: std.xen,v 1.9 2017/01/12 05:24:36 ryo Exp $
+# $NetBSD: std.xen,v 1.10 2019/02/02 12:32:54 cherry Exp $
 # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp 
 #
 # standard, required NetBSD/i386 'options'
@@ -7,6 +7,7 @@ machine xen amd64
 include 	"conf/std"	# MI standard options
 
 options 	XEN	#Xen support
+options 	__XEN_INTERFACE_VERSION__=0x00030201 # Xen 3.1 interface
 #options 	__XEN_INTERFACE_VERSION__=0x00030205 # Xen 3.1 interface
 
 options 	CPU_IN_CKSUM

Index: src/sys/arch/i386/i386/genassym.cf
diff -u 

CVS commit: src/sys/arch/amd64/conf

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 12:05:09 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0

Log Message:
Summary: Disable ixg(4) until the linuxist mb() API re-definition
within the XEN amd64 dom0 build is resolved.

Detail:
The xen public headers >= 0x00030201 depend on a linuxism - a memory
barrier "API" namely mb(), rmb() and wmb(). These are made accessible
to NetBSD code via the interface
sys/external/bsd/common/include/asm/barrier.h

Currently the ixg(4) driver uses an identical API by defining them
(incorrectly) to inline assembler macro definitions in
sys/dev/pci/ixgbe/ixgbe_osdep.h

This will result in the dom0 builds failing to build due to this
redefinition of the macros. We therefore disable the driver in
NetBSD/amd64 dom0 in order to facilitate smoothly moving the XEN
kernel builds to the new XEN source level API (RELEASE-4.11.1).

The fix for this is trivial, but needs the attention of the driver
maintainer.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/amd64/conf/XEN3_DOM0

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



CVS commit: src/sys/arch/amd64/conf

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 12:05:09 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0

Log Message:
Summary: Disable ixg(4) until the linuxist mb() API re-definition
within the XEN amd64 dom0 build is resolved.

Detail:
The xen public headers >= 0x00030201 depend on a linuxism - a memory
barrier "API" namely mb(), rmb() and wmb(). These are made accessible
to NetBSD code via the interface
sys/external/bsd/common/include/asm/barrier.h

Currently the ixg(4) driver uses an identical API by defining them
(incorrectly) to inline assembler macro definitions in
sys/dev/pci/ixgbe/ixgbe_osdep.h

This will result in the dom0 builds failing to build due to this
redefinition of the macros. We therefore disable the driver in
NetBSD/amd64 dom0 in order to facilitate smoothly moving the XEN
kernel builds to the new XEN source level API (RELEASE-4.11.1).

The fix for this is trivial, but needs the attention of the driver
maintainer.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/amd64/conf/XEN3_DOM0

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/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.162 src/sys/arch/amd64/conf/XEN3_DOM0:1.163
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.162	Tue Dec 25 11:56:14 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Feb  2 12:05:09 2019
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.162 2018/12/25 11:56:14 mlelstv Exp $
+# $NetBSD: XEN3_DOM0,v 1.163 2019/02/02 12:05:09 cherry Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.162 $"
+#ident		"XEN3_DOM0-$Revision: 1.163 $"
 
 maxusers	32		# estimated number of users
 
@@ -371,7 +371,7 @@ ipw*	at pci? dev ? function ?	# Intel PR
 iwi*	at pci? dev ? function ?	# Intel PRO/Wireless 2200BG
 iwn*	at pci? dev ? function ?	# Intel PRO/Wireless 4965AGN
 iwm*	at pci? dev ? function ?	# Intel Wireless WiFi Link 7xxx
-ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
+#ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
 jme*	at pci? dev ? function ?	# JMicron JMC2[56]0 ethernet
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet



CVS import: src/sys/external/mit/xen-include-public/dist/xen/include/public

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 08:03:48 UTC 2019

Update of 
/cvsroot/src/sys/external/mit/xen-include-public/dist/xen/include/public
In directory ivanova.netbsd.org:/tmp/cvs-serv20221

Log Message:
Import Xen public headers version 4.11.1

Release tag: RELEASE-4-11-1

git log of the freeze is as follows:

commit 96cbd0893f783997caaf117e897d5fa8f2dc7b5f
Author: Jan Beulich 
Date:   Thu Nov 29 15:04:11 2018 +0100

update Xen version to 4.11.1


Status:

Vendor Tag: RELEASE-4-11-1
Release Tags:   xen-4-11-1

N src/sys/external/mit/xen-include-public/dist/xen/include/public/COPYING
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-arm.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86_32.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86_64.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/callback.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/dom0_ops.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/domctl.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/elfnote.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/features.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/errno.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/event_channel.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/kexec.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/grant_table.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/nmi.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/physdev.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/trace.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/pmu.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/sched.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/sysctl.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/tmem.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/vcpu.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/version.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/vm_event.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xen-compat.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xencomm.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xenoprof.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-arm/smccc.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-arm/hvm/save.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/cpufeatureset.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/cpuid.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/pmu.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen-mca.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen-x86_32.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen-x86_64.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/hvm/save.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/hvm/start_info.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/dm_op.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/e820.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_info_table.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_op.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_vcpu.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_xs_strings.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/ioreq.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/params.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/pvdrivers.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/save.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/9pfs.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/console.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/displif.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/fbif.h
N 

CVS import: src/sys/external/mit/xen-include-public/dist/xen/include/public

2019-02-02 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Feb  2 08:03:48 UTC 2019

Update of 
/cvsroot/src/sys/external/mit/xen-include-public/dist/xen/include/public
In directory ivanova.netbsd.org:/tmp/cvs-serv20221

Log Message:
Import Xen public headers version 4.11.1

Release tag: RELEASE-4-11-1

git log of the freeze is as follows:

commit 96cbd0893f783997caaf117e897d5fa8f2dc7b5f
Author: Jan Beulich 
Date:   Thu Nov 29 15:04:11 2018 +0100

update Xen version to 4.11.1


Status:

Vendor Tag: RELEASE-4-11-1
Release Tags:   xen-4-11-1

N src/sys/external/mit/xen-include-public/dist/xen/include/public/COPYING
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-arm.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86_32.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86_64.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/callback.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/dom0_ops.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/domctl.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/elfnote.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/features.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/errno.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/event_channel.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/kexec.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/grant_table.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/nmi.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/physdev.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/trace.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/pmu.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/sched.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/sysctl.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/tmem.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/vcpu.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/version.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/vm_event.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xen-compat.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xencomm.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/xenoprof.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-arm/smccc.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-arm/hvm/save.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/cpufeatureset.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/cpuid.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/pmu.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen-mca.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen-x86_32.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen-x86_64.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/xen.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/hvm/save.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/arch-x86/hvm/start_info.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/dm_op.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/e820.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_info_table.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_op.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_vcpu.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/hvm_xs_strings.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/ioreq.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/params.h
N 
src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/pvdrivers.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/hvm/save.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/9pfs.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/console.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/displif.h
N src/sys/external/mit/xen-include-public/dist/xen/include/public/io/fbif.h
N 

CVS commit: src/sys/arch/xen/include

2019-01-23 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Jan 24 04:16:16 UTC 2019

Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h

Log Message:
The event_channel_op hypercall uses a newer API since
__XEN_INTERFACE_VERSION__  0x00030202

Since hvm_op only supports event_channel_op via the newer API, we
can't get away with our current event_channel_op_compat shim.

We thus introduce the new API to our internal hypercall C API
interface.

This change should have no effect on the PV kernels, since they will
continue to use the pre 0x00030202 API.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/i386/hypercalls.h

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



CVS commit: src/sys/arch/xen/include

2019-01-23 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Jan 24 04:16:16 UTC 2019

Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h

Log Message:
The event_channel_op hypercall uses a newer API since
__XEN_INTERFACE_VERSION__  0x00030202

Since hvm_op only supports event_channel_op via the newer API, we
can't get away with our current event_channel_op_compat shim.

We thus introduce the new API to our internal hypercall C API
interface.

This change should have no effect on the PV kernels, since they will
continue to use the pre 0x00030202 API.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/i386/hypercalls.h

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/include/amd64/hypercalls.h
diff -u src/sys/arch/xen/include/amd64/hypercalls.h:1.9 src/sys/arch/xen/include/amd64/hypercalls.h:1.10
--- src/sys/arch/xen/include/amd64/hypercalls.h:1.9	Thu Jan 24 04:11:38 2019
+++ src/sys/arch/xen/include/amd64/hypercalls.h	Thu Jan 24 04:16:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hypercalls.h,v 1.9 2019/01/24 04:11:38 cherry Exp $ */
+/* $NetBSD: hypercalls.h,v 1.10 2019/01/24 04:16:16 cherry Exp $ */
 /**
  * hypercall.h
  * 
@@ -242,9 +242,14 @@ HYPERVISOR_update_va_mapping(
 }
 
 static inline int
-HYPERVISOR_event_channel_op(void *op)
+HYPERVISOR_event_channel_op(evtchn_op_t *op)
 {
+	KASSERT(op != NULL);
+#if __XEN_INTERFACE_VERSION__ < 0x00030202
 	return _hypercall1(int, event_channel_op, op);
+#else
+	return _hypercall2(int, event_channel_op, op->cmd, >u);
+#endif
 }
 
 static inline int

Index: src/sys/arch/xen/include/i386/hypercalls.h
diff -u src/sys/arch/xen/include/i386/hypercalls.h:1.16 src/sys/arch/xen/include/i386/hypercalls.h:1.17
--- src/sys/arch/xen/include/i386/hypercalls.h:1.16	Thu Jul 26 17:20:08 2018
+++ src/sys/arch/xen/include/i386/hypercalls.h	Thu Jan 24 04:16:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypercalls.h,v 1.16 2018/07/26 17:20:08 maxv Exp $	*/
+/*	$NetBSD: hypercalls.h,v 1.17 2019/01/24 04:16:16 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -457,14 +457,20 @@ HYPERVISOR_multicall(void *call_list, in
 
 
 static __inline int
-HYPERVISOR_event_channel_op(void *op)
+HYPERVISOR_event_channel_op(evtchn_op_t *op)
 {
 int ret;
 unsigned long ign1;
 
+#if __XEN_INTERFACE_VERSION__ < 0x00030202
 _hypercall(__HYPERVISOR_event_channel_op, _harg("1" (op)),
 	_harg("=a" (ret), "=b" (ign1)));
+#else
+unsigned long ign2;
 
+_hypercall(__HYPERVISOR_event_channel_op, _harg("1" (op->cmd), "2" (>u)),
+	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#endif
 return ret;
 }
 



CVS commit: src/sys/arch/xen/include/amd64

2019-01-23 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Jan 24 04:11:38 UTC 2019

Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h

Log Message:
hvm_op returns a signed value.

The pattern is that a hypercall which returns a value < 0 may imply an
error.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/include/amd64/hypercalls.h

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/include/amd64/hypercalls.h
diff -u src/sys/arch/xen/include/amd64/hypercalls.h:1.8 src/sys/arch/xen/include/amd64/hypercalls.h:1.9
--- src/sys/arch/xen/include/amd64/hypercalls.h:1.8	Wed Dec  7 16:01:39 2011
+++ src/sys/arch/xen/include/amd64/hypercalls.h	Thu Jan 24 04:11:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hypercalls.h,v 1.8 2011/12/07 16:01:39 cegger Exp $ */
+/* $NetBSD: hypercalls.h,v 1.9 2019/01/24 04:11:38 cherry Exp $ */
 /**
  * hypercall.h
  * 
@@ -361,11 +361,11 @@ HYPERVISOR_nmi_op(
 	return _hypercall2(int, nmi_op, op, arg);
 }
 
-static inline unsigned long
+static inline long
 HYPERVISOR_hvm_op(
 int op, void *arg)
 {
-return _hypercall2(unsigned long, hvm_op, op, arg);
+return _hypercall2(long, hvm_op, op, arg);
 }
 
 static inline int



CVS commit: src/sys/arch/xen/include/amd64

2019-01-23 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Jan 24 04:11:38 UTC 2019

Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h

Log Message:
hvm_op returns a signed value.

The pattern is that a hypercall which returns a value < 0 may imply an
error.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/include/amd64/hypercalls.h

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



Re: CVS commit: src/sys/arch/x86/x86

2019-01-06 Thread Cherry G . Mathew
Maxime Villard  writes:

> Can we do something about it now? It's been more than a week, and the issue is
> still there. NVMM still doesn't modload, same for procfs, and GENERIC_KASLR
> doesn't work either.
>
> This needs to be fixed now, and we should not start adding random hacks all
> over the place (like the one below).
>

Sorry for the delay - I've rolled back the changes.

http://mail-index.netbsd.org/source-changes/2019/01/06/msg102113.html

The XEN related ones I will roll back if enough people complain. I'm
meanwhile investigating other options.

Thanks for your patience.
-- 
~cherry


CVS commit: src/sys/arch

2019-01-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Jan  6 14:35:31 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S i386func.S
src/sys/arch/xen/x86: xenfunc.c

Log Message:
Rollback http://mail-index.netbsd.org/source-changes/2018/12/22/msg101629.html

This change breaks module loading due to weak alias being unsupported
in the kernel module linker.

Requested by maxv@ and others as it affects their work.

No immediate decision on a replacement method is available, but other options
suggested include pre-processing, conditional compilation (#ifdef etc) and other
source level methods to avoid linktime decision making.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/i386/i386func.S
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/x86/xenfunc.c

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



CVS commit: src/sys/arch

2019-01-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Jan  6 14:35:31 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S i386func.S
src/sys/arch/xen/x86: xenfunc.c

Log Message:
Rollback http://mail-index.netbsd.org/source-changes/2018/12/22/msg101629.html

This change breaks module loading due to weak alias being unsupported
in the kernel module linker.

Requested by maxv@ and others as it affects their work.

No immediate decision on a replacement method is available, but other options
suggested include pre-processing, conditional compilation (#ifdef etc) and other
source level methods to avoid linktime decision making.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/i386/i386func.S
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/x86/xenfunc.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.34 src/sys/arch/amd64/amd64/cpufunc.S:1.35
--- src/sys/arch/amd64/amd64/cpufunc.S:1.34	Sat Dec 22 21:27:22 2018
+++ src/sys/arch/amd64/amd64/cpufunc.S	Sun Jan  6 14:35:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.34 2018/12/22 21:27:22 cherry Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.35 2019/01/06 14:35:31 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -63,53 +63,18 @@ ENTRY(x86_mfence)
 	ret
 END(x86_mfence)
 
-/*
- * These functions below should always be accessed via the corresponding wrapper
- * function names defined in x86/include/cpufunc.h and exported as WEAK_ALIAS()
- *
- * We use this rather roundabout method so that a runtime wrapper function may
- * be made available for PVHVM, which could override both native and PV aliases
- * and decide which to invoke at run time.
- */
-
-WEAK_ALIAS(invlpg, amd64_invlpg)
-WEAK_ALIAS(lidt, amd64_lidt)
-WEAK_ALIAS(lldt, amd64_lldt)
-WEAK_ALIAS(ltr, amd64_ltr)
-WEAK_ALIAS(lcr0, amd64_lcr0)
-WEAK_ALIAS(rcr0, amd64_rcr0)
-WEAK_ALIAS(rcr2, amd64_rcr2)
-WEAK_ALIAS(lcr2, amd64_lcr2)
-WEAK_ALIAS(rcr3, amd64_rcr3)
-WEAK_ALIAS(lcr3, amd64_lcr3)
-WEAK_ALIAS(tlbflush, amd64_tlbflush)
-WEAK_ALIAS(tlbflushg, amd64_tlbflushg)
-WEAK_ALIAS(rdr0, amd64_rdr0)
-WEAK_ALIAS(ldr0, amd64_ldr0)
-WEAK_ALIAS(rdr1, amd64_rdr1)
-WEAK_ALIAS(ldr1, amd64_ldr1)
-WEAK_ALIAS(rdr2, amd64_rdr2)
-WEAK_ALIAS(ldr2, amd64_ldr2)
-WEAK_ALIAS(rdr3, amd64_rdr3)
-WEAK_ALIAS(ldr3, amd64_ldr3)
-WEAK_ALIAS(rdr6, amd64_rdr6)
-WEAK_ALIAS(ldr6, amd64_ldr6)
-WEAK_ALIAS(rdr7, amd64_rdr7)
-WEAK_ALIAS(ldr7, amd64_ldr7)
-WEAK_ALIAS(wbinvd, amd64_wbinvd)
-
 #ifndef XEN
-ENTRY(amd64_invlpg)
+ENTRY(invlpg)
 	invlpg	(%rdi)
 	ret
-END(amd64_invlpg)
+END(invlpg)
 
-ENTRY(amd64_lidt)
+ENTRY(lidt)
 	lidt	(%rdi)
 	ret
-END(amd64_lidt)
+END(lidt)
 
-ENTRY(amd64_lldt)
+ENTRY(lldt)
 	cmpl	%edi, CPUVAR(CURLDT)
 	jne	1f
 	ret
@@ -117,42 +82,42 @@ ENTRY(amd64_lldt)
 	movl	%edi, CPUVAR(CURLDT)
 	lldt	%di
 	ret
-END(amd64_lldt)
+END(lldt)
 
-ENTRY(amd64_ltr)
+ENTRY(ltr)
 	ltr	%di
 	ret
-END(amd64_ltr)
+END(ltr)
 
-ENTRY(amd64_lcr0)
+ENTRY(lcr0)
 	movq	%rdi, %cr0
 	ret
-END(amd64_lcr0)
+END(lcr0)
 
-ENTRY(amd64_rcr0)
+ENTRY(rcr0)
 	movq	%cr0, %rax
 	ret
-END(amd64_rcr0)
+END(rcr0)
 
-ENTRY(amd64_lcr2)
+ENTRY(lcr2)
 	movq	%rdi, %cr2
 	ret
-END(amd64_lcr2)
+END(lcr2)
 
-ENTRY(amd64_rcr2)
+ENTRY(rcr2)
 	movq	%cr2, %rax
 	ret
-END(amd64_rcr2)
+END(rcr2)
 
-ENTRY(amd64_lcr3)
+ENTRY(lcr3)
 	movq	%rdi, %cr3
 	ret
-END(amd64_lcr3)
+END(lcr3)
 
-ENTRY(amd64_rcr3)
+ENTRY(rcr3)
 	movq	%cr3, %rax
 	ret
-END(amd64_rcr3)
+END(rcr3)
 #endif
 
 ENTRY(lcr4)
@@ -194,7 +159,7 @@ END(rcr8)
  * If PGE is not in use, we reload CR3.
  */
 #ifndef XEN
-ENTRY(amd64_tlbflushg)
+ENTRY(tlbflushg)
 	movq	%cr4, %rax
 	testq	$CR4_PGE, %rax
 	jz	1f
@@ -203,74 +168,74 @@ ENTRY(amd64_tlbflushg)
 	movq	%rdx, %cr4
 	movq	%rax, %cr4
 	ret
-END(amd64_tlbflushg)
+END(tlbflushg)
 
-ENTRY(amd64_tlbflush)
+ENTRY(tlbflush)
 1:
 	movq	%cr3, %rax
 	movq	%rax, %cr3
 	ret
-END(amd64_tlbflush)
+END(tlbflush)
 
-ENTRY(amd64_ldr0)
+ENTRY(ldr0)
 	movq	%rdi, %dr0
 	ret
-END(amd64_ldr0)
+END(ldr0)
 
-ENTRY(amd64_rdr0)
+ENTRY(rdr0)
 	movq	%dr0, %rax
 	ret
-END(amd64_rdr0)
+END(rdr0)
 
-ENTRY(amd64_ldr1)
+ENTRY(ldr1)
 	movq	%rdi, %dr1
 	ret
-END(amd64_ldr1)
+END(ldr1)
 
-ENTRY(amd64_rdr1)
+ENTRY(rdr1)
 	movq	%dr1, %rax
 	ret
-END(amd64_rdr1)
+END(rdr1)
 
-ENTRY(amd64_ldr2)
+ENTRY(ldr2)
 	movq	%rdi, %dr2
 	ret
-END(amd64_ldr2)
+END(ldr2)
 
-ENTRY(amd64_rdr2)
+ENTRY(rdr2)
 	movq	%dr2, %rax
 	ret
-END(amd64_rdr2)
+END(rdr2)
 
-ENTRY(amd64_ldr3)
+ENTRY(ldr3)
 	movq	%rdi, %dr3
 	ret
-END(amd64_ldr3)
+END(ldr3)
 
-ENTRY(amd64_rdr3)
+ENTRY(rdr3)
 	movq	%dr3, %rax
 	ret
-END(amd64_rdr3)
+END(rdr3)
 
-ENTRY(amd64_ldr6)
+ENTRY(ldr6)
 	movq	%rdi, %dr6
 	ret
-END(amd64_ldr6)

Re: CVS commit: src/sys/arch

2018-12-30 Thread Cherry G . Mathew
Christoph Badura  writes:

> On Tue, Dec 25, 2018 at 11:45:42AM +0530, Cherry G.Mathew wrote:
>> Joerg Sonnenberger  writes:
>> > On Sat, Dec 22, 2018 at 09:27:22PM +, Cherry G. Mathew wrote:
>> >> Modified Files:
>> >>   src/sys/arch/amd64/amd64: cpufunc.S
>> >>   src/sys/arch/i386/i386: cpufunc.S i386func.S
>> >>   src/sys/arch/xen/x86: xenfunc.c
>> >> Log Message:
>> >> Introduce a weak alias method of exporting different implementations
>> >> of the same API.
>> > Why? As in: what's the advantage of making them weak.
>> I'd posted separately before this commit explaining the rationale.
>
> It took me a while to check the most obvious places and figure out which
> message it might have been.  A more precise reference would have helped.
>
>> Here's the scenario above:
>> 
>> let's take lcr3(). On native this is a ring3 operation, implemented in
>> assembler. On xen, this is a PV call. Currently there's no need to have
>> both implementations in a single binary, since PV and native binaries
>> are distinct. With PVHVM, we have a situation where at boot time, the
>> native version is required, and after XEN is detected, we can use the
>> XEN version of the call. I've taken the approach of naming the
>> individual functions distinctly, eg: i386_lcr3(), or xen_lcr3(), while
>> and exporting them weakly as the consumed version, ie; lcr3().
>> 
>> What happens is that when the individual binary is compiled, the
>> appropriate weakly exported symbol takes over, and things work as
>> expected. When  the combined binary for PVHVM is required, we write a
>> strongly exported "switch" function, called lcr3() (I haven't committed
>> this yet) which overrides both the weak symbols. It can then do the
>> runtime calls by calling into the appropriate i386_lcr3() or xen_lcr3(),
>> depending on the mode in which it is running.
>
> I don't find this argument for weak aliases convincing.  You plan to
> write the function that makes a runtime decision between the
> implemenation anyway.  You might as well write that function now and avoid
> another bit of hidden magic.
>

The other options have been suggested earlier (function pointers and
hotpatching).

Function pointers require reprototyping every function required (I don't
have an exhaustive list yet). Hotpatching isn't useful in that it will
overwrite the default version, so we'll have to hotpatch twice. Once to
override the default, and then to make a copy so that the default is
available. It's also ugly, so for me this is the least preferable
method.

> You can have multiple versions of that "switch" function and select the
> appropriate one with config(8) logic.  

It's too late for that. Things like lcr3() need to work way before
config(8) is a twinkle in boot(8)s eyes.

> Or you can select with #ifdef.  Somewhere you have to place the logic
> for conditional compilation/linking.  Having that logic concentrated
> in a single place instead of N seems preferable to me.

Yes, it's pretty intense - see x86/mainbus.c:mainbus_attach() for a
sample of what is to come.

-- 
~cherry


Re: Weak x86 aliases

2018-12-28 Thread Cherry G . Mathew
Maxime Villard  writes:

> Le 28/12/2018 à 15:06, Cherry G.Mathew a écrit :
>> Maxime Villard  writes:
>>> Le 28/12/2018 à 14:57, Cherry G.Mathew a écrit :
 Maxime Villard  writes:
>> Introduce a weak alias method of exporting different implementations
>> of the same API.
>
> Please revert or fix this change.

 I'm not sure what the fix is - do you have a suggestion ?
>>>
>>> either re-apply it without using weak symbols, or change the modloader
>>> to accept weak symbols
>>
>> I don't like the imperative in your tone. NVMM is the user of modloader,
>> not PVHVM. So if you feel like your usecase needs fixing, I'd say it's
>> your problem - or don't use modules, but see below.
>
> Wut? Yes my suggestions are either we re-apply the change without using
> weak symbols or we change the modloader to accept weak symbols.
>

Would a __strong_alias() fix this for you ? ie; is aliasing problematic
in itself ?

-- 
~cherry


Re: Weak x86 aliases

2018-12-28 Thread Cherry G . Mathew
John Nemeth  writes:

> On Dec 28, 11:52pm, "Mathew, Cherry G." wrote:
> } On December 28, 2018 9:54:11 PM GMT+05:30, John Nemeth  
> wrote:
> } >On Dec 28,  7:36pm, "Cherry G.Mathew" wrote:
> } >} Maxime Villard  writes:
> } >} > Le 28/12/2018 �� 14:57, Cherry G.Mathew a ��crit :
> } >} >> Maxime Villard  writes:
> } >}  Introduce a weak alias method of exporting different
> } >implementations
> } >}  of the same API.
> } >} >>>
> } >} >>> Please revert or fix this change.
> } >} >>
> } >} >> I'm not sure what the fix is - do you have a suggestion ?
> } >} >
> } >} > either re-apply it without using weak symbols, or change the
> } >modloader
> } >} > to accept weak symbols
> } >} 
> } >} I don't like the imperative in your tone. NVMM is the user of
> } >modloader,
> } >} not PVHVM. So if you feel like your usecase needs fixing, I'd say
> } >it's
> } >} your problem - or don't use modules, but see below.
> } >
> } > I suspect there's a language issue here due to people using
> } >English as a second language.  However, I don't see an imperative
> } >(command) here.  You asked for suggestions on how to fix a problem.
> } >He answered your question with a couple of suggestions.  That's
> } >all.
> } >
> } > Also, I would argue that the kernel uses modloader, not the
> } >module.  In any event, as mentioned, it is your change that broke
> } >things...
> } 
> } Based on Jason's reply I suspect I've broken modules on Xen too.
> } ISTR that you did some work in this area. If you did, can you
> } comment?
>
>  I mostly worked on the infrastructure to build a seperate set
> of modules for xen and xen-pae.  On amd64, Xen modules didn't work
> due to missing modmap, which maxv fixed.  On i386, only simple
> modules worked due to not being able to find symbols.  I really
> don't know a whole lot about linkers and loaders (manipulating
> makefiles is much simpler).
>
>  However, having said that, I suspect that your work with PVHVM
> (and presumably PVH after that) will make the idea of having seperate
> modules for Xen obsolete.  I.e. it appears to me that we're headed
> to a world where a single kernel will work both on raw iron and
> under Xen.
>

I would like to maintain PV as is. It has advantages that the PVHVM
stuff doesn't have.

-- 
~cherry


Re: Weak x86 aliases

2018-12-28 Thread Cherry G . Mathew
Cherry G. Mathew  writes:


[...]

> I think I'll revert these for now, 

PS: I'm in transit and probably not the best time to do this - if you
feel like it's urgent enough, please feel free to rollback. I'll fix
breakage on my end once the dust settles. I'll be in a commitable place
in ~48hrs.

-- 
~cherry


Re: Weak x86 aliases

2018-12-28 Thread Cherry G . Mathew
Maxime Villard  writes:

> Le 28/12/2018 à 14:57, Cherry G.Mathew a écrit :
>> Maxime Villard  writes:
 Introduce a weak alias method of exporting different implementations
 of the same API.
>>>
>>> Please revert or fix this change.
>>
>> I'm not sure what the fix is - do you have a suggestion ?
>
> either re-apply it without using weak symbols, or change the modloader
> to accept weak symbols
>

I don't like the imperative in your tone. NVMM is the user of modloader,
not PVHVM. So if you feel like your usecase needs fixing, I'd say it's
your problem - or don't use modules, but see below.

>>> The kernel modules that use these functions can't be modloaded
>>> anymore, because weak symbols aren't resolved.
>>>
>>> Eg, NVMM can't be modloaded anymore, because it uses rcr0 among others.
>>>
>>
>> I think I'll revert these for now, because PVHVM doesn't/shouldn't use
>> them anyway, but I'd like to know how to fix this properly. modload not
>> working due to __weak_alias() sounds like something we don't do properly
>> in the modload path.
>
> There is a check in kobj_sym_lookup():
>
> 926   case STB_WEAK:
> 927   kobj_error(ko, "weak symbols not supported");
> 928   return EINVAL;
>
> To resolve correctly I guess we need to take the strongest of the
> duplicated symbols.
>

I'll look into this unless someone else beats me to it - but for now I'm
ok for the specific change that breaks things for NVMM to be rolled
back.

(Please see other email about timeframe).


-- 
~cherry


Re: Weak x86 aliases

2018-12-28 Thread Cherry G . Mathew
Maxime Villard  writes:

>> Introduce a weak alias method of exporting different implementations
>> of the same API.
>
> Please revert or fix this change. 

I'm not sure what the fix is - do you have a suggestion ?

> The kernel modules that use these functions can't be modloaded
> anymore, because weak symbols aren't resolved.
>
> Eg, NVMM can't be modloaded anymore, because it uses rcr0 among others.
>

I think I'll revert these for now, because PVHVM doesn't/shouldn't use
them anyway, but I'd like to know how to fix this properly. modload not
working due to __weak_alias() sounds like something we don't do properly
in the modload path.

-- 
~cherry


CVS commit: src/sys/arch

2018-12-26 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Dec 26 11:12:57 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: spl.S
src/sys/arch/i386/i386: spl.S
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Xen can use the native splraise(9) functions.

There is no need for a slower C version.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/x86/xen_intr.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/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.37 src/sys/arch/amd64/amd64/spl.S:1.38
--- src/sys/arch/amd64/amd64/spl.S:1.37	Tue Dec 25 06:50:11 2018
+++ src/sys/arch/amd64/amd64/spl.S	Wed Dec 26 11:12:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.37 2018/12/25 06:50:11 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.38 2018/12/26 11:12:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -78,6 +78,17 @@
 
 	.text
 
+/*
+ * int splraise(int s);
+ */
+ENTRY(splraise)
+	movl	CPUVAR(ILEVEL),%eax
+	cmpl	%edi,%eax
+	cmoval	%eax,%edi
+	movl	%edi,CPUVAR(ILEVEL)
+	ret
+END(splraise)
+
 #ifndef XEN
 /*
  * Xsoftintr()
@@ -202,17 +213,6 @@ IDTVEC(resume_preempt)
 IDTVEC_END(resume_preempt)
 
 /*
- * int splraise(int s);
- */
-ENTRY(splraise)
-	movl	CPUVAR(ILEVEL),%eax
-	cmpl	%edi,%eax
-	cmoval	%eax,%edi
-	movl	%edi,CPUVAR(ILEVEL)
-	ret
-END(splraise)
-
-/*
  * void spllower(int s);
  *
  * Must be the same size as cx8_spllower().  This must use

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.45 src/sys/arch/i386/i386/spl.S:1.46
--- src/sys/arch/i386/i386/spl.S:1.45	Tue Dec 25 09:00:26 2018
+++ src/sys/arch/i386/i386/spl.S	Wed Dec 26 11:12:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.45 2018/12/25 09:00:26 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.46 2018/12/26 11:12:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.45 2018/12/25 09:00:26 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.46 2018/12/26 11:12:57 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -44,7 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.45
 
 	.text
 
-#ifndef XEN
 /*
  * int splraise(int s);
  */
@@ -68,6 +67,8 @@ ENTRY(splraise)
 	ret
 END(splraise)
 
+#ifndef XEN
+
 /*
  * void spllower(int s);
  *

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.12 src/sys/arch/xen/x86/xen_intr.c:1.13
--- src/sys/arch/xen/x86/xen_intr.c:1.12	Tue Dec 25 09:00:26 2018
+++ src/sys/arch/xen/x86/xen_intr.c	Wed Dec 26 11:12:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.12 2018/12/25 09:00:26 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.12 2018/12/25 09:00:26 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $");
 
 #include 
 #include 
@@ -72,22 +72,6 @@ u_long xen_read_psl(void);
 void xen_write_psl(u_long);
 
 /*
- * Add a mask to cpl, and return the old value of cpl.
- */
-int
-splraise(int nlevel)
-{
-	int olevel;
-	struct cpu_info *ci = curcpu();
-
-	olevel = ci->ci_ilevel;
-	if (nlevel > olevel)
-		ci->ci_ilevel = nlevel;
-	__insn_barrier();
-	return (olevel);
-}
-
-/*
  * Restore a value to cpl (unmasking interrupts).  If any unmasked
  * interrupts are pending, call Xspllower() to process them.
  */



CVS commit: src/sys/arch

2018-12-26 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Dec 26 11:12:57 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: spl.S
src/sys/arch/i386/i386: spl.S
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Xen can use the native splraise(9) functions.

There is no need for a slower C version.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/x86/xen_intr.c

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



CVS commit: src/sys/arch/i386/i386

2018-12-25 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Dec 26 06:37:31 UTC 2018

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Missed a file during previous commit completing transition to
separate handler queues for i386.

This should fix the build (hopefully!)

Thanks to Robert Elz for pointing it out.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/i386/i386/locore.S

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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.161 src/sys/arch/i386/i386/locore.S:1.162
--- src/sys/arch/i386/i386/locore.S:1.161	Wed Aug  1 13:35:01 2018
+++ src/sys/arch/i386/i386/locore.S	Wed Dec 26 06:37:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.161 2018/08/01 13:35:01 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.162 2018/12/26 06:37:31 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.161 2018/08/01 13:35:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.162 2018/12/26 06:37:31 cherry Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -1288,12 +1288,12 @@ IDTVEC(syscall)
 	movl	$.Lsyscall_resume, %esi /* address to resume loop at */
 .Lsyscall_resume:
 	movl	%ebx,%eax		/* get cpl */
-	movl	CPUVAR(IUNMASK)(,%eax,4),%eax
-	andl	CPUVAR(IPENDING),%eax	/* any non-masked bits left? */
+	movl	CPUVAR(XUNMASK)(,%eax,4),%eax
+	andl	CPUVAR(XPENDING),%eax	/* any non-masked bits left? */
 	jz	17f
 	bsrl	%eax,%eax
-	btrl	%eax,CPUVAR(IPENDING)
-	movl	CPUVAR(ISOURCES)(,%eax,4),%eax
+	btrl	%eax,CPUVAR(XPENDING)
+	movl	CPUVAR(XSOURCES)(,%eax,4),%eax
 	jmp	*IS_RESUME(%eax)
 17:	movl	%ebx, CPUVAR(ILEVEL)	/* restore cpl  */
 	jmp	.Lsyscall_checkast



CVS commit: src/sys/arch/i386/i386

2018-12-25 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Dec 26 06:37:31 UTC 2018

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Missed a file during previous commit completing transition to
separate handler queues for i386.

This should fix the build (hopefully!)

Thanks to Robert Elz for pointing it out.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/i386/i386/locore.S

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



CVS commit: src/sys/arch

2018-12-25 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec 25 09:00:26 UTC 2018

Modified Files:
src/sys/arch/i386/i386: i386_trap.S spl.S
src/sys/arch/xen/x86: xen_intr.c

Log Message:
fix i386 build - missed sources migration in previous commit.

allow xen_intr.c to build by bringing in static support functions for
-D INTRSTACKSIZE

This should fix the i386 build now.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/x86/xen_intr.c

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



CVS commit: src/sys/arch

2018-12-25 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec 25 09:00:26 UTC 2018

Modified Files:
src/sys/arch/i386/i386: i386_trap.S spl.S
src/sys/arch/xen/x86: xen_intr.c

Log Message:
fix i386 build - missed sources migration in previous commit.

allow xen_intr.c to build by bringing in static support functions for
-D INTRSTACKSIZE

This should fix the i386 build now.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/x86/xen_intr.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/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.15 src/sys/arch/i386/i386/i386_trap.S:1.16
--- src/sys/arch/i386/i386/i386_trap.S:1.15	Sat Jul 14 14:29:40 2018
+++ src/sys/arch/i386/i386/i386_trap.S	Tue Dec 25 09:00:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.15 2018/07/14 14:29:40 maxv Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.16 2018/12/25 09:00:26 cherry Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.15 2018/07/14 14:29:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.16 2018/12/25 09:00:26 cherry Exp $");
 #endif
 
 /*
@@ -447,12 +447,12 @@ _C_LABEL(trapreturn):	.globl	trapreturn
 	movl	$.Lalltraps_resume,%esi /* address to resume loop at */
 .Lalltraps_resume:
 	movl	%ebx,%eax		/* get cpl */
-	movl	CPUVAR(IUNMASK)(,%eax,4),%eax
-	andl	CPUVAR(IPENDING),%eax	/* any non-masked bits left? */
+	movl	CPUVAR(XUNMASK)(,%eax,4),%eax
+	andl	CPUVAR(XPENDING),%eax	/* any non-masked bits left? */
 	jz	7f
 	bsrl	%eax,%eax
-	btrl	%eax,CPUVAR(IPENDING)
-	movl	CPUVAR(ISOURCES)(,%eax,4),%eax
+	btrl	%eax,CPUVAR(XPENDING)
+	movl	CPUVAR(XSOURCES)(,%eax,4),%eax
 	jmp	*IS_RESUME(%eax)
 7:	movl	%ebx,CPUVAR(ILEVEL)	/* restore cpl */
 	jmp	_C_LABEL(trapreturn)

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.44 src/sys/arch/i386/i386/spl.S:1.45
--- src/sys/arch/i386/i386/spl.S:1.44	Tue Dec 25 06:50:11 2018
+++ src/sys/arch/i386/i386/spl.S	Tue Dec 25 09:00:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.44 2018/12/25 06:50:11 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.45 2018/12/25 09:00:26 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.44 2018/12/25 06:50:11 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.45 2018/12/25 09:00:26 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -290,12 +290,12 @@ IDTVEC(doreti)
 2:	/* Check for ASTs on exit to user mode. */
 #if	defined(XEN)
 	movl	%ebx,%eax
-	movl	CPUVAR(IUNMASK)(,%eax,4),%eax
-	andl	CPUVAR(IPENDING),%eax
+	movl	CPUVAR(XUNMASK)(,%eax,4),%eax
+	andl	CPUVAR(XPENDING),%eax
 	jz	3f
 	bsrl	%eax,%eax		/* slow, but not worth optimizing */
-	btrl	%eax,CPUVAR(IPENDING)
-	movl	CPUVAR(ISOURCES)(,%eax, 4),%eax
+	btrl	%eax,CPUVAR(XPENDING)
+	movl	CPUVAR(XSOURCES)(,%eax, 4),%eax
 	jmp	*IS_RESUME(%eax)
 #endif
 3:

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.11 src/sys/arch/xen/x86/xen_intr.c:1.12
--- src/sys/arch/xen/x86/xen_intr.c:1.11	Tue Dec 25 06:50:12 2018
+++ src/sys/arch/xen/x86/xen_intr.c	Tue Dec 25 09:00:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.11 2018/12/25 06:50:12 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.12 2018/12/25 09:00:26 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.11 2018/12/25 06:50:12 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.12 2018/12/25 09:00:26 cherry Exp $");
 
 #include 
 #include 
@@ -40,6 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v
 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -302,6 +304,24 @@ xen_cpu_intr_redistribute(void)
 }
 
 /* MD - called by x86/cpu.c */
+#if defined(INTRSTACKSIZE)
+static inline bool
+redzone_const_or_false(bool x)
+{
+#ifdef DIAGNOSTIC
+	return x;
+#else
+	return false;
+#endif /* !DIAGNOSTIC */
+}
+
+static inline int
+redzone_const_or_zero(int x)
+{
+	return redzone_const_or_false(true) ? x : 0;
+}
+#endif
+
 void
 cpu_intr_init(struct cpu_info *ci)
 {



CVS commit: src/sys/arch

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec 25 06:50:12 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf lock_stubs.S spl.S vector.S
src/sys/arch/i386/i386: genassym.cf spl.S vector.S
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/x86/x86: i8259.c intr.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/x86: hypervisor_machdep.c xen_intr.c
src/sys/arch/xen/xen: clock.c evtchn.c xenevt.c

Log Message:
Excise XEN specific code out of x86/x86/intr.c into xen/x86/xen_intr.c

While at it, separate the source function tracking so that the interrupt
paths are truly independant.

Use weak symbol exporting to provision for future PVHVM co-existence
of both files, but with independant paths. Introduce assembler code
such that in a unified scenario, native interrupts get first priority
in spllower(), followed by XEN event callbacks. IPL management and
semantics are unchanged - native handlers and xen callbacks are
expected to maintain their ipl related semantics.

In summary, after this commit, native and XEN now have completely
unrelated interrupt handling mechanisms, including
intr_establish_xname() and assembler stubs and intr handler
management.

Happy Christmas!


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/x86/i8259.c
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.173 -r1.174 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/xen/xenevt.c

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



CVS commit: src/sys/arch

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec 25 06:50:12 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf lock_stubs.S spl.S vector.S
src/sys/arch/i386/i386: genassym.cf spl.S vector.S
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/x86/x86: i8259.c intr.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/x86: hypervisor_machdep.c xen_intr.c
src/sys/arch/xen/xen: clock.c evtchn.c xenevt.c

Log Message:
Excise XEN specific code out of x86/x86/intr.c into xen/x86/xen_intr.c

While at it, separate the source function tracking so that the interrupt
paths are truly independant.

Use weak symbol exporting to provision for future PVHVM co-existence
of both files, but with independant paths. Introduce assembler code
such that in a unified scenario, native interrupts get first priority
in spllower(), followed by XEN event callbacks. IPL management and
semantics are unchanged - native handlers and xen callbacks are
expected to maintain their ipl related semantics.

In summary, after this commit, native and XEN now have completely
unrelated interrupt handling mechanisms, including
intr_establish_xname() and assembler stubs and intr handler
management.

Happy Christmas!


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/x86/i8259.c
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.173 -r1.174 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/xen/xenevt.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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.70 src/sys/arch/amd64/amd64/genassym.cf:1.71
--- src/sys/arch/amd64/amd64/genassym.cf:1.70	Sun Aug 12 15:31:01 2018
+++ src/sys/arch/amd64/amd64/genassym.cf	Tue Dec 25 06:50:11 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.70 2018/08/12 15:31:01 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.71 2018/12/25 06:50:11 cherry Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -248,12 +248,14 @@ define	CPU_INFO_CURPRIORITY	offsetof(str
 define	CPU_INFO_FPCURLWP	offsetof(struct cpu_info, ci_fpcurlwp)
 
 define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
+define	CPU_INFO_ILEVEL		offsetof(struct cpu_info, ci_ilevel)
+define	CPU_INFO_IDEPTH		offsetof(struct cpu_info, ci_idepth)
+if !defined(XEN)
 define	CPU_INFO_IPENDING	offsetof(struct cpu_info, ci_ipending)
 define	CPU_INFO_IMASK		offsetof(struct cpu_info, ci_imask)
 define	CPU_INFO_IUNMASK	offsetof(struct cpu_info, ci_iunmask)
-define	CPU_INFO_ILEVEL		offsetof(struct cpu_info, ci_ilevel)
-define	CPU_INFO_IDEPTH		offsetof(struct cpu_info, ci_idepth)
 define	CPU_INFO_ISOURCES	offsetof(struct cpu_info, ci_isources)
+endif
 define	CPU_INFO_MTX_COUNT	offsetof(struct cpu_info, ci_mtx_count)
 define	CPU_INFO_MTX_OLDSPL	offsetof(struct cpu_info, ci_mtx_oldspl)
 define  CPU_INFO_CPUID		offsetof(struct cpu_info, ci_cpuid)
@@ -352,6 +354,10 @@ define	BST_TYPE		offsetof(struct bus_spa
 
 ifdef XEN
 define CPU_INFO_VCPU		offsetof(struct cpu_info, ci_vcpu)
+define CPU_INFO_XPENDING	offsetof(struct cpu_info, ci_xpending)
+define CPU_INFO_XMASK		offsetof(struct cpu_info, ci_xmask)
+define CPU_INFO_XUNMASK		offsetof(struct cpu_info, ci_xunmask)
+define CPU_INFO_XSOURCES	offsetof(struct cpu_info, ci_xsources)
 define EVTCHN_UPCALL_MASK	offsetof(struct vcpu_info, evtchn_upcall_mask)
 define XEN_PT_BASE		offsetof(struct start_info, pt_base)
 define XEN_NR_PT_FRAMES		offsetof(struct start_info, nr_pt_frames)

Index: src/sys/arch/amd64/amd64/lock_stubs.S
diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.29 src/sys/arch/amd64/amd64/lock_stubs.S:1.30
--- src/sys/arch/amd64/amd64/lock_stubs.S:1.29	Sat Jul 14 14:29:40 2018
+++ src/sys/arch/amd64/amd64/lock_stubs.S	Tue Dec 25 06:50:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.29 2018/07/14 14:29:40 maxv Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.30 2018/12/25 

Re: CVS commit: src/sys/arch

2018-12-24 Thread Cherry G . Mathew
Joerg Sonnenberger  writes:

> On Sat, Dec 22, 2018 at 09:27:22PM +0000, Cherry G. Mathew wrote:
>> Module Name: src
>> Committed By:cherry
>> Date:Sat Dec 22 21:27:22 UTC 2018
>> 
>> Modified Files:
>>  src/sys/arch/amd64/amd64: cpufunc.S
>>  src/sys/arch/i386/i386: cpufunc.S i386func.S
>>  src/sys/arch/xen/x86: xenfunc.c
>> 
>> Log Message:
>> Introduce a weak alias method of exporting different implementations
>> of the same API.
>
> Why? As in: what's the advantage of making them weak.
>

I'd posted separately before this commit explaining the rationale.

Here's the scenario above:

let's take lcr3(). On native this is a ring3 operation, implemented in
assembler. On xen, this is a PV call. Currently there's no need to have
both implementations in a single binary, since PV and native binaries
are distinct. With PVHVM, we have a situation where at boot time, the
native version is required, and after XEN is detected, we can use the
XEN version of the call. I've taken the approach of naming the
individual functions distinctly, eg: i386_lcr3(), or xen_lcr3(), while
and exporting them weakly as the consumed version, ie; lcr3().

What happens is that when the individual binary is compiled, the
appropriate weakly exported symbol takes over, and things work as
expected. When  the combined binary for PVHVM is required, we write a
strongly exported "switch" function, called lcr3() (I haven't committed
this yet) which overrides both the weak symbols. It can then do the
runtime calls by calling into the appropriate i386_lcr3() or xen_lcr3(),
depending on the mode in which it is running.

In the specific case above however, I realised that most of the
functions I converted are not appropriate for use in PVHVM as the native
versions are likely to be more efficient. I may roll them back once
things stabilise.

I hope this was a useful explanation.
-- 
~cherry


CVS commit: src/sys/arch/x86/x86

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Dec 24 22:05:45 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c mp.c x86_machdep.c

Log Message:
Towards bifurcating XEN and native interrupt related functions,
this is a preliminary cleanup sweep.

Move functions related to MP bus probe and scanning to x86/mp.c

Move generic platform pic search function to x86/x86_machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/mp.c
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x86/x86/x86_machdep.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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.139 src/sys/arch/x86/x86/intr.c:1.140
--- src/sys/arch/x86/x86/intr.c:1.139	Mon Dec 24 14:55:41 2018
+++ src/sys/arch/x86/x86/intr.c	Mon Dec 24 22:05:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.139 2018/12/24 14:55:41 cherry Exp $	*/
+/*	$NetBSD: intr.c,v 1.140 2018/12/24 22:05:45 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.139 2018/12/24 14:55:41 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.140 2018/12/24 22:05:45 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -220,13 +220,6 @@ static SIMPLEQ_HEAD(, intrsource) io_int
 
 static kmutex_t intr_distribute_lock;
 
-#if NIOAPIC > 0 || NACPICA > 0
-static int intr_scan_bus(int, int, intr_handle_t *);
-#if NPCI > 0
-static int intr_find_pcibridge(int, pcitag_t *, pci_chipset_tag_t *);
-#endif
-#endif
-
 #if !defined(XEN)
 static int intr_allocate_slot_cpu(struct cpu_info *, struct pic *, int, int *,
   struct intrsource *);
@@ -374,123 +367,6 @@ intr_calculatemasks(struct cpu_info *ci)
 }
 
 /*
- * List to keep track of PCI buses that are probed but not known
- * to the firmware. Used to
- *
- * XXX should maintain one list, not an array and a linked list.
- */
-#if (NPCI > 0) && ((NIOAPIC > 0) || NACPICA > 0)
-struct intr_extra_bus {
-	int bus;
-	pcitag_t *pci_bridge_tag;
-	pci_chipset_tag_t pci_chipset_tag;
-	LIST_ENTRY(intr_extra_bus) list;
-};
-
-LIST_HEAD(, intr_extra_bus) intr_extra_buses =
-LIST_HEAD_INITIALIZER(intr_extra_buses);
-
-
-void
-intr_add_pcibus(struct pcibus_attach_args *pba)
-{
-	struct intr_extra_bus *iebp;
-
-	iebp = kmem_alloc(sizeof(*iebp), KM_SLEEP);
-	iebp->bus = pba->pba_bus;
-	iebp->pci_chipset_tag = pba->pba_pc;
-	iebp->pci_bridge_tag = pba->pba_bridgetag;
-	LIST_INSERT_HEAD(_extra_buses, iebp, list);
-}
-
-static int
-intr_find_pcibridge(int bus, pcitag_t *pci_bridge_tag,
-		pci_chipset_tag_t *pc)
-{
-	struct intr_extra_bus *iebp;
-	struct mp_bus *mpb;
-
-	if (bus < 0)
-		return ENOENT;
-
-	if (bus < mp_nbus) {
-		mpb = _busses[bus];
-		if (mpb->mb_pci_bridge_tag == NULL)
-			return ENOENT;
-		*pci_bridge_tag = *mpb->mb_pci_bridge_tag;
-		*pc = mpb->mb_pci_chipset_tag;
-		return 0;
-	}
-
-	LIST_FOREACH(iebp, _extra_buses, list) {
-		if (iebp->bus == bus) {
-			if (iebp->pci_bridge_tag == NULL)
-return ENOENT;
-			*pci_bridge_tag = *iebp->pci_bridge_tag;
-			*pc = iebp->pci_chipset_tag;
-			return 0;
-		}
-	}
-	return ENOENT;
-}
-#endif
-
-#if NIOAPIC > 0 || NACPICA > 0
-/*
- * 'pin' argument pci bus_pin encoding of a device/pin combination.
- */
-int
-intr_find_mpmapping(int bus, int pin, intr_handle_t *handle)
-{
-
-#if NPCI > 0
-	while (intr_scan_bus(bus, pin, handle) != 0) {
-		int dev, func;
-		pcitag_t pci_bridge_tag;
-		pci_chipset_tag_t pc;
-
-		if (intr_find_pcibridge(bus, _bridge_tag, ) != 0)
-			return ENOENT;
-		dev = pin >> 2;
-		pin = pin & 3;
-		pin = PPB_INTERRUPT_SWIZZLE(pin + 1, dev) - 1;
-		pci_decompose_tag(pc, pci_bridge_tag, , , );
-		pin |= (dev << 2);
-	}
-	return 0;
-#else
-	return intr_scan_bus(bus, pin, handle);
-#endif
-}
-
-static int
-intr_scan_bus(int bus, int pin, intr_handle_t *handle)
-{
-	struct mp_intr_map *mip, *intrs;
-
-	if (bus < 0 || bus >= mp_nbus)
-		return ENOENT;
-
-	intrs = mp_busses[bus].mb_intrs;
-	if (intrs == NULL)
-		return ENOENT;
-
-	for (mip = intrs; mip != NULL; mip = mip->next) {
-		if (mip->bus_pin == pin) {
-#if NACPICA > 0
-			if (mip->linkdev != NULL)
-if (mpacpi_findintr_linkdev(mip) != 0)
-	continue;
-#endif
-			*handle = mip->ioapic_ih;
-			return 0;
-		}
-	}
-	return ENOENT;
-}
-#endif
-
-/*
  * Create an interrupt id such as "ioapic0 pin 9". This interrupt id is used
  * by MI code and intrctl(8).
  */
@@ -852,23 +728,6 @@ intr_biglock_wrapper(void *vp)
 #endif /* MULTIPROCESSOR */
 #endif /* XEN */
 
-#if defined(DOM0OPS) || !defined(XEN)
-struct pic *
-intr_findpic(int num)
-{
-#if NIOAPIC > 0
-	struct ioapic_softc *pic;
-
-	pic = ioapic_find_bybase(num);
-	if (pic != NULL)
-		return >sc_pic;
-#endif
-	if (num < NUM_LEGACY_IRQS)
-		return _pic;
-
-	return NULL;
-}
-#endif
 
 

CVS commit: src/sys/arch/x86/x86

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Dec 24 22:05:45 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c mp.c x86_machdep.c

Log Message:
Towards bifurcating XEN and native interrupt related functions,
this is a preliminary cleanup sweep.

Move functions related to MP bus probe and scanning to x86/mp.c

Move generic platform pic search function to x86/x86_machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/mp.c
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x86/x86/x86_machdep.c

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



CVS commit: src/sys/arch/xen/conf

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Dec 24 21:15:59 UTC 2018

Modified Files:
src/sys/arch/xen/conf: files.xen

Log Message:
Do not include files for MSI support on XEN dom0.

We do not support MSI as of now.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/arch/xen/conf/files.xen

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/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.172 src/sys/arch/xen/conf/files.xen:1.173
--- src/sys/arch/xen/conf/files.xen:1.172	Sat Dec 22 07:45:58 2018
+++ src/sys/arch/xen/conf/files.xen	Mon Dec 24 21:15:59 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.172 2018/12/22 07:45:58 cherry Exp $
+#	$NetBSD: files.xen,v 1.173 2018/12/24 21:15:59 cherry Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -381,8 +381,6 @@ file	arch/xen/xen/privcmd.c		dom0ops
 file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
 file	arch/x86/pci/pci_machdep.c	hypervisor & pci & dom0ops
 file	arch/x86/pci/pci_intr_machdep.c	hypervisor & pci
-file	arch/x86/pci/pci_msi_machdep.c	hypervisor & pci
-file	arch/x86/pci/msipic.c		hypervisor & pci
 file	arch/x86/isa/isa_machdep.c	hypervisor & dom0ops
 file	arch/xen/xen/xenevt.c		xenevt & dom0ops
 file	arch/xen/xen/xennetback_xenbus.c xvif



CVS commit: src/sys/arch/xen/conf

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Dec 24 21:15:59 UTC 2018

Modified Files:
src/sys/arch/xen/conf: files.xen

Log Message:
Do not include files for MSI support on XEN dom0.

We do not support MSI as of now.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/arch/xen/conf/files.xen

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



CVS commit: src/sys/arch

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Dec 24 14:55:42 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/x86: xen_intr.c xen_ipi.c
src/sys/arch/xen/xen: clock.c if_xennet_xenbus.c pciback.c xbd_xenbus.c
xbdback_xenbus.c xencons.c xenevt.c xennetback_xenbus.c
xpci_xenbus.c
src/sys/arch/xen/xenbus: xenbus_comms.c

Log Message:
Bifurcate the interrupt establish functions between XEN and non-XEN

Thus intr_establish_xname() becomes xen_intr_establish_xname() etc.

One consequence of this is that dom0 devices expect the native
function calls to be available and we thus provide weak aliasing for
dom0 builds to succeed. XEN and non-XEN devices are distinguished by
the PIC they are established on. XEN interrupts are exclusively
established on xen_pic, while dom0 interrupts are established on
natively available PICs.

This allows us an orthogonal path to xen device management (eg:
xenstore events) in XENPVHVM, without having to worry about unifying
the vector entry paths, etc., which is quite challenging.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/xen/xencons.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/xen/xenevt.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/xennetback_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/xpci_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xenbus/xenbus_comms.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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.138 src/sys/arch/x86/x86/intr.c:1.139
--- src/sys/arch/x86/x86/intr.c:1.138	Sun Dec 23 12:11:40 2018
+++ src/sys/arch/x86/x86/intr.c	Mon Dec 24 14:55:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.138 2018/12/23 12:11:40 jdolecek Exp $	*/
+/*	$NetBSD: intr.c,v 1.139 2018/12/24 14:55:41 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.138 2018/12/23 12:11:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.139 2018/12/24 14:55:41 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1207,117 +1207,12 @@ intr_num_handlers(struct intrsource *isp
 	return num;
 }
 
-#else /* XEN */
-void *
-intr_establish(int legacy_irq, struct pic *pic, int pin,
-int type, int level, int (*handler)(void *), void *arg,
-bool known_mpsafe)
-{
-
-	return intr_establish_xname(legacy_irq, pic, pin, type, level,
-	handler, arg, known_mpsafe, "XEN");
-}
-
-void *
-intr_establish_xname(int legacy_irq, struct pic *pic, int pin,
-int type, int level, int (*handler)(void *), void *arg,
-bool known_mpsafe, const char *xname)
-{
-	const char *intrstr;
-	char intrstr_buf[INTRIDBUF];
-
-	if (pic->pic_type == PIC_XEN) {
-		struct intrhand *rih;
-
-		/*
-		 * event_set_handler interprets `level != IPL_VM' to
-		 * mean MP-safe, so we require the caller to match that
-		 * for the moment.
-		 */
-		KASSERT(known_mpsafe == (level != IPL_VM));
-
-		intrstr = intr_create_intrid(legacy_irq, pic, pin, intrstr_buf,
-		sizeof(intrstr_buf));
-
-		event_set_handler(pin, handler, arg, level, intrstr, xname);
-
-		rih = kmem_zalloc(sizeof(*rih), cold ? KM_NOSLEEP : KM_SLEEP);
-		if (rih == NULL) {
-			printf("%s: can't allocate handler info\n", __func__);
-			return NULL;
-		}
-
-		/*
-		 * XXX:
-		 * This is just a copy for API conformance.
-		 * The real ih is lost in the innards of
-		 * event_set_handler(); where the details of
-		 * biglock_wrapper etc are taken care of.
-		 * All that goes away when we nuke event_set_handler()
-		 * et. al. and unify with x86/intr.c
-		 */
-		rih->ih_pin = pin; /* port */
-		rih->ih_fun = rih->ih_realfun = handler;
-		rih->ih_arg = rih->ih_realarg = arg;
-		rih->pic_type = pic->pic_type;
-		return rih;
-	} 	/* Else we assume pintr */
-
-#if NPCI > 0 || NISA > 0
-	struct pintrhand *pih;
-	int gsi;
-	int vector, evtchn;
-
-	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < NUM_XEN_IRQS),
-	"bad legacy IRQ value: %d", legacy_irq);
-	KASSERTMSG(!(legacy_irq == -1 && pic == _pic),
-	"non-legacy IRQon i8259 ");
-
-	gsi = xen_pic_to_gsi(pic, pin);
-
-	intrstr = intr_create_intrid(gsi, pic, pin, intrstr_buf,
-	

CVS commit: src/sys/arch

2018-12-24 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Dec 24 14:55:42 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/x86: xen_intr.c xen_ipi.c
src/sys/arch/xen/xen: clock.c if_xennet_xenbus.c pciback.c xbd_xenbus.c
xbdback_xenbus.c xencons.c xenevt.c xennetback_xenbus.c
xpci_xenbus.c
src/sys/arch/xen/xenbus: xenbus_comms.c

Log Message:
Bifurcate the interrupt establish functions between XEN and non-XEN

Thus intr_establish_xname() becomes xen_intr_establish_xname() etc.

One consequence of this is that dom0 devices expect the native
function calls to be available and we thus provide weak aliasing for
dom0 builds to succeed. XEN and non-XEN devices are distinguished by
the PIC they are established on. XEN interrupts are exclusively
established on xen_pic, while dom0 interrupts are established on
natively available PICs.

This allows us an orthogonal path to xen device management (eg:
xenstore events) in XENPVHVM, without having to worry about unifying
the vector entry paths, etc., which is quite challenging.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/xen/xencons.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/xen/xenevt.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/xennetback_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/xpci_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xenbus/xenbus_comms.c

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



CVS commit: src/sys/arch

2018-12-22 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 21:27:22 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S i386func.S
src/sys/arch/xen/x86: xenfunc.c

Log Message:
Introduce a weak alias method of exporting different implementations
of the same API.

For eg: the amd64 native implementation of invlpg() now becomes
amd64_invlpg() with a weak symbol export of invlpg(), while the XEN
implementation becomes xen_invlpg(), also weakly exported as invlpg()

Note that linking in both together without having an override function
named invlpg() would be a mistake, as we have limited control over
which of the two options would emerge as the finally exported invlpg()
resulting in a potential situation where the wrong function is finally
exported. This change avoids this situation.

We should however include an override function invlpg() in that case,
such that it is able to then pass on the call to the appropriate
backing function (amd64_invlpg() in the case of native, and
xen_invlpg() in the case of under XEN virtualisation) at runtime.

This change does not introduce such a function and therefore does not
alter builds to include native as well as XEN implementations in the
same binary. This will be done later, with the introduction of XEN
PVHVM mode, where precisely such a runtime switch is required.

There are no operational changes introduced by this change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/i386func.S
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/x86/xenfunc.c

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



CVS commit: src/sys/arch

2018-12-22 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 21:27:22 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S i386func.S
src/sys/arch/xen/x86: xenfunc.c

Log Message:
Introduce a weak alias method of exporting different implementations
of the same API.

For eg: the amd64 native implementation of invlpg() now becomes
amd64_invlpg() with a weak symbol export of invlpg(), while the XEN
implementation becomes xen_invlpg(), also weakly exported as invlpg()

Note that linking in both together without having an override function
named invlpg() would be a mistake, as we have limited control over
which of the two options would emerge as the finally exported invlpg()
resulting in a potential situation where the wrong function is finally
exported. This change avoids this situation.

We should however include an override function invlpg() in that case,
such that it is able to then pass on the call to the appropriate
backing function (amd64_invlpg() in the case of native, and
xen_invlpg() in the case of under XEN virtualisation) at runtime.

This change does not introduce such a function and therefore does not
alter builds to include native as well as XEN implementations in the
same binary. This will be done later, with the introduction of XEN
PVHVM mode, where precisely such a runtime switch is required.

There are no operational changes introduced by this change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/i386func.S
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/x86/xenfunc.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.33 src/sys/arch/amd64/amd64/cpufunc.S:1.34
--- src/sys/arch/amd64/amd64/cpufunc.S:1.33	Sat Jul 21 06:09:13 2018
+++ src/sys/arch/amd64/amd64/cpufunc.S	Sat Dec 22 21:27:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.33 2018/07/21 06:09:13 maxv Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.34 2018/12/22 21:27:22 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -63,18 +63,53 @@ ENTRY(x86_mfence)
 	ret
 END(x86_mfence)
 
+/*
+ * These functions below should always be accessed via the corresponding wrapper
+ * function names defined in x86/include/cpufunc.h and exported as WEAK_ALIAS()
+ *
+ * We use this rather roundabout method so that a runtime wrapper function may
+ * be made available for PVHVM, which could override both native and PV aliases
+ * and decide which to invoke at run time.
+ */
+
+WEAK_ALIAS(invlpg, amd64_invlpg)
+WEAK_ALIAS(lidt, amd64_lidt)
+WEAK_ALIAS(lldt, amd64_lldt)
+WEAK_ALIAS(ltr, amd64_ltr)
+WEAK_ALIAS(lcr0, amd64_lcr0)
+WEAK_ALIAS(rcr0, amd64_rcr0)
+WEAK_ALIAS(rcr2, amd64_rcr2)
+WEAK_ALIAS(lcr2, amd64_lcr2)
+WEAK_ALIAS(rcr3, amd64_rcr3)
+WEAK_ALIAS(lcr3, amd64_lcr3)
+WEAK_ALIAS(tlbflush, amd64_tlbflush)
+WEAK_ALIAS(tlbflushg, amd64_tlbflushg)
+WEAK_ALIAS(rdr0, amd64_rdr0)
+WEAK_ALIAS(ldr0, amd64_ldr0)
+WEAK_ALIAS(rdr1, amd64_rdr1)
+WEAK_ALIAS(ldr1, amd64_ldr1)
+WEAK_ALIAS(rdr2, amd64_rdr2)
+WEAK_ALIAS(ldr2, amd64_ldr2)
+WEAK_ALIAS(rdr3, amd64_rdr3)
+WEAK_ALIAS(ldr3, amd64_ldr3)
+WEAK_ALIAS(rdr6, amd64_rdr6)
+WEAK_ALIAS(ldr6, amd64_ldr6)
+WEAK_ALIAS(rdr7, amd64_rdr7)
+WEAK_ALIAS(ldr7, amd64_ldr7)
+WEAK_ALIAS(wbinvd, amd64_wbinvd)
+
 #ifndef XEN
-ENTRY(invlpg)
+ENTRY(amd64_invlpg)
 	invlpg	(%rdi)
 	ret
-END(invlpg)
+END(amd64_invlpg)
 
-ENTRY(lidt)
+ENTRY(amd64_lidt)
 	lidt	(%rdi)
 	ret
-END(lidt)
+END(amd64_lidt)
 
-ENTRY(lldt)
+ENTRY(amd64_lldt)
 	cmpl	%edi, CPUVAR(CURLDT)
 	jne	1f
 	ret
@@ -82,42 +117,42 @@ ENTRY(lldt)
 	movl	%edi, CPUVAR(CURLDT)
 	lldt	%di
 	ret
-END(lldt)
+END(amd64_lldt)
 
-ENTRY(ltr)
+ENTRY(amd64_ltr)
 	ltr	%di
 	ret
-END(ltr)
+END(amd64_ltr)
 
-ENTRY(lcr0)
+ENTRY(amd64_lcr0)
 	movq	%rdi, %cr0
 	ret
-END(lcr0)
+END(amd64_lcr0)
 
-ENTRY(rcr0)
+ENTRY(amd64_rcr0)
 	movq	%cr0, %rax
 	ret
-END(rcr0)
+END(amd64_rcr0)
 
-ENTRY(lcr2)
+ENTRY(amd64_lcr2)
 	movq	%rdi, %cr2
 	ret
-END(lcr2)
+END(amd64_lcr2)
 
-ENTRY(rcr2)
+ENTRY(amd64_rcr2)
 	movq	%cr2, %rax
 	ret
-END(rcr2)
+END(amd64_rcr2)
 
-ENTRY(lcr3)
+ENTRY(amd64_lcr3)
 	movq	%rdi, %cr3
 	ret
-END(lcr3)
+END(amd64_lcr3)
 
-ENTRY(rcr3)
+ENTRY(amd64_rcr3)
 	movq	%cr3, %rax
 	ret
-END(rcr3)
+END(amd64_rcr3)
 #endif
 
 ENTRY(lcr4)
@@ -159,7 +194,7 @@ END(rcr8)
  * If PGE is not in use, we reload CR3.
  */
 #ifndef XEN
-ENTRY(tlbflushg)
+ENTRY(amd64_tlbflushg)
 	movq	%cr4, %rax
 	testq	$CR4_PGE, %rax
 	jz	1f
@@ -168,74 +203,74 @@ ENTRY(tlbflushg)
 	movq	%rdx, %cr4
 	movq	%rax, %cr4
 	ret
-END(tlbflushg)
+END(amd64_tlbflushg)
 
-ENTRY(tlbflush)
+ENTRY(amd64_tlbflush)
 1:
 	movq	%cr3, %rax
 	movq	%rax, %cr3
 	ret
-END(tlbflush)
+END(amd64_tlbflush)
 
-ENTRY(ldr0)

CVS commit: src/sys/arch

2018-12-21 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 07:45:59 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/amd64/conf: XEN3_DOM0 files.amd64
src/sys/arch/i386/conf: XEN3PAE_DOM0 files.i386
src/sys/arch/i386/i386: i386_mainbus.c
src/sys/arch/x86/include: autoconf.h
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: autoconf.c xen_mainbus.c
Added Files:
src/sys/arch/x86/x86: mainbus.c

Log Message:
This change modifies the mainbus(4) entry point for all x86 sub-archs
in the following way:

i) It provides a unified entry point in
   x86/x86/mainbus.c:mainbus_attach()
ii) It carves out the preliminary bus attachment sequence that is
   common to all sub-archs into
   x86/x86/mainbus.c: x86_cpubus_attach()
iii) It consolidates the remaining pathways as internal callee
   functions so that these may be called piecemeal if required. A
   special usecase of this is XEN PVHVM which may need to call the
   native configure path, the xen configure path, or both.
iv) It moves the driver private data structures from
   i386/i386_mainbus.c to an x86/ level one. This allows for other
   sub-arch's to do similar, if needed. (They do not at the moment).
v) For dom0 kernels, it enables 'acpi0 at mainbus?' and
   'acpi0 at hypervisorbus'. This serves two purposes:
   a) To demonstrate the possibility of dynamic configuration tree
  traversal ordering changes.
   b) To allow for the common acpi_check(self, "acpibus") call in
   x86/mainbus.c to not barf when it is called from the dom0 attach
   path. We allow for the acpi0 device to be a child of mainbus with
   the changes to amd64/conf/XEN3_DOM0 and i386/conf/XEN3PAE_DOM0
   without actually probing further in the code. This path will later
   be pursued in a PVHVM boot codepath.

There should be no operative changes with this change. If there are,
please complain loudly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.398 -r1.399 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/i386/i386_mainbus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/include/autoconf.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/mainbus.c
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/x86/autoconf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/x86/xen_mainbus.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/amd64/amd64/amd64_mainbus.c
diff -u src/sys/arch/amd64/amd64/amd64_mainbus.c:1.2 src/sys/arch/amd64/amd64/amd64_mainbus.c:1.3
--- src/sys/arch/amd64/amd64/amd64_mainbus.c:1.2	Sat Dec 22 06:59:27 2018
+++ src/sys/arch/amd64/amd64/amd64_mainbus.c	Sat Dec 22 07:45:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $	*/
+/*	$NetBSD: amd64_mainbus.c,v 1.3 2018/12/22 07:45:58 cherry Exp $	*/
 /*	NetBSD: mainbus.c,v 1.39 2018/12/02 08:19:44 cherry Exp 	*/
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.3 2018/12/22 07:45:58 cherry Exp $");
 
 #include 
 #include 
@@ -83,15 +83,11 @@ __KERNEL_RCSID(0, "$NetBSD: amd64_mainbu
  * XXXfvdl ACPI
  */
 
-int	mainbus_match(device_t, cfdata_t, void *);
-void	mainbus_attach(device_t, device_t, void *);
+int	amd64_mainbus_match(device_t, cfdata_t, void *);
+void	amd64_mainbus_attach(device_t, device_t, void *);
+int	amd64_mainbus_print(void *, const char *);
 
-CFATTACH_DECL_NEW(mainbus, 0,
-mainbus_match, mainbus_attach, NULL, NULL);
-
-int	mainbus_print(void *, const char *);
-
-union mainbus_attach_args {
+union amd64_mainbus_attach_args {
 	const char *mba_busname;		/* first elem of all */
 	struct pcibus_attach_args mba_pba;
 	struct isabus_attach_args mba_iba;
@@ -128,8 +124,8 @@ int mp_nintr;
 int mp_isa_bus = -1;
 int mp_eisa_bus = -1;
 
-bool acpi_present;
-bool mpacpi_active;
+extern bool acpi_present;
+extern bool mpacpi_active;
 
 # ifdef MPVERBOSE
 #  if MPVERBOSE > 0
@@ -147,7 +143,7 @@ int mp_verbose = 0;
  * Probe for the mainbus; always succeeds.
  */
 int
-mainbus_match(device_t parent, cfdata_t match, void *aux)
+amd64_mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	return 1;
@@ -157,82 +153,10 @@ mainbus_match(device_t parent, cfdata_t 
  * Attach the mainbus.
  */
 void
-mainbus_attach(device_t parent, device_t self, void *aux)
+amd64_mainbus_attach(device_t parent, device_t self, void *aux)
 {
 #if NPCI > 0 || NACPICA > 0 || 

CVS commit: src/sys/arch

2018-12-21 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 07:45:59 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/amd64/conf: XEN3_DOM0 files.amd64
src/sys/arch/i386/conf: XEN3PAE_DOM0 files.i386
src/sys/arch/i386/i386: i386_mainbus.c
src/sys/arch/x86/include: autoconf.h
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: autoconf.c xen_mainbus.c
Added Files:
src/sys/arch/x86/x86: mainbus.c

Log Message:
This change modifies the mainbus(4) entry point for all x86 sub-archs
in the following way:

i) It provides a unified entry point in
   x86/x86/mainbus.c:mainbus_attach()
ii) It carves out the preliminary bus attachment sequence that is
   common to all sub-archs into
   x86/x86/mainbus.c: x86_cpubus_attach()
iii) It consolidates the remaining pathways as internal callee
   functions so that these may be called piecemeal if required. A
   special usecase of this is XEN PVHVM which may need to call the
   native configure path, the xen configure path, or both.
iv) It moves the driver private data structures from
   i386/i386_mainbus.c to an x86/ level one. This allows for other
   sub-arch's to do similar, if needed. (They do not at the moment).
v) For dom0 kernels, it enables 'acpi0 at mainbus?' and
   'acpi0 at hypervisorbus'. This serves two purposes:
   a) To demonstrate the possibility of dynamic configuration tree
  traversal ordering changes.
   b) To allow for the common acpi_check(self, "acpibus") call in
   x86/mainbus.c to not barf when it is called from the dom0 attach
   path. We allow for the acpi0 device to be a child of mainbus with
   the changes to amd64/conf/XEN3_DOM0 and i386/conf/XEN3PAE_DOM0
   without actually probing further in the code. This path will later
   be pursued in a PVHVM boot codepath.

There should be no operative changes with this change. If there are,
please complain loudly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.398 -r1.399 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/i386/i386_mainbus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/include/autoconf.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/mainbus.c
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/x86/autoconf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/x86/xen_mainbus.c

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



CVS commit: src/sys/arch

2018-12-21 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 06:59:27 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/i386/i386: i386_mainbus.c
src/sys/arch/xen/x86: xen_mainbus.c

Log Message:
Don't forget pedigree. Re-introduce old RCS Id tags from the originals


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/i386/i386_mainbus.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/x86/xen_mainbus.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/amd64/amd64/amd64_mainbus.c
diff -u src/sys/arch/amd64/amd64/amd64_mainbus.c:1.1 src/sys/arch/amd64/amd64/amd64_mainbus.c:1.2
--- src/sys/arch/amd64/amd64/amd64_mainbus.c:1.1	Sat Dec 22 06:33:36 2018
+++ src/sys/arch/amd64/amd64/amd64_mainbus.c	Sat Dec 22 06:59:27 2018
@@ -1,5 +1,5 @@
-/*	$NetBSD: amd64_mainbus.c,v 1.1 2018/12/22 06:33:36 cherry Exp $	*/
-
+/*	$NetBSD: amd64_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $	*/
+/*	NetBSD: mainbus.c,v 1.39 2018/12/02 08:19:44 cherry Exp 	*/
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
  *
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.1 2018/12/22 06:33:36 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $");
 
 #include 
 #include 

Index: src/sys/arch/i386/i386/i386_mainbus.c
diff -u src/sys/arch/i386/i386/i386_mainbus.c:1.1 src/sys/arch/i386/i386/i386_mainbus.c:1.2
--- src/sys/arch/i386/i386/i386_mainbus.c:1.1	Sat Dec 22 06:33:36 2018
+++ src/sys/arch/i386/i386/i386_mainbus.c	Sat Dec 22 06:59:27 2018
@@ -1,4 +1,5 @@
-/*	$NetBSD: i386_mainbus.c,v 1.1 2018/12/22 06:33:36 cherry Exp $	*/
+/*	$NetBSD: i386_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $	*/
+/*	NetBSD: mainbus.c,v 1.104 2018/12/02 08:19:44 cherry Exp 	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.1 2018/12/22 06:33:36 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $");
 
 #include 
 #include 

Index: src/sys/arch/xen/x86/xen_mainbus.c
diff -u src/sys/arch/xen/x86/xen_mainbus.c:1.1 src/sys/arch/xen/x86/xen_mainbus.c:1.2
--- src/sys/arch/xen/x86/xen_mainbus.c:1.1	Sat Dec 22 06:33:37 2018
+++ src/sys/arch/xen/x86/xen_mainbus.c	Sat Dec 22 06:59:27 2018
@@ -1,4 +1,5 @@
-/*	$NetBSD: xen_mainbus.c,v 1.1 2018/12/22 06:33:37 cherry Exp $	*/
+/*	$NetBSD: xen_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $	*/
+/*	NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp 	*/
 /*	NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp 	*/
 
 /*
@@ -32,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.1 2018/12/22 06:33:37 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.2 2018/12/22 06:59:27 cherry Exp $");
 
 #include 
 #include 



CVS commit: src/sys/arch

2018-12-21 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 06:59:27 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/i386/i386: i386_mainbus.c
src/sys/arch/xen/x86: xen_mainbus.c

Log Message:
Don't forget pedigree. Re-introduce old RCS Id tags from the originals


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/i386/i386_mainbus.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/x86/xen_mainbus.c

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



CVS commit: src/sys/arch

2018-12-21 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 06:33:37 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/conf: files.i386
src/sys/arch/xen/conf: files.xen
Added Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/i386/i386: i386_mainbus.c
src/sys/arch/xen/x86: xen_mainbus.c
Removed Files:
src/sys/arch/amd64/amd64: mainbus.c
src/sys/arch/i386/i386: mainbus.c
src/sys/arch/xen/x86: mainbus.c

Log Message:
Move mainbus(4) driver files in various x86 sub-archs to name prefixed
versions. This allows us to further modularise them by unifying common
bus probe code in x86/x86/mainbus.c to  be introduced next.

This commit has no functional changes. It is done for ease of
visibility of newer diffs in the queue.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.39 -r0 src/sys/arch/amd64/amd64/mainbus.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.397 -r1.398 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/i386/i386_mainbus.c
cvs rdiff -u -r1.104 -r0 src/sys/arch/i386/i386/mainbus.c
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.19 -r0 src/sys/arch/xen/x86/mainbus.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/xen/x86/xen_mainbus.c

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



CVS commit: src/sys/arch

2018-12-21 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Dec 22 06:33:37 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/conf: files.i386
src/sys/arch/xen/conf: files.xen
Added Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/i386/i386: i386_mainbus.c
src/sys/arch/xen/x86: xen_mainbus.c
Removed Files:
src/sys/arch/amd64/amd64: mainbus.c
src/sys/arch/i386/i386: mainbus.c
src/sys/arch/xen/x86: mainbus.c

Log Message:
Move mainbus(4) driver files in various x86 sub-archs to name prefixed
versions. This allows us to further modularise them by unifying common
bus probe code in x86/x86/mainbus.c to  be introduced next.

This commit has no functional changes. It is done for ease of
visibility of newer diffs in the queue.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.39 -r0 src/sys/arch/amd64/amd64/mainbus.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.397 -r1.398 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/i386/i386_mainbus.c
cvs rdiff -u -r1.104 -r0 src/sys/arch/i386/i386/mainbus.c
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.19 -r0 src/sys/arch/xen/x86/mainbus.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/xen/x86/xen_mainbus.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/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.108 src/sys/arch/amd64/conf/files.amd64:1.109
--- src/sys/arch/amd64/conf/files.amd64:1.108	Mon Dec  3 00:12:22 2018
+++ src/sys/arch/amd64/conf/files.amd64	Sat Dec 22 06:33:36 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.108 2018/12/03 00:12:22 christos Exp $
+#	$NetBSD: files.amd64,v 1.109 2018/12/22 06:33:36 cherry Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -94,7 +94,7 @@ include	"dev/i2o/files.i2o"
 # XXX BIOS32 only if something that uses it is configured!
 device	mainbus: isabus, pcibus, bios32, acpibus, cpubus, ioapicbus, ipmibus
 attach	mainbus at root
-file	arch/amd64/amd64/mainbus.c		mainbus
+file	arch/amd64/amd64/amd64_mainbus.c	mainbus
 
 #
 # PCI-only drivers

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.397 src/sys/arch/i386/conf/files.i386:1.398
--- src/sys/arch/i386/conf/files.i386:1.397	Mon Dec  3 00:11:39 2018
+++ src/sys/arch/i386/conf/files.i386	Sat Dec 22 06:33:36 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.397 2018/12/03 00:11:39 christos Exp $
+#	$NetBSD: files.i386,v 1.398 2018/12/22 06:33:36 cherry Exp $
 #
 # new style config file for i386 architecture
 #
@@ -129,7 +129,7 @@ device	mainbus: isabus, eisabus, mcabus,
 	cpubus, ioapicbus, apmbus, pnpbiosbus, ipmibus,
 	bioscall
 attach	mainbus at root
-file	arch/i386/i386/mainbus.c	mainbus
+file	arch/i386/i386/i386_mainbus.c	mainbus
 
 #
 # PCI-only drivers

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.170 src/sys/arch/xen/conf/files.xen:1.171
--- src/sys/arch/xen/conf/files.xen:1.170	Thu Jul 26 15:38:26 2018
+++ src/sys/arch/xen/conf/files.xen	Sat Dec 22 06:33:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.170 2018/07/26 15:38:26 maxv Exp $
+#	$NetBSD: files.xen,v 1.171 2018/12/22 06:33:37 cherry Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -173,7 +173,7 @@ define ipmibus {}
 
 device mainbus: cpubus, ioapicbus, hypervisorbus, bios32, ipmibus
 attach	mainbus at root
-file	arch/xen/x86/mainbus.c		mainbus
+file	arch/xen/x86/xen_mainbus.c		mainbus
 
 # Xen hypervisor
 device	hypervisor { [apid = -1]}: isabus, pcibus, sysmon_power, xendevbus, acpibus

Added files:

Index: src/sys/arch/amd64/amd64/amd64_mainbus.c
diff -u /dev/null src/sys/arch/amd64/amd64/amd64_mainbus.c:1.1
--- /dev/null	Sat Dec 22 06:33:37 2018
+++ src/sys/arch/amd64/amd64/amd64_mainbus.c	Sat Dec 22 06:33:36 2018
@@ -0,0 +1,326 @@
+/*	$NetBSD: amd64_mainbus.c,v 1.1 2018/12/22 06:33:36 cherry Exp $	*/
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou.  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.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *  This product includes software developed 

CVS commit: src

2018-12-20 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 20 10:33:42 UTC 2018

Modified Files:
src/share/man/man4: options.4
src/sys/arch/x86/conf: files.x86

Log Message:
Enable 'options NO_PCI_MSI_MSIX' to DTRT in x86 builds.

Document 'options NO_PCI_MSI_MSIX' in options(4).


To generate a diff of this commit:
cvs rdiff -u -r1.495 -r1.496 src/share/man/man4/options.4
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/x86/conf/files.x86

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.495 src/share/man/man4/options.4:1.496
--- src/share/man/man4/options.4:1.495	Thu Dec 20 09:17:04 2018
+++ src/share/man/man4/options.4	Thu Dec 20 10:33:41 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.495 2018/12/20 09:17:04 cherry Exp $
+.\"	$NetBSD: options.4,v 1.496 2018/12/20 10:33:41 cherry Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -2688,6 +2688,11 @@ bolded
 .El
 .Ss x86-specific Options
 .Bl -ohang
+.It Cd options NO_PCI_MSI_MSIX
+Disable support for MSI/MSIX in the kernel.
+See
+.Xr pci_msi 9
+for details of MSI/MSIX support
 .It Cd options NO_PREEMPTION
 Disables
 .Xr kpreempt 9

Index: src/sys/arch/x86/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.104 src/sys/arch/x86/conf/files.x86:1.105
--- src/sys/arch/x86/conf/files.x86:1.104	Fri Dec  7 15:47:11 2018
+++ src/sys/arch/x86/conf/files.x86	Thu Dec 20 10:33:41 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.104 2018/12/07 15:47:11 maxv Exp $
+#	$NetBSD: files.x86,v 1.105 2018/12/20 10:33:41 cherry Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI
@@ -155,8 +155,8 @@ file	arch/x86/x86/vga_post.c		vga_post
 file	arch/x86/pci/pci_machdep.c	pci
 #file	arch/x86/pci/pci_ranges.c	pci
 file	arch/x86/pci/pci_intr_machdep.c	pci
-file	arch/x86/pci/pci_msi_machdep.c	pci
-file	arch/x86/pci/msipic.c		pci
+file	arch/x86/pci/pci_msi_machdep.c	pci & ! no_pci_msi_msix
+file	arch/x86/pci/msipic.c		pci & ! no_pci_msi_msix
 
 file	arch/x86/pci/pciide_machdep.c	pciide_common
 



CVS commit: src

2018-12-20 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 20 10:33:42 UTC 2018

Modified Files:
src/share/man/man4: options.4
src/sys/arch/x86/conf: files.x86

Log Message:
Enable 'options NO_PCI_MSI_MSIX' to DTRT in x86 builds.

Document 'options NO_PCI_MSI_MSIX' in options(4).


To generate a diff of this commit:
cvs rdiff -u -r1.495 -r1.496 src/share/man/man4/options.4
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/x86/conf/files.x86

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



CVS commit: src/share/man/man4

2018-12-20 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 20 09:17:04 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Close .Bl directive properly


To generate a diff of this commit:
cvs rdiff -u -r1.494 -r1.495 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.494 src/share/man/man4/options.4:1.495
--- src/share/man/man4/options.4:1.494	Thu Dec 20 08:32:55 2018
+++ src/share/man/man4/options.4	Thu Dec 20 09:17:04 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.494 2018/12/20 08:32:55 cherry Exp $
+.\"	$NetBSD: options.4,v 1.495 2018/12/20 09:17:04 cherry Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -2685,6 +2685,7 @@ underlined
 .It 4
 bolded
 .El
+.El
 .Ss x86-specific Options
 .Bl -ohang
 .It Cd options NO_PREEMPTION
@@ -2692,7 +2693,6 @@ Disables
 .Xr kpreempt 9
 support in the kernel.
 .El
-.El
 .\" The following requests should be uncommented and used where appropriate.
 .\" .Sh FILES
 .\" .Sh EXAMPLES



CVS commit: src/share/man/man4

2018-12-20 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 20 09:17:04 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Close .Bl directive properly


To generate a diff of this commit:
cvs rdiff -u -r1.494 -r1.495 src/share/man/man4/options.4

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



CVS commit: src/share/man/man4

2018-12-20 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 20 08:32:55 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Document 'options NO_PREEMPTION'

With prompting from Christoph Badura.


To generate a diff of this commit:
cvs rdiff -u -r1.493 -r1.494 src/share/man/man4/options.4

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



CVS commit: src/share/man/man4

2018-12-20 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 20 08:32:55 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Document 'options NO_PREEMPTION'

With prompting from Christoph Badura.


To generate a diff of this commit:
cvs rdiff -u -r1.493 -r1.494 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.493 src/share/man/man4/options.4:1.494
--- src/share/man/man4/options.4:1.493	Wed Dec 19 13:57:45 2018
+++ src/share/man/man4/options.4	Thu Dec 20 08:32:55 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.493 2018/12/19 13:57:45 maxv Exp $
+.\"	$NetBSD: options.4,v 1.494 2018/12/20 08:32:55 cherry Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -2685,6 +2685,13 @@ underlined
 .It 4
 bolded
 .El
+.Ss x86-specific Options
+.Bl -ohang
+.It Cd options NO_PREEMPTION
+Disables
+.Xr kpreempt 9
+support in the kernel.
+.El
 .El
 .\" The following requests should be uncommented and used where appropriate.
 .\" .Sh FILES



CVS commit: src/sys/arch/x86/include

2018-12-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 13 16:16:51 UTC 2018

Modified Files:
src/sys/arch/x86/include: intr.h

Log Message:
Allow x86 builds to have the opportunity to not have pre-emption
enabled by default. This can be effected by having a:

"optionsNO_PREEMPTION"

line in the kernel configuration file.

While it was tempting to tie __HAVE_PREEMPTION to MULTIPROCESSOR,
as is currently assumed in sys/kern/kern_stub.c ,

having MULTIPROCESSOR without __HAVE_PREEMPTION
and not having either are valid configuration options which users
could have choice of. We thus err on the side of configurability.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/include/intr.h

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



CVS commit: src/sys/arch/x86/include

2018-12-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Dec 13 16:16:51 UTC 2018

Modified Files:
src/sys/arch/x86/include: intr.h

Log Message:
Allow x86 builds to have the opportunity to not have pre-emption
enabled by default. This can be effected by having a:

"optionsNO_PREEMPTION"

line in the kernel configuration file.

While it was tempting to tie __HAVE_PREEMPTION to MULTIPROCESSOR,
as is currently assumed in sys/kern/kern_stub.c ,

having MULTIPROCESSOR without __HAVE_PREEMPTION
and not having either are valid configuration options which users
could have choice of. We thus err on the side of configurability.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/include/intr.h

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/x86/include/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.56 src/sys/arch/x86/include/intr.h:1.57
--- src/sys/arch/x86/include/intr.h:1.56	Sun Jun 24 13:35:33 2018
+++ src/sys/arch/x86/include/intr.h	Thu Dec 13 16:16:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.56 2018/06/24 13:35:33 jdolecek Exp $	*/
+/*	$NetBSD: intr.h,v 1.57 2018/12/13 16:16:51 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,9 @@
 
 #if !defined(XEN)
 #define	__HAVE_FAST_SOFTINTS
+#if !defined(NO_PREEMPTION)
 #define	__HAVE_PREEMPTION
+#endif /* !defined(NO_PREEMPTION) */
 #endif /*  !defined(XEN) */
 
 #ifdef _KERNEL



CVS commit: src/sys/arch/x86/x86

2018-12-04 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec  4 19:27:22 UTC 2018

Modified Files:
src/sys/arch/x86/x86: cpu.c intr.c

Log Message:
Hypothetically speaking, if one were to want to compile a

'no options MULTIPROCESSOR'

kernel, these files may trip up the build.

Fix them by moving around the #defines as originally intended.

No Functional Changes.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/x86/x86/intr.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/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.163 src/sys/arch/x86/x86/cpu.c:1.164
--- src/sys/arch/x86/x86/cpu.c:1.163	Tue Dec  4 19:22:42 2018
+++ src/sys/arch/x86/x86/cpu.c	Tue Dec  4 19:27:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.164 2018/12/04 19:27:22 cherry Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.164 2018/12/04 19:27:22 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -188,10 +188,10 @@ struct cpu_info *cpu_starting;
 void	cpu_hatch(void *);
 static void	cpu_boot_secondary(struct cpu_info *ci);
 static void	cpu_start_secondary(struct cpu_info *ci);
-#endif
 #if NLAPIC > 0
 static void	cpu_copy_trampoline(paddr_t);
 #endif
+#endif /* MULTIPROCESSOR */
 
 /*
  * Runs once per boot once multiprocessor goo has been detected and
@@ -987,6 +987,7 @@ cpu_debug_dump(void)
 }
 #endif
 
+#ifdef MULTIPROCESSOR
 #if NLAPIC > 0
 static void
 cpu_copy_trampoline(paddr_t pdir_pa)
@@ -1028,7 +1029,6 @@ cpu_copy_trampoline(paddr_t pdir_pa)
 }
 #endif
 
-#ifdef MULTIPROCESSOR
 int
 mp_cpu_start(struct cpu_info *ci, paddr_t target)
 {

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.136 src/sys/arch/x86/x86/intr.c:1.137
--- src/sys/arch/x86/x86/intr.c:1.136	Sun Dec  2 08:19:44 2018
+++ src/sys/arch/x86/x86/intr.c	Tue Dec  4 19:27:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.136 2018/12/02 08:19:44 cherry Exp $	*/
+/*	$NetBSD: intr.c,v 1.137 2018/12/04 19:27:22 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.136 2018/12/02 08:19:44 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.137 2018/12/04 19:27:22 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1493,7 +1493,9 @@ void
 cpu_intr_init(struct cpu_info *ci)
 {
 #if !defined(XEN)
+#if (NLAPIC > 0) || defined(MULTIPROCESSOR) || defined(__HAVE_PREEMPTION)
 	struct intrsource *isp;
+#endif
 #if NLAPIC > 0
 	static int first = 1;
 #if defined(MULTIPROCESSOR)



CVS commit: src/sys/arch/x86/x86

2018-12-04 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec  4 19:27:22 UTC 2018

Modified Files:
src/sys/arch/x86/x86: cpu.c intr.c

Log Message:
Hypothetically speaking, if one were to want to compile a

'no options MULTIPROCESSOR'

kernel, these files may trip up the build.

Fix them by moving around the #defines as originally intended.

No Functional Changes.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/x86/x86/intr.c

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



CVS commit: src/sys/arch/x86/x86

2018-12-04 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Dec  4 19:22:42 UTC 2018

Modified Files:
src/sys/arch/x86/x86: cpu.c

Log Message:
Stop panic()ing on a UP system.

The reason for the panic is that the cpu_attach() doesn't run to
completion because it thinks it's run past maxcpus (which in the case
of UP), is 1.

This is because on x86 at least, mi_cpu_attach() is called *before*
configure() (and thus the cpu_match()/cpu_attach() pair). Thus ncpu
has already been incremented by the time MD cpu_attach() is called.

Fix this.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/x86/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/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.162 src/sys/arch/x86/x86/cpu.c:1.163
--- src/sys/arch/x86/x86/cpu.c:1.162	Mon Nov 12 18:10:36 2018
+++ src/sys/arch/x86/x86/cpu.c	Tue Dec  4 19:22:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -320,7 +320,7 @@ cpu_attach(device_t parent, device_t sel
 
 	sc->sc_dev = self;
 
-	if (ncpu == maxcpus) {
+	if (ncpu > maxcpus) {
 #ifndef _LP64
 		aprint_error(": too many CPUs, please use NetBSD/amd64\n");
 #else



  1   2   3   4   5   6   >