Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Make DOM0OPS build for PVH/PVHVM too



details:   https://anonhg.NetBSD.org/src/rev/245821807114
branches:  trunk
changeset: 1009861:245821807114
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue May 05 17:02:01 2020 +0000

description:
Make DOM0OPS build for PVH/PVHVM too

diffstat:

 sys/arch/x86/x86/pmap.c              |   8 ++++----
 sys/arch/xen/conf/files.xen          |  16 ++++++++++++++--
 sys/arch/xen/conf/files.xen.pv       |  15 ++-------------
 sys/arch/xen/x86/xen_intr.c          |   6 +++---
 sys/arch/xen/xen/hypervisor.c        |  10 +++++-----
 sys/arch/xen/xen/privcmd.c           |   6 ++++--
 sys/arch/xen/xen/xbdback_xenbus.c    |   9 +++++----
 sys/arch/xen/xen/xenevt.c            |  13 +++++++++----
 sys/arch/xen/xen/xennetback_xenbus.c |   9 +++++----
 9 files changed, 51 insertions(+), 41 deletions(-)

diffs (truncated from 331 to 300 lines):

diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/x86/x86/pmap.c   Tue May 05 17:02:01 2020 +0000
@@ -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 @@
                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 @@
 #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);
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen       Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/conf/files.xen       Tue May 05 17:02:01 2020 +0000
@@ -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 @@
 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
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/conf/files.xen.pv
--- a/sys/arch/xen/conf/files.xen.pv    Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/conf/files.xen.pv    Tue May 05 17:02:01 2020 +0000
@@ -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 @@
 # 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 @@
 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
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/x86/xen_intr.c
--- a/sys/arch/xen/x86/xen_intr.c       Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/x86/xen_intr.c       Tue May 05 17:02:01 2020 +0000
@@ -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 @@
                /* 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.
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/xen/hypervisor.c
--- a/sys/arch/xen/xen/hypervisor.c     Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/xen/hypervisor.c     Tue May 05 17:02:01 2020 +0000
@@ -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 @@
  * 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 @@
        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 @@
        if (xendomain_is_privileged()) {
                xenprivcmd_init();
        }
-#endif /* DOM0OPS */
+#endif /* XENPV && DOM0OPS */
 
        hypervisor_machdep_attach();
 
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/xen/privcmd.c
--- a/sys/arch/xen/xen/privcmd.c        Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/xen/privcmd.c        Tue May 05 17:02:01 2020 +0000
@@ -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 @@
 #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)
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Tue May 05 17:02:01 2020 +0000
@@ -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 @@
 #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 @@
        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 @@
                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;
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/xen/xenevt.c
--- a/sys/arch/xen/xen/xenevt.c Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/xen/xenevt.c Tue May 05 17:02:01 2020 +0000
@@ -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 @@
         * 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 @@
                /* 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;
 }
diff -r 0296dcd8a4c9 -r 245821807114 sys/arch/xen/xen/xennetback_xenbus.c
--- a/sys/arch/xen/xen/xennetback_xenbus.c      Tue May 05 16:58:11 2020 +0000
+++ b/sys/arch/xen/xen/xennetback_xenbus.c      Tue May 05 17:02:01 2020 +0000
@@ -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>



Home | Main Index | Thread Index | Old Index