Skip to content

Commit

Permalink
argo: introduce the argo_op hypercall boilerplate
Browse files Browse the repository at this point in the history
Presence is gated upon CONFIG_ARGO.

Registers the hypercall previously reserved for this.
Takes 5 arguments, does nothing and returns -ENOSYS.

Will be avoiding a compat ABI by using fixed-size types in hypercall ops so
HYPERCALL, rather than COMPAT_CALL, is the correct macro for the hypercall
tables.

Even though handles will be used for (up to) two of the arguments to the
hypercall, there will be no need for any XLAT_* translation functions
because the referenced data structures have been constructed to be exactly
the same size and bit pattern on both 32-bit and 64-bit guests, and padded
to be integer multiples of 32 bits in size. This means that the same
copy_to_guest and copy_from_guest logic can be relied upon to perform as
required without any further intervention. Testing communication with 32
and 64 bit guests has confirmed this works as intended.

Signed-off-by: Christopher Clark <[email protected]>
Acked-by: Jan Beulich <[email protected]>

v2 Copyright line: add 2019
v2 feedback xen-project#3 Jan: drop "message" from argo_message_op
v2 feedback xen-project#3 Jan: add Acked-by
v1 feedback #15 Jan: handle upper-halves of hypercall args
v1 feedback #15 Jan: use unsigned where negative values impossible
  • Loading branch information
dozylynx authored and andyhhp committed Jan 15, 2019
1 parent 597b225 commit 0a17259
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xen/arch/x86/guest/hypercall_page.S
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DECLARE_HYPERCALL(sysctl)
DECLARE_HYPERCALL(domctl)
DECLARE_HYPERCALL(kexec_op)
DECLARE_HYPERCALL(tmem_op)
DECLARE_HYPERCALL(xc_reserved_op)
DECLARE_HYPERCALL(argo_op)
DECLARE_HYPERCALL(xenpmu_op)

DECLARE_HYPERCALL(arch_0)
Expand Down
3 changes: 3 additions & 0 deletions xen/arch/x86/hvm/hypercall.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ static const hypercall_table_t hvm_hypercall_table[] = {
HYPERCALL(domctl),
#ifdef CONFIG_TMEM
HYPERCALL(tmem_op),
#endif
#ifdef CONFIG_ARGO
HYPERCALL(argo_op),
#endif
COMPAT_CALL(platform_op),
#ifdef CONFIG_PV
Expand Down
3 changes: 3 additions & 0 deletions xen/arch/x86/hypercall.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =
ARGS(domctl, 1),
ARGS(kexec_op, 2),
ARGS(tmem_op, 1),
#ifdef CONFIG_ARGO
ARGS(argo_op, 5),
#endif
ARGS(xenpmu_op, 2),
#ifdef CONFIG_HVM
ARGS(hvm_op, 2),
Expand Down
3 changes: 3 additions & 0 deletions xen/arch/x86/pv/hypercall.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ const hypercall_table_t pv_hypercall_table[] = {
#endif
#ifdef CONFIG_TMEM
HYPERCALL(tmem_op),
#endif
#ifdef CONFIG_ARGO
HYPERCALL(argo_op),
#endif
HYPERCALL(xenpmu_op),
#ifdef CONFIG_HVM
Expand Down
1 change: 1 addition & 0 deletions xen/common/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
obj-$(CONFIG_ARGO) += argo.o
obj-y += bitmap.o
obj-y += bsearch.o
obj-$(CONFIG_CORE_PARKING) += core_parking.o
Expand Down
28 changes: 28 additions & 0 deletions xen/common/argo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/******************************************************************************
* Argo : Hypervisor-Mediated data eXchange
*
* Derived from v4v, the version 2 of v2v.
*
* Copyright (c) 2010, Citrix Systems
* Copyright (c) 2018-2019 BAE Systems
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include <xen/errno.h>
#include <xen/guest_access.h>

long
do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3,
unsigned long arg4)
{
return -ENOSYS;
}
2 changes: 1 addition & 1 deletion xen/include/public/xen.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
#define __HYPERVISOR_domctl 36
#define __HYPERVISOR_kexec_op 37
#define __HYPERVISOR_tmem_op 38
#define __HYPERVISOR_xc_reserved_op 39 /* reserved for XenClient */
#define __HYPERVISOR_argo_op 39
#define __HYPERVISOR_xenpmu_op 40
#define __HYPERVISOR_dm_op 41

Expand Down
9 changes: 9 additions & 0 deletions xen/include/xen/hypercall.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ do_tmem_op(
XEN_GUEST_HANDLE_PARAM(tmem_op_t) uops);
#endif

#ifdef CONFIG_ARGO
extern long do_argo_op(
unsigned int cmd,
XEN_GUEST_HANDLE_PARAM(void) arg1,
XEN_GUEST_HANDLE_PARAM(void) arg2,
unsigned long arg3,
unsigned long arg4);
#endif

extern long
do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg);

Expand Down

0 comments on commit 0a17259

Please sign in to comment.