Sun Sep 16 22:09:34 2012 UTC ()
Rename kcpuset_copybits() to kcpuset_export_u32() and thus be more specific
about the interface.


(rmind)
diff -r1.83 -r1.84 src/sys/arch/arm/arm32/arm32_machdep.c
diff -r1.2 -r1.3 src/sys/arch/arm/cortex/gic.c
diff -r1.48 -r1.49 src/sys/arch/xen/x86/x86_xpmap.c
diff -r1.7 -r1.8 src/sys/kern/subr_kcpuset.c
diff -r1.7 -r1.8 src/sys/sys/kcpuset.h

cvs diff -r1.83 -r1.84 src/sys/arch/arm/arm32/arm32_machdep.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm32/arm32_machdep.c 2012/08/31 23:59:51 1.83
+++ src/sys/arch/arm/arm32/arm32_machdep.c 2012/09/16 22:09:33 1.84
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: arm32_machdep.c,v 1.83 2012/08/31 23:59:51 matt Exp $ */ 1/* $NetBSD: arm32_machdep.c,v 1.84 2012/09/16 22:09:33 rmind Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1994-1998 Mark Brinicombe. 4 * Copyright (c) 1994-1998 Mark Brinicombe.
5 * Copyright (c) 1994 Brini. 5 * Copyright (c) 1994 Brini.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software written for Brini by Mark Brinicombe 8 * This code is derived from software written for Brini by Mark Brinicombe
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE. 36 * SUCH DAMAGE.
37 * 37 *
38 * Machine dependent functions for kernel setup 38 * Machine dependent functions for kernel setup
39 * 39 *
40 * Created : 17/09/94 40 * Created : 17/09/94
41 * Updated : 18/04/01 updated for new wscons 41 * Updated : 18/04/01 updated for new wscons
42 */ 42 */
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.83 2012/08/31 23:59:51 matt Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.84 2012/09/16 22:09:33 rmind Exp $");
46 46
47#include "opt_modular.h" 47#include "opt_modular.h"
48#include "opt_md.h" 48#include "opt_md.h"
49#include "opt_pmap_debug.h" 49#include "opt_pmap_debug.h"
50 50
51#include <sys/param.h> 51#include <sys/param.h>
52#include <sys/systm.h> 52#include <sys/systm.h>
53#include <sys/reboot.h> 53#include <sys/reboot.h>
54#include <sys/proc.h> 54#include <sys/proc.h>
55#include <sys/kauth.h> 55#include <sys/kauth.h>
56#include <sys/kernel.h> 56#include <sys/kernel.h>
57#include <sys/mbuf.h> 57#include <sys/mbuf.h>
58#include <sys/mount.h> 58#include <sys/mount.h>
@@ -518,27 +518,27 @@ vaddr_t @@ -518,27 +518,27 @@ vaddr_t
518cpu_uarea_alloc_idlelwp(struct cpu_info *ci) 518cpu_uarea_alloc_idlelwp(struct cpu_info *ci)
519{ 519{
520 const vaddr_t va = idlestack.pv_va + ci->ci_cpuid * USPACE; 520 const vaddr_t va = idlestack.pv_va + ci->ci_cpuid * USPACE;
521 // printf("%s: %s: va=%lx\n", __func__, ci->ci_data.cpu_name, va); 521 // printf("%s: %s: va=%lx\n", __func__, ci->ci_data.cpu_name, va);
522 return va; 522 return va;
523} 523}
524#endif 524#endif
525 525
526#ifdef MULTIPROCESSOR 526#ifdef MULTIPROCESSOR
527void 527void
528cpu_boot_secondary_processors(void) 528cpu_boot_secondary_processors(void)
529{ 529{
530 uint32_t mbox; 530 uint32_t mbox;
531 kcpuset_copybits(kcpuset_attached, &mbox, sizeof(mbox)); 531 kcpuset_export_u32(kcpuset_attached, &mbox, sizeof(mbox));
532 atomic_swap_32(&arm_cpu_mbox, mbox); 532 atomic_swap_32(&arm_cpu_mbox, mbox);
533 membar_producer(); 533 membar_producer();
534#ifdef _ARM_ARCH_7 534#ifdef _ARM_ARCH_7
535 __asm __volatile("sev; sev; sev"); 535 __asm __volatile("sev; sev; sev");
536#endif 536#endif
537} 537}
538 538
539void 539void
540xc_send_ipi(struct cpu_info *ci) 540xc_send_ipi(struct cpu_info *ci)
541{ 541{
542 KASSERT(kpreempt_disabled()); 542 KASSERT(kpreempt_disabled());
543 KASSERT(curcpu() != ci); 543 KASSERT(curcpu() != ci);
544 544

cvs diff -r1.2 -r1.3 src/sys/arch/arm/cortex/gic.c (expand / switch to unified diff)

--- src/sys/arch/arm/cortex/gic.c 2012/09/14 03:52:50 1.2
+++ src/sys/arch/arm/cortex/gic.c 2012/09/16 22:09:34 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gic.c,v 1.2 2012/09/14 03:52:50 matt Exp $ */ 1/* $NetBSD: gic.c,v 1.3 2012/09/16 22:09:34 rmind Exp $ */
2/*- 2/*-
3 * Copyright (c) 2012 The NetBSD Foundation, Inc. 3 * Copyright (c) 2012 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas of 3am Software Foundry. 7 * by Matt Thomas of 3am Software Foundry.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31#define _INTR_PRIVATE 31#define _INTR_PRIVATE
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.2 2012/09/14 03:52:50 matt Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.3 2012/09/16 22:09:34 rmind Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/evcnt.h> 39#include <sys/evcnt.h>
40#include <sys/intr.h> 40#include <sys/intr.h>
41#include <sys/proc.h> 41#include <sys/proc.h>
42#include <sys/xcall.h> /* for xc_ipi_handler */ 42#include <sys/xcall.h> /* for xc_ipi_handler */
43 43
44#include <arm/armreg.h> 44#include <arm/armreg.h>
45#include <arm/cpufunc.h> 45#include <arm/cpufunc.h>
46#include <arm/atomic.h> 46#include <arm/atomic.h>
47 47
@@ -427,27 +427,27 @@ armgic_cpu_init(struct pic_softc *pic, s @@ -427,27 +427,27 @@ armgic_cpu_init(struct pic_softc *pic, s
427} 427}
428 428
429void 429void
430armgic_ipi_send(struct pic_softc *pic, const kcpuset_t *kcp, u_long ipi) 430armgic_ipi_send(struct pic_softc *pic, const kcpuset_t *kcp, u_long ipi)
431{ 431{
432 struct armgic_softc * const sc = PICTOSOFTC(pic); 432 struct armgic_softc * const sc = PICTOSOFTC(pic);
433 433
434 if (ipi == IPI_NOP) { 434 if (ipi == IPI_NOP) {
435 __asm __volatile("sev"); 435 __asm __volatile("sev");
436 return; 436 return;
437 } 437 }
438 438
439 uint32_t targets; 439 uint32_t targets;
440 kcpuset_copybits(kcp, &targets, sizeof(targets)); 440 kcpuset_export_u32(kcp, &targets, sizeof(targets));
441 uint32_t sgir = __SHIFTOUT(ARMGIC_SGI_IPIBASE + ipi, GICD_SGIR_SGIINTID); 441 uint32_t sgir = __SHIFTOUT(ARMGIC_SGI_IPIBASE + ipi, GICD_SGIR_SGIINTID);
442 sgir |= __SHIFTOUT(targets, GICD_SGIR_TargetList); 442 sgir |= __SHIFTOUT(targets, GICD_SGIR_TargetList);
443 443
444 printf("%s: %s: %#x", __func__, curcpu()->ci_data.cpu_name, sgir); 444 printf("%s: %s: %#x", __func__, curcpu()->ci_data.cpu_name, sgir);
445 gicd_write(sc, GICD_SGIR, sgir); 445 gicd_write(sc, GICD_SGIR, sgir);
446 printf("\n"); 446 printf("\n");
447} 447}
448#endif 448#endif
449 449
450int 450int
451armgic_match(device_t parent, cfdata_t cf, void *aux) 451armgic_match(device_t parent, cfdata_t cf, void *aux)
452{ 452{
453 struct mpcore_attach_args * const mpcaa = aux; 453 struct mpcore_attach_args * const mpcaa = aux;

cvs diff -r1.48 -r1.49 src/sys/arch/xen/x86/x86_xpmap.c (expand / switch to unified diff)

--- src/sys/arch/xen/x86/x86_xpmap.c 2012/08/21 09:06:02 1.48
+++ src/sys/arch/xen/x86/x86_xpmap.c 2012/09/16 22:09:34 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x86_xpmap.c,v 1.48 2012/08/21 09:06:02 bouyer Exp $ */ 1/* $NetBSD: x86_xpmap.c,v 1.49 2012/09/16 22:09:34 rmind Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Mathieu Ropert <mro@adviseo.fr> 4 * Copyright (c) 2006 Mathieu Ropert <mro@adviseo.fr>
5 * 5 *
6 * Permission to use, copy, modify, and distribute this software for any 6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above 7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies. 8 * copyright notice and this permission notice appear in all copies.
9 * 9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
@@ -59,27 +59,27 @@ @@ -59,27 +59,27 @@
59 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 59 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
60 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 60 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
61 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 61 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
62 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 62 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
63 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 63 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
64 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 64 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
65 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 65 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 66 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
67 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68 */ 68 */
69 69
70 70
71#include <sys/cdefs.h> 71#include <sys/cdefs.h>
72__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.48 2012/08/21 09:06:02 bouyer Exp $"); 72__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.49 2012/09/16 22:09:34 rmind Exp $");
73 73
74#include "opt_xen.h" 74#include "opt_xen.h"
75#include "opt_ddb.h" 75#include "opt_ddb.h"
76#include "ksyms.h" 76#include "ksyms.h"
77 77
78#include <sys/param.h> 78#include <sys/param.h>
79#include <sys/systm.h> 79#include <sys/systm.h>
80#include <sys/mutex.h> 80#include <sys/mutex.h>
81#include <sys/cpu.h> 81#include <sys/cpu.h>
82 82
83#include <uvm/uvm.h> 83#include <uvm/uvm.h>
84 84
85#include <x86/pmap.h> 85#include <x86/pmap.h>
@@ -370,27 +370,27 @@ xpq_queue_invlpg(vaddr_t va) @@ -370,27 +370,27 @@ xpq_queue_invlpg(vaddr_t va)
370 XENPRINTK2(("xpq_queue_invlpg %#" PRIxVADDR "\n", va)); 370 XENPRINTK2(("xpq_queue_invlpg %#" PRIxVADDR "\n", va));
371 op.cmd = MMUEXT_INVLPG_LOCAL; 371 op.cmd = MMUEXT_INVLPG_LOCAL;
372 op.arg1.linear_addr = (va & ~PAGE_MASK); 372 op.arg1.linear_addr = (va & ~PAGE_MASK);
373 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) 373 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0)
374 panic("xpq_queue_invlpg"); 374 panic("xpq_queue_invlpg");
375} 375}
376 376
377void 377void
378xen_mcast_invlpg(vaddr_t va, kcpuset_t *kc) 378xen_mcast_invlpg(vaddr_t va, kcpuset_t *kc)
379{ 379{
380 xcpumask_t xcpumask; 380 xcpumask_t xcpumask;
381 mmuext_op_t op; 381 mmuext_op_t op;
382 382
383 kcpuset_copybits(kc, &xcpumask.xcpum_km[0], sizeof(xcpumask)); 383 kcpuset_export_u32(kc, &xcpumask.xcpum_km[0], sizeof(xcpumask));
384 384
385 /* Flush pending page updates */ 385 /* Flush pending page updates */
386 xpq_flush_queue(); 386 xpq_flush_queue();
387 387
388 op.cmd = MMUEXT_INVLPG_MULTI; 388 op.cmd = MMUEXT_INVLPG_MULTI;
389 op.arg1.linear_addr = va; 389 op.arg1.linear_addr = va;
390 op.arg2.vcpumask = &xcpumask.xcpum_xm; 390 op.arg2.vcpumask = &xcpumask.xcpum_xm;
391 391
392 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) { 392 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) {
393 panic("xpq_queue_invlpg_all"); 393 panic("xpq_queue_invlpg_all");
394 } 394 }
395 395
396 return; 396 return;
@@ -411,27 +411,27 @@ xen_bcast_invlpg(vaddr_t va) @@ -411,27 +411,27 @@ xen_bcast_invlpg(vaddr_t va)
411 panic("xpq_queue_invlpg_all"); 411 panic("xpq_queue_invlpg_all");
412 } 412 }
413 413
414 return; 414 return;
415} 415}
416 416
417/* This is a synchronous call. */ 417/* This is a synchronous call. */
418void 418void
419xen_mcast_tlbflush(kcpuset_t *kc) 419xen_mcast_tlbflush(kcpuset_t *kc)
420{ 420{
421 xcpumask_t xcpumask; 421 xcpumask_t xcpumask;
422 mmuext_op_t op; 422 mmuext_op_t op;
423 423
424 kcpuset_copybits(kc, &xcpumask.xcpum_km[0], sizeof(xcpumask)); 424 kcpuset_export_u32(kc, &xcpumask.xcpum_km[0], sizeof(xcpumask));
425 425
426 /* Flush pending page updates */ 426 /* Flush pending page updates */
427 xpq_flush_queue(); 427 xpq_flush_queue();
428 428
429 op.cmd = MMUEXT_TLB_FLUSH_MULTI; 429 op.cmd = MMUEXT_TLB_FLUSH_MULTI;
430 op.arg2.vcpumask = &xcpumask.xcpum_xm; 430 op.arg2.vcpumask = &xcpumask.xcpum_xm;
431 431
432 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) { 432 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) {
433 panic("xpq_queue_invlpg_all"); 433 panic("xpq_queue_invlpg_all");
434 } 434 }
435 435
436 return; 436 return;
437} 437}

cvs diff -r1.7 -r1.8 src/sys/kern/subr_kcpuset.c (expand / switch to unified diff)

--- src/sys/kern/subr_kcpuset.c 2012/08/20 22:01:29 1.7
+++ src/sys/kern/subr_kcpuset.c 2012/09/16 22:09:33 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: subr_kcpuset.c,v 1.7 2012/08/20 22:01:29 rmind Exp $ */ 1/* $NetBSD: subr_kcpuset.c,v 1.8 2012/09/16 22:09:33 rmind Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2011 The NetBSD Foundation, Inc. 4 * Copyright (c) 2011 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Mindaugas Rasiukevicius. 8 * by Mindaugas Rasiukevicius.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 31
32/* 32/*
33 * Kernel CPU set implementation. 33 * Kernel CPU set implementation.
34 * 34 *
35 * Interface can be used by kernel subsystems as a unified dynamic CPU 35 * Interface can be used by kernel subsystems as a unified dynamic CPU
36 * bitset implementation handling many CPUs. Facility also supports early 36 * bitset implementation handling many CPUs. Facility also supports early
37 * use by MD code on boot, as it fixups bitsets on further boot. 37 * use by MD code on boot, as it fixups bitsets on further boot.
38 * 38 *
39 * TODO: 39 * TODO:
40 * - Handle "reverse" bitset on fixup/grow. 40 * - Handle "reverse" bitset on fixup/grow.
41 */ 41 */
42 42
43#include <sys/cdefs.h> 43#include <sys/cdefs.h>
44__KERNEL_RCSID(0, "$NetBSD: subr_kcpuset.c,v 1.7 2012/08/20 22:01:29 rmind Exp $"); 44__KERNEL_RCSID(0, "$NetBSD: subr_kcpuset.c,v 1.8 2012/09/16 22:09:33 rmind Exp $");
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/types.h> 47#include <sys/types.h>
48 48
49#include <sys/atomic.h> 49#include <sys/atomic.h>
50#include <sys/sched.h> 50#include <sys/sched.h>
51#include <sys/kcpuset.h> 51#include <sys/kcpuset.h>
52#include <sys/pool.h> 52#include <sys/pool.h>
53 53
54/* Number of CPUs to support. */ 54/* Number of CPUs to support. */
55#define KC_MAXCPUS roundup2(MAXCPUS, 32) 55#define KC_MAXCPUS roundup2(MAXCPUS, 32)
56 56
57/* 57/*
@@ -292,27 +292,27 @@ kcpuset_copyout(kcpuset_t *kcp, cpuset_t @@ -292,27 +292,27 @@ kcpuset_copyout(kcpuset_t *kcp, cpuset_t
292 kcpuset_impl_t *kc __unused = KC_GETSTRUCT(kcp); 292 kcpuset_impl_t *kc __unused = KC_GETSTRUCT(kcp);
293 293
294 KASSERT(kc_initialised); 294 KASSERT(kc_initialised);
295 KASSERT(kc->kc_refcnt > 0); 295 KASSERT(kc->kc_refcnt > 0);
296 KASSERT(kc->kc_next == NULL); 296 KASSERT(kc->kc_next == NULL);
297 297
298 if (len > kc_bitsize) { /* XXX */ 298 if (len > kc_bitsize) { /* XXX */
299 return EINVAL; 299 return EINVAL;
300 } 300 }
301 return copyout(kcp, ucp, len); 301 return copyout(kcp, ucp, len);
302} 302}
303 303
304void 304void
305kcpuset_copybits(const kcpuset_t *kcp, uint32_t *bitfield, size_t len) 305kcpuset_export_u32(const kcpuset_t *kcp, uint32_t *bitfield, size_t len)
306{ 306{
307 size_t rlen = MIN(kc_bitsize, len); 307 size_t rlen = MIN(kc_bitsize, len);
308 308
309 KASSERT(kcp != NULL); 309 KASSERT(kcp != NULL);
310 memcpy(bitfield, kcp->bits, rlen); 310 memcpy(bitfield, kcp->bits, rlen);
311} 311}
312 312
313/* 313/*
314 * Routines to change bit field - zero, fill, copy, set, unset, etc. 314 * Routines to change bit field - zero, fill, copy, set, unset, etc.
315 */ 315 */
316 316
317void 317void
318kcpuset_zero(kcpuset_t *kcp) 318kcpuset_zero(kcpuset_t *kcp)

cvs diff -r1.7 -r1.8 src/sys/sys/kcpuset.h (expand / switch to unified diff)

--- src/sys/sys/kcpuset.h 2012/08/20 22:01:30 1.7
+++ src/sys/sys/kcpuset.h 2012/09/16 22:09:33 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kcpuset.h,v 1.7 2012/08/20 22:01:30 rmind Exp $ */ 1/* $NetBSD: kcpuset.h,v 1.8 2012/09/16 22:09:33 rmind Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008, 2011 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008, 2011 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas and Mindaugas Rasiukevicius. 8 * by Christos Zoulas and Mindaugas Rasiukevicius.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -40,34 +40,35 @@ typedef struct kcpuset kcpuset_t; @@ -40,34 +40,35 @@ typedef struct kcpuset kcpuset_t;
40#include <sys/sched.h> 40#include <sys/sched.h>
41 41
42void kcpuset_sysinit(void); 42void kcpuset_sysinit(void);
43 43
44void kcpuset_create(kcpuset_t **, bool); 44void kcpuset_create(kcpuset_t **, bool);
45void kcpuset_destroy(kcpuset_t *); 45void kcpuset_destroy(kcpuset_t *);
46void kcpuset_copy(kcpuset_t *, kcpuset_t *); 46void kcpuset_copy(kcpuset_t *, kcpuset_t *);
47 47
48void kcpuset_use(kcpuset_t *); 48void kcpuset_use(kcpuset_t *);
49void kcpuset_unuse(kcpuset_t *, kcpuset_t **); 49void kcpuset_unuse(kcpuset_t *, kcpuset_t **);
50 50
51int kcpuset_copyin(const cpuset_t *, kcpuset_t *, size_t); 51int kcpuset_copyin(const cpuset_t *, kcpuset_t *, size_t);
52int kcpuset_copyout(kcpuset_t *, cpuset_t *, size_t); 52int kcpuset_copyout(kcpuset_t *, cpuset_t *, size_t);
53void kcpuset_copybits(const kcpuset_t *, uint32_t *, size_t); 
54 53
55void kcpuset_zero(kcpuset_t *); 54void kcpuset_zero(kcpuset_t *);
56void kcpuset_fill(kcpuset_t *); 55void kcpuset_fill(kcpuset_t *);
57void kcpuset_set(kcpuset_t *, cpuid_t); 56void kcpuset_set(kcpuset_t *, cpuid_t);
58void kcpuset_clear(kcpuset_t *, cpuid_t); 57void kcpuset_clear(kcpuset_t *, cpuid_t);
59 58
60bool kcpuset_isset(kcpuset_t *, cpuid_t); 59bool kcpuset_isset(kcpuset_t *, cpuid_t);
61bool kcpuset_isotherset(kcpuset_t *, cpuid_t); 60bool kcpuset_isotherset(kcpuset_t *, cpuid_t);
62bool kcpuset_iszero(kcpuset_t *); 61bool kcpuset_iszero(kcpuset_t *);
63bool kcpuset_match(const kcpuset_t *, const kcpuset_t *); 62bool kcpuset_match(const kcpuset_t *, const kcpuset_t *);
64void kcpuset_merge(kcpuset_t *, kcpuset_t *); 63void kcpuset_merge(kcpuset_t *, kcpuset_t *);
65void kcpuset_intersect(kcpuset_t *, kcpuset_t *); 64void kcpuset_intersect(kcpuset_t *, kcpuset_t *);
66int kcpuset_countset(kcpuset_t *); 65int kcpuset_countset(kcpuset_t *);
67 66
68void kcpuset_atomic_set(kcpuset_t *, cpuid_t); 67void kcpuset_atomic_set(kcpuset_t *, cpuid_t);
69void kcpuset_atomic_clear(kcpuset_t *, cpuid_t); 68void kcpuset_atomic_clear(kcpuset_t *, cpuid_t);
70 69
 70void kcpuset_export_u32(const kcpuset_t *, uint32_t *, size_t);
 71
71#endif 72#endif
72 73
73#endif /* _SYS_KCPUSET_H_ */ 74#endif /* _SYS_KCPUSET_H_ */