grulib.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation; either version 2.1 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * 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 Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser 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. */
  18. #ifndef __GRULIB_H__
  19. #define __GRULIB_H__
  20. #define GRU_BASENAME "gru"
  21. #define GRU_FULLNAME "/dev/gru"
  22. #define GRU_IOCTL_NUM 'G'
  23. /*
  24. * Maximum number of GRU segments that a user can have open
  25. * ZZZ temp - set high for testing. Revisit.
  26. */
  27. #define GRU_MAX_OPEN_CONTEXTS 32
  28. /* Set Number of Request Blocks */
  29. #define GRU_CREATE_CONTEXT _IOWR(GRU_IOCTL_NUM, 1, void *)
  30. /* Register task as using the slice */
  31. #define GRU_SET_TASK_SLICE _IOWR(GRU_IOCTL_NUM, 5, void *)
  32. /* Fetch exception detail */
  33. #define GRU_USER_GET_EXCEPTION_DETAIL _IOWR(GRU_IOCTL_NUM, 6, void *)
  34. /* For user call_os handling - normally a TLB fault */
  35. #define GRU_USER_CALL_OS _IOWR(GRU_IOCTL_NUM, 8, void *)
  36. /* For user unload context */
  37. #define GRU_USER_UNLOAD_CONTEXT _IOWR(GRU_IOCTL_NUM, 9, void *)
  38. /* For fetching GRU chiplet status */
  39. #define GRU_GET_CHIPLET_STATUS _IOWR(GRU_IOCTL_NUM, 10, void *)
  40. /* For user TLB flushing (primarily for tests) */
  41. #define GRU_USER_FLUSH_TLB _IOWR(GRU_IOCTL_NUM, 50, void *)
  42. /* Get some config options (primarily for tests & emulator) */
  43. #define GRU_GET_CONFIG_INFO _IOWR(GRU_IOCTL_NUM, 51, void *)
  44. #define CONTEXT_WINDOW_BYTES(th) (GRU_GSEG_PAGESIZE * (th))
  45. #define THREAD_POINTER(p, th) (p + GRU_GSEG_PAGESIZE * (th))
  46. /*
  47. * Structure used to pass TLB flush parameters to the driver
  48. */
  49. struct gru_create_context_req {
  50. unsigned long gseg;
  51. unsigned int data_segment_bytes;
  52. unsigned int control_blocks;
  53. unsigned int maximum_thread_count;
  54. unsigned int options;
  55. };
  56. /*
  57. * Structure used to pass unload context parameters to the driver
  58. */
  59. struct gru_unload_context_req {
  60. unsigned long gseg;
  61. };
  62. /*
  63. * Structure used to pass TLB flush parameters to the driver
  64. */
  65. struct gru_flush_tlb_req {
  66. unsigned long gseg;
  67. unsigned long vaddr;
  68. size_t len;
  69. };
  70. /*
  71. * GRU configuration info (temp - for testing)
  72. */
  73. struct gru_config_info {
  74. int cpus;
  75. int blades;
  76. int nodes;
  77. int chiplets;
  78. int fill[16];
  79. };
  80. #endif /* __GRULIB_H__ */