Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions arch/arm/arm32/hypercall.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include <xtf/asm_macros.h>
#include <xen/xen.h>

#define __HVC(imm16) .long \
((0xE1400070 | (((imm16) & 0xFFF0) << 4) | ((imm16) & 0x000F)) & 0xFFFFFFFF)

#define HYPERCALL_SIMPLE(hypercall) \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both .S was borrowed from Linux right? If so, that's fine because the license is not GPL. But please retain the copyright from the author.

ENTRY(hypercall_##hypercall) \
mov r12, #__HYPERVISOR_##hypercall; \
__HVC(XEN_HYPERCALL_TAG); \
mov pc ,lr; \
ENDFUNC(hypercall_##hypercall)

#define HYPERCALL0 HYPERCALL_SIMPLE
#define HYPERCALL1 HYPERCALL_SIMPLE
#define HYPERCALL2 HYPERCALL_SIMPLE
#define HYPERCALL3 HYPERCALL_SIMPLE
#define HYPERCALL4 HYPERCALL_SIMPLE

#define HYPERCALL5(hypercall) \
ENTRY(hypercall_##hypercall) \
stmdb sp!, {r4}; \
ldr r4, [sp, #4]; \
mov r12, #__HYPERVISOR_##hypercall; \
__HVC(XEN_HYPERCALL_TAG); \
ldm sp!, {r4}; \
mov pc ,lr; \
ENDFUNC(hypercall_##hypercall)

.text

HYPERCALL2(xen_version);
HYPERCALL3(console_io);
HYPERCALL3(grant_table_op);
HYPERCALL2(sched_op);
HYPERCALL2(event_channel_op);
HYPERCALL2(hvm_op);
HYPERCALL2(memory_op);
HYPERCALL2(physdev_op);
HYPERCALL3(vcpu_op);
HYPERCALL1(tmem_op);
HYPERCALL2(multicall);
HYPERCALL2(vm_assist);
HYPERCALL1(sysctl);
HYPERCALL1(domctl);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this hypercall list in any specific order?
If not, it should be sorted into an order (eg. alphabetical, or by ascending hypercall number).
A comment should be added to state what the order is, so that any future additions will be inserted into the correct place.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HYPERCALL5(argo_op);
would be nice (or it can go in when a test that exercises Argo goes in).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrappers were borrowed from Linux(with little modifications) and the list is not sorted.
It does not really matter what the order is. Preferable way is to insert additions at the end of list.
argo_op hypercall should be added together with public interface argo.h. So this should come together with a test.

33 changes: 33 additions & 0 deletions arch/arm/arm64/hypercall.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <xtf/asm_macros.h>
#include <xen/xen.h>

#define HYPERCALL_SIMPLE(hypercall) \
ENTRY(hypercall_##hypercall) \
mov x16, #__HYPERVISOR_##hypercall; \
hvc XEN_HYPERCALL_TAG; \
ret; \
ENDFUNC(hypercall_##hypercall)

#define HYPERCALL0 HYPERCALL_SIMPLE
#define HYPERCALL1 HYPERCALL_SIMPLE
#define HYPERCALL2 HYPERCALL_SIMPLE
#define HYPERCALL3 HYPERCALL_SIMPLE
#define HYPERCALL4 HYPERCALL_SIMPLE
#define HYPERCALL5 HYPERCALL_SIMPLE

.text

HYPERCALL2(xen_version);
HYPERCALL3(console_io);
HYPERCALL3(grant_table_op);
HYPERCALL2(sched_op);
HYPERCALL2(event_channel_op);
HYPERCALL2(hvm_op);
HYPERCALL2(memory_op);
HYPERCALL2(physdev_op);
HYPERCALL3(vcpu_op);
HYPERCALL1(tmem_op);
HYPERCALL2(multicall);
HYPERCALL2(vm_assist);
HYPERCALL1(sysctl);
HYPERCALL1(domctl);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments as for the 32-bit version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check my comment for arm32

43 changes: 21 additions & 22 deletions arch/arm/include/arch/hypercall.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@
#define XTF_ARM_HYPERCALL_H

#include <xtf/lib.h>
#include <arch/desc.h>
#include <arch/page.h>
#include <xen/sysctl.h>

#define _hypercall_1(type, hcall, a1) \
({ \
UNIMPLEMENTED(); \
(type)0; \
})
int hypercall_memory_op(unsigned int cmd, void *arg);
int hypercall_domctl(unsigned long op);
int hypercall_sched_op(int cmd, void *arg);
int hypercall_console_io(int cmd, int count, char *str);
int hypercall_xen_version(int cmd, void *arg);
int hypercall_event_channel_op(int cmd, void *op);
int hypercall_physdev_op(void *physdev_op);
int hypercall_sysctl(xen_sysctl_t *arg);
int hypercall_hvm_op(unsigned long op, void *arg);
int hypercall_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
int hypercall_vcpu_op(int cmd, int vcpuid, void *extra_args);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+int hypercall_argo_op(unsigned int cmd, void *arg1, void *arg2,
+                      unsigned long arg3, unsigned long arg4);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hypercall_argo_op should be added together with argo.h public interface. This shall be added when adding a test for argo.


#define _hypercall_2(type, hcall, a1, a2) \
({ \
UNIMPLEMENTED(); \
(type)0; \
})

#define _hypercall_3(type, hcall, a1, a2, a3) \
({ \
UNIMPLEMENTED(); \
(type)0; \
})

#define _hypercall_5(type, hcall, a1, a2, a3, a4, a5) \
({ \
UNIMPLEMENTED(); \
(type)0; \
})
/*
* Higher level hypercall helpers
*/
static inline void hypercall_console_write(const char *buf, size_t count)
{
(void)hypercall_console_io(CONSOLEIO_write, count, (char *)buf);
}

#endif /* XTF_ARM_HYPERCALL_H */

Expand Down
2 changes: 1 addition & 1 deletion build/arm32/arch-files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
include $(ROOT)/build/arm-common/arch-files.mk

# Specific files for arm32
obj-perenv +=
obj-perenv += $(ROOT)/arch/arm/arm32/hypercall.o
1 change: 1 addition & 0 deletions build/arm64/arch-files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ include $(ROOT)/build/arm-common/arch-files.mk

# Specific files for arm64
obj-perenv += $(ROOT)/arch/arm/arm64/cache.o
obj-perenv += $(ROOT)/arch/arm/arm64/hypercall.o