Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Liu Yu <yu.liu@freescale.com>
Cc: agraf@suse.de, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt
Date: Mon, 02 Jan 2012 18:23:09 +0000	[thread overview]
Message-ID: <4F01F60D.9010002@freescale.com> (raw)
In-Reply-To: <1325312176-17697-2-git-send-email-yu.liu@freescale.com>

On 12/31/2011 12:16 AM, Liu Yu wrote:
> If the guest hypervisor node contains "has-idle" property.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
>  arch/powerpc/kernel/kvm.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index b06bdae..258f129 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -28,6 +28,7 @@
>  #include <asm/sections.h>
>  #include <asm/cacheflush.h>
>  #include <asm/disassemble.h>
> +#include <asm/machdep.h>
>  
>  #define KVM_MAGIC_PAGE		(-4096L)
>  #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
> @@ -571,6 +572,30 @@ static __init void kvm_free_tmp(void)
>  	}
>  }
>  
> +static void kvm_hcall_ev_idle(void)
> +{
> +	ulong in[8];
> +	ulong out[8];
> +
> +	current_thread_info()->local_flags |= _TLF_NAPPING;
> +	local_irq_enable();
> +	kvm_hypercall(in, out, HC_VENDOR_EPAPR | HC_EV_IDLE);
> +}

I think this has to be done in assembly -- otherwise it's not safe for
the interrupt handler to return directly to LR.

> +static int kvm_para_ev_has_idle(void)
> +{
> +	struct device_node *hyper_node;
> +
> +	hyper_node = of_find_node_by_path("/hypervisor");
> +	if (!hyper_node)
> +		return 0;
> +
> +	if (of_get_property(hyper_node, "has-idle", NULL))
> +		return 1;
> +
> +	return 0;
> +}

Since this is standardized in ePAPR, can we move it out of kvm.c an into
generic code to work with any hypervisor that sets has-idle?  Likewise
with kvm_para_setup().

-Scott


  reply	other threads:[~2012-01-02 18:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-31  6:16 [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host Liu Yu
2011-12-31  6:16 ` [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux Liu Yu
2012-01-02 18:23   ` Scott Wood [this message]
2012-01-04  9:23     ` [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt Liu Yu-B13201
2012-01-04 19:21       ` Scott Wood
2012-01-02 18:17 ` [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host Scott Wood
2012-01-03 14:01 ` Avi Kivity
2012-01-03 14:13   ` Alexander Graf
2012-01-04 10:33     ` Avi Kivity
2012-01-04 12:04       ` Alexander Graf
2012-01-04 12:11         ` Avi Kivity
2012-01-04 19:25         ` Scott Wood

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=4F01F60D.9010002@freescale.com \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=yu.liu@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox