Skip to content

Commit ee1f9d1

Browse files
jgross1bostrovs
authored andcommitted
xen: allow pv-only hypercalls only with CONFIG_XEN_PV
Put the definitions of the hypercalls usable only by pv guests inside CONFIG_XEN_PV sections. On Arm two dummy functions related to pv hypercalls can be removed. While at it remove the no longer supported tmem hypercall definition. Signed-off-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent d99bb72 commit ee1f9d1

File tree

5 files changed

+102
-127
lines changed

5 files changed

+102
-127
lines changed

arch/arm/xen/enlighten.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
442442
EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
443443
EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
444444
EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
445-
EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
446445
EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw);
447446
EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
448447
EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist);

arch/arm/xen/hypercall.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ HYPERCALL2(hvm_op);
8888
HYPERCALL2(memory_op);
8989
HYPERCALL2(physdev_op);
9090
HYPERCALL3(vcpu_op);
91-
HYPERCALL1(tmem_op);
9291
HYPERCALL1(platform_op_raw);
9392
HYPERCALL2(multicall);
9493
HYPERCALL2(vm_assist);

arch/arm64/xen/hypercall.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ HYPERCALL2(hvm_op);
8080
HYPERCALL2(memory_op);
8181
HYPERCALL2(physdev_op);
8282
HYPERCALL3(vcpu_op);
83-
HYPERCALL1(tmem_op);
8483
HYPERCALL1(platform_op_raw);
8584
HYPERCALL2(multicall);
8685
HYPERCALL2(vm_assist);

arch/x86/include/asm/xen/hypercall.h

Lines changed: 102 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ privcmd_call(unsigned int call,
248248
return res;
249249
}
250250

251+
#ifdef CONFIG_XEN_PV
251252
static inline int
252253
HYPERVISOR_set_trap_table(struct trap_info *table)
253254
{
@@ -280,6 +281,107 @@ HYPERVISOR_callback_op(int cmd, void *arg)
280281
return _hypercall2(int, callback_op, cmd, arg);
281282
}
282283

284+
static inline int
285+
HYPERVISOR_set_debugreg(int reg, unsigned long value)
286+
{
287+
return _hypercall2(int, set_debugreg, reg, value);
288+
}
289+
290+
static inline unsigned long
291+
HYPERVISOR_get_debugreg(int reg)
292+
{
293+
return _hypercall1(unsigned long, get_debugreg, reg);
294+
}
295+
296+
static inline int
297+
HYPERVISOR_update_descriptor(u64 ma, u64 desc)
298+
{
299+
return _hypercall2(int, update_descriptor, ma, desc);
300+
}
301+
302+
static inline int
303+
HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
304+
unsigned long flags)
305+
{
306+
return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
307+
}
308+
309+
static inline int
310+
HYPERVISOR_set_segment_base(int reg, unsigned long value)
311+
{
312+
return _hypercall2(int, set_segment_base, reg, value);
313+
}
314+
315+
static inline void
316+
MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
317+
{
318+
mcl->op = __HYPERVISOR_fpu_taskswitch;
319+
mcl->args[0] = set;
320+
321+
trace_xen_mc_entry(mcl, 1);
322+
}
323+
324+
static inline void
325+
MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
326+
pte_t new_val, unsigned long flags)
327+
{
328+
mcl->op = __HYPERVISOR_update_va_mapping;
329+
mcl->args[0] = va;
330+
mcl->args[1] = new_val.pte;
331+
mcl->args[2] = flags;
332+
333+
trace_xen_mc_entry(mcl, 3);
334+
}
335+
336+
static inline void
337+
MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
338+
struct desc_struct desc)
339+
{
340+
mcl->op = __HYPERVISOR_update_descriptor;
341+
mcl->args[0] = maddr;
342+
mcl->args[1] = *(unsigned long *)&desc;
343+
344+
trace_xen_mc_entry(mcl, 2);
345+
}
346+
347+
static inline void
348+
MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
349+
int count, int *success_count, domid_t domid)
350+
{
351+
mcl->op = __HYPERVISOR_mmu_update;
352+
mcl->args[0] = (unsigned long)req;
353+
mcl->args[1] = count;
354+
mcl->args[2] = (unsigned long)success_count;
355+
mcl->args[3] = domid;
356+
357+
trace_xen_mc_entry(mcl, 4);
358+
}
359+
360+
static inline void
361+
MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
362+
int *success_count, domid_t domid)
363+
{
364+
mcl->op = __HYPERVISOR_mmuext_op;
365+
mcl->args[0] = (unsigned long)op;
366+
mcl->args[1] = count;
367+
mcl->args[2] = (unsigned long)success_count;
368+
mcl->args[3] = domid;
369+
370+
trace_xen_mc_entry(mcl, 4);
371+
}
372+
373+
static inline void
374+
MULTI_stack_switch(struct multicall_entry *mcl,
375+
unsigned long ss, unsigned long esp)
376+
{
377+
mcl->op = __HYPERVISOR_stack_switch;
378+
mcl->args[0] = ss;
379+
mcl->args[1] = esp;
380+
381+
trace_xen_mc_entry(mcl, 2);
382+
}
383+
#endif
384+
283385
static inline int
284386
HYPERVISOR_sched_op(int cmd, void *arg)
285387
{
@@ -308,24 +410,6 @@ HYPERVISOR_platform_op(struct xen_platform_op *op)
308410
return _hypercall1(int, platform_op, op);
309411
}
310412

311-
static __always_inline int
312-
HYPERVISOR_set_debugreg(int reg, unsigned long value)
313-
{
314-
return _hypercall2(int, set_debugreg, reg, value);
315-
}
316-
317-
static __always_inline unsigned long
318-
HYPERVISOR_get_debugreg(int reg)
319-
{
320-
return _hypercall1(unsigned long, get_debugreg, reg);
321-
}
322-
323-
static inline int
324-
HYPERVISOR_update_descriptor(u64 ma, u64 desc)
325-
{
326-
return _hypercall2(int, update_descriptor, ma, desc);
327-
}
328-
329413
static inline long
330414
HYPERVISOR_memory_op(unsigned int cmd, void *arg)
331415
{
@@ -338,13 +422,6 @@ HYPERVISOR_multicall(void *call_list, uint32_t nr_calls)
338422
return _hypercall2(int, multicall, call_list, nr_calls);
339423
}
340424

341-
static inline int
342-
HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
343-
unsigned long flags)
344-
{
345-
return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
346-
}
347-
348425
static inline int
349426
HYPERVISOR_event_channel_op(int cmd, void *arg)
350427
{
@@ -387,14 +464,6 @@ HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
387464
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
388465
}
389466

390-
#ifdef CONFIG_X86_64
391-
static inline int
392-
HYPERVISOR_set_segment_base(int reg, unsigned long value)
393-
{
394-
return _hypercall2(int, set_segment_base, reg, value);
395-
}
396-
#endif
397-
398467
static inline int
399468
HYPERVISOR_suspend(unsigned long start_info_mfn)
400469
{
@@ -415,13 +484,6 @@ HYPERVISOR_hvm_op(int op, void *arg)
415484
return _hypercall2(unsigned long, hvm_op, op, arg);
416485
}
417486

418-
static inline int
419-
HYPERVISOR_tmem_op(
420-
struct tmem_op *op)
421-
{
422-
return _hypercall1(int, tmem_op, op);
423-
}
424-
425487
static inline int
426488
HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
427489
{
@@ -439,73 +501,4 @@ HYPERVISOR_dm_op(
439501
return ret;
440502
}
441503

442-
static inline void
443-
MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
444-
{
445-
mcl->op = __HYPERVISOR_fpu_taskswitch;
446-
mcl->args[0] = set;
447-
448-
trace_xen_mc_entry(mcl, 1);
449-
}
450-
451-
static inline void
452-
MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
453-
pte_t new_val, unsigned long flags)
454-
{
455-
mcl->op = __HYPERVISOR_update_va_mapping;
456-
mcl->args[0] = va;
457-
mcl->args[1] = new_val.pte;
458-
mcl->args[2] = flags;
459-
460-
trace_xen_mc_entry(mcl, 3);
461-
}
462-
463-
static inline void
464-
MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
465-
struct desc_struct desc)
466-
{
467-
mcl->op = __HYPERVISOR_update_descriptor;
468-
mcl->args[0] = maddr;
469-
mcl->args[1] = *(unsigned long *)&desc;
470-
471-
trace_xen_mc_entry(mcl, 2);
472-
}
473-
474-
static inline void
475-
MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
476-
int count, int *success_count, domid_t domid)
477-
{
478-
mcl->op = __HYPERVISOR_mmu_update;
479-
mcl->args[0] = (unsigned long)req;
480-
mcl->args[1] = count;
481-
mcl->args[2] = (unsigned long)success_count;
482-
mcl->args[3] = domid;
483-
484-
trace_xen_mc_entry(mcl, 4);
485-
}
486-
487-
static inline void
488-
MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
489-
int *success_count, domid_t domid)
490-
{
491-
mcl->op = __HYPERVISOR_mmuext_op;
492-
mcl->args[0] = (unsigned long)op;
493-
mcl->args[1] = count;
494-
mcl->args[2] = (unsigned long)success_count;
495-
mcl->args[3] = domid;
496-
497-
trace_xen_mc_entry(mcl, 4);
498-
}
499-
500-
static inline void
501-
MULTI_stack_switch(struct multicall_entry *mcl,
502-
unsigned long ss, unsigned long esp)
503-
{
504-
mcl->op = __HYPERVISOR_stack_switch;
505-
mcl->args[0] = ss;
506-
mcl->args[1] = esp;
507-
508-
trace_xen_mc_entry(mcl, 2);
509-
}
510-
511504
#endif /* _ASM_X86_XEN_HYPERCALL_H */

include/xen/arm/hypercall.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ unsigned long HYPERVISOR_hvm_op(int op, void *arg);
5353
int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
5454
int HYPERVISOR_physdev_op(int cmd, void *arg);
5555
int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
56-
int HYPERVISOR_tmem_op(void *arg);
5756
int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
5857
int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
5958
struct xen_dm_op_buf *bufs);
@@ -74,18 +73,4 @@ HYPERVISOR_suspend(unsigned long start_info_mfn)
7473
return HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
7574
}
7675

77-
static inline void
78-
MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
79-
unsigned int new_val, unsigned long flags)
80-
{
81-
BUG();
82-
}
83-
84-
static inline void
85-
MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
86-
int count, int *success_count, domid_t domid)
87-
{
88-
BUG();
89-
}
90-
9176
#endif /* _ASM_ARM_XEN_HYPERCALL_H */

0 commit comments

Comments
 (0)