1 /*
2  * HvCallHpt.h
3  * Copyright (C) 2001  Mike Corrigan IBM Corporation
4  *
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
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
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
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18  */
19 
20 //============================================================================
21 //
22 //	This file contains the "hypervisor call" interface which is used to
23 //	drive the hypervisor from the OS.
24 //
25 //============================================================================
26 
27 //-------------------------------------------------------------------
28 // Standard Includes
29 //-------------------------------------------------------------------
30 #ifndef  _HVCALLSC_H
31 #include "HvCallSc.h"
32 #endif
33 
34 #ifndef  _HVTYPES_H
35 #include <asm/iSeries/HvTypes.h>
36 #endif
37 
38 //-------------------------------------------------------------------
39 // Other Includes
40 //-------------------------------------------------------------------
41 
42 #ifndef _PPC_MMU_H
43 #include <asm/mmu.h>
44 #endif
45 
46 //-----------------------------------------------------------------------------
47 // Constants
48 //-----------------------------------------------------------------------------
49 #ifndef _HVCALLHPT_H
50 #define _HVCALLHPT_H
51 
52 #define HvCallHptGetHptAddress		HvCallHpt +  0
53 #define HvCallHptGetHptPages		HvCallHpt +  1
54 #define HvCallHptSetPp			HvCallHpt +  5
55 #define HvCallHptSetSwBits		HvCallHpt +  6
56 #define HvCallHptUpdate			HvCallHpt +  7
57 #define HvCallHptInvalidateNoSyncICache	HvCallHpt +  8
58 #define HvCallHptGet			HvCallHpt + 11
59 #define HvCallHptFindNextValid		HvCallHpt + 12
60 #define HvCallHptFindValid		HvCallHpt + 13
61 #define HvCallHptAddValidate		HvCallHpt + 16
62 #define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18
63 
64 
65 //============================================================================
HvCallHpt_getHptAddress(void)66 static inline u64		HvCallHpt_getHptAddress(void)
67 {
68 	u64 retval = HvCall0(HvCallHptGetHptAddress);
69 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
70 	return retval;
71 }
72 //============================================================================
HvCallHpt_getHptPages(void)73 static inline u64		HvCallHpt_getHptPages(void)
74 {
75 	u64 retval = HvCall0(HvCallHptGetHptPages);
76 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
77 	return retval;
78 }
79 //=============================================================================
HvCallHpt_setPp(u32 hpteIndex,u8 value)80 static inline void		HvCallHpt_setPp(u32 hpteIndex, u8 value)
81 {
82 	HvCall2( HvCallHptSetPp, hpteIndex, value );
83 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
84 }
85 //=============================================================================
HvCallHpt_setSwBits(u32 hpteIndex,u8 bitson,u8 bitsoff)86 static inline void		HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff )
87 {
88 	HvCall3( HvCallHptSetSwBits, hpteIndex, bitson, bitsoff );
89 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
90 }
91 //=============================================================================
HvCallHpt_invalidateNoSyncICache(u32 hpteIndex)92 static inline void		HvCallHpt_invalidateNoSyncICache(u32 hpteIndex)
93 
94 {
95 	HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex );
96 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
97 }
98 //=============================================================================
HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex,u8 bitson,u8 bitsoff)99 static inline u64		HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, u8 bitsoff )
100 
101 {
102 	u64 compressedStatus;
103 	compressedStatus = HvCall4( HvCallHptInvalidateSetSwBitsGet, hpteIndex, bitson, bitsoff, 1 );
104 	HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex );
105 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
106 	return compressedStatus;
107 }
108 //=============================================================================
HvCallHpt_findValid(struct _HPTE * hpte,u64 vpn)109 static inline u64		HvCallHpt_findValid( struct _HPTE *hpte, u64 vpn )
110 {
111 	u64 retIndex = HvCall3Ret16( HvCallHptFindValid, hpte, vpn, 0, 0 );
112 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
113 	return retIndex;
114 }
115 //=============================================================================
HvCallHpt_findNextValid(struct _HPTE * hpte,u32 hpteIndex,u8 bitson,u8 bitsoff)116 static inline u64		HvCallHpt_findNextValid( struct _HPTE *hpte, u32 hpteIndex, u8 bitson, u8 bitsoff )
117 {
118 	u64 retIndex = HvCall3Ret16( HvCallHptFindNextValid, hpte, hpteIndex, bitson, bitsoff );
119 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
120 	return retIndex;
121 }
122 //=============================================================================
HvCallHpt_get(struct _HPTE * hpte,u32 hpteIndex)123 static inline void		HvCallHpt_get( struct _HPTE *hpte, u32 hpteIndex )
124 {
125 	HvCall2Ret16( HvCallHptGet, hpte, hpteIndex, 0 );
126 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
127 }
128 //============================================================================
HvCallHpt_addValidate(u32 hpteIndex,u32 hBit,struct _HPTE * hpte)129 static inline void		HvCallHpt_addValidate( u32 hpteIndex,
130 						       u32 hBit,
131 						       struct _HPTE *hpte )
132 
133 {
134 	HvCall4( HvCallHptAddValidate, hpteIndex,
135 		 hBit, (*((u64 *)hpte)), (*(((u64 *)hpte)+1)) );
136 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
137 }
138 
139 
140 //=============================================================================
141 
142 #endif // _HVCALLHPT_H
143 
144