Add Argo test
Subsystems (2)
PATCH v2 1/1 Add Argo test
Simple test cases for the four Argo operations, register, unregister, sendv and notify exercised with a single test domain.
Add infrastructure to access Argo: a 5-argument hypercall, number 39.
Signed-off-by Christopher Clark <[email protected]>
---
v2:
- corrected the CC list. Apologies for the omissions in posting v1.
- update to use $(ALL_ENVIRONMENTS) in TEST-ENVS: pv32pae was unintentionally missing and all are wanted included.
arch/x86/hypercall_page.S | 2 +- arch/x86/include/arch/hypercall-x86_32.h | 13 + arch/x86/include/arch/hypercall-x86_64.h | 14 + docs/all-tests.dox | 2 + include/xen/argo.h | 255 ++++++++++++++++ include/xen/xen.h | 11 +- include/xtf/hypercall.h | 8 + include/xtf/numbers.h | 5 + tests/argo/Makefile | 9 + tests/argo/main.c | 360 +++++++++++++++++++++++ 10 files changed, 677 insertions(+), 2 deletions(-) create mode 100644 include/xen/argo.h create mode 100644 tests/argo/Makefile create mode 100644 tests/argo/main.c
arch/x86/hypercall_page.S +1 -1
@@ -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)
arch/x86/include/arch/hypercall-x86_32.h +13 -0
@@ -53,6 +53,19 @@ (type )res; \ }) +#define _hypercall32_5 (type, hcall, a1, a2, a3, a4, a5) \ + ({ \ + long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3), \ + _a4 = (long)(a4), _a5 = (long)(a5); \ + asm volatile ( \ + "call hypercall_page + %c[offset]" \ + : "=a" (res), "+b" (_a1), "+c" (_a2), "+d" (_a3), \ + "+S" (_a4), "+D" (_a5) \ + : [offset] "i" (hcall * 32) \ + : "memory" ); \ + (type)res; \ + }) +#endif /* XTF_X86_32_HYPERCALL_H */ /*
arch/x86/include/arch/hypercall-x86_64.h +14 -0
@@ -53,6 +53,20 @@ (type )res; \ }) +#define _hypercall64_5 (type, hcall, a1, a2, a3, a4, a5) \ + ({ \ + long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3); \ + register long _a4 asm ("r10") = (long)(a4); \ + register long _a5 asm ("r8") = (long)(a5); \ + asm volatile ( \ + "call hypercall_page + %c[offset]" \ + : "=a" (res), "+D" (_a1), "+S" (_a2), "+d" (_a3), \ + "+r" (_a4), "+r" (_a5) \ + : [offset] "i" (hcall * 32) \ + : "memory" ); \ + (type)res; \ + }) +#endif /* XTF_X86_64_HYPERCALL_H */ /*
docs/all-tests.dox +2 -0
@@ -164,6 +164,8 @@ states. @section index-utility Utilities +@subpage test-argo - Argo functionality test + @subpage test-cpuid - Print CPUID information. @subpage test-fep - Test availability of HVM Forced Emulation Prefix.
include/xen/argo.h new file +255 -0
255 lines not on this page · raw message
include/xen/xen.h +10 -1
@@ -49,7 +49,7 @@#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/* Architecture-specific hypercall definitions. */
@@ -66,6 +66,15 @@typedef uint16_t domid_t ;#endif +/* Define a variable length array (depends on compiler). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >=199901L +#define XEN_FLEX_ARRAY_DIM +#elif defined(__GNUC__) +#define XEN_FLEX_ARRAY_DIM 0 +#else +#define XEN_FLEX_ARRAY_DIM 1/* variable size */ +#endif +#define DOMID_FIRST_RESERVED (0x7ff0U)#define DOMID_SELF (0x7ff0U)
include/xtf/hypercall.h +8 -0
@@ -13,6 +13,7 @@# define HYPERCALL2 _hypercall64_2# define HYPERCALL3 _hypercall64_3# define HYPERCALL4 _hypercall64_4 +# define HYPERCALL5 _hypercall64_5#elif defined(__i386__)
@@ -21,6 +22,7 @@# define HYPERCALL2 _hypercall32_2# define HYPERCALL3 _hypercall32_3# define HYPERCALL4 _hypercall32_4 +# define HYPERCALL5 _hypercall32_5#else # error Bad architecture for hypercalls
@@ -170,6 +172,12 @@ static inline long hypercall_sysctl(xen_sysctl_t *arg)return HYPERCALL1 (long, __HYPERVISOR_sysctl, arg); } +static inline long hypercall_argo_op (unsigned int cmd,void *arg1,void *arg2, +unsigned long arg3,unsigned long arg4) +{ +return HYPERCALL5 (long, __HYPERVISOR_argo_op, cmd, arg1, arg2, arg3, arg4); +} +/* * Higher level hypercall helpers */
include/xtf/numbers.h +5 -0
@@ -52,6 +52,11 @@*/ #define _u (v) ((unsigned long)(v)) +/** +* Round up a number to the next integer +*/ +#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#endif /* !__ASSEMBLY__ */ #endif /* XTF_NUMBERS_H */
tests/argo/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +include $(ROOT)/build/common.mk + +NAME := argo +CATEGORY := utility +TEST-ENVS := $(ALL_ENVIRONMENTS) + +obj-perenv += main.o + +include $(ROOT)/build/gen.mk
tests/argo/main.c new file +360 -0
360 lines not on this page · raw message
Signature · 1 line
2.17.1