mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
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 <jgross@suse.com> Link: https://lore.kernel.org/r/20211028081221.2475-3-jgross@suse.com Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
This commit is contained in:
parent
d99bb72a30
commit
ee1f9d1914
@ -442,7 +442,6 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
|
||||
EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist);
|
||||
|
@ -88,7 +88,6 @@ HYPERCALL2(hvm_op);
|
||||
HYPERCALL2(memory_op);
|
||||
HYPERCALL2(physdev_op);
|
||||
HYPERCALL3(vcpu_op);
|
||||
HYPERCALL1(tmem_op);
|
||||
HYPERCALL1(platform_op_raw);
|
||||
HYPERCALL2(multicall);
|
||||
HYPERCALL2(vm_assist);
|
||||
|
@ -80,7 +80,6 @@ HYPERCALL2(hvm_op);
|
||||
HYPERCALL2(memory_op);
|
||||
HYPERCALL2(physdev_op);
|
||||
HYPERCALL3(vcpu_op);
|
||||
HYPERCALL1(tmem_op);
|
||||
HYPERCALL1(platform_op_raw);
|
||||
HYPERCALL2(multicall);
|
||||
HYPERCALL2(vm_assist);
|
||||
|
@ -248,6 +248,7 @@ privcmd_call(unsigned int call,
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XEN_PV
|
||||
static inline int
|
||||
HYPERVISOR_set_trap_table(struct trap_info *table)
|
||||
{
|
||||
@ -281,40 +282,12 @@ HYPERVISOR_callback_op(int cmd, void *arg)
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_sched_op(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, sched_op, cmd, arg);
|
||||
}
|
||||
|
||||
static inline long
|
||||
HYPERVISOR_set_timer_op(u64 timeout)
|
||||
{
|
||||
unsigned long timeout_hi = (unsigned long)(timeout>>32);
|
||||
unsigned long timeout_lo = (unsigned long)timeout;
|
||||
return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_mca(struct xen_mc *mc_op)
|
||||
{
|
||||
mc_op->interface_version = XEN_MCA_INTERFACE_VERSION;
|
||||
return _hypercall1(int, mca, mc_op);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_platform_op(struct xen_platform_op *op)
|
||||
{
|
||||
op->interface_version = XENPF_INTERFACE_VERSION;
|
||||
return _hypercall1(int, platform_op, op);
|
||||
}
|
||||
|
||||
static __always_inline int
|
||||
HYPERVISOR_set_debugreg(int reg, unsigned long value)
|
||||
{
|
||||
return _hypercall2(int, set_debugreg, reg, value);
|
||||
}
|
||||
|
||||
static __always_inline unsigned long
|
||||
static inline unsigned long
|
||||
HYPERVISOR_get_debugreg(int reg)
|
||||
{
|
||||
return _hypercall1(unsigned long, get_debugreg, reg);
|
||||
@ -326,18 +299,6 @@ HYPERVISOR_update_descriptor(u64 ma, u64 desc)
|
||||
return _hypercall2(int, update_descriptor, ma, desc);
|
||||
}
|
||||
|
||||
static inline long
|
||||
HYPERVISOR_memory_op(unsigned int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(long, memory_op, cmd, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_multicall(void *call_list, uint32_t nr_calls)
|
||||
{
|
||||
return _hypercall2(int, multicall, call_list, nr_calls);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
|
||||
unsigned long flags)
|
||||
@ -345,99 +306,11 @@ HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
|
||||
return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_event_channel_op(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, event_channel_op, cmd, arg);
|
||||
}
|
||||
|
||||
static __always_inline int
|
||||
HYPERVISOR_xen_version(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, xen_version, cmd, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_console_io(int cmd, int count, char *str)
|
||||
{
|
||||
return _hypercall3(int, console_io, cmd, count, str);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_physdev_op(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, physdev_op, cmd, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
|
||||
{
|
||||
return _hypercall3(int, grant_table_op, cmd, uop, count);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
|
||||
{
|
||||
return _hypercall2(int, vm_assist, cmd, type);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
|
||||
{
|
||||
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
static inline int
|
||||
HYPERVISOR_set_segment_base(int reg, unsigned long value)
|
||||
{
|
||||
return _hypercall2(int, set_segment_base, reg, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_suspend(unsigned long start_info_mfn)
|
||||
{
|
||||
struct sched_shutdown r = { .reason = SHUTDOWN_suspend };
|
||||
|
||||
/*
|
||||
* For a PV guest the tools require that the start_info mfn be
|
||||
* present in rdx/edx when the hypercall is made. Per the
|
||||
* hypercall calling convention this is the third hypercall
|
||||
* argument, which is start_info_mfn here.
|
||||
*/
|
||||
return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn);
|
||||
}
|
||||
|
||||
static inline unsigned long __must_check
|
||||
HYPERVISOR_hvm_op(int op, void *arg)
|
||||
{
|
||||
return _hypercall2(unsigned long, hvm_op, op, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_tmem_op(
|
||||
struct tmem_op *op)
|
||||
{
|
||||
return _hypercall1(int, tmem_op, op);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
|
||||
{
|
||||
return _hypercall2(int, xenpmu_op, op, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_dm_op(
|
||||
domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
|
||||
{
|
||||
int ret;
|
||||
__xen_stac();
|
||||
ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
|
||||
__xen_clac();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
|
||||
@ -507,5 +380,125 @@ MULTI_stack_switch(struct multicall_entry *mcl,
|
||||
|
||||
trace_xen_mc_entry(mcl, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_sched_op(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, sched_op, cmd, arg);
|
||||
}
|
||||
|
||||
static inline long
|
||||
HYPERVISOR_set_timer_op(u64 timeout)
|
||||
{
|
||||
unsigned long timeout_hi = (unsigned long)(timeout>>32);
|
||||
unsigned long timeout_lo = (unsigned long)timeout;
|
||||
return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_mca(struct xen_mc *mc_op)
|
||||
{
|
||||
mc_op->interface_version = XEN_MCA_INTERFACE_VERSION;
|
||||
return _hypercall1(int, mca, mc_op);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_platform_op(struct xen_platform_op *op)
|
||||
{
|
||||
op->interface_version = XENPF_INTERFACE_VERSION;
|
||||
return _hypercall1(int, platform_op, op);
|
||||
}
|
||||
|
||||
static inline long
|
||||
HYPERVISOR_memory_op(unsigned int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(long, memory_op, cmd, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_multicall(void *call_list, uint32_t nr_calls)
|
||||
{
|
||||
return _hypercall2(int, multicall, call_list, nr_calls);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_event_channel_op(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, event_channel_op, cmd, arg);
|
||||
}
|
||||
|
||||
static __always_inline int
|
||||
HYPERVISOR_xen_version(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, xen_version, cmd, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_console_io(int cmd, int count, char *str)
|
||||
{
|
||||
return _hypercall3(int, console_io, cmd, count, str);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_physdev_op(int cmd, void *arg)
|
||||
{
|
||||
return _hypercall2(int, physdev_op, cmd, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
|
||||
{
|
||||
return _hypercall3(int, grant_table_op, cmd, uop, count);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
|
||||
{
|
||||
return _hypercall2(int, vm_assist, cmd, type);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
|
||||
{
|
||||
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_suspend(unsigned long start_info_mfn)
|
||||
{
|
||||
struct sched_shutdown r = { .reason = SHUTDOWN_suspend };
|
||||
|
||||
/*
|
||||
* For a PV guest the tools require that the start_info mfn be
|
||||
* present in rdx/edx when the hypercall is made. Per the
|
||||
* hypercall calling convention this is the third hypercall
|
||||
* argument, which is start_info_mfn here.
|
||||
*/
|
||||
return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn);
|
||||
}
|
||||
|
||||
static inline unsigned long __must_check
|
||||
HYPERVISOR_hvm_op(int op, void *arg)
|
||||
{
|
||||
return _hypercall2(unsigned long, hvm_op, op, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
|
||||
{
|
||||
return _hypercall2(int, xenpmu_op, op, arg);
|
||||
}
|
||||
|
||||
static inline int
|
||||
HYPERVISOR_dm_op(
|
||||
domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
|
||||
{
|
||||
int ret;
|
||||
__xen_stac();
|
||||
ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
|
||||
__xen_clac();
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* _ASM_X86_XEN_HYPERCALL_H */
|
||||
|
@ -53,7 +53,6 @@ unsigned long HYPERVISOR_hvm_op(int op, void *arg);
|
||||
int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
|
||||
int HYPERVISOR_physdev_op(int cmd, void *arg);
|
||||
int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
|
||||
int HYPERVISOR_tmem_op(void *arg);
|
||||
int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
|
||||
int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
|
||||
struct xen_dm_op_buf *bufs);
|
||||
@ -74,18 +73,4 @@ HYPERVISOR_suspend(unsigned long start_info_mfn)
|
||||
return HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
|
||||
}
|
||||
|
||||
static inline void
|
||||
MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
|
||||
unsigned int new_val, unsigned long flags)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void
|
||||
MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
|
||||
int count, int *success_count, domid_t domid)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
#endif /* _ASM_ARM_XEN_HYPERCALL_H */
|
||||
|
Loading…
Reference in New Issue
Block a user