Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
grutables.h File Reference
#include <linux/rmap.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/wait.h>
#include <linux/mmu_notifier.h>
#include "gru.h"
#include "grulib.h"
#include "gruhandles.h"

Go to the source code of this file.

Data Structures

struct  gru_stats_s
 
struct  mcs_op_statistic
 
struct  gru_mm_tracker
 
struct  gru_mm_struct
 
struct  gru_vma_data
 
struct  gru_thread_state
 
struct  gru_state
 
struct  gru_blade_state
 

Macros

#define GRU_MAX_BLADES   MAX_NUMNODES
 
#define GRU_MAX_GRUS   (GRU_MAX_BLADES * GRU_CHIPLETS_PER_BLADE)
 
#define GRU_DRIVER_ID_STR   "SGI GRU Device Driver"
 
#define GRU_DRIVER_VERSION_STR   "0.85"
 
#define OPT_DPRINT   1
 
#define OPT_STATS   2
 
#define IRQ_GRU   110 /* Starting IRQ number for interrupts */
 
#define GRU_ASSIGN_DELAY   ((HZ * 20) / 1000)
 
#define GRU_STEAL_DELAY   ((HZ * 200) / 1000)
 
#define STAT(id)
 
#define gru_dbg(x...)
 
#define MAX_ASID   0xfffff0
 
#define MIN_ASID   8
 
#define ASID_INC   8 /* number of regions */
 
#define VADDR_HI_BIT   64
 
#define GRUREGION(addr)   ((addr) >> (VADDR_HI_BIT - 3) & 3)
 
#define GRUASID(asid, addr)   ((asid) + GRUREGION(addr))
 
#define TSID(a, v)   (((a) - (v)->vm_start) / GRU_GSEG_PAGESIZE)
 
#define UGRUADDR(gts)
 
#define NULLCTX   (-1) /* if context not loaded into GRU */
 
#define get_tfm_for_cpu(g, c)   ((struct gru_tlb_fault_map *)get_tfm((g)->gs_gru_base_vaddr, (c)))
 
#define get_tfh_by_index(g, i)   ((struct gru_tlb_fault_handle *)get_tfh((g)->gs_gru_base_vaddr, (i)))
 
#define get_tgh_by_index(g, i)   ((struct gru_tlb_global_handle *)get_tgh((g)->gs_gru_base_vaddr, (i)))
 
#define get_cbe_by_index(g, i)
 
#define get_gru(b, c)   (&gru_base[b]->bs_grus[c])
 
#define DSR_BYTES(dsr)   ((dsr) * GRU_DSR_AU_BYTES)
 
#define CBR_BYTES(cbr)   ((cbr) * GRU_HANDLE_BYTES * GRU_CBR_AU_SIZE * 2)
 
#define thread_cbr_number(gts, n)
 
#define GID_TO_GRU(gid)
 
#define for_each_gru_in_bitmap(gid, map)   for_each_set_bit((gid), (map), GRU_MAX_GRUS)
 
#define for_each_gru_on_blade(gru, nid, i)
 
#define foreach_gid(gid)   for ((gid) = 0; (gid) < gru_max_gids; (gid)++)
 
#define for_each_gts_on_gru(gts, gru, ctxnum)
 
#define for_each_cbr_in_tfm(i, map)   for_each_set_bit((i), (map), GRU_NUM_CBE)
 
#define for_each_cbr_in_allocation_map(i, map, k)
 
#define for_each_dsr_in_allocation_map(i, map, k)
 
#define gseg_physical_address(gru, ctxnum)   ((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)
 
#define gseg_virtual_address(gru, ctxnum)   ((gru)->gs_gru_base_vaddr + ctxnum * GRU_GSEG_STRIDE)
 
#define UV_MAX_INT_CORES   8
 
#define uv_cpu_socket_number(p)   ((cpu_physical_id(p) >> 5) & 1)
 
#define uv_cpu_ht_number(p)   (cpu_physical_id(p) & 1)
 
#define uv_cpu_core_number(p)
 

Enumerations

enum  mcs_op {
  cchop_allocate, cchop_start, cchop_interrupt, cchop_interrupt_sync,
  cchop_deallocate, tfhop_write_only, tfhop_write_restart, tghop_invalidate,
  mcsop_last
}
 

Functions

struct gru_mm_tracker __attribute__ ((packed))
 
struct gru_vma_datagru_alloc_vma_data (struct vm_area_struct *vma, int tsid)
 
struct gru_thread_stategru_find_thread_state (struct vm_area_struct *vma, int tsid)
 
struct gru_thread_stategru_alloc_thread_state (struct vm_area_struct *vma, int tsid)
 
struct gru_stategru_assign_gru_context (struct gru_thread_state *gts)
 
void gru_load_context (struct gru_thread_state *gts)
 
void gru_steal_context (struct gru_thread_state *gts)
 
void gru_unload_context (struct gru_thread_state *gts, int savestate)
 
int gru_update_cch (struct gru_thread_state *gts)
 
void gts_drop (struct gru_thread_state *gts)
 
void gru_tgh_flush_init (struct gru_state *gru)
 
int gru_kservices_init (void)
 
void gru_kservices_exit (void)
 
irqreturn_t gru0_intr (int irq, void *dev_id)
 
irqreturn_t gru1_intr (int irq, void *dev_id)
 
irqreturn_t gru_intr_mblade (int irq, void *dev_id)
 
int gru_dump_chiplet_request (unsigned long arg)
 
long gru_get_gseg_statistics (unsigned long arg)
 
int gru_handle_user_call_os (unsigned long address)
 
int gru_user_flush_tlb (unsigned long arg)
 
int gru_user_unload_context (unsigned long arg)
 
int gru_get_exception_detail (unsigned long arg)
 
int gru_set_context_option (unsigned long address)
 
void gru_check_context_placement (struct gru_thread_state *gts)
 
int gru_cpu_fault_map_id (void)
 
struct vm_area_structgru_find_vma (unsigned long vaddr)
 
void gru_flush_all_tlb (struct gru_state *gru)
 
int gru_proc_init (void)
 
void gru_proc_exit (void)
 
struct gru_thread_stategru_alloc_gts (struct vm_area_struct *vma, int cbr_au_count, int dsr_au_count, unsigned char tlb_preload_count, int options, int tsid)
 
unsigned long gru_reserve_cb_resources (struct gru_state *gru, int cbr_au_count, char *cbmap)
 
unsigned long gru_reserve_ds_resources (struct gru_state *gru, int dsr_au_count, char *dsmap)
 
int gru_fault (struct vm_area_struct *, struct vm_fault *vmf)
 
struct gru_mm_structgru_register_mmu_notifier (void)
 
void gru_drop_mmu_notifier (struct gru_mm_struct *gms)
 
int gru_ktest (unsigned long arg)
 
void gru_flush_tlb_range (struct gru_mm_struct *gms, unsigned long start, unsigned long len)
 

Variables

struct gru_stats_s gru_stats
 
struct gru_blade_stategru_base []
 
unsigned long gru_start_paddr
 
unsigned long gru_end_paddr
 
voidgru_start_vaddr
 
unsigned int gru_max_gids
 
struct mcs_op_statistic mcs_op_statistics [mcsop_last]
 
unsigned int mt_asid_gen
 
unsigned int mt_asid
 
unsigned short mt_ctxbitmap
 
struct gru_mm_struct __attribute__
 
struct vm_operations_struct gru_vm_ops
 
struct devicegrudev
 
unsigned long gru_options
 

Macro Definition Documentation

#define ASID_INC   8 /* number of regions */

Definition at line 296 of file grutables.h.

#define CBR_BYTES (   cbr)    ((cbr) * GRU_HANDLE_BYTES * GRU_CBR_AU_SIZE * 2)

Definition at line 504 of file grutables.h.

#define DSR_BYTES (   dsr)    ((dsr) * GRU_DSR_AU_BYTES)

Definition at line 503 of file grutables.h.

#define for_each_cbr_in_allocation_map (   i,
  map,
  k 
)
Value:
for ((i) = (k)*GRU_CBR_AU_SIZE; \
(i) < ((k) + 1) * GRU_CBR_AU_SIZE; (i)++)

Definition at line 541 of file grutables.h.

#define for_each_cbr_in_tfm (   i,
  map 
)    for_each_set_bit((i), (map), GRU_NUM_CBE)

Definition at line 537 of file grutables.h.

#define for_each_dsr_in_allocation_map (   i,
  map,
  k 
)
Value:
for_each_set_bit((k), (const unsigned long *)(map), GRU_DSR_AU) \
for ((i) = (k) * GRU_DSR_AU_CL; \
(i) < ((k) + 1) * GRU_DSR_AU_CL; (i)++)

Definition at line 547 of file grutables.h.

#define for_each_gru_in_bitmap (   gid,
  map 
)    for_each_set_bit((gid), (map), GRU_MAX_GRUS)

Definition at line 518 of file grutables.h.

#define for_each_gru_on_blade (   gru,
  nid,
  i 
)
Value:
for ((gru) = gru_base[nid]->bs_grus, (i) = 0; \
(i)++, (gru)++)

Definition at line 522 of file grutables.h.

#define for_each_gts_on_gru (   gts,
  gru,
  ctxnum 
)
Value:
for ((ctxnum) = 0; (ctxnum) < GRU_NUM_CCH; (ctxnum)++) \
if (((gts) = (gru)->gs_gts[ctxnum]))

Definition at line 532 of file grutables.h.

#define foreach_gid (   gid)    for ((gid) = 0; (gid) < gru_max_gids; (gid)++)

Definition at line 528 of file grutables.h.

#define get_cbe_by_index (   g,
  i 
)
Value:
((struct gru_control_block_extended *)get_cbe((g)->gs_gru_base_vaddr,\
(i)))

Definition at line 491 of file grutables.h.

#define get_gru (   b,
  c 
)    (&gru_base[b]->bs_grus[c])

Definition at line 500 of file grutables.h.

#define get_tfh_by_index (   g,
  i 
)    ((struct gru_tlb_fault_handle *)get_tfh((g)->gs_gru_base_vaddr, (i)))

Definition at line 487 of file grutables.h.

#define get_tfm_for_cpu (   g,
  c 
)    ((struct gru_tlb_fault_map *)get_tfm((g)->gs_gru_base_vaddr, (c)))

Definition at line 485 of file grutables.h.

#define get_tgh_by_index (   g,
  i 
)    ((struct gru_tlb_global_handle *)get_tgh((g)->gs_gru_base_vaddr, (i)))

Definition at line 489 of file grutables.h.

#define GID_TO_GRU (   gid)
Value:

Definition at line 511 of file grutables.h.

#define GRU_ASSIGN_DELAY   ((HZ * 20) / 1000)

Definition at line 268 of file grutables.h.

#define gru_dbg (   x...)

Definition at line 288 of file grutables.h.

#define GRU_DRIVER_ID_STR   "SGI GRU Device Driver"

Definition at line 163 of file grutables.h.

#define GRU_DRIVER_VERSION_STR   "0.85"

Definition at line 164 of file grutables.h.

#define GRU_MAX_BLADES   MAX_NUMNODES

Definition at line 160 of file grutables.h.

#define GRU_MAX_GRUS   (GRU_MAX_BLADES * GRU_CHIPLETS_PER_BLADE)

Definition at line 161 of file grutables.h.

#define GRU_STEAL_DELAY   ((HZ * 200) / 1000)

Definition at line 274 of file grutables.h.

#define GRUASID (   asid,
  addr 
)    ((asid) + GRUREGION(addr))

Definition at line 301 of file grutables.h.

#define GRUREGION (   addr)    ((addr) >> (VADDR_HI_BIT - 3) & 3)

Definition at line 300 of file grutables.h.

#define gseg_physical_address (   gru,
  ctxnum 
)    ((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)

Definition at line 552 of file grutables.h.

#define gseg_virtual_address (   gru,
  ctxnum 
)    ((gru)->gs_gru_base_vaddr + ctxnum * GRU_GSEG_STRIDE)

Definition at line 554 of file grutables.h.

#define IRQ_GRU   110 /* Starting IRQ number for interrupts */

Definition at line 265 of file grutables.h.

#define MAX_ASID   0xfffff0

Definition at line 294 of file grutables.h.

#define MIN_ASID   8

Definition at line 295 of file grutables.h.

#define NULLCTX   (-1) /* if context not loaded into GRU */

Definition at line 402 of file grutables.h.

#define OPT_DPRINT   1

Definition at line 261 of file grutables.h.

#define OPT_STATS   2

Definition at line 262 of file grutables.h.

#define STAT (   id)
Value:
do { \
if (gru_options & OPT_STATS) \
atomic_long_inc(&gru_stats.id); \
} while (0)

Definition at line 276 of file grutables.h.

#define thread_cbr_number (   gts,
  n 
)
Value:
((gts)->ts_cbr_idx[(n) / GRU_CBR_AU_SIZE] \

Definition at line 507 of file grutables.h.

#define TSID (   a,
  v 
)    (((a) - (v)->vm_start) / GRU_GSEG_PAGESIZE)

Definition at line 398 of file grutables.h.

#define UGRUADDR (   gts)
Value:
((gts)->ts_vma->vm_start + \
(gts)->ts_tsid * GRU_GSEG_PAGESIZE)

Definition at line 399 of file grutables.h.

#define uv_cpu_core_number (   p)
Value:
(((cpu_physical_id(p) >> 2) & 4) | \
((cpu_physical_id(p) >> 1) & 3))

Definition at line 619 of file grutables.h.

#define uv_cpu_ht_number (   p)    (cpu_physical_id(p) & 1)

Definition at line 618 of file grutables.h.

#define uv_cpu_socket_number (   p)    ((cpu_physical_id(p) >> 5) & 1)

Definition at line 617 of file grutables.h.

#define UV_MAX_INT_CORES   8

Definition at line 616 of file grutables.h.

#define VADDR_HI_BIT   64

Definition at line 299 of file grutables.h.

Enumeration Type Documentation

enum mcs_op
Enumerator:
cchop_allocate 
cchop_start 
cchop_interrupt 
cchop_interrupt_sync 
cchop_deallocate 
tfhop_write_only 
tfhop_write_restart 
tghop_invalidate 
mcsop_last 

Definition at line 249 of file grutables.h.

Function Documentation

struct gru_mm_tracker __attribute__ ( (packed)  )
read

Definition at line 171 of file esd_usb2.c.

irqreturn_t gru0_intr ( int  irq,
void dev_id 
)

Definition at line 598 of file grufault.c.

irqreturn_t gru1_intr ( int  irq,
void dev_id 
)

Definition at line 603 of file grufault.c.

struct gru_thread_state* gru_alloc_gts ( struct vm_area_struct vma,
int  cbr_au_count,
int  dsr_au_count,
unsigned char  tlb_preload_count,
int  options,
int  tsid 
)
read

Definition at line 323 of file grumain.c.

struct gru_thread_state* gru_alloc_thread_state ( struct vm_area_struct vma,
int  tsid 
)
read

Definition at line 407 of file grumain.c.

struct gru_vma_data* gru_alloc_vma_data ( struct vm_area_struct vma,
int  tsid 
)
read

Definition at line 372 of file grumain.c.

struct gru_state* gru_assign_gru_context ( struct gru_thread_state gts)
read

Definition at line 869 of file grumain.c.

void gru_check_context_placement ( struct gru_thread_state gts)

Definition at line 732 of file grumain.c.

int gru_cpu_fault_map_id ( void  )

Definition at line 55 of file grumain.c.

void gru_drop_mmu_notifier ( struct gru_mm_struct gms)

Definition at line 329 of file grutlbpurge.c.

int gru_dump_chiplet_request ( unsigned long  arg)

Definition at line 188 of file grukdump.c.

int gru_fault ( struct vm_area_struct ,
struct vm_fault *  vmf 
)

Definition at line 929 of file grumain.c.

struct gru_thread_state* gru_find_thread_state ( struct vm_area_struct vma,
int  tsid 
)
read

Definition at line 390 of file grumain.c.

struct vm_area_struct* gru_find_vma ( unsigned long  vaddr)
read

Definition at line 61 of file grufault.c.

void gru_flush_all_tlb ( struct gru_state gru)

Definition at line 209 of file grutlbpurge.c.

void gru_flush_tlb_range ( struct gru_mm_struct gms,
unsigned long  start,
unsigned long  len 
)

Definition at line 158 of file grutlbpurge.c.

int gru_get_exception_detail ( unsigned long  arg)

Definition at line 695 of file grufault.c.

long gru_get_gseg_statistics ( unsigned long  arg)

Definition at line 827 of file grufault.c.

int gru_handle_user_call_os ( unsigned long  address)

Definition at line 646 of file grufault.c.

irqreturn_t gru_intr_mblade ( int  irq,
void dev_id 
)

Definition at line 608 of file grufault.c.

void gru_kservices_exit ( void  )

Definition at line 1157 of file grukservices.c.

int gru_kservices_init ( void  )

Definition at line 1152 of file grukservices.c.

int gru_ktest ( unsigned long  arg)

Definition at line 1127 of file grukservices.c.

void gru_load_context ( struct gru_thread_state gts)

Definition at line 591 of file grumain.c.

void gru_proc_exit ( void  )

Definition at line 378 of file gruprocfs.c.

int gru_proc_init ( void  )

Definition at line 362 of file gruprocfs.c.

struct gru_mm_struct* gru_register_mmu_notifier ( void  )
read

Definition at line 298 of file grutlbpurge.c.

unsigned long gru_reserve_cb_resources ( struct gru_state gru,
int  cbr_au_count,
char cbmap 
)

Definition at line 185 of file grumain.c.

unsigned long gru_reserve_ds_resources ( struct gru_state gru,
int  dsr_au_count,
char dsmap 
)

Definition at line 192 of file grumain.c.

int gru_set_context_option ( unsigned long  address)

Definition at line 858 of file grufault.c.

void gru_steal_context ( struct gru_thread_state gts)

Definition at line 783 of file grumain.c.

void gru_tgh_flush_init ( struct gru_state gru)

Definition at line 355 of file grutlbpurge.c.

void gru_unload_context ( struct gru_thread_state gts,
int  savestate 
)

Definition at line 555 of file grumain.c.

int gru_update_cch ( struct gru_thread_state gts)

Definition at line 658 of file grumain.c.

int gru_user_flush_tlb ( unsigned long  arg)

Definition at line 800 of file grufault.c.

int gru_user_unload_context ( unsigned long  arg)

Definition at line 771 of file grufault.c.

void gts_drop ( struct gru_thread_state gts)

Definition at line 296 of file grumain.c.

Variable Documentation

struct gru_blade_state* gru_base[]
unsigned long gru_end_paddr
unsigned int gru_max_gids
unsigned long gru_options
unsigned long gru_start_paddr
void* gru_start_vaddr
struct gru_stats_s gru_stats

Definition at line 54 of file grufile.c.

struct vm_operations_struct gru_vm_ops

Definition at line 598 of file grufile.c.

struct device* grudev

Definition at line 48 of file grumain.c.

struct mcs_op_statistic mcs_op_statistics[mcsop_last]

Definition at line 40 of file gruhandles.c.

unsigned int mt_asid

Definition at line 320 of file grutables.h.

unsigned int mt_asid_gen

Definition at line 319 of file grutables.h.

unsigned short mt_ctxbitmap

Definition at line 321 of file grutables.h.