linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Liu Yu <yu.liu@freescale.com>
Cc: linuxppc-dev@ozlabs.org, B07421@freescale.com, agraf@suse.de,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v3 1/3] KVM: PPC: epapr: Factor out the epapr init
Date: Fri, 10 Feb 2012 12:39:51 -0600	[thread overview]
Message-ID: <4F356477.7010809@freescale.com> (raw)
In-Reply-To: <1328868141-17364-1-git-send-email-yu.liu@freescale.com>

On 02/10/2012 04:02 AM, Liu Yu wrote:
> from the kvm guest paravirt init code.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v3:
> apply the epapr init for all ppc platform
> 
>  arch/powerpc/Kconfig                    |    4 +++
>  arch/powerpc/include/asm/epapr_hcalls.h |    8 +++++
>  arch/powerpc/kernel/Makefile            |    1 +
>  arch/powerpc/kernel/epapr_para.c        |   46 +++++++++++++++++++++++++++++++
>  arch/powerpc/kernel/kvm.c               |   13 +++------
>  arch/powerpc/kvm/Kconfig                |    1 +
>  6 files changed, 64 insertions(+), 9 deletions(-)
>  create mode 100644 arch/powerpc/kernel/epapr_para.c
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 47682b6..00bd508 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -196,6 +196,10 @@ config EPAPR_BOOT
>  	  Used to allow a board to specify it wants an ePAPR compliant wrapper.
>  	default n
>  
> +config EPAPR_PARA
> +	bool
> +	default n

EPAPR_PARAVIRT

>  config DEFAULT_UIMAGE
>  	bool
>  	help
> diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
> index f3b0c2c..c4b86e4 100644
> --- a/arch/powerpc/include/asm/epapr_hcalls.h
> +++ b/arch/powerpc/include/asm/epapr_hcalls.h
> @@ -148,6 +148,14 @@
>  #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
>  #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
>  
> +extern u32 *epapr_hcall_insts;
> +extern int epapr_hcall_insts_len;
> +
> +static inline void epapr_get_hcall_insts(u32 **instp, int *lenp)
> +{
> +	*instp = epapr_hcall_insts;
> +	*lenp = epapr_hcall_insts_len;
> +}

Why do we need a function for this?  Why is the public interface
anything other than "invoke a hypercall"?

> +static int __init epapr_para_init(void)
> +{
> +	struct device_node *hyper_node;
> +	u32 *insts;
> +	int len;
> +
> +	hyper_node = of_find_node_by_path("/hypervisor");
> +	if (!hyper_node)
> +		return -ENODEV;
> +
> +	insts = (u32*)of_get_property(hyper_node, "hcall-instructions", &len);

Do not cast away that const.

> @@ -535,18 +536,12 @@ EXPORT_SYMBOL_GPL(kvm_hypercall);
>  static int kvm_para_setup(void)
>  {
>  	extern u32 kvm_hypercall_start;
> -	struct device_node *hyper_node;
>  	u32 *insts;
>  	int len, i;
>  
> -	hyper_node = of_find_node_by_path("/hypervisor");
> -	if (!hyper_node)
> -		return -1;
> -
> -	insts = (u32*)of_get_property(hyper_node, "hcall-instructions", &len);
> -	if (len % 4)
> -		return -1;
> -	if (len > (4 * 4))
> +	insts = epapr_hcall_insts;
> +	len = epapr_hcall_insts_len;
> +	if (insts == NULL)
>  		return -1;
>  
>  	for (i = 0; i < (len / 4); i++)

Why are you still doing the patching inside kvm.c?

-Scott

  parent reply	other threads:[~2012-02-10 18:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 10:02 [PATCH v3 1/3] KVM: PPC: epapr: Factor out the epapr init Liu Yu
2012-02-10 10:02 ` [PATCH v3 2/3] KVM: PPC: epapr: Add idle hcall support for host Liu Yu
2012-02-10 10:02   ` [PATCH v3 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest Liu Yu
2012-02-10 18:41     ` Scott Wood
2012-02-10 18:39 ` Scott Wood [this message]
2012-02-13  5:47   ` [PATCH v3 1/3] KVM: PPC: epapr: Factor out the epapr init Liu Yu-B13201
2012-02-13 17:15     ` 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=4F356477.7010809@freescale.com \
    --to=scottwood@freescale.com \
    --cc=B07421@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).