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