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