18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 58c2ecf20Sopenharmony_ci * it under the terms of the GNU Lesser General Public License as published by 68c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2.1 of the License, or 78c2ecf20Sopenharmony_ci * (at your option) any later version. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 108c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 118c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128c2ecf20Sopenharmony_ci * GNU Lesser General Public License for more details. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * You should have received a copy of the GNU Lesser General Public License 158c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software 168c2ecf20Sopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#ifndef __GRU_H__ 208c2ecf20Sopenharmony_ci#define __GRU_H__ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* 238c2ecf20Sopenharmony_ci * GRU architectural definitions 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci#define GRU_CACHE_LINE_BYTES 64 268c2ecf20Sopenharmony_ci#define GRU_HANDLE_STRIDE 256 278c2ecf20Sopenharmony_ci#define GRU_CB_BASE 0 288c2ecf20Sopenharmony_ci#define GRU_DS_BASE 0x20000 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* 318c2ecf20Sopenharmony_ci * Size used to map GRU GSeg 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci#if defined(CONFIG_IA64) 348c2ecf20Sopenharmony_ci#define GRU_GSEG_PAGESIZE (256 * 1024UL) 358c2ecf20Sopenharmony_ci#elif defined(CONFIG_X86_64) 368c2ecf20Sopenharmony_ci#define GRU_GSEG_PAGESIZE (256 * 1024UL) /* ZZZ 2MB ??? */ 378c2ecf20Sopenharmony_ci#else 388c2ecf20Sopenharmony_ci#error "Unsupported architecture" 398c2ecf20Sopenharmony_ci#endif 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* 428c2ecf20Sopenharmony_ci * Structure for obtaining GRU resource information 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_cistruct gru_chiplet_info { 458c2ecf20Sopenharmony_ci int node; 468c2ecf20Sopenharmony_ci int chiplet; 478c2ecf20Sopenharmony_ci int blade; 488c2ecf20Sopenharmony_ci int total_dsr_bytes; 498c2ecf20Sopenharmony_ci int total_cbr; 508c2ecf20Sopenharmony_ci int total_user_dsr_bytes; 518c2ecf20Sopenharmony_ci int total_user_cbr; 528c2ecf20Sopenharmony_ci int free_user_dsr_bytes; 538c2ecf20Sopenharmony_ci int free_user_cbr; 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* 578c2ecf20Sopenharmony_ci * Statictics kept for each context. 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_cistruct gru_gseg_statistics { 608c2ecf20Sopenharmony_ci unsigned long fmm_tlbmiss; 618c2ecf20Sopenharmony_ci unsigned long upm_tlbmiss; 628c2ecf20Sopenharmony_ci unsigned long tlbdropin; 638c2ecf20Sopenharmony_ci unsigned long context_stolen; 648c2ecf20Sopenharmony_ci unsigned long reserved[10]; 658c2ecf20Sopenharmony_ci}; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Flags for GRU options on the gru_create_context() call */ 688c2ecf20Sopenharmony_ci/* Select one of the follow 4 options to specify how TLB misses are handled */ 698c2ecf20Sopenharmony_ci#define GRU_OPT_MISS_DEFAULT 0x0000 /* Use default mode */ 708c2ecf20Sopenharmony_ci#define GRU_OPT_MISS_USER_POLL 0x0001 /* User will poll CB for faults */ 718c2ecf20Sopenharmony_ci#define GRU_OPT_MISS_FMM_INTR 0x0002 /* Send interrupt to cpu to 728c2ecf20Sopenharmony_ci handle fault */ 738c2ecf20Sopenharmony_ci#define GRU_OPT_MISS_FMM_POLL 0x0003 /* Use system polling thread */ 748c2ecf20Sopenharmony_ci#define GRU_OPT_MISS_MASK 0x0003 /* Mask for TLB MISS option */ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#endif /* __GRU_H__ */ 79