Skip to content

Commit ff7b539

Browse files
dozylynxEric Chanudet
authored andcommitted
argo: introduce the argo_op hypercall boilerplate
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
1 parent 5504704 commit ff7b539

File tree

8 files changed

+49
-2
lines changed

8 files changed

+49
-2
lines changed

xen/arch/x86/guest/hypercall_page.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ DECLARE_HYPERCALL(sysctl)
5959
DECLARE_HYPERCALL(domctl)
6060
DECLARE_HYPERCALL(kexec_op)
6161
DECLARE_HYPERCALL(tmem_op)
62-
DECLARE_HYPERCALL(xc_reserved_op)
62+
DECLARE_HYPERCALL(argo_op)
6363
DECLARE_HYPERCALL(xenpmu_op)
6464

6565
DECLARE_HYPERCALL(arch_0)

xen/arch/x86/hvm/hypercall.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ static const hypercall_table_t hvm_hypercall_table[] = {
133133
HYPERCALL(domctl),
134134
#ifdef CONFIG_TMEM
135135
HYPERCALL(tmem_op),
136+
#endif
137+
#ifdef CONFIG_ARGO
138+
HYPERCALL(argo_op),
136139
#endif
137140
COMPAT_CALL(platform_op),
138141
#ifdef CONFIG_PV

xen/arch/x86/hypercall.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =
6464
ARGS(domctl, 1),
6565
ARGS(kexec_op, 2),
6666
ARGS(tmem_op, 1),
67+
#ifdef CONFIG_ARGO
68+
ARGS(argo_op, 5),
69+
#endif
6770
ARGS(xenpmu_op, 2),
6871
#ifdef CONFIG_HVM
6972
ARGS(hvm_op, 2),

xen/arch/x86/pv/hypercall.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ const hypercall_table_t pv_hypercall_table[] = {
7676
#endif
7777
#ifdef CONFIG_TMEM
7878
HYPERCALL(tmem_op),
79+
#endif
80+
#ifdef CONFIG_ARGO
81+
HYPERCALL(argo_op),
7982
#endif
8083
HYPERCALL(xenpmu_op),
8184
#ifdef CONFIG_HVM

xen/common/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
obj-$(CONFIG_ARGO) += argo.o
12
obj-y += bitmap.o
23
obj-y += bsearch.o
34
obj-$(CONFIG_CORE_PARKING) += core_parking.o

xen/common/argo.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/******************************************************************************
2+
* Argo : Hypervisor-Mediated data eXchange
3+
*
4+
* Derived from v4v, the version 2 of v2v.
5+
*
6+
* Copyright (c) 2010, Citrix Systems
7+
* Copyright (c) 2018-2019 BAE Systems
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17+
*/
18+
19+
#include <xen/errno.h>
20+
#include <xen/guest_access.h>
21+
22+
long
23+
do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
24+
XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3,
25+
unsigned long arg4)
26+
{
27+
return -ENOSYS;
28+
}

xen/include/public/xen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
118118
#define __HYPERVISOR_domctl 36
119119
#define __HYPERVISOR_kexec_op 37
120120
#define __HYPERVISOR_tmem_op 38
121-
#define __HYPERVISOR_xc_reserved_op 39 /* reserved for XenClient */
121+
#define __HYPERVISOR_argo_op 39
122122
#define __HYPERVISOR_xenpmu_op 40
123123
#define __HYPERVISOR_dm_op 41
124124

xen/include/xen/hypercall.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ do_tmem_op(
136136
XEN_GUEST_HANDLE_PARAM(tmem_op_t) uops);
137137
#endif
138138

139+
#ifdef CONFIG_ARGO
140+
extern long do_argo_op(
141+
unsigned int cmd,
142+
XEN_GUEST_HANDLE_PARAM(void) arg1,
143+
XEN_GUEST_HANDLE_PARAM(void) arg2,
144+
unsigned long arg3,
145+
unsigned long arg4);
146+
#endif
147+
139148
extern long
140149
do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg);
141150

0 commit comments

Comments
 (0)