xref: /titanic_41/usr/src/uts/sun4v/sys/mpo.h (revision 909c1a3310e6a348a85950c7179fefda50d0e37d)
1 
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License (the "License").
7  * You may not use this file except in compliance with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef _SYS_MPO_H
29 #define	_SYS_MPO_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <sys/lgrp.h>
38 
39 /*
40  * mpo.h -  Sun4v MPO common header file
41  *
42  */
43 
44 #define	PROP_LG_CPU_ID	"id"
45 #define	PROP_LG_MASK	"address-mask"
46 #define	PROP_LG_LATENCY "latency"
47 #define	PROP_LG_MATCH	"address-match"
48 #define	PROP_LG_MEM_LG	"memory-latency-group"
49 #define	PROP_LG_CPU	"cpu"
50 #define	PROP_LG_MBLOCK	"mblock"
51 #define	PROP_LG_BASE	"base"
52 #define	PROP_LG_SIZE	"size"
53 #define	PROP_LG_RA_PA_OFFSET	"address-congruence-offset"
54 
55 /* Macro to set the correspending bit if an mem-lg homeid is a member */
56 #define	HOMESET_ADD(homeset, home)\
57 	homeset |= ((int)1 << (home))
58 
59 /* Macro to check if an mem_lg homeid is a member of the homeset */
60 #define	MEM_LG_ISMEMBER(homeset, home)\
61 	((homeset) & ((uint64_t)1 << (home)))
62 
63 /* Structure to store CPU information from the MD */
64 
65 struct cpu_md {
66 	uint_t 	home;
67 	int	lgrp_index;
68 };
69 
70 /* Structure to store mem-lg information from the MD */
71 
72 struct lgrp_md {
73 	uint64_t	id;
74 	uint64_t	addr_mask;
75 	uint64_t	addr_match;
76 	uint64_t	latency;
77 	mde_cookie_t	node;
78 	int		ncpu;
79 };
80 
81 /* Structure to store mblock information retrieved from the MD */
82 
83 struct mblock_md {
84 	uint64_t	base;
85 	uint64_t	size;
86 	uint64_t	ra_to_pa;
87 	mde_cookie_t	node;
88 	pfn_t		base_pfn;
89 	pfn_t		end_pfn;
90 };
91 
92 /* Structure for memnode information for use by plat_pfn_to_mem_node */
93 
94 struct mnode_info {
95 	pfn_t		base_pfn;
96 	pfn_t		end_pfn;
97 };
98 
99 /* A stripe defines the portion of a mem_node that falls in one mblock */
100 typedef struct {
101 	pfn_t physbase;	/* first page in mnode in the corresponding mblock */
102 	pfn_t physmax;	/* last valid page in mnode in mblock */
103 	pfn_t offset;   /* stripe starts at physbase - offset */
104 	int exists;	/* set to 1 if mblock has memory in this mnode stripe */
105 } mem_stripe_t;
106 
107 /* These are used when MPO requires preallocated kvseg32 space */
108 extern	caddr_t	mpo_heap32_buf;
109 extern	size_t	mpo_heap32_bufsz;
110 extern void mpo_cpu_add(int cpuid);
111 extern void mpo_cpu_remove(int cpuid);
112 
113 #ifdef	__cplusplus
114 }
115 #endif
116 
117 #endif /* _SYS_MPO_H */
118