xref: /titanic_50/usr/src/uts/sun4/os/lgrpplat.c (revision affbd3ccca8e26191a210ec9f9ffae170f919afd)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h>
317c478bd9Sstevel@tonic-gate #include <sys/lgrp.h>
327c478bd9Sstevel@tonic-gate #include <sys/memnode.h>
337c478bd9Sstevel@tonic-gate #include <sys/mman.h>
347c478bd9Sstevel@tonic-gate #include <sys/param.h>
357c478bd9Sstevel@tonic-gate #include <sys/systm.h>
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate #include <vm/seg_spt.h>
387c478bd9Sstevel@tonic-gate #include <vm/seg_vn.h>
39*affbd3ccSkchow #include <vm/vm_dep.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #include <sys/errno.h>
427c478bd9Sstevel@tonic-gate #include <sys/kstat.h>
437c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
447c478bd9Sstevel@tonic-gate #include <sys/memlist.h>
457c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * Platform-specific support for lgroups common to sun4 based platforms.
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  * Those sun4 platforms wanting default lgroup behavior build with
517c478bd9Sstevel@tonic-gate  * MAX_MEM_NODES = 1.  Those sun4 platforms wanting other than default
527c478bd9Sstevel@tonic-gate  * lgroup behavior build with MAX_MEM_NODES > 1 and provide unique
537c478bd9Sstevel@tonic-gate  * definitions to replace the #pragma weak interfaces.
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate /*
577c478bd9Sstevel@tonic-gate  * For now, there are 0 or 1 memnodes per lgroup on sun4 based platforms,
587c478bd9Sstevel@tonic-gate  * plus the root lgroup.
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate #define	NLGRP	(MAX_MEM_NODES + 1)
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate /*
637c478bd9Sstevel@tonic-gate  * Allocate lgrp and lgrp stat arrays statically.
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate struct lgrp_stats lgrp_stats[NLGRP];
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate static int nlgrps_alloc;
687c478bd9Sstevel@tonic-gate static lgrp_t lgrp_space[NLGRP];
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * Arrays mapping lgroup handles to memnodes and vice versa.  This helps
727c478bd9Sstevel@tonic-gate  * manage a copy-rename operation during DR, which moves memory from one
737c478bd9Sstevel@tonic-gate  * board to another without changing addresses/pfns or memnodes.
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate int lgrphand_to_memnode[MAX_MEM_NODES];
767c478bd9Sstevel@tonic-gate int memnode_to_lgrphand[MAX_MEM_NODES];
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate static pgcnt_t lgrp_plat_mem_size_default(lgrp_handle_t, lgrp_mem_query_t);
797c478bd9Sstevel@tonic-gate int plat_lgrphand_to_mem_node(lgrp_handle_t);
807c478bd9Sstevel@tonic-gate lgrp_handle_t plat_mem_node_to_lgrphand(int);
817c478bd9Sstevel@tonic-gate void plat_assign_lgrphand_to_mem_node(lgrp_handle_t, int);
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate  * Default sun4 lgroup interfaces which should be overriden
857c478bd9Sstevel@tonic-gate  * by platform module.
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate extern void plat_lgrp_init(void);
887c478bd9Sstevel@tonic-gate extern void plat_lgrp_config(lgrp_config_flag_t, uintptr_t);
897c478bd9Sstevel@tonic-gate extern lgrp_handle_t plat_lgrp_cpu_to_hand(processorid_t);
907c478bd9Sstevel@tonic-gate extern int plat_lgrp_latency(lgrp_handle_t, lgrp_handle_t);
917c478bd9Sstevel@tonic-gate extern lgrp_handle_t plat_lgrp_root_hand(void);
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #pragma weak plat_lgrp_init
947c478bd9Sstevel@tonic-gate #pragma weak plat_lgrp_config
957c478bd9Sstevel@tonic-gate #pragma weak plat_lgrp_cpu_to_hand
967c478bd9Sstevel@tonic-gate #pragma weak plat_lgrp_latency
977c478bd9Sstevel@tonic-gate #pragma weak plat_lgrp_root_hand
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate int mpo_disabled = 0;
1007c478bd9Sstevel@tonic-gate lgrp_handle_t lgrp_default_handle = LGRP_DEFAULT_HANDLE;
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate void
1037c478bd9Sstevel@tonic-gate lgrp_plat_init(void)
1047c478bd9Sstevel@tonic-gate {
1057c478bd9Sstevel@tonic-gate 	int i;
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate 	/*
1087c478bd9Sstevel@tonic-gate 	 * Initialize lookup tables to invalid values so we catch
1097c478bd9Sstevel@tonic-gate 	 * any illegal use of them.
1107c478bd9Sstevel@tonic-gate 	 */
1117c478bd9Sstevel@tonic-gate 	for (i = 0; i < MAX_MEM_NODES; i++) {
1127c478bd9Sstevel@tonic-gate 		memnode_to_lgrphand[i] = -1;
1137c478bd9Sstevel@tonic-gate 		lgrphand_to_memnode[i] = -1;
1147c478bd9Sstevel@tonic-gate 	}
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() == 1) {
1177c478bd9Sstevel@tonic-gate 		max_mem_nodes = 1;
1187c478bd9Sstevel@tonic-gate 		return;
1197c478bd9Sstevel@tonic-gate 	}
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate 	if (&plat_lgrp_cpu_to_hand)
1227c478bd9Sstevel@tonic-gate 		max_mem_nodes = MAX_MEM_NODES;
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate 	if (&plat_lgrp_init)
1257c478bd9Sstevel@tonic-gate 		plat_lgrp_init();
1267c478bd9Sstevel@tonic-gate }
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate void
1297c478bd9Sstevel@tonic-gate lgrp_plat_main_init(void)
1307c478bd9Sstevel@tonic-gate {
1317c478bd9Sstevel@tonic-gate }
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /* ARGSUSED */
1347c478bd9Sstevel@tonic-gate void
1357c478bd9Sstevel@tonic-gate lgrp_plat_config(lgrp_config_flag_t flag, uintptr_t arg)
1367c478bd9Sstevel@tonic-gate {
1377c478bd9Sstevel@tonic-gate 	if (max_mem_nodes == 1)
1387c478bd9Sstevel@tonic-gate 		return;
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate 	if (&plat_lgrp_config) {
1417c478bd9Sstevel@tonic-gate 		plat_lgrp_config(flag, arg);
1427c478bd9Sstevel@tonic-gate 	}
1437c478bd9Sstevel@tonic-gate }
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate lgrp_handle_t
1467c478bd9Sstevel@tonic-gate lgrp_plat_cpu_to_hand(processorid_t id)
1477c478bd9Sstevel@tonic-gate {
1487c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() > 1 && &plat_lgrp_cpu_to_hand)
1497c478bd9Sstevel@tonic-gate 		return (plat_lgrp_cpu_to_hand(id));
1507c478bd9Sstevel@tonic-gate 	else
1517c478bd9Sstevel@tonic-gate 		return (LGRP_DEFAULT_HANDLE);
1527c478bd9Sstevel@tonic-gate }
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /*
1557c478bd9Sstevel@tonic-gate  * Lgroup interfaces common to all sun4 platforms.
1567c478bd9Sstevel@tonic-gate  */
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate /*
1597c478bd9Sstevel@tonic-gate  * Return the platform handle of the lgroup that contains the physical memory
1607c478bd9Sstevel@tonic-gate  * corresponding to the given page frame number
1617c478bd9Sstevel@tonic-gate  */
1627c478bd9Sstevel@tonic-gate lgrp_handle_t
1637c478bd9Sstevel@tonic-gate lgrp_plat_pfn_to_hand(pfn_t pfn)
1647c478bd9Sstevel@tonic-gate {
1657c478bd9Sstevel@tonic-gate 	int	mnode;
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() == 1 || max_mem_nodes == 1)
1687c478bd9Sstevel@tonic-gate 		return (LGRP_DEFAULT_HANDLE);
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate 	if (pfn > physmax)
1717c478bd9Sstevel@tonic-gate 		return (LGRP_NULL_HANDLE);
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate 	mnode = PFN_2_MEM_NODE(pfn);
1747c478bd9Sstevel@tonic-gate 	return (MEM_NODE_2_LGRPHAND(mnode));
1757c478bd9Sstevel@tonic-gate }
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * Return the maximum number of supported lgroups
1797c478bd9Sstevel@tonic-gate  */
1807c478bd9Sstevel@tonic-gate int
1817c478bd9Sstevel@tonic-gate lgrp_plat_max_lgrps(void)
1827c478bd9Sstevel@tonic-gate {
1837c478bd9Sstevel@tonic-gate 	return (NLGRP);
1847c478bd9Sstevel@tonic-gate }
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * Return the number of free pages in an lgroup.
1887c478bd9Sstevel@tonic-gate  *
1897c478bd9Sstevel@tonic-gate  * For query of LGRP_MEM_SIZE_FREE, return the number of base pagesize
1907c478bd9Sstevel@tonic-gate  * pages on freelists.  For query of LGRP_MEM_SIZE_AVAIL, return the
1917c478bd9Sstevel@tonic-gate  * number of allocatable base pagesize pages corresponding to the
1927c478bd9Sstevel@tonic-gate  * lgroup (e.g. do not include page_t's, BOP_ALLOC()'ed memory, ..)
1937c478bd9Sstevel@tonic-gate  * For query of LGRP_MEM_SIZE_INSTALL, return the amount of physical
1947c478bd9Sstevel@tonic-gate  * memory installed, regardless of whether or not it's usable.
1957c478bd9Sstevel@tonic-gate  */
1967c478bd9Sstevel@tonic-gate pgcnt_t
1977c478bd9Sstevel@tonic-gate lgrp_plat_mem_size(lgrp_handle_t plathand, lgrp_mem_query_t query)
1987c478bd9Sstevel@tonic-gate {
1997c478bd9Sstevel@tonic-gate 	int	mnode;
2007c478bd9Sstevel@tonic-gate 	pgcnt_t	npgs = (pgcnt_t)0;
2017c478bd9Sstevel@tonic-gate 	extern struct memlist *phys_avail;
2027c478bd9Sstevel@tonic-gate 	extern struct memlist *phys_install;
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() == 1 || max_mem_nodes == 1 || mpo_disabled ||
2067c478bd9Sstevel@tonic-gate 	    plathand == LGRP_DEFAULT_HANDLE)
2077c478bd9Sstevel@tonic-gate 		return (lgrp_plat_mem_size_default(plathand, query));
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate 	if (plathand != LGRP_NULL_HANDLE) {
2107c478bd9Sstevel@tonic-gate 		mnode = plat_lgrphand_to_mem_node(plathand);
2117c478bd9Sstevel@tonic-gate 		if (mnode >= 0 && mem_node_config[mnode].exists) {
2127c478bd9Sstevel@tonic-gate 			switch (query) {
2137c478bd9Sstevel@tonic-gate 			case LGRP_MEM_SIZE_FREE:
214*affbd3ccSkchow 				npgs = MNODE_PGCNT(mnode);
2157c478bd9Sstevel@tonic-gate 				break;
2167c478bd9Sstevel@tonic-gate 			case LGRP_MEM_SIZE_AVAIL:
2177c478bd9Sstevel@tonic-gate 				npgs = mem_node_memlist_pages(mnode,
2187c478bd9Sstevel@tonic-gate 				    phys_avail);
2197c478bd9Sstevel@tonic-gate 				break;
2207c478bd9Sstevel@tonic-gate 			case LGRP_MEM_SIZE_INSTALL:
2217c478bd9Sstevel@tonic-gate 				npgs = mem_node_memlist_pages(mnode,
2227c478bd9Sstevel@tonic-gate 				    phys_install);
2237c478bd9Sstevel@tonic-gate 				break;
2247c478bd9Sstevel@tonic-gate 			default:
2257c478bd9Sstevel@tonic-gate 				break;
2267c478bd9Sstevel@tonic-gate 			}
2277c478bd9Sstevel@tonic-gate 		}
2287c478bd9Sstevel@tonic-gate 	}
2297c478bd9Sstevel@tonic-gate 	return (npgs);
2307c478bd9Sstevel@tonic-gate }
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate /*
2337c478bd9Sstevel@tonic-gate  * Return latency between "from" and "to" lgroups
2347c478bd9Sstevel@tonic-gate  * If "from" or "to" is LGRP_NONE, then just return latency within other
2357c478bd9Sstevel@tonic-gate  * lgroup.  This latency number can only be used for relative comparison
2367c478bd9Sstevel@tonic-gate  * between lgroups on the running system, cannot be used across platforms,
2377c478bd9Sstevel@tonic-gate  * and may not reflect the actual latency.  It is platform and implementation
2387c478bd9Sstevel@tonic-gate  * specific, so platform gets to decide its value.
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate int
2417c478bd9Sstevel@tonic-gate lgrp_plat_latency(lgrp_handle_t from, lgrp_handle_t to)
2427c478bd9Sstevel@tonic-gate {
2437c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() > 1 && &plat_lgrp_latency)
2447c478bd9Sstevel@tonic-gate 		return (plat_lgrp_latency(from, to));
2457c478bd9Sstevel@tonic-gate 	else
2467c478bd9Sstevel@tonic-gate 		return (0);
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*
2507c478bd9Sstevel@tonic-gate  * Return platform handle for root lgroup
2517c478bd9Sstevel@tonic-gate  */
2527c478bd9Sstevel@tonic-gate lgrp_handle_t
2537c478bd9Sstevel@tonic-gate lgrp_plat_root_hand(void)
2547c478bd9Sstevel@tonic-gate {
2557c478bd9Sstevel@tonic-gate 	if (&plat_lgrp_root_hand)
2567c478bd9Sstevel@tonic-gate 		return (plat_lgrp_root_hand());
2577c478bd9Sstevel@tonic-gate 	else
2587c478bd9Sstevel@tonic-gate 		return (LGRP_DEFAULT_HANDLE);
2597c478bd9Sstevel@tonic-gate }
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /* Internal interfaces */
2627c478bd9Sstevel@tonic-gate /*
2637c478bd9Sstevel@tonic-gate  * Return the number of free, allocatable, or installed
2647c478bd9Sstevel@tonic-gate  * pages in an lgroup
2657c478bd9Sstevel@tonic-gate  * This is a copy of the MAX_MEM_NODES == 1 version of the routine
2667c478bd9Sstevel@tonic-gate  * used when MPO is disabled (i.e. single lgroup)
2677c478bd9Sstevel@tonic-gate  */
2687c478bd9Sstevel@tonic-gate /* ARGSUSED */
2697c478bd9Sstevel@tonic-gate static pgcnt_t
2707c478bd9Sstevel@tonic-gate lgrp_plat_mem_size_default(lgrp_handle_t lgrphand, lgrp_mem_query_t query)
2717c478bd9Sstevel@tonic-gate {
2727c478bd9Sstevel@tonic-gate 	extern struct memlist *phys_install;
2737c478bd9Sstevel@tonic-gate 	extern struct memlist *phys_avail;
2747c478bd9Sstevel@tonic-gate 	struct memlist *mlist;
2757c478bd9Sstevel@tonic-gate 	pgcnt_t npgs = 0;
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate 	switch (query) {
2787c478bd9Sstevel@tonic-gate 	case LGRP_MEM_SIZE_FREE:
2797c478bd9Sstevel@tonic-gate 		return ((pgcnt_t)freemem);
2807c478bd9Sstevel@tonic-gate 	case LGRP_MEM_SIZE_AVAIL:
2817c478bd9Sstevel@tonic-gate 		memlist_read_lock();
2827c478bd9Sstevel@tonic-gate 		for (mlist = phys_avail; mlist; mlist = mlist->next)
2837c478bd9Sstevel@tonic-gate 			npgs += btop(mlist->size);
2847c478bd9Sstevel@tonic-gate 		memlist_read_unlock();
2857c478bd9Sstevel@tonic-gate 		return (npgs);
2867c478bd9Sstevel@tonic-gate 	case LGRP_MEM_SIZE_INSTALL:
2877c478bd9Sstevel@tonic-gate 		memlist_read_lock();
2887c478bd9Sstevel@tonic-gate 		for (mlist = phys_install; mlist; mlist = mlist->next)
2897c478bd9Sstevel@tonic-gate 			npgs += btop(mlist->size);
2907c478bd9Sstevel@tonic-gate 		memlist_read_unlock();
2917c478bd9Sstevel@tonic-gate 		return (npgs);
2927c478bd9Sstevel@tonic-gate 	default:
2937c478bd9Sstevel@tonic-gate 		return ((pgcnt_t)0);
2947c478bd9Sstevel@tonic-gate 	}
2957c478bd9Sstevel@tonic-gate }
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate /*
2987c478bd9Sstevel@tonic-gate  * Return the memnode associated with the specified lgroup handle
2997c478bd9Sstevel@tonic-gate  */
3007c478bd9Sstevel@tonic-gate int
3017c478bd9Sstevel@tonic-gate plat_lgrphand_to_mem_node(lgrp_handle_t plathand)
3027c478bd9Sstevel@tonic-gate {
3037c478bd9Sstevel@tonic-gate 	int mnode;
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() == 1 || mpo_disabled || max_mem_nodes == 1)
3067c478bd9Sstevel@tonic-gate 		return (-1);
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate 	/*
3097c478bd9Sstevel@tonic-gate 	 * We should always receive a valid pointer to a platform
3107c478bd9Sstevel@tonic-gate 	 * handle, as we can not choose the allocation policy in
3117c478bd9Sstevel@tonic-gate 	 * this layer.
3127c478bd9Sstevel@tonic-gate 	 */
3137c478bd9Sstevel@tonic-gate 	ASSERT((int)plathand >= 0 && (int)plathand < max_mem_nodes);
3147c478bd9Sstevel@tonic-gate 
3157c478bd9Sstevel@tonic-gate 	mnode = lgrphand_to_memnode[(int)plathand];
3167c478bd9Sstevel@tonic-gate 	return (mnode);
3177c478bd9Sstevel@tonic-gate }
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate lgrp_handle_t
3207c478bd9Sstevel@tonic-gate plat_mem_node_to_lgrphand(int mnode)
3217c478bd9Sstevel@tonic-gate {
3227c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() == 1 || mpo_disabled || max_mem_nodes == 1)
3237c478bd9Sstevel@tonic-gate 		return (lgrp_default_handle);
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate 	ASSERT(mnode >= 0 && mnode < max_mem_nodes);
3267c478bd9Sstevel@tonic-gate 	return (memnode_to_lgrphand[mnode]);
3277c478bd9Sstevel@tonic-gate }
3287c478bd9Sstevel@tonic-gate 
3297c478bd9Sstevel@tonic-gate void
3307c478bd9Sstevel@tonic-gate plat_assign_lgrphand_to_mem_node(lgrp_handle_t plathand, int mnode)
3317c478bd9Sstevel@tonic-gate {
3327c478bd9Sstevel@tonic-gate 	if (lgrp_topo_ht_limit() == 1 || mpo_disabled || max_mem_nodes == 1)
3337c478bd9Sstevel@tonic-gate 		return;
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate 	ASSERT(plathand < max_mem_nodes);
3367c478bd9Sstevel@tonic-gate 	ASSERT(mnode >= 0 && mnode < max_mem_nodes);
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate 	lgrphand_to_memnode[plathand] = mnode;
3397c478bd9Sstevel@tonic-gate 	memnode_to_lgrphand[mnode] = plathand;
3407c478bd9Sstevel@tonic-gate }
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate lgrp_t *
3437c478bd9Sstevel@tonic-gate lgrp_plat_alloc(lgrp_id_t lgrpid)
3447c478bd9Sstevel@tonic-gate {
3457c478bd9Sstevel@tonic-gate 	lgrp_t *lgrp;
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate 	lgrp = &lgrp_space[nlgrps_alloc++];
3487c478bd9Sstevel@tonic-gate 	if (lgrpid >= NLGRP || nlgrps_alloc > NLGRP)
3497c478bd9Sstevel@tonic-gate 		return (NULL);
3507c478bd9Sstevel@tonic-gate 	return (lgrp);
3517c478bd9Sstevel@tonic-gate }
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate /*
3547c478bd9Sstevel@tonic-gate  * Probe memory in each node from current CPU to determine latency topology
3557c478bd9Sstevel@tonic-gate  */
3567c478bd9Sstevel@tonic-gate void
3577c478bd9Sstevel@tonic-gate lgrp_plat_probe(void)
3587c478bd9Sstevel@tonic-gate {
3597c478bd9Sstevel@tonic-gate }
360