From: "Zhao, Yakui" <yakui.zhao@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Jason Chen CJ <jason.cj.chen@intel.com>
Subject: Re: [RFC PATCH v2 3/3] arch/x86/acrn: add hypercall for acrn_guest
Date: Mon, 8 Apr 2019 11:31:48 +0800 [thread overview]
Message-ID: <efe1ffd8-4ab9-9204-f411-5e9caa6e88a1@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1904052110370.1802@nanos.tec.linutronix.de>
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
>
prev parent reply other threads:[~2019-04-08 3:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 4:53 [RFC PATCH v2 0/3] arch/x86: Add the support of ACRN guest under arch/x86 Zhao Yakui
2019-03-26 4:53 ` [RFC PATCH v2 1/3] arch/x86: add the support of ACRN guest Zhao Yakui
2019-04-05 19:01 ` Thomas Gleixner
2019-04-08 3:36 ` Zhao, Yakui
2019-03-26 4:53 ` [RFC PATCH v2 2/3] arch/x86/acrn: Use HYPERVISOR_CALLBACK_VECTOR for Acrn upcall vector Zhao Yakui
2019-04-05 19:07 ` Thomas Gleixner
2019-04-08 3:33 ` Zhao, Yakui
2019-03-26 4:53 ` [RFC PATCH v2 3/3] arch/x86/acrn: add hypercall for acrn_guest Zhao Yakui
2019-04-05 19:19 ` Thomas Gleixner
2019-04-08 3:31 ` Zhao, Yakui [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=efe1ffd8-4ab9-9204-f411-5e9caa6e88a1@intel.com \
--to=yakui.zhao@intel.com \
--cc=jason.cj.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®