Module Name:    src
Committed By:   bouyer
Date:           Tue May  5 17:02:01 UTC 2020

Modified Files:
        src/sys/arch/x86/x86: pmap.c
        src/sys/arch/xen/conf: files.xen files.xen.pv
        src/sys/arch/xen/x86: xen_intr.c
        src/sys/arch/xen/xen: hypervisor.c privcmd.c xbdback_xenbus.c xenevt.c
            xennetback_xenbus.c

Log Message:
Make DOM0OPS build for PVH/PVHVM too


To generate a diff of this commit:
cvs rdiff -u -r1.387 -r1.388 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/conf/files.xen.pv
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/xen/xen/privcmd.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/xen/xen/xenevt.c
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/xen/xen/xennetback_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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.387 src/sys/arch/x86/x86/pmap.c:1.388
--- src/sys/arch/x86/x86/pmap.c:1.387	Sat May  2 16:44:36 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.387 2020/05/02 16:44:36 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.388 2020/05/05 17:02:01 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.387 2020/05/02 16:44:36 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.388 2020/05/05 17:02:01 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -982,7 +982,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 		pte = vtopte(va);
 	else
 		pte = kvtopte(va);
-#ifdef DOM0OPS
+#if defined(XENPV) && defined(DOM0OPS)
 	if (pa < pmap_pa_start || pa >= pmap_pa_end) {
 #ifdef DEBUG
 		printf_nolog("%s: pa %#" PRIxPADDR " for va %#" PRIxVADDR
@@ -990,7 +990,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 #endif /* DEBUG */
 		npte = pa;
 	} else
-#endif /* DOM0OPS */
+#endif /* XENPV && DOM0OPS */
 		npte = pmap_pa2pte(pa);
 	npte |= protection_codes[prot] | PTE_P | pmap_pg_g;
 	npte |= pmap_pat_flags(flags);

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.184 src/sys/arch/xen/conf/files.xen:1.185
--- src/sys/arch/xen/conf/files.xen:1.184	Sat May  2 16:46:06 2020
+++ src/sys/arch/xen/conf/files.xen	Tue May  5 17:02:01 2020
@@ -1,6 +1,6 @@
-#	$NetBSD: files.xen,v 1.184 2020/05/02 16:46:06 bouyer Exp $
+#	$NetBSD: files.xen,v 1.185 2020/05/05 17:02:01 bouyer Exp $
 
-defflag	opt_xen.h			XEN XENPVH XENPVHVM PAE
+defflag	opt_xen.h			XEN XENPVH XENPVHVM PAE DOM0OPS
 
 file	arch/xen/x86/hypervisor_machdep.c	xen
 file	arch/xen/x86/xen_intr.c			xen
@@ -46,3 +46,15 @@ file	arch/xen/xen/xennet_checksum.c	xvif
 device	xbd: disk
 attach	xbd at xenbus
 file	arch/xen/xen/xbd_xenbus.c	xbd
+
+# Domain-0 operations
+file	arch/xen/xen/privcmd.c		dom0ops
+file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
+file	arch/xen/xen/xenevt.c		xenevt & dom0ops
+file	arch/xen/xen/xennetback_xenbus.c xvif
+file	arch/xen/xen/xbdback_xenbus.c xbdback
+
+# Xen event peudo-device
+defpseudo xenevt
+defpseudo xvif
+defpseudo xbdback

Index: src/sys/arch/xen/conf/files.xen.pv
diff -u src/sys/arch/xen/conf/files.xen.pv:1.2 src/sys/arch/xen/conf/files.xen.pv:1.3
--- src/sys/arch/xen/conf/files.xen.pv:1.2	Sat Apr 25 15:26:17 2020
+++ src/sys/arch/xen/conf/files.xen.pv	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen.pv,v 1.2 2020/04/25 15:26:17 bouyer Exp $
+#	$NetBSD: files.xen.pv,v 1.3 2020/05/05 17:02:01 bouyer Exp $
 
 file	arch/xen/x86/autoconf.c		xenpv
 file	arch/xen/x86/x86_xpmap.c	xenpv
@@ -17,11 +17,6 @@ include "arch/xen/conf/files.compat"
 # System bus types
 #
 
-# Xen event peudo-device
-defpseudo xenevt
-defpseudo xvif
-defpseudo xbdback
-
 # PCI frontend
 device xpci: pcibus
 attach xpci at xenbus with xpci_xenbus
@@ -40,10 +35,4 @@ device vcpu
 attach vcpu at xendevbus
 file	arch/xen/x86/cpu.c		xenpv & vcpu
 
-# Domain-0 operations
-defflag	opt_xen.h			DOM0OPS XENPV
-file	arch/xen/xen/privcmd.c		dom0ops
-file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
-file	arch/xen/xen/xenevt.c		xenevt & (dom0ops | xenpvhvm)
-file	arch/xen/xen/xennetback_xenbus.c xvif
-file	arch/xen/xen/xbdback_xenbus.c xbdback
+defflag	opt_xen.h			XENPV

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.25 src/sys/arch/xen/x86/xen_intr.c:1.26
--- src/sys/arch/xen/x86/xen_intr.c:1.25	Mon May  4 15:55:56 2020
+++ src/sys/arch/xen/x86/xen_intr.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.25 2020/05/04 15:55:56 jdolecek Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.26 2020/05/05 17:02:01 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.25 2020/05/04 15:55:56 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.26 2020/05/05 17:02:01 bouyer Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -232,7 +232,7 @@ xen_intr_disestablish(struct intrhand *i
 		/* event_remove_handler frees ih */
 		return;
 	}
-#if defined(DOM0OPS)
+#if defined(DOM0OPS) && defined(XENPV)
 	/* 
 	 * Cache state, to prevent a use after free situation with
 	 * ih.

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.80 src/sys/arch/xen/xen/hypervisor.c:1.81
--- src/sys/arch/xen/xen/hypervisor.c:1.80	Sun May  3 17:24:11 2020
+++ src/sys/arch/xen/xen/hypervisor.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.80 2020/05/03 17:24:11 bouyer Exp $ */
+/* $NetBSD: hypervisor.c,v 1.81 2020/05/05 17:02:01 bouyer Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.80 2020/05/03 17:24:11 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.81 2020/05/05 17:02:01 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -156,7 +156,7 @@ union hypervisor_attach_cookie {
  * This is set when the ISA bus is attached.  If it's not set by the
  * time it's checked below, then mainbus attempts to attach an ISA.
  */
-#ifdef DOM0OPS
+#if defined(XENPV) && defined(DOM0OPS)
 int     isa_has_been_seen;
 #if NISA > 0
 struct  x86_isa_chipset x86_isa_chipset;
@@ -663,7 +663,7 @@ hypervisor_attach(device_t parent, devic
 	hac.hac_xencons.xa_device = "xencons";
 	config_found_ia(self, "xendevbus", &hac.hac_xencons, hypervisor_print);
 #endif
-#ifdef DOM0OPS
+#if defined(XENPV) && defined(DOM0OPS)
 #if NPCI > 0
 #if NACPICA > 0
 	if (acpi_present) {
@@ -728,7 +728,7 @@ hypervisor_attach(device_t parent, devic
 	if (xendomain_is_privileged()) {
 		xenprivcmd_init();
 	}
-#endif /* DOM0OPS */
+#endif /* XENPV && DOM0OPS */
 
 	hypervisor_machdep_attach();
 

Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.56 src/sys/arch/xen/xen/privcmd.c:1.57
--- src/sys/arch/xen/xen/privcmd.c:1.56	Sat Apr 25 15:26:18 2020
+++ src/sys/arch/xen/xen/privcmd.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.56 2020/04/25 15:26:18 bouyer Exp $ */
+/* $NetBSD: privcmd.c,v 1.57 2020/05/05 17:02:01 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.56 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.57 2020/05/05 17:02:01 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,6 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 
 #include <uvm/uvm_fault_i.h>
 
 #include <xen/kernfs_machdep.h>
+#include <xen/hypervisor.h>
+#include <xen/xen.h>
 #include <xen/xenio.h>
 
 #define	PRIVCMD_MODE	(S_IRUSR)

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.92 src/sys/arch/xen/xen/xbdback_xenbus.c:1.93
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.92	Sat Apr 25 20:05:25 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.92 2020/04/25 20:05:25 jdolecek Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.93 2020/05/05 17:02:01 bouyer Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.92 2020/04/25 20:05:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.93 2020/05/05 17:02:01 bouyer Exp $");
 
 #include <sys/buf.h>
 #include <sys/condvar.h>
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb
 #include <sys/types.h>
 #include <sys/vnode.h>
 
+#include <xen/hypervisor.h>
 #include <xen/xen.h>
 #include <xen/xen_shm.h>
 #include <xen/evtchn.h>
@@ -595,7 +596,7 @@ xbdback_connect(struct xbdback_instance 
 	XENPRINTF(("xbdback %s: connect evchannel %d\n", xbusd->xbusd_path, xbdi->xbdi_evtchn));
 	xbdi->xbdi_evtchn = evop.u.bind_interdomain.local_port;
 
-	xbdi->xbdi_ih = xen_intr_establish_xname(-1, &xen_pic, xbdi->xbdi_evtchn,
+	xbdi->xbdi_ih = intr_establish_xname(-1, &xen_pic, xbdi->xbdi_evtchn,
 	    IST_LEVEL, IPL_BIO, xbdback_evthandler, xbdi, false,
 	    xbdi->xbdi_name);
 	KASSERT(xbdi->xbdi_ih != NULL);
@@ -642,7 +643,7 @@ xbdback_disconnect(struct xbdback_instan
 		return;
 	}
 	hypervisor_mask_event(xbdi->xbdi_evtchn);
-	xen_intr_disestablish(xbdi->xbdi_ih);
+	intr_disestablish(xbdi->xbdi_ih);
 
 	/* signal thread that we want to disconnect, then wait for it */
 	xbdi->xbdi_status = DISCONNECTING;

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.57 src/sys/arch/xen/xen/xenevt.c:1.58
--- src/sys/arch/xen/xen/xenevt.c:1.57	Sat Apr 25 15:26:18 2020
+++ src/sys/arch/xen/xen/xenevt.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: xenevt.c,v 1.57 2020/04/25 15:26:18 bouyer Exp $      */
+/*      $NetBSD: xenevt.c,v 1.58 2020/05/05 17:02:01 bouyer Exp $      */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.57 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.58 2020/05/05 17:02:01 bouyer Exp $");
 
 #include "opt_xen.h"
 #include <sys/param.h>
@@ -176,12 +176,12 @@ xenevtattach(int n)
 	 * Allocate a loopback event port.
 	 * This helps us massage xenevt_processevt() into the
 	 * callchain at the appropriate level using only
-	 * xen_intr_establish_xname().
+	 * intr_establish_xname().
 	 */
 	evtchn_port_t evtchn = xenevt_alloc_event();
 
 	/* The real objective here is to wiggle into the ih callchain for IPL level */
-	ih = xen_intr_establish_xname(-1, &xen_pic, evtchn,  IST_LEVEL, level,
+	ih = intr_establish_xname(-1, &xen_pic, evtchn,  IST_LEVEL, level,
 	    xenevt_processevt, NULL, true, "xenevt");
 
 	KASSERT(ih != NULL);
@@ -357,8 +357,13 @@ xenevtmmap(dev_t dev, off_t off, int pro
 		/* only one page, so off is always 0 */
 		if (off != 0)
 			return -1;
+#ifdef XENPV
 		return x86_btop(
 		   xpmap_mtop((paddr_t)xen_start_info.store_mfn << PAGE_SHIFT));
+#else
+		return x86_btop(
+		   (paddr_t)xen_start_info.store_mfn << PAGE_SHIFT);
+#endif
 	}
 	return -1;
 }

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.104 src/sys/arch/xen/xen/xennetback_xenbus.c:1.105
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.104	Mon May  4 08:22:45 2020
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Tue May  5 17:02:01 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: xennetback_xenbus.c,v 1.104 2020/05/04 08:22:45 jdolecek Exp $      */
+/*      $NetBSD: xennetback_xenbus.c,v 1.105 2020/05/05 17:02:01 bouyer Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.104 2020/05/04 08:22:45 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.105 2020/05/05 17:02:01 bouyer Exp $");
 
 #include "opt_xen.h"
 
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: xennetback_x
 
 #include <net/if_ether.h>
 
+#include <xen/hypervisor.h>
 #include <xen/xen.h>
 #include <xen/xen_shm.h>
 #include <xen/evtchn.h>
@@ -361,7 +362,7 @@ xennetback_xenbus_destroy(void *arg)
 
 	if (xneti->xni_ih != NULL) {
 		hypervisor_mask_event(xneti->xni_evtchn);
-		xen_intr_disestablish(xneti->xni_ih);
+		intr_disestablish(xneti->xni_ih);
 		xneti->xni_ih = NULL;
 	}
 
@@ -528,7 +529,7 @@ xennetback_connect(struct xnetback_insta
 	xneti->xni_status = CONNECTED;
 	xen_wmb();
 
-	xneti->xni_ih = xen_intr_establish_xname(-1, &xen_pic, xneti->xni_evtchn,
+	xneti->xni_ih = intr_establish_xname(-1, &xen_pic, xneti->xni_evtchn,
 	    IST_LEVEL, IPL_NET, xennetback_evthandler, xneti, false,
 	    xneti->xni_if.if_xname);
 	KASSERT(xneti->xni_ih != NULL);

Reply via email to