xref: /openbmc/linux/arch/x86/include/asm/paravirt_types.h (revision d699090510c3223641a23834b4710e2d4309a6ad)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_PARAVIRT_TYPES_H
3 #define _ASM_X86_PARAVIRT_TYPES_H
4 
5 #ifndef __ASSEMBLY__
6 /* These all sit in the .parainstructions section to tell us what to patch. */
7 struct paravirt_patch_site {
8 	u8 *instr;		/* original instructions */
9 	u8 type;		/* type of this instruction */
10 	u8 len;			/* length of original instruction */
11 };
12 #endif
13 
14 #ifdef CONFIG_PARAVIRT
15 
16 #ifndef __ASSEMBLY__
17 
18 #include <asm/desc_defs.h>
19 #include <asm/pgtable_types.h>
20 #include <asm/nospec-branch.h>
21 
22 struct page;
23 struct thread_struct;
24 struct desc_ptr;
25 struct tss_struct;
26 struct mm_struct;
27 struct desc_struct;
28 struct task_struct;
29 struct cpumask;
30 struct flush_tlb_info;
31 struct mmu_gather;
32 struct vm_area_struct;
33 
34 /*
35  * Wrapper type for pointers to code which uses the non-standard
36  * calling convention.  See PV_CALL_SAVE_REGS_THUNK below.
37  */
38 struct paravirt_callee_save {
39 	void *func;
40 };
41 
42 /* general info */
43 struct pv_info {
44 #ifdef CONFIG_PARAVIRT_XXL
45 	u16 extra_user_64bit_cs;  /* __USER_CS if none */
46 #endif
47 
48 	const char *name;
49 };
50 
51 #ifdef CONFIG_PARAVIRT_XXL
52 struct pv_lazy_ops {
53 	/* Set deferred update mode, used for batching operations. */
54 	void (*enter)(void);
55 	void (*leave)(void);
56 	void (*flush)(void);
57 } __no_randomize_layout;
58 #endif
59 
60 struct pv_cpu_ops {
61 	/* hooks for various privileged instructions */
62 	void (*io_delay)(void);
63 
64 #ifdef CONFIG_PARAVIRT_XXL
65 	unsigned long (*get_debugreg)(int regno);
66 	void (*set_debugreg)(int regno, unsigned long value);
67 
68 	unsigned long (*read_cr0)(void);
69 	void (*write_cr0)(unsigned long);
70 
71 	void (*write_cr4)(unsigned long);
72 
73 	/* Segment descriptor handling */
74 	void (*load_tr_desc)(void);
75 	void (*load_gdt)(const struct desc_ptr *);
76 	void (*load_idt)(const struct desc_ptr *);
77 	void (*set_ldt)(const void *desc, unsigned entries);
78 	unsigned long (*store_tr)(void);
79 	void (*load_tls)(struct thread_struct *t, unsigned int cpu);
80 	void (*load_gs_index)(unsigned int idx);
81 	void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
82 				const void *desc);
83 	void (*write_gdt_entry)(struct desc_struct *,
84 				int entrynum, const void *desc, int size);
85 	void (*write_idt_entry)(gate_desc *,
86 				int entrynum, const gate_desc *gate);
87 	void (*alloc_ldt)(struct desc_struct *ldt, unsigned entries);
88 	void (*free_ldt)(struct desc_struct *ldt, unsigned entries);
89 
90 	void (*load_sp0)(unsigned long sp0);
91 
92 #ifdef CONFIG_X86_IOPL_IOPERM
93 	void (*invalidate_io_bitmap)(void);
94 	void (*update_io_bitmap)(void);
95 #endif
96 
97 	void (*wbinvd)(void);
98 
99 	/* cpuid emulation, mostly so that caps bits can be disabled */
100 	void (*cpuid)(unsigned int *eax, unsigned int *ebx,
101 		      unsigned int *ecx, unsigned int *edx);
102 
103 	/* Unsafe MSR operations.  These will warn or panic on failure. */
104 	u64 (*read_msr)(unsigned int msr);
105 	void (*write_msr)(unsigned int msr, unsigned low, unsigned high);
106 
107 	/*
108 	 * Safe MSR operations.
109 	 * read sets err to 0 or -EIO.  write returns 0 or -EIO.
110 	 */
111 	u64 (*read_msr_safe)(unsigned int msr, int *err);
112 	int (*write_msr_safe)(unsigned int msr, unsigned low, unsigned high);
113 
114 	u64 (*read_pmc)(int counter);
115 
116 	void (*start_context_switch)(struct task_struct *prev);
117 	void (*end_context_switch)(struct task_struct *next);
118 #endif
119 } __no_randomize_layout;
120 
121 struct pv_irq_ops {
122 #ifdef CONFIG_PARAVIRT_XXL
123 	/*
124 	 * Get/set interrupt state.  save_fl is expected to use X86_EFLAGS_IF;
125 	 * all other bits returned from save_fl are undefined.
126 	 *
127 	 * NOTE: These functions callers expect the callee to preserve
128 	 * more registers than the standard C calling convention.
129 	 */
130 	struct paravirt_callee_save save_fl;
131 	struct paravirt_callee_save irq_disable;
132 	struct paravirt_callee_save irq_enable;
133 #endif
134 	void (*safe_halt)(void);
135 	void (*halt)(void);
136 } __no_randomize_layout;
137 
138 struct pv_mmu_ops {
139 	/* TLB operations */
140 	void (*flush_tlb_user)(void);
141 	void (*flush_tlb_kernel)(void);
142 	void (*flush_tlb_one_user)(unsigned long addr);
143 	void (*flush_tlb_multi)(const struct cpumask *cpus,
144 				const struct flush_tlb_info *info);
145 
146 	void (*tlb_remove_table)(struct mmu_gather *tlb, void *table);
147 
148 	/* Hook for intercepting the destruction of an mm_struct. */
149 	void (*exit_mmap)(struct mm_struct *mm);
150 	void (*notify_page_enc_status_changed)(unsigned long pfn, int npages, bool enc);
151 
152 #ifdef CONFIG_PARAVIRT_XXL
153 	struct paravirt_callee_save read_cr2;
154 	void (*write_cr2)(unsigned long);
155 
156 	unsigned long (*read_cr3)(void);
157 	void (*write_cr3)(unsigned long);
158 
159 	/* Hook for intercepting the creation/use of an mm_struct. */
160 	void (*enter_mmap)(struct mm_struct *mm);
161 
162 	/* Hooks for allocating and freeing a pagetable top-level */
163 	int  (*pgd_alloc)(struct mm_struct *mm);
164 	void (*pgd_free)(struct mm_struct *mm, pgd_t *pgd);
165 
166 	/*
167 	 * Hooks for allocating/releasing pagetable pages when they're
168 	 * attached to a pagetable
169 	 */
170 	void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn);
171 	void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn);
172 	void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn);
173 	void (*alloc_p4d)(struct mm_struct *mm, unsigned long pfn);
174 	void (*release_pte)(unsigned long pfn);
175 	void (*release_pmd)(unsigned long pfn);
176 	void (*release_pud)(unsigned long pfn);
177 	void (*release_p4d)(unsigned long pfn);
178 
179 	/* Pagetable manipulation functions */
180 	void (*set_pte)(pte_t *ptep, pte_t pteval);
181 	void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
182 
183 	pte_t (*ptep_modify_prot_start)(struct vm_area_struct *vma, unsigned long addr,
184 					pte_t *ptep);
185 	void (*ptep_modify_prot_commit)(struct vm_area_struct *vma, unsigned long addr,
186 					pte_t *ptep, pte_t pte);
187 
188 	struct paravirt_callee_save pte_val;
189 	struct paravirt_callee_save make_pte;
190 
191 	struct paravirt_callee_save pgd_val;
192 	struct paravirt_callee_save make_pgd;
193 
194 	void (*set_pud)(pud_t *pudp, pud_t pudval);
195 
196 	struct paravirt_callee_save pmd_val;
197 	struct paravirt_callee_save make_pmd;
198 
199 	struct paravirt_callee_save pud_val;
200 	struct paravirt_callee_save make_pud;
201 
202 	void (*set_p4d)(p4d_t *p4dp, p4d_t p4dval);
203 
204 #if CONFIG_PGTABLE_LEVELS >= 5
205 	struct paravirt_callee_save p4d_val;
206 	struct paravirt_callee_save make_p4d;
207 
208 	void (*set_pgd)(pgd_t *pgdp, pgd_t pgdval);
209 #endif	/* CONFIG_PGTABLE_LEVELS >= 5 */
210 
211 	struct pv_lazy_ops lazy_mode;
212 
213 	/* dom0 ops */
214 
215 	/* Sometimes the physical address is a pfn, and sometimes its
216 	   an mfn.  We can tell which is which from the index. */
217 	void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
218 			   phys_addr_t phys, pgprot_t flags);
219 #endif
220 } __no_randomize_layout;
221 
222 struct arch_spinlock;
223 #ifdef CONFIG_SMP
224 #include <asm/spinlock_types.h>
225 #endif
226 
227 struct qspinlock;
228 
229 struct pv_lock_ops {
230 	void (*queued_spin_lock_slowpath)(struct qspinlock *lock, u32 val);
231 	struct paravirt_callee_save queued_spin_unlock;
232 
233 	void (*wait)(u8 *ptr, u8 val);
234 	void (*kick)(int cpu);
235 
236 	struct paravirt_callee_save vcpu_is_preempted;
237 } __no_randomize_layout;
238 
239 /* This contains all the paravirt structures: we get a convenient
240  * number for each function using the offset which we use to indicate
241  * what to patch. */
242 struct paravirt_patch_template {
243 	struct pv_cpu_ops	cpu;
244 	struct pv_irq_ops	irq;
245 	struct pv_mmu_ops	mmu;
246 	struct pv_lock_ops	lock;
247 } __no_randomize_layout;
248 
249 extern struct pv_info pv_info;
250 extern struct paravirt_patch_template pv_ops;
251 
252 #define PARAVIRT_PATCH(x)					\
253 	(offsetof(struct paravirt_patch_template, x) / sizeof(void *))
254 
255 #define paravirt_type(op)				\
256 	[paravirt_typenum] "i" (PARAVIRT_PATCH(op)),	\
257 	[paravirt_opptr] "m" (pv_ops.op)
258 /*
259  * Generate some code, and mark it as patchable by the
260  * apply_paravirt() alternate instruction patcher.
261  */
262 #define _paravirt_alt(insn_string, type)		\
263 	"771:\n\t" insn_string "\n" "772:\n"		\
264 	".pushsection .parainstructions,\"a\"\n"	\
265 	_ASM_ALIGN "\n"					\
266 	_ASM_PTR " 771b\n"				\
267 	"  .byte " type "\n"				\
268 	"  .byte 772b-771b\n"				\
269 	_ASM_ALIGN "\n"					\
270 	".popsection\n"
271 
272 /* Generate patchable code, with the default asm parameters. */
273 #define paravirt_alt(insn_string)					\
274 	_paravirt_alt(insn_string, "%c[paravirt_typenum]")
275 
276 /* Simple instruction patching code. */
277 #define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t"
278 
279 unsigned int paravirt_patch(u8 type, void *insn_buff, unsigned long addr, unsigned int len);
280 
281 int paravirt_disable_iospace(void);
282 
283 /*
284  * This generates an indirect call based on the operation type number.
285  * The type number, computed in PARAVIRT_PATCH, is derived from the
286  * offset into the paravirt_patch_template structure, and can therefore be
287  * freely converted back into a structure offset.
288  */
289 #define PARAVIRT_CALL					\
290 	ANNOTATE_RETPOLINE_SAFE				\
291 	"call *%[paravirt_opptr];"
292 
293 /*
294  * These macros are intended to wrap calls through one of the paravirt
295  * ops structs, so that they can be later identified and patched at
296  * runtime.
297  *
298  * Normally, a call to a pv_op function is a simple indirect call:
299  * (pv_op_struct.operations)(args...).
300  *
301  * Unfortunately, this is a relatively slow operation for modern CPUs,
302  * because it cannot necessarily determine what the destination
303  * address is.  In this case, the address is a runtime constant, so at
304  * the very least we can patch the call to a simple direct call, or,
305  * ideally, patch an inline implementation into the callsite.  (Direct
306  * calls are essentially free, because the call and return addresses
307  * are completely predictable.)
308  *
309  * For i386, these macros rely on the standard gcc "regparm(3)" calling
310  * convention, in which the first three arguments are placed in %eax,
311  * %edx, %ecx (in that order), and the remaining arguments are placed
312  * on the stack.  All caller-save registers (eax,edx,ecx) are expected
313  * to be modified (either clobbered or used for return values).
314  * X86_64, on the other hand, already specifies a register-based calling
315  * conventions, returning at %rax, with parameters going in %rdi, %rsi,
316  * %rdx, and %rcx. Note that for this reason, x86_64 does not need any
317  * special handling for dealing with 4 arguments, unlike i386.
318  * However, x86_64 also has to clobber all caller saved registers, which
319  * unfortunately, are quite a bit (r8 - r11)
320  *
321  * The call instruction itself is marked by placing its start address
322  * and size into the .parainstructions section, so that
323  * apply_paravirt() in arch/i386/kernel/alternative.c can do the
324  * appropriate patching under the control of the backend pv_init_ops
325  * implementation.
326  *
327  * Unfortunately there's no way to get gcc to generate the args setup
328  * for the call, and then allow the call itself to be generated by an
329  * inline asm.  Because of this, we must do the complete arg setup and
330  * return value handling from within these macros.  This is fairly
331  * cumbersome.
332  *
333  * There are 5 sets of PVOP_* macros for dealing with 0-4 arguments.
334  * It could be extended to more arguments, but there would be little
335  * to be gained from that.  For each number of arguments, there are
336  * two VCALL and CALL variants for void and non-void functions.
337  *
338  * When there is a return value, the invoker of the macro must specify
339  * the return type.  The macro then uses sizeof() on that type to
340  * determine whether it's a 32 or 64 bit value and places the return
341  * in the right register(s) (just %eax for 32-bit, and %edx:%eax for
342  * 64-bit). For x86_64 machines, it just returns in %rax regardless of
343  * the return value size.
344  *
345  * 64-bit arguments are passed as a pair of adjacent 32-bit arguments;
346  * i386 also passes 64-bit arguments as a pair of adjacent 32-bit arguments
347  * in low,high order
348  *
349  * Small structures are passed and returned in registers.  The macro
350  * calling convention can't directly deal with this, so the wrapper
351  * functions must do it.
352  *
353  * These PVOP_* macros are only defined within this header.  This
354  * means that all uses must be wrapped in inline functions.  This also
355  * makes sure the incoming and outgoing types are always correct.
356  */
357 #ifdef CONFIG_X86_32
358 #define PVOP_CALL_ARGS							\
359 	unsigned long __eax = __eax, __edx = __edx, __ecx = __ecx;
360 
361 #define PVOP_CALL_ARG1(x)		"a" ((unsigned long)(x))
362 #define PVOP_CALL_ARG2(x)		"d" ((unsigned long)(x))
363 #define PVOP_CALL_ARG3(x)		"c" ((unsigned long)(x))
364 
365 #define PVOP_VCALL_CLOBBERS		"=a" (__eax), "=d" (__edx),	\
366 					"=c" (__ecx)
367 #define PVOP_CALL_CLOBBERS		PVOP_VCALL_CLOBBERS
368 
369 #define PVOP_VCALLEE_CLOBBERS		"=a" (__eax), "=d" (__edx)
370 #define PVOP_CALLEE_CLOBBERS		PVOP_VCALLEE_CLOBBERS
371 
372 #define EXTRA_CLOBBERS
373 #define VEXTRA_CLOBBERS
374 #else  /* CONFIG_X86_64 */
375 /* [re]ax isn't an arg, but the return val */
376 #define PVOP_CALL_ARGS						\
377 	unsigned long __edi = __edi, __esi = __esi,		\
378 		__edx = __edx, __ecx = __ecx, __eax = __eax;
379 
380 #define PVOP_CALL_ARG1(x)		"D" ((unsigned long)(x))
381 #define PVOP_CALL_ARG2(x)		"S" ((unsigned long)(x))
382 #define PVOP_CALL_ARG3(x)		"d" ((unsigned long)(x))
383 #define PVOP_CALL_ARG4(x)		"c" ((unsigned long)(x))
384 
385 #define PVOP_VCALL_CLOBBERS	"=D" (__edi),				\
386 				"=S" (__esi), "=d" (__edx),		\
387 				"=c" (__ecx)
388 #define PVOP_CALL_CLOBBERS	PVOP_VCALL_CLOBBERS, "=a" (__eax)
389 
390 /*
391  * void functions are still allowed [re]ax for scratch.
392  *
393  * The ZERO_CALL_USED REGS feature may end up zeroing out callee-saved
394  * registers. Make sure we model this with the appropriate clobbers.
395  */
396 #ifdef CONFIG_ZERO_CALL_USED_REGS
397 #define PVOP_VCALLEE_CLOBBERS	"=a" (__eax), PVOP_VCALL_CLOBBERS
398 #else
399 #define PVOP_VCALLEE_CLOBBERS	"=a" (__eax)
400 #endif
401 #define PVOP_CALLEE_CLOBBERS	PVOP_VCALLEE_CLOBBERS
402 
403 #define EXTRA_CLOBBERS	 , "r8", "r9", "r10", "r11"
404 #define VEXTRA_CLOBBERS	 , "rax", "r8", "r9", "r10", "r11"
405 #endif	/* CONFIG_X86_32 */
406 
407 #ifdef CONFIG_PARAVIRT_DEBUG
408 #define PVOP_TEST_NULL(op)	BUG_ON(pv_ops.op == NULL)
409 #else
410 #define PVOP_TEST_NULL(op)	((void)pv_ops.op)
411 #endif
412 
413 #define PVOP_RETVAL(rettype)						\
414 	({	unsigned long __mask = ~0UL;				\
415 		BUILD_BUG_ON(sizeof(rettype) > sizeof(unsigned long));	\
416 		switch (sizeof(rettype)) {				\
417 		case 1: __mask =       0xffUL; break;			\
418 		case 2: __mask =     0xffffUL; break;			\
419 		case 4: __mask = 0xffffffffUL; break;			\
420 		default: break;						\
421 		}							\
422 		__mask & __eax;						\
423 	})
424 
425 
426 #define ____PVOP_CALL(ret, op, call_clbr, extra_clbr, ...)	\
427 	({								\
428 		PVOP_CALL_ARGS;						\
429 		PVOP_TEST_NULL(op);					\
430 		asm volatile(paravirt_alt(PARAVIRT_CALL)		\
431 			     : call_clbr, ASM_CALL_CONSTRAINT		\
432 			     : paravirt_type(op),			\
433 			       ##__VA_ARGS__				\
434 			     : "memory", "cc" extra_clbr);		\
435 		ret;							\
436 	})
437 
438 #define ____PVOP_ALT_CALL(ret, op, alt, cond, call_clbr,		\
439 			  extra_clbr, ...)				\
440 	({								\
441 		PVOP_CALL_ARGS;						\
442 		PVOP_TEST_NULL(op);					\
443 		asm volatile(ALTERNATIVE(paravirt_alt(PARAVIRT_CALL),	\
444 					 alt, cond)			\
445 			     : call_clbr, ASM_CALL_CONSTRAINT		\
446 			     : paravirt_type(op),			\
447 			       ##__VA_ARGS__				\
448 			     : "memory", "cc" extra_clbr);		\
449 		ret;							\
450 	})
451 
452 #define __PVOP_CALL(rettype, op, ...)					\
453 	____PVOP_CALL(PVOP_RETVAL(rettype), op,				\
454 		      PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS, ##__VA_ARGS__)
455 
456 #define __PVOP_ALT_CALL(rettype, op, alt, cond, ...)			\
457 	____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op, alt, cond,		\
458 			  PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS,		\
459 			  ##__VA_ARGS__)
460 
461 #define __PVOP_CALLEESAVE(rettype, op, ...)				\
462 	____PVOP_CALL(PVOP_RETVAL(rettype), op.func,			\
463 		      PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
464 
465 #define __PVOP_ALT_CALLEESAVE(rettype, op, alt, cond, ...)		\
466 	____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op.func, alt, cond,	\
467 			  PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
468 
469 
470 #define __PVOP_VCALL(op, ...)						\
471 	(void)____PVOP_CALL(, op, PVOP_VCALL_CLOBBERS,			\
472 		       VEXTRA_CLOBBERS, ##__VA_ARGS__)
473 
474 #define __PVOP_ALT_VCALL(op, alt, cond, ...)				\
475 	(void)____PVOP_ALT_CALL(, op, alt, cond,			\
476 				PVOP_VCALL_CLOBBERS, VEXTRA_CLOBBERS,	\
477 				##__VA_ARGS__)
478 
479 #define __PVOP_VCALLEESAVE(op, ...)					\
480 	(void)____PVOP_CALL(, op.func,					\
481 			    PVOP_VCALLEE_CLOBBERS, , ##__VA_ARGS__)
482 
483 #define __PVOP_ALT_VCALLEESAVE(op, alt, cond, ...)			\
484 	(void)____PVOP_ALT_CALL(, op.func, alt, cond,			\
485 				PVOP_VCALLEE_CLOBBERS, , ##__VA_ARGS__)
486 
487 
488 #define PVOP_CALL0(rettype, op)						\
489 	__PVOP_CALL(rettype, op)
490 #define PVOP_VCALL0(op)							\
491 	__PVOP_VCALL(op)
492 #define PVOP_ALT_CALL0(rettype, op, alt, cond)				\
493 	__PVOP_ALT_CALL(rettype, op, alt, cond)
494 #define PVOP_ALT_VCALL0(op, alt, cond)					\
495 	__PVOP_ALT_VCALL(op, alt, cond)
496 
497 #define PVOP_CALLEE0(rettype, op)					\
498 	__PVOP_CALLEESAVE(rettype, op)
499 #define PVOP_VCALLEE0(op)						\
500 	__PVOP_VCALLEESAVE(op)
501 #define PVOP_ALT_CALLEE0(rettype, op, alt, cond)			\
502 	__PVOP_ALT_CALLEESAVE(rettype, op, alt, cond)
503 #define PVOP_ALT_VCALLEE0(op, alt, cond)				\
504 	__PVOP_ALT_VCALLEESAVE(op, alt, cond)
505 
506 
507 #define PVOP_CALL1(rettype, op, arg1)					\
508 	__PVOP_CALL(rettype, op, PVOP_CALL_ARG1(arg1))
509 #define PVOP_VCALL1(op, arg1)						\
510 	__PVOP_VCALL(op, PVOP_CALL_ARG1(arg1))
511 #define PVOP_ALT_VCALL1(op, arg1, alt, cond)				\
512 	__PVOP_ALT_VCALL(op, alt, cond, PVOP_CALL_ARG1(arg1))
513 
514 #define PVOP_CALLEE1(rettype, op, arg1)					\
515 	__PVOP_CALLEESAVE(rettype, op, PVOP_CALL_ARG1(arg1))
516 #define PVOP_VCALLEE1(op, arg1)						\
517 	__PVOP_VCALLEESAVE(op, PVOP_CALL_ARG1(arg1))
518 #define PVOP_ALT_CALLEE1(rettype, op, arg1, alt, cond)			\
519 	__PVOP_ALT_CALLEESAVE(rettype, op, alt, cond, PVOP_CALL_ARG1(arg1))
520 #define PVOP_ALT_VCALLEE1(op, arg1, alt, cond)				\
521 	__PVOP_ALT_VCALLEESAVE(op, alt, cond, PVOP_CALL_ARG1(arg1))
522 
523 
524 #define PVOP_CALL2(rettype, op, arg1, arg2)				\
525 	__PVOP_CALL(rettype, op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2))
526 #define PVOP_VCALL2(op, arg1, arg2)					\
527 	__PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2))
528 
529 #define PVOP_CALL3(rettype, op, arg1, arg2, arg3)			\
530 	__PVOP_CALL(rettype, op, PVOP_CALL_ARG1(arg1),			\
531 		    PVOP_CALL_ARG2(arg2), PVOP_CALL_ARG3(arg3))
532 #define PVOP_VCALL3(op, arg1, arg2, arg3)				\
533 	__PVOP_VCALL(op, PVOP_CALL_ARG1(arg1),				\
534 		     PVOP_CALL_ARG2(arg2), PVOP_CALL_ARG3(arg3))
535 
536 #define PVOP_CALL4(rettype, op, arg1, arg2, arg3, arg4)			\
537 	__PVOP_CALL(rettype, op,					\
538 		    PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2),		\
539 		    PVOP_CALL_ARG3(arg3), PVOP_CALL_ARG4(arg4))
540 #define PVOP_VCALL4(op, arg1, arg2, arg3, arg4)				\
541 	__PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2),	\
542 		     PVOP_CALL_ARG3(arg3), PVOP_CALL_ARG4(arg4))
543 
544 void _paravirt_nop(void);
545 void paravirt_BUG(void);
546 unsigned long paravirt_ret0(void);
547 #ifdef CONFIG_PARAVIRT_XXL
548 u64 _paravirt_ident_64(u64);
549 unsigned long pv_native_save_fl(void);
550 void pv_native_irq_disable(void);
551 void pv_native_irq_enable(void);
552 unsigned long pv_native_read_cr2(void);
553 #endif
554 
555 #define paravirt_nop	((void *)_paravirt_nop)
556 
557 extern struct paravirt_patch_site __parainstructions[],
558 	__parainstructions_end[];
559 
560 #endif	/* __ASSEMBLY__ */
561 #endif  /* CONFIG_PARAVIRT */
562 #endif	/* _ASM_X86_PARAVIRT_TYPES_H */
563