On Tue, 26 Mar 2019, Zhao Yakui wrote:
When acrn_hypervisor is detected, the hypercall is needed so that the
acrn guest can query/config some settings. For example: it can be used
to query the resources in hypervisor and manage the CPU/memory/device/
interrupt for Guest system.
So the hypercall is added so that the kernel can communicate with the
low-level acrn-hypervisor. On x86 it is implemented by using vmacll when
is implemented with the VMCALL instruction
the acrn hypervisor is enabled.
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+ * acrn_hypercall.h : acrn hypervisor call API
No file names in headers please. They are pointless and get out of sync
when files are renamed.
This will be fixed.
asm headers start with
+ * Hypercalls for ACRN Guest
+ * Hypercall number is passed in r8 register.
+ * Return value will be placed in rax.
+ * Up to 2 arguments are passed in rdi, rsi.
+static inline long acrn_hypercall0(unsigned long hcall_id)
Remove the empty new line please.
+ register long result asm("rax");
+ register unsigned long r8 asm("r8") = hcall_id;
Please order them the other way around, like a reverse christmas tree:
register unsigned long r8 asm("r8") = hcall_id;
register long result asm("rax");
That's way simpler to read.
+ asm volatile(".byte 0x0F,0x01,0xC1\n"
+ : "=r"(result)
+ : "r"(r8));
Please mention in the changelog why this is implemented with bytes and not
with the proper mnemonic. I assume it depends on binutils, so please
document which version of binutils supports the mnemonic.
And in the first function, i.e. hypercall0, add a comment above the asm
volatile() to that effect as well.