paravirt_privop.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /******************************************************************************
  2. * include/asm-ia64/paravirt_privops.h
  3. *
  4. * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
  5. * VA Linux Systems Japan K.K.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #ifndef _ASM_IA64_PARAVIRT_PRIVOP_H
  23. #define _ASM_IA64_PARAVIRT_PRIVOP_H
  24. #ifdef CONFIG_PARAVIRT
  25. #ifndef __ASSEMBLY__
  26. #include <linux/types.h>
  27. #include <asm/kregs.h> /* for IA64_PSR_I */
  28. /******************************************************************************
  29. * replacement of intrinsics operations.
  30. */
  31. struct pv_cpu_ops {
  32. void (*fc)(unsigned long addr);
  33. unsigned long (*thash)(unsigned long addr);
  34. unsigned long (*get_cpuid)(int index);
  35. unsigned long (*get_pmd)(int index);
  36. unsigned long (*getreg)(int reg);
  37. void (*setreg)(int reg, unsigned long val);
  38. void (*ptcga)(unsigned long addr, unsigned long size);
  39. unsigned long (*get_rr)(unsigned long index);
  40. void (*set_rr)(unsigned long index, unsigned long val);
  41. void (*set_rr0_to_rr4)(unsigned long val0, unsigned long val1,
  42. unsigned long val2, unsigned long val3,
  43. unsigned long val4);
  44. void (*ssm_i)(void);
  45. void (*rsm_i)(void);
  46. unsigned long (*get_psr_i)(void);
  47. void (*intrin_local_irq_restore)(unsigned long flags);
  48. };
  49. extern struct pv_cpu_ops pv_cpu_ops;
  50. extern void ia64_native_setreg_func(int regnum, unsigned long val);
  51. extern unsigned long ia64_native_getreg_func(int regnum);
  52. /************************************************/
  53. /* Instructions paravirtualized for performance */
  54. /************************************************/
  55. /* mask for ia64_native_ssm/rsm() must be constant.("i" constraing).
  56. * static inline function doesn't satisfy it. */
  57. #define paravirt_ssm(mask) \
  58. do { \
  59. if ((mask) == IA64_PSR_I) \
  60. pv_cpu_ops.ssm_i(); \
  61. else \
  62. ia64_native_ssm(mask); \
  63. } while (0)
  64. #define paravirt_rsm(mask) \
  65. do { \
  66. if ((mask) == IA64_PSR_I) \
  67. pv_cpu_ops.rsm_i(); \
  68. else \
  69. ia64_native_rsm(mask); \
  70. } while (0)
  71. /******************************************************************************
  72. * replacement of hand written assembly codes.
  73. */
  74. struct pv_cpu_asm_switch {
  75. unsigned long switch_to;
  76. unsigned long leave_syscall;
  77. unsigned long work_processed_syscall;
  78. unsigned long leave_kernel;
  79. };
  80. void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch *cpu_asm_switch);
  81. #endif /* __ASSEMBLY__ */
  82. #define IA64_PARAVIRT_ASM_FUNC(name) paravirt_ ## name
  83. #else
  84. /* fallback for native case */
  85. #define IA64_PARAVIRT_ASM_FUNC(name) ia64_native_ ## name
  86. #endif /* CONFIG_PARAVIRT */
  87. /* these routines utilize privilege-sensitive or performance-sensitive
  88. * privileged instructions so the code must be replaced with
  89. * paravirtualized versions */
  90. #define ia64_switch_to IA64_PARAVIRT_ASM_FUNC(switch_to)
  91. #define ia64_leave_syscall IA64_PARAVIRT_ASM_FUNC(leave_syscall)
  92. #define ia64_work_processed_syscall \
  93. IA64_PARAVIRT_ASM_FUNC(work_processed_syscall)
  94. #define ia64_leave_kernel IA64_PARAVIRT_ASM_FUNC(leave_kernel)
  95. #endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */