blob: a843b0f87b72c10c53a2dd775d318e319d1862c4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 2001 Mike Corrigan IBM Corporation
Stephen Rothwell45dc76a2005-06-21 17:15:33 -07003 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * 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 Rothwell45dc76a2005-06-21 17:15:33 -07008 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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 Rothwell45dc76a2005-06-21 17:15:33 -070013 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 * 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 */
Stephen Rothwell0e29bb12005-10-14 17:09:16 +100018#ifndef _PLATFORMS_ISERIES_CALL_HPT_H
19#define _PLATFORMS_ISERIES_CALL_HPT_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070021/*
22 * This file contains the "hypervisor call" interface which is used to
23 * drive the hypervisor from the OS.
24 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Kelly Daly50592f52005-11-02 11:37:22 +110026#include <asm/iseries/hv_call_sc.h>
Kelly Daly1ec65d72005-11-02 13:46:07 +110027#include <asm/iseries/hv_types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/mmu.h>
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#define HvCallHptGetHptAddress HvCallHpt + 0
31#define HvCallHptGetHptPages HvCallHpt + 1
32#define HvCallHptSetPp HvCallHpt + 5
33#define HvCallHptSetSwBits HvCallHpt + 6
34#define HvCallHptUpdate HvCallHpt + 7
35#define HvCallHptInvalidateNoSyncICache HvCallHpt + 8
36#define HvCallHptGet HvCallHpt + 11
37#define HvCallHptFindNextValid HvCallHpt + 12
38#define HvCallHptFindValid HvCallHpt + 13
39#define HvCallHptAddValidate HvCallHpt + 16
40#define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18
41
42
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070043static inline u64 HvCallHpt_getHptAddress(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070044{
Stephen Rothwell6b7feec2005-06-21 17:15:35 -070045 return HvCall0(HvCallHptGetHptAddress);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070047
48static inline u64 HvCallHpt_getHptPages(void)
49{
Stephen Rothwell6b7feec2005-06-21 17:15:35 -070050 return HvCall0(HvCallHptGetHptPages);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070052
53static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value)
Linus Torvalds1da177e2005-04-16 15:20:36 -070054{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070055 HvCall2(HvCallHptSetPp, hpteIndex, value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070057
58static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070060 HvCall3(HvCallHptSetSwBits, hpteIndex, bitson, bitsoff);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070062
63static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex)
Linus Torvalds1da177e2005-04-16 15:20:36 -070064{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070065 HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070067
68static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson,
69 u8 bitsoff)
Linus Torvalds1da177e2005-04-16 15:20:36 -070070{
71 u64 compressedStatus;
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070072
73 compressedStatus = HvCall4(HvCallHptInvalidateSetSwBitsGet,
74 hpteIndex, bitson, bitsoff, 1);
75 HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 return compressedStatus;
77}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070078
David Gibson96e28442005-07-13 01:11:42 -070079static inline u64 HvCallHpt_findValid(hpte_t *hpte, u64 vpn)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080{
Stephen Rothwell6b7feec2005-06-21 17:15:35 -070081 return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070083
David Gibson96e28442005-07-13 01:11:42 -070084static inline u64 HvCallHpt_findNextValid(hpte_t *hpte, u32 hpteIndex,
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070085 u8 bitson, u8 bitsoff)
Linus Torvalds1da177e2005-04-16 15:20:36 -070086{
Stephen Rothwell6b7feec2005-06-21 17:15:35 -070087 return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex,
88 bitson, bitsoff);
Linus Torvalds1da177e2005-04-16 15:20:36 -070089}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070090
David Gibson96e28442005-07-13 01:11:42 -070091static inline void HvCallHpt_get(hpte_t *hpte, u32 hpteIndex)
Linus Torvalds1da177e2005-04-16 15:20:36 -070092{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070093 HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -070094}
95
David Gibson96e28442005-07-13 01:11:42 -070096static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, hpte_t *hpte)
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070097{
David Gibson96e28442005-07-13 01:11:42 -070098 HvCall4(HvCallHptAddValidate, hpteIndex, hBit, hpte->v, hpte->r);
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070099}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
Stephen Rothwell0e29bb12005-10-14 17:09:16 +1000101#endif /* _PLATFORMS_ISERIES_CALL_HPT_H */