All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Zhao Yakui <yakui.zhao@intel.com>
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: Fri, 5 Apr 2019 21:19:29 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1904052110370.1802@nanos.tec.linutronix.de> (raw)
In-Reply-To: <1553576023-6434-4-git-send-email-yakui.zhao@intel.com>

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.

> + */
> +
> +#ifndef __ACRN_HYPERCALL_H__
> +#define __ACRN_HYPERCALL_H__

asm headers start with

    __ASM_X86_....

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

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

Thanks,

	tglx

  reply	other threads:[~2019-04-05 19:19 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 [this message]
2019-04-08  3:31     ` Zhao, Yakui

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=alpine.DEB.2.21.1904052110370.1802@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=jason.cj.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=yakui.zhao@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.