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 /* 22fb2f18f8Sesaxe * Copyright 2007 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 #pragma ident "%Z%%M% %I% %E% SMI" 30fb2f18f8Sesaxe 31fb2f18f8Sesaxe /* 32fb2f18f8Sesaxe * CMT PG class 33fb2f18f8Sesaxe */ 34fb2f18f8Sesaxe 35fb2f18f8Sesaxe #ifdef __cplusplus 36fb2f18f8Sesaxe extern "C" { 37fb2f18f8Sesaxe #endif 38fb2f18f8Sesaxe 39fb2f18f8Sesaxe #if (defined(_KERNEL) || defined(_KMEMUSER)) 40fb2f18f8Sesaxe #include <sys/group.h> 41fb2f18f8Sesaxe #include <sys/pghw.h> 42fb2f18f8Sesaxe #include <sys/types.h> 43fb2f18f8Sesaxe 44fb2f18f8Sesaxe /* 45fb2f18f8Sesaxe * CMT pg structure 46fb2f18f8Sesaxe */ 47fb2f18f8Sesaxe typedef struct pg_cmt { 48fb2f18f8Sesaxe struct pghw cmt_pg; /* physical grouping */ 49fb2f18f8Sesaxe struct group *cmt_siblings; /* CMT PGs to balance with */ 50fb2f18f8Sesaxe struct pg_cmt *cmt_parent; /* Parent CMT PG */ 51fb2f18f8Sesaxe struct group *cmt_children; /* Active children CMT PGs */ 52fb2f18f8Sesaxe int cmt_nchildren; /* # of children CMT PGs */ 53fb2f18f8Sesaxe int cmt_hint; /* hint for balancing */ 54fb2f18f8Sesaxe uint32_t cmt_nrunning; /* # of running threads */ 55fb2f18f8Sesaxe struct group cmt_cpus_actv; 56fb2f18f8Sesaxe bitset_t cmt_cpus_actv_set; /* bitset of active CPUs */ 57fb2f18f8Sesaxe } pg_cmt_t; 58fb2f18f8Sesaxe 59fb2f18f8Sesaxe 60fb2f18f8Sesaxe /* 61fb2f18f8Sesaxe * Change the number of running threads on the pg 62fb2f18f8Sesaxe */ 63fb2f18f8Sesaxe #define PG_NRUN_UPDATE(cp, n) (pg_cmt_load((cp), (n))) 64fb2f18f8Sesaxe 65fb2f18f8Sesaxe void pg_cmt_load(cpu_t *, int); 66fb2f18f8Sesaxe void pg_cmt_cpu_startup(cpu_t *); 67fb2f18f8Sesaxe int pg_cmt_can_migrate(cpu_t *, cpu_t *); 68fb2f18f8Sesaxe 69*d129bde2Sesaxe int pg_plat_cmt_load_bal_hw(pghw_type_t); 70*d129bde2Sesaxe int pg_plat_cmt_affinity_hw(pghw_type_t); 71*d129bde2Sesaxe 72fb2f18f8Sesaxe #endif /* !_KERNEL && !_KMEMUSER */ 73fb2f18f8Sesaxe 74fb2f18f8Sesaxe #ifdef __cplusplus 75fb2f18f8Sesaxe } 76fb2f18f8Sesaxe #endif 77fb2f18f8Sesaxe 78fb2f18f8Sesaxe #endif /* _CMT_H */ 79