diff options
Diffstat (limited to 'include/asm-ppc64/iSeries/HvLpConfig.h')
-rw-r--r-- | include/asm-ppc64/iSeries/HvLpConfig.h | 300 |
1 files changed, 79 insertions, 221 deletions
diff --git a/include/asm-ppc64/iSeries/HvLpConfig.h b/include/asm-ppc64/iSeries/HvLpConfig.h index bdbd70f42c9d..f1cf1e70ca3c 100644 --- a/include/asm-ppc64/iSeries/HvLpConfig.h +++ b/include/asm-ppc64/iSeries/HvLpConfig.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvLpConfig.h | 2 | * HvLpConfig.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,262 +19,120 @@ | |||
19 | #ifndef _HVLPCONFIG_H | 19 | #ifndef _HVLPCONFIG_H |
20 | #define _HVLPCONFIG_H | 20 | #define _HVLPCONFIG_H |
21 | 21 | ||
22 | //=========================================================================== | 22 | /* |
23 | // | 23 | * This file contains the interface to the LPAR configuration data |
24 | // This file contains the interface to the LPAR configuration data | 24 | * to determine which resources should be allocated to each partition. |
25 | // to determine which resources should be allocated to each partition. | 25 | */ |
26 | // | ||
27 | //=========================================================================== | ||
28 | 26 | ||
29 | #include <asm/iSeries/HvCallCfg.h> | 27 | #include <asm/iSeries/HvCallSc.h> |
30 | #include <asm/iSeries/HvTypes.h> | 28 | #include <asm/iSeries/HvTypes.h> |
31 | #include <asm/iSeries/ItLpNaca.h> | 29 | #include <asm/iSeries/ItLpNaca.h> |
32 | #include <asm/iSeries/LparData.h> | ||
33 | 30 | ||
34 | //------------------------------------------------------------------- | 31 | enum { |
35 | // Constants | 32 | HvCallCfg_Cur = 0, |
36 | //------------------------------------------------------------------- | 33 | HvCallCfg_Init = 1, |
34 | HvCallCfg_Max = 2, | ||
35 | HvCallCfg_Min = 3 | ||
36 | }; | ||
37 | |||
38 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 | ||
39 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 | ||
40 | #define HvCallCfgGetMsChunks HvCallCfg + 9 | ||
41 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 | ||
42 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 | ||
43 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 | ||
44 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 | ||
45 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | ||
37 | 46 | ||
38 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); | 47 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); |
39 | 48 | ||
40 | //=================================================================== | ||
41 | static inline HvLpIndex HvLpConfig_getLpIndex(void) | 49 | static inline HvLpIndex HvLpConfig_getLpIndex(void) |
42 | { | 50 | { |
43 | return itLpNaca.xLpIndex; | 51 | return itLpNaca.xLpIndex; |
44 | } | 52 | } |
45 | //=================================================================== | 53 | |
46 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) | 54 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) |
47 | { | 55 | { |
48 | return itLpNaca.xPrimaryLpIndex; | 56 | return itLpNaca.xPrimaryLpIndex; |
49 | } | 57 | } |
50 | //================================================================= | 58 | |
51 | static inline HvLpIndex HvLpConfig_getLps(void) | 59 | static inline u64 HvLpConfig_getMsChunks(void) |
52 | { | ||
53 | return HvCallCfg_getLps(); | ||
54 | } | ||
55 | //================================================================= | ||
56 | static inline HvLpIndexMap HvLpConfig_getActiveLpMap(void) | ||
57 | { | ||
58 | return HvCallCfg_getActiveLpMap(); | ||
59 | } | ||
60 | //================================================================= | ||
61 | static inline u64 HvLpConfig_getSystemMsMegs(void) | ||
62 | { | ||
63 | return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG; | ||
64 | } | ||
65 | //================================================================= | ||
66 | static inline u64 HvLpConfig_getSystemMsChunks(void) | ||
67 | { | ||
68 | return HvCallCfg_getSystemMsChunks(); | ||
69 | } | ||
70 | //================================================================= | ||
71 | static inline u64 HvLpConfig_getSystemMsPages(void) | ||
72 | { | ||
73 | return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK; | ||
74 | } | ||
75 | //================================================================ | ||
76 | static inline u64 HvLpConfig_getMsMegs(void) | ||
77 | { | ||
78 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) / HVCHUNKSPERMEG; | ||
79 | } | ||
80 | //================================================================ | ||
81 | static inline u64 HvLpConfig_getMsChunks(void) | ||
82 | { | ||
83 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
84 | } | ||
85 | //================================================================ | ||
86 | static inline u64 HvLpConfig_getMsPages(void) | ||
87 | { | ||
88 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * HVPAGESPERCHUNK; | ||
89 | } | ||
90 | //================================================================ | ||
91 | static inline u64 HvLpConfig_getMinMsMegs(void) | ||
92 | { | ||
93 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) / HVCHUNKSPERMEG; | ||
94 | } | ||
95 | //================================================================ | ||
96 | static inline u64 HvLpConfig_getMinMsChunks(void) | ||
97 | { | ||
98 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
99 | } | ||
100 | //================================================================ | ||
101 | static inline u64 HvLpConfig_getMinMsPages(void) | ||
102 | { | ||
103 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) * HVPAGESPERCHUNK; | ||
104 | } | ||
105 | //================================================================ | ||
106 | static inline u64 HvLpConfig_getMinRuntimeMsMegs(void) | ||
107 | { | ||
108 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) / HVCHUNKSPERMEG; | ||
109 | } | ||
110 | //=============================================================== | ||
111 | static inline u64 HvLpConfig_getMinRuntimeMsChunks(void) | ||
112 | { | ||
113 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()); | ||
114 | } | ||
115 | //=============================================================== | ||
116 | static inline u64 HvLpConfig_getMinRuntimeMsPages(void) | ||
117 | { | ||
118 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) * HVPAGESPERCHUNK; | ||
119 | } | ||
120 | //=============================================================== | ||
121 | static inline u64 HvLpConfig_getMaxMsMegs(void) | ||
122 | { | ||
123 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) / HVCHUNKSPERMEG; | ||
124 | } | ||
125 | //=============================================================== | ||
126 | static inline u64 HvLpConfig_getMaxMsChunks(void) | ||
127 | { | ||
128 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
129 | } | ||
130 | //=============================================================== | ||
131 | static inline u64 HvLpConfig_getMaxMsPages(void) | ||
132 | { | ||
133 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) * HVPAGESPERCHUNK; | ||
134 | } | ||
135 | //=============================================================== | ||
136 | static inline u64 HvLpConfig_getInitMsMegs(void) | ||
137 | { | ||
138 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) / HVCHUNKSPERMEG; | ||
139 | } | ||
140 | //=============================================================== | ||
141 | static inline u64 HvLpConfig_getInitMsChunks(void) | ||
142 | { | ||
143 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init); | ||
144 | } | ||
145 | //=============================================================== | ||
146 | static inline u64 HvLpConfig_getInitMsPages(void) | ||
147 | { return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) * HVPAGESPERCHUNK; | ||
148 | } | ||
149 | //=============================================================== | ||
150 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) | ||
151 | { | ||
152 | return HvCallCfg_getSystemPhysicalProcessors(); | ||
153 | } | ||
154 | //=============================================================== | ||
155 | static inline u64 HvLpConfig_getSystemLogicalProcessors(void) | ||
156 | { | ||
157 | return HvCallCfg_getSystemPhysicalProcessors() * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
158 | } | ||
159 | //=============================================================== | ||
160 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
161 | { | ||
162 | return HvCallCfg_getNumProcsInSharedPool(sPI); | ||
163 | } | ||
164 | //=============================================================== | ||
165 | static inline u64 HvLpConfig_getPhysicalProcessors(void) | ||
166 | { | ||
167 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
168 | } | ||
169 | //=============================================================== | ||
170 | static inline u64 HvLpConfig_getLogicalProcessors(void) | ||
171 | { | ||
172 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
173 | } | ||
174 | //=============================================================== | ||
175 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) | ||
176 | { | ||
177 | return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex()); | ||
178 | } | ||
179 | //=============================================================== | ||
180 | static inline u64 HvLpConfig_getSharedProcUnits(void) | ||
181 | { | ||
182 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
183 | } | ||
184 | //=============================================================== | ||
185 | static inline u64 HvLpConfig_getMinSharedProcUnits(void) | ||
186 | { | ||
187 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
188 | } | ||
189 | //=============================================================== | ||
190 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) | ||
191 | { | ||
192 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
193 | } | ||
194 | //=============================================================== | ||
195 | static inline u64 HvLpConfig_getMinPhysicalProcessors(void) | ||
196 | { | ||
197 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
198 | } | ||
199 | //=============================================================== | ||
200 | static inline u64 HvLpConfig_getMinLogicalProcessors(void) | ||
201 | { | ||
202 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
203 | } | ||
204 | //=============================================================== | ||
205 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) | ||
206 | { | ||
207 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
208 | } | ||
209 | //=============================================================== | ||
210 | static inline u64 HvLpConfig_getMaxLogicalProcessors(void) | ||
211 | { | ||
212 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
213 | } | ||
214 | //=============================================================== | ||
215 | static inline u64 HvLpConfig_getInitPhysicalProcessors(void) | ||
216 | { | 60 | { |
217 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init); | 61 | return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(), |
62 | HvCallCfg_Cur); | ||
218 | } | 63 | } |
219 | //=============================================================== | 64 | |
220 | static inline u64 HvLpConfig_getInitLogicalProcessors(void) | 65 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) |
221 | { | 66 | { |
222 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | 67 | return HvCall0(HvCallCfgGetSystemPhysicalProcessors); |
223 | } | 68 | } |
224 | //================================================================ | 69 | |
225 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) | 70 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) |
226 | { | 71 | { |
227 | return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline()); | 72 | return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI); |
228 | } | 73 | } |
229 | //=============================================================== | 74 | |
230 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(HvLpIndex lp) | 75 | static inline u64 HvLpConfig_getPhysicalProcessors(void) |
231 | { | 76 | { |
232 | return HvCallCfg_getVirtualLanIndexMap(lp); | 77 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), |
78 | HvCallCfg_Cur); | ||
233 | } | 79 | } |
234 | //================================================================ | 80 | |
235 | static inline HvLpIndex HvLpConfig_getBusOwner(HvBusNumber busNumber) | 81 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) |
236 | { | 82 | { |
237 | return HvCallCfg_getBusOwner(busNumber); | 83 | return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex()); |
238 | } | 84 | } |
239 | //=============================================================== | 85 | |
240 | static inline int HvLpConfig_isBusDedicated(HvBusNumber busNumber) | 86 | static inline u64 HvLpConfig_getSharedProcUnits(void) |
241 | { | 87 | { |
242 | return HvCallCfg_isBusDedicated(busNumber); | 88 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), |
89 | HvCallCfg_Cur); | ||
243 | } | 90 | } |
244 | //================================================================ | 91 | |
245 | static inline HvLpIndexMap HvLpConfig_getBusAllocation(HvBusNumber busNumber) | 92 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) |
246 | { | 93 | { |
247 | return HvCallCfg_getBusAllocation(busNumber); | 94 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), |
95 | HvCallCfg_Max); | ||
248 | } | 96 | } |
249 | //================================================================ | 97 | |
250 | // returns the absolute real address of the load area | 98 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) |
251 | static inline u64 HvLpConfig_getLoadAddress(void) | ||
252 | { | 99 | { |
253 | return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff; | 100 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), |
101 | HvCallCfg_Max); | ||
254 | } | 102 | } |
255 | //================================================================ | 103 | |
256 | static inline u64 HvLpConfig_getLoadPages(void) | 104 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp( |
257 | { | 105 | HvLpIndex lp) |
258 | return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK; | 106 | { |
107 | /* | ||
108 | * This is a new function in V5R1 so calls to this on older | ||
109 | * hypervisors will return -1 | ||
110 | */ | ||
111 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); | ||
112 | if (retVal == -1) | ||
113 | retVal = 0; | ||
114 | return retVal; | ||
259 | } | 115 | } |
260 | //================================================================ | 116 | |
261 | static inline int HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber) | 117 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) |
262 | { | 118 | { |
263 | HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber); | 119 | return HvLpConfig_getVirtualLanIndexMapForLp( |
264 | return (busOwner == HvLpConfig_getLpIndex()); | 120 | HvLpConfig_getLpIndex_outline()); |
265 | } | 121 | } |
266 | //================================================================ | 122 | |
267 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, HvLpIndex lp2) | 123 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, |
124 | HvLpIndex lp2) | ||
268 | { | 125 | { |
269 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = HvCallCfg_getVirtualLanIndexMap( lp1 ); | 126 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = |
270 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = HvCallCfg_getVirtualLanIndexMap( lp2 ); | 127 | HvLpConfig_getVirtualLanIndexMapForLp(lp1); |
128 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = | ||
129 | HvLpConfig_getVirtualLanIndexMapForLp(lp2); | ||
271 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); | 130 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); |
272 | } | 131 | } |
273 | //================================================================ | 132 | |
274 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) | 133 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) |
275 | { | 134 | { |
276 | return HvCallCfg_getHostingLpIndex(lp); | 135 | return HvCall1(HvCallCfgGetHostingLpIndex, lp); |
277 | } | 136 | } |
278 | //================================================================ | ||
279 | 137 | ||
280 | #endif /* _HVLPCONFIG_H */ | 138 | #endif /* _HVLPCONFIG_H */ |