paravirt_privop.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #endif /* __ASSEMBLY__ */
  72. #else
  73. /* fallback for native case */
  74. #endif /* CONFIG_PARAVIRT */
  75. #endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */