Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 8 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 13 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
Kelly Daly | ecb3ca27 | 2005-11-02 15:53:01 +1100 | [diff] [blame] | 18 | #ifndef _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H |
| 19 | #define _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 21 | /* |
| 22 | * This file contains the interface to the LPAR configuration data |
| 23 | * to determine which resources should be allocated to each partition. |
| 24 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Kelly Daly | 50592f5 | 2005-11-02 11:37:22 +1100 | [diff] [blame] | 26 | #include <asm/iseries/hv_call_sc.h> |
Kelly Daly | 1ec65d7 | 2005-11-02 13:46:07 +1100 | [diff] [blame] | 27 | #include <asm/iseries/hv_types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 29 | enum { |
| 30 | HvCallCfg_Cur = 0, |
| 31 | HvCallCfg_Init = 1, |
| 32 | HvCallCfg_Max = 2, |
| 33 | HvCallCfg_Min = 3 |
| 34 | }; |
| 35 | |
| 36 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 |
| 37 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 |
| 38 | #define HvCallCfgGetMsChunks HvCallCfg + 9 |
| 39 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 |
| 40 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 |
| 41 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 |
| 42 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 |
| 43 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); |
Michael Ellerman | a2ced11 | 2006-07-13 17:52:12 +1000 | [diff] [blame] | 46 | extern HvLpIndex HvLpConfig_getLpIndex(void); |
| 47 | extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void); |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 48 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 49 | static inline u64 HvLpConfig_getMsChunks(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 51 | return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(), |
| 52 | HvCallCfg_Cur); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 54 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 55 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 57 | return HvCall0(HvCallCfgGetSystemPhysicalProcessors); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 59 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 60 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 62 | return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 64 | |
| 65 | static inline u64 HvLpConfig_getPhysicalProcessors(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 67 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 68 | HvCallCfg_Cur); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 70 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 71 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 73 | return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 75 | |
| 76 | static inline u64 HvLpConfig_getSharedProcUnits(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 78 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 79 | HvCallCfg_Cur); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 81 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 82 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 84 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 85 | HvCallCfg_Max); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 87 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 88 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 90 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 91 | HvCallCfg_Max); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 93 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 94 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp( |
| 95 | HvLpIndex lp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 97 | /* |
| 98 | * This is a new function in V5R1 so calls to this on older |
| 99 | * hypervisors will return -1 |
| 100 | */ |
| 101 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); |
| 102 | if (retVal == -1) |
| 103 | retVal = 0; |
| 104 | return retVal; |
| 105 | } |
| 106 | |
| 107 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) |
| 108 | { |
| 109 | return HvLpConfig_getVirtualLanIndexMapForLp( |
| 110 | HvLpConfig_getLpIndex_outline()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 112 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 113 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, |
| 114 | HvLpIndex lp2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | { |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 116 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 117 | HvLpConfig_getVirtualLanIndexMapForLp(lp1); |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 118 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 119 | HvLpConfig_getVirtualLanIndexMapForLp(lp2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); |
| 121 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 122 | |
| 123 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | { |
Stephen Rothwell | 2310c97 | 2005-06-21 17:15:38 -0700 | [diff] [blame] | 125 | return HvCall1(HvCallCfgGetHostingLpIndex, lp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
Kelly Daly | ecb3ca27 | 2005-11-02 15:53:01 +1100 | [diff] [blame] | 128 | #endif /* _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H */ |