xref: /titanic_50/usr/src/uts/common/sys/cmt.h (revision 59ac0c1669407488b67ae9e273667a340dccc611)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_CMT_H
27 #define	_CMT_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * CMT PG class
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #if (defined(_KERNEL) || defined(_KMEMUSER))
40 #include <sys/group.h>
41 #include <sys/pghw.h>
42 #include <sys/types.h>
43 
44 /*
45  * CMT pg structure
46  */
47 typedef struct pg_cmt {
48 	struct pghw	cmt_pg;			/* physical grouping */
49 	struct group	*cmt_siblings;		/* CMT PGs to balance with */
50 	struct pg_cmt	*cmt_parent;		/* Parent CMT PG */
51 	struct group	*cmt_children;		/* Active children CMT PGs */
52 	int		cmt_nchildren;		/* # of children CMT PGs */
53 	int		cmt_hint;		/* hint for balancing */
54 	uint32_t	cmt_nrunning;		/* # of running threads */
55 	struct group	cmt_cpus_actv;
56 	bitset_t	cmt_cpus_actv_set;	/* bitset of active CPUs */
57 } pg_cmt_t;
58 
59 
60 /*
61  * Change the number of running threads on the pg
62  */
63 #define	PG_NRUN_UPDATE(cp, n)	(pg_cmt_load((cp), (n)))
64 
65 void		pg_cmt_load(cpu_t *, int);
66 void		pg_cmt_cpu_startup(cpu_t *);
67 int		pg_cmt_can_migrate(cpu_t *, cpu_t *);
68 
69 int		pg_plat_cmt_load_bal_hw(pghw_type_t);
70 int		pg_plat_cmt_affinity_hw(pghw_type_t);
71 
72 #endif	/* !_KERNEL && !_KMEMUSER */
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif /* _CMT_H */
79