Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc kcpuset_t changes for the pmap and removal ...



details:   https://anonhg.NetBSD.org/src/rev/a65dcc586473
branches:  trunk
changeset: 788673:a65dcc586473
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Jul 17 23:27:02 2013 +0000

description:
kcpuset_t changes for the pmap and removal of __cpuset_t

diffstat:

 sys/arch/powerpc/booke/booke_machdep.c |  32 +++++++++++-------
 sys/arch/powerpc/booke/booke_pmap.c    |  12 ++++--
 sys/arch/powerpc/include/booke/pmap.h  |   6 +-
 sys/arch/powerpc/include/cpu.h         |  14 ++++----
 sys/arch/powerpc/include/cpuset.h      |  57 ----------------------------------
 sys/arch/powerpc/include/types.h       |   3 +-
 6 files changed, 39 insertions(+), 85 deletions(-)

diffs (284 lines):

diff -r d70f595f76a0 -r a65dcc586473 sys/arch/powerpc/booke/booke_machdep.c
--- a/sys/arch/powerpc/booke/booke_machdep.c    Wed Jul 17 23:25:25 2013 +0000
+++ b/sys/arch/powerpc/booke/booke_machdep.c    Wed Jul 17 23:27:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: booke_machdep.c,v 1.17 2012/10/29 05:23:44 matt Exp $  */
+/*     $NetBSD: booke_machdep.c,v 1.18 2013/07/17 23:27:02 matt Exp $  */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 #define        _POWERPC_BUS_DMA_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.17 2012/10/29 05:23:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.18 2013/07/17 23:27:02 matt Exp $");
 
 #include "opt_modular.h"
 
@@ -54,7 +54,6 @@
 
 #include <uvm/uvm_extern.h>
 
-#include <powerpc/cpuset.h>
 #include <powerpc/pcb.h>
 #include <powerpc/spr.h>
 #include <powerpc/booke/spr.h>
@@ -222,6 +221,12 @@
                ci->ci_idepth = -1;
                ci->ci_pmap_kern_segtab = curcpu()->ci_pmap_kern_segtab;
        }
+
+       kcpuset_create(&cpuset_info.cpus_running, true);
+       kcpuset_create(&cpuset_info.cpus_hatched, true);
+       kcpuset_create(&cpuset_info.cpus_paused, true);
+       kcpuset_create(&cpuset_info.cpus_resumed, true);
+       kcpuset_create(&cpuset_info.cpus_halted, true);
 #endif /* MULTIPROCESSOR */
 }
 
@@ -458,18 +463,18 @@
 register_t
 cpu_hatch(void)
 {
-       volatile struct cpuset_info * const csi = &cpuset_info;
+       struct cpuset_info * const csi = &cpuset_info;
        const size_t id = cpu_number();
 
        /*
         * We've hatched so tell the spinup code.
         */
-       CPUSET_ADD(csi->cpus_hatched, id);
+       kcpuset_set(csi->cpus_hatched, id);
 
        /*
         * Loop until running bit for this cpu is set.
         */
-       while (!CPUSET_HAS_P(csi->cpus_running, id)) {
+       while (!kcpuset_isset(csi->cpus_running, id)) {
                continue;
        }
 
@@ -490,24 +495,27 @@
        volatile struct cpuset_info * const csi = &cpuset_info;
        CPU_INFO_ITERATOR cii;
        struct cpu_info *ci;
-       __cpuset_t running = CPUSET_NULLSET;
+       kcpuset_t *running;
+
+       kcpuset_create(&running, true);
 
        for (CPU_INFO_FOREACH(cii, ci)) {
                /*
                 * Skip this CPU if it didn't sucessfully hatch.
                 */
-               if (! CPUSET_HAS_P(csi->cpus_hatched, cpu_index(ci)))
+               if (!kcpuset_isset(csi->cpus_hatched, cpu_index(ci)))
                        continue;
 
                KASSERT(!CPU_IS_PRIMARY(ci));
                KASSERT(ci->ci_data.cpu_idlelwp);
 
-               CPUSET_ADD(running, cpu_index(ci));
+               kcpuset_set(running, cpu_index(ci));
        }
-       KASSERT(CPUSET_EQUAL_P(csi->cpus_hatched, running));
-       if (!CPUSET_EMPTY_P(running)) {
-               CPUSET_ADDSET(csi->cpus_running, running);
+       KASSERT(kcpuset_match(csi->cpus_hatched, running));
+       if (!kcpuset_iszero(running)) {
+               kcpuset_merge(csi->cpus_running, running);
        }
+       kcpuset_destroy(running);
 }
 #endif
 
diff -r d70f595f76a0 -r a65dcc586473 sys/arch/powerpc/booke/booke_pmap.c
--- a/sys/arch/powerpc/booke/booke_pmap.c       Wed Jul 17 23:25:25 2013 +0000
+++ b/sys/arch/powerpc/booke/booke_pmap.c       Wed Jul 17 23:27:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: booke_pmap.c,v 1.16 2012/09/07 18:05:11 matt Exp $     */
+/*     $NetBSD: booke_pmap.c,v 1.17 2013/07/17 23:27:02 matt Exp $     */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.16 2012/09/07 18:05:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.17 2013/07/17 23:27:02 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
@@ -52,7 +52,7 @@
  * Initialize the kernel pmap.
  */
 #ifdef MULTIPROCESSOR
-#define        PMAP_SIZE       offsetof(struct pmap, pm_pai[MAXCPUS])
+#define        PMAP_SIZE       offsetof(struct pmap, pm_pai[PMAP_TLB_MAX])
 #else
 #define        PMAP_SIZE       sizeof(struct pmap)
 #endif
@@ -90,7 +90,7 @@
 }
 
 void
-pmap_md_page_syncicache(struct vm_page *pg, __cpuset_t onproc)
+pmap_md_page_syncicache(struct vm_page *pg, const kcpuset_t *onproc)
 {
        /*
         * If onproc is empty, we could do a
@@ -160,6 +160,10 @@
         */
        pmap_kernel()->pm_segtab = stp;
        curcpu()->ci_pmap_kern_segtab = stp;
+#ifdef MULTIPROCESSOR
+       pmap_kernel()->pm_active = kcpuset_running;
+       pmap_kernel()->pm_onproc = kcpuset_running;
+#endif
 
        KASSERT(endkernel == trunc_page(endkernel));
 
diff -r d70f595f76a0 -r a65dcc586473 sys/arch/powerpc/include/booke/pmap.h
--- a/sys/arch/powerpc/include/booke/pmap.h     Wed Jul 17 23:25:25 2013 +0000
+++ b/sys/arch/powerpc/include/booke/pmap.h     Wed Jul 17 23:27:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.11 2012/10/02 23:51:39 christos Exp $       */
+/*     $NetBSD: pmap.h,v 1.12 2013/07/17 23:27:02 matt Exp $   */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -53,7 +53,6 @@
 #include <uvm/uvm_page.h>
 #ifdef __PMAP_PRIVATE
 #include <powerpc/booke/cpuvar.h>
-#include <powerpc/cpuset.h>
 #endif
 
 #define        PMAP_NEED_PROCWR
@@ -71,6 +70,7 @@
 #define        KERNEL_PID      0
 
 #define        PMAP_TLB_NUM_PIDS               256
+#define        PMAP_TLB_MAX                    1
 #define        PMAP_INVALID_SEGTAB_ADDRESS     ((pmap_segtab_t *)0xfeeddead)
 
 #define        pmap_phys_address(x)            (x)
@@ -96,7 +96,7 @@
 #endif
 #endif
 
-void   pmap_md_page_syncicache(struct vm_page *, __cpuset_t);
+void   pmap_md_page_syncicache(struct vm_page *, const kcpuset_t *);
 vaddr_t        pmap_bootstrap(vaddr_t, vaddr_t, phys_ram_seg_t *, size_t);
 bool   pmap_extract(struct pmap *, vaddr_t, paddr_t *);
 
diff -r d70f595f76a0 -r a65dcc586473 sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Wed Jul 17 23:25:25 2013 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Wed Jul 17 23:27:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.96 2013/04/25 00:08:48 macallan Exp $        */
+/*     $NetBSD: cpu.h,v 1.97 2013/07/17 23:27:02 matt Exp $    */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -175,14 +175,14 @@
 };
 
 struct cpuset_info {
-       __cpuset_t cpus_running;
-       __cpuset_t cpus_hatched;
-       __cpuset_t cpus_paused;
-       __cpuset_t cpus_resumed;
-       __cpuset_t cpus_halted;
+       kcpuset_t *cpus_running;
+       kcpuset_t *cpus_hatched;
+       kcpuset_t *cpus_paused;
+       kcpuset_t *cpus_resumed;
+       kcpuset_t *cpus_halted;
 };
 
-extern volatile struct cpuset_info cpuset_info;
+extern struct cpuset_info cpuset_info;
 #endif /* MULTIPROCESSOR && !_MODULE */
 
 #if defined(MULTIPROCESSOR) || defined(_MODULE)
diff -r d70f595f76a0 -r a65dcc586473 sys/arch/powerpc/include/cpuset.h
--- a/sys/arch/powerpc/include/cpuset.h Wed Jul 17 23:25:25 2013 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*     $NetBSD: cpuset.h,v 1.1 2011/06/05 16:52:25 matt Exp $  */
-
-/*-
- * Copyright (c) 2004 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _POWERPC_CPUSET_H_
-#define        _POWERPC_CPUSET_H_
-
-#include <sys/atomic.h>
-
-#define        CPUSET_SINGLE(cpu)              ((__cpuset_t)1U << (cpu))
-
-#define        CPUSET_ADD(set, cpu)            atomic_or_32(&(set), CPUSET_SINGLE(cpu))
-#define        CPUSET_DEL(set, cpu)            atomic_and_32(&(set), ~CPUSET_SINGLE(cpu))
-#define        CPUSET_ADDSET(set1, set2)       atomic_or_32(&(set1), (set2))
-#define        CPUSET_DELSET(set1, set2)       atomic_and_32(&(set1), ~(set2))
-
-#define        CPUSET_EXCEPT(set, cpu)         ((set) & ~CPUSET_SINGLE(cpu))
-
-#define        CPUSET_HAS_P(set, cpu)          ((set) & CPUSET_SINGLE(cpu))
-#define        CPUSET_INTERSECTS_P(set1, set2) ((set1) & (set2))
-#define        CPUSET_NEXT(set)                (ffs(set) - 1)
-
-#define CPUSET_NULLSET                 ((__cpuset_t)0)
-#define        CPUSET_EMPTY_P(set)             ((set) == (__cpuset_t)0)
-#define        CPUSET_EQUAL_P(set1, set2)      ((set1) == (set2))
-#define        CPUSET_CLEAR(set)               ((set) = (__cpuset_t)0)
-#define        CPUSET_ASSIGN(set1, set2)       ((set1) = (set2))
-#define        CPUSET_MERGE(set1, set2)        ((set1) |= (set2))
-#define        CPUSET_REMOVE(set1, set2)       ((set1) & ~(set2))
-#define        CPUSET_SUBSET(set1, set2)       ((set1) & (set2))
-#define        CPUSET_INVERT(set)              (~(set))
-
-#endif /* _POWERPC_CPUSET_H_ */
diff -r d70f595f76a0 -r a65dcc586473 sys/arch/powerpc/include/types.h
--- a/sys/arch/powerpc/include/types.h  Wed Jul 17 23:25:25 2013 +0000
+++ b/sys/arch/powerpc/include/types.h  Wed Jul 17 23:27:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: types.h,v 1.47 2012/05/26 00:31:07 matt Exp $  */
+/*     $NetBSD: types.h,v 1.48 2013/07/17 23:27:02 matt Exp $  */
 
 /*-
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -69,7 +69,6 @@
 #endif
 
 typedef volatile int __cpu_simple_lock_t;
-typedef volatile __uint32_t __cpuset_t;
 
 #define __SIMPLELOCK_LOCKED    1
 #define __SIMPLELOCK_UNLOCKED  0



Home | Main Index | Thread Index | Old Index