xref: /OK3568_Linux_fs/kernel/drivers/misc/sgi-gru/gru.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  *  This program is free software; you can redistribute it and/or modify
5*4882a593Smuzhiyun  *  it under the terms of the GNU Lesser General Public License as published by
6*4882a593Smuzhiyun  *  the Free Software Foundation; either version 2.1 of the License, or
7*4882a593Smuzhiyun  *  (at your option) any later version.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  *  This program is distributed in the hope that it will be useful,
10*4882a593Smuzhiyun  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11*4882a593Smuzhiyun  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*4882a593Smuzhiyun  *  GNU Lesser General Public License for more details.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  *  You should have received a copy of the GNU Lesser General Public License
15*4882a593Smuzhiyun  *  along with this program; if not, write to the Free Software
16*4882a593Smuzhiyun  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #ifndef __GRU_H__
20*4882a593Smuzhiyun #define __GRU_H__
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /*
23*4882a593Smuzhiyun  * GRU architectural definitions
24*4882a593Smuzhiyun  */
25*4882a593Smuzhiyun #define GRU_CACHE_LINE_BYTES		64
26*4882a593Smuzhiyun #define GRU_HANDLE_STRIDE		256
27*4882a593Smuzhiyun #define GRU_CB_BASE			0
28*4882a593Smuzhiyun #define GRU_DS_BASE			0x20000
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun /*
31*4882a593Smuzhiyun  * Size used to map GRU GSeg
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun #if defined(CONFIG_IA64)
34*4882a593Smuzhiyun #define GRU_GSEG_PAGESIZE	(256 * 1024UL)
35*4882a593Smuzhiyun #elif defined(CONFIG_X86_64)
36*4882a593Smuzhiyun #define GRU_GSEG_PAGESIZE	(256 * 1024UL)		/* ZZZ 2MB ??? */
37*4882a593Smuzhiyun #else
38*4882a593Smuzhiyun #error "Unsupported architecture"
39*4882a593Smuzhiyun #endif
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /*
42*4882a593Smuzhiyun  * Structure for obtaining GRU resource information
43*4882a593Smuzhiyun  */
44*4882a593Smuzhiyun struct gru_chiplet_info {
45*4882a593Smuzhiyun 	int	node;
46*4882a593Smuzhiyun 	int	chiplet;
47*4882a593Smuzhiyun 	int	blade;
48*4882a593Smuzhiyun 	int	total_dsr_bytes;
49*4882a593Smuzhiyun 	int	total_cbr;
50*4882a593Smuzhiyun 	int	total_user_dsr_bytes;
51*4882a593Smuzhiyun 	int	total_user_cbr;
52*4882a593Smuzhiyun 	int	free_user_dsr_bytes;
53*4882a593Smuzhiyun 	int	free_user_cbr;
54*4882a593Smuzhiyun };
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun /*
57*4882a593Smuzhiyun  * Statictics kept for each context.
58*4882a593Smuzhiyun  */
59*4882a593Smuzhiyun struct gru_gseg_statistics {
60*4882a593Smuzhiyun 	unsigned long	fmm_tlbmiss;
61*4882a593Smuzhiyun 	unsigned long	upm_tlbmiss;
62*4882a593Smuzhiyun 	unsigned long	tlbdropin;
63*4882a593Smuzhiyun 	unsigned long	context_stolen;
64*4882a593Smuzhiyun 	unsigned long	reserved[10];
65*4882a593Smuzhiyun };
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun /* Flags for GRU options on the gru_create_context() call */
68*4882a593Smuzhiyun /* Select one of the follow 4 options to specify how TLB misses are handled */
69*4882a593Smuzhiyun #define GRU_OPT_MISS_DEFAULT	0x0000	/* Use default mode */
70*4882a593Smuzhiyun #define GRU_OPT_MISS_USER_POLL	0x0001	/* User will poll CB for faults */
71*4882a593Smuzhiyun #define GRU_OPT_MISS_FMM_INTR	0x0002	/* Send interrupt to cpu to
72*4882a593Smuzhiyun 					   handle fault */
73*4882a593Smuzhiyun #define GRU_OPT_MISS_FMM_POLL	0x0003	/* Use system polling thread */
74*4882a593Smuzhiyun #define GRU_OPT_MISS_MASK	0x0003	/* Mask for TLB MISS option */
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun #endif		/* __GRU_H__ */
79