lkml.org 
[lkml]   [2019]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH v2 3/3] arch/x86/acrn: add hypercall for acrn_guest
From
Date


On 2019年04月06日 03:19, Thomas Gleixner wrote:
> 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.
>>
>> +++ b/arch/x86/include/asm/acrn_hypercall.h
>> @@ -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.

Sure. It will be removed in next vesion.

>
>> + */
>> +
>> +#ifndef __ACRN_HYPERCALL_H__
>> +#define __ACRN_HYPERCALL_H__
>
> asm headers start with
>
> __ASM_X86_....
>
This will be fixed.

>> +
>> +#include <linux/errno.h>
>> +
>> +#ifdef CONFIG_ACRN_GUEST
>> +
>> +/*
>> + * 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.

This will be fixed.

>
>> + 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.

I check the binutils version mentioned in Document/changes.
(binutils, 2.20)
It seems that the "vmcall" is already supported.
So the "vmcall" mnemonic will be used to make it readable.

>
> And in the first function, i.e. hypercall0, add a comment above the asm
> volatile() to that effect as well.

Sure.


>
> Thanks,
>
> tglx
>

\
 
 \ /
  Last update: 2019-04-08 05:35    [W:0.051 / U:7.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site