All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Breeds <tony@bakeyournoodle.com>
To: ehrhardt@linux.vnet.ibm.com
Cc: linuxppc-dev@ozlabs.org, embedded-hypervisor@power.org,
	hollisb@us.ibm.com, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 1/6] kvmppc: read device tree hypervisor node infrastructure
Date: Thu, 24 Jul 2008 01:41:34 +0000	[thread overview]
Message-ID: <20080724014133.GH20457@bakeyournoodle.com> (raw)
In-Reply-To: <1216802207-32675-2-git-send-email-ehrhardt@linux.vnet.ibm.com>

On Wed, Jul 23, 2008 at 10:36:42AM +0200, ehrhardt@linux.vnet.ibm.com wrote:

Hi Christian,
	A few comments inlined ...

> diff --git a/include/asm-powerpc/kvm_para.h b/include/asm-powerpc/kvm_para.h
> --- a/include/asm-powerpc/kvm_para.h
> +++ b/include/asm-powerpc/kvm_para.h
> @@ -14,7 +14,9 @@
>   *
>   * Copyright IBM Corp. 2008
>   *
> - * Authors: Hollis Blanchard <hollisb@us.ibm.com>
> + * Authors:
> + * 	Hollis Blanchard <hollisb@us.ibm.com>
> + * 	Christian Ehrhardt <ehrhardt@de.ibm.com>
>   */
>  
>  #ifndef __POWERPC_KVM_PARA_H__
> @@ -22,15 +24,44 @@
>  
>  #ifdef __KERNEL__
>  
> +#include <linux/of.h>
> +
> +static struct kvmppc_para_features {
> +	char *dtcell;
> +	int feature;
> +} para_features[] = {
> +};
> +
>  static inline int kvm_para_available(void)
>  {
> -	return 0;
> +	struct device_node *dn;
> +
> +	dn = of_find_node_by_path("/hypervisor");

You need an of_node_put(dn);

> +
> +	return !!dn;
>  }
>  
>  static inline unsigned int kvm_arch_para_features(void)
>  {
> -	return 0;
> +	struct device_node *dn;
> +	const int *dtval;
> +	unsigned int features = 0;
> +	int i;
> +
> +	dn = of_find_node_by_path("/hypervisor");
> +	if (!dn)
> +		return 0;
> +
> +	for (i = 0; i < ARRAY_SIZE(para_features)-1; i++) {

Why -1?  Isn't ARRAY_SIZE(para_features) adequate?

> +		dtval = of_get_property(dn, para_features[i].dtcell, NULL);
> +		if (dtval && *dtval = 1)
> +			features |= (1 << para_features[i].feature);
> +	}
> +

You need an of_node_put(dn);

> +	return features;
>  }

Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!


WARNING: multiple messages have this Message-ID (diff)
From: Tony Breeds <tony@bakeyournoodle.com>
To: ehrhardt@linux.vnet.ibm.com
Cc: linuxppc-dev@ozlabs.org, embedded-hypervisor@power.org,
	hollisb@us.ibm.com, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 1/6] kvmppc: read device tree hypervisor node infrastructure
Date: Thu, 24 Jul 2008 11:41:34 +1000	[thread overview]
Message-ID: <20080724014133.GH20457@bakeyournoodle.com> (raw)
In-Reply-To: <1216802207-32675-2-git-send-email-ehrhardt@linux.vnet.ibm.com>

On Wed, Jul 23, 2008 at 10:36:42AM +0200, ehrhardt@linux.vnet.ibm.com wrote:

Hi Christian,
	A few comments inlined ...

> diff --git a/include/asm-powerpc/kvm_para.h b/include/asm-powerpc/kvm_para.h
> --- a/include/asm-powerpc/kvm_para.h
> +++ b/include/asm-powerpc/kvm_para.h
> @@ -14,7 +14,9 @@
>   *
>   * Copyright IBM Corp. 2008
>   *
> - * Authors: Hollis Blanchard <hollisb@us.ibm.com>
> + * Authors:
> + * 	Hollis Blanchard <hollisb@us.ibm.com>
> + * 	Christian Ehrhardt <ehrhardt@de.ibm.com>
>   */
>  
>  #ifndef __POWERPC_KVM_PARA_H__
> @@ -22,15 +24,44 @@
>  
>  #ifdef __KERNEL__
>  
> +#include <linux/of.h>
> +
> +static struct kvmppc_para_features {
> +	char *dtcell;
> +	int feature;
> +} para_features[] = {
> +};
> +
>  static inline int kvm_para_available(void)
>  {
> -	return 0;
> +	struct device_node *dn;
> +
> +	dn = of_find_node_by_path("/hypervisor");

You need an of_node_put(dn);

> +
> +	return !!dn;
>  }
>  
>  static inline unsigned int kvm_arch_para_features(void)
>  {
> -	return 0;
> +	struct device_node *dn;
> +	const int *dtval;
> +	unsigned int features = 0;
> +	int i;
> +
> +	dn = of_find_node_by_path("/hypervisor");
> +	if (!dn)
> +		return 0;
> +
> +	for (i = 0; i < ARRAY_SIZE(para_features)-1; i++) {

Why -1?  Isn't ARRAY_SIZE(para_features) adequate?

> +		dtval = of_get_property(dn, para_features[i].dtcell, NULL);
> +		if (dtval && *dtval == 1)
> +			features |= (1 << para_features[i].feature);
> +	}
> +

You need an of_node_put(dn);

> +	return features;
>  }

Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!

  reply	other threads:[~2008-07-24  1:41 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  8:36 [PATCH 0/6][RFC] kvmppc: paravirtualization interface ehrhardt
2008-07-23  8:36 ` ehrhardt
2008-07-23  8:36 ` [PATCH 1/6] kvmppc: read device tree hypervisor node infrastructure ehrhardt
2008-07-23  8:36   ` ehrhardt
2008-07-24  1:41   ` Tony Breeds [this message]
2008-07-24  1:41     ` Tony Breeds
2008-07-24  7:44     ` Christian Ehrhardt
2008-07-24  7:44       ` Christian Ehrhardt
2008-07-23  8:36 ` [PATCH 2/6] kvmppc: add hypercall infrastructure - host part ehrhardt
2008-07-23  8:36   ` ehrhardt
2008-07-24  1:43   ` Tony Breeds
2008-07-24  1:43     ` Tony Breeds
2008-07-30 13:41     ` Geert Uytterhoeven
2008-07-30 13:41       ` Geert Uytterhoeven
2008-07-23  8:36 ` [PATCH 3/6] kvmppc: add hypercall infrastructure - guest part ehrhardt
2008-07-23  8:36   ` ehrhardt
2008-07-24  1:45   ` Tony Breeds
2008-07-24  1:45     ` Tony Breeds
2008-07-24  7:56     ` Christian Ehrhardt
2008-07-24  7:56       ` Christian Ehrhardt
2008-07-23  8:36 ` [PATCH 4/6] kvmppc: magic page hypercall - host part ehrhardt
2008-07-23  8:36   ` ehrhardt
2008-07-24  1:49   ` Tony Breeds
2008-07-24  1:49     ` Tony Breeds
2008-07-23  8:36 ` [PATCH 5/6] kvmppc: magic page paravirtualization - guest part ehrhardt
2008-07-23  8:36   ` ehrhardt
2008-07-24  1:59   ` Tony Breeds
2008-07-24  1:59     ` Tony Breeds
2008-07-23  8:36 ` [PATCH 6/6] kvmppc: kvm-userspace: device tree modification for magicpage ehrhardt
2008-07-23  8:36   ` ehrhardt
2008-07-24  2:01 ` [PATCH 0/6][RFC] kvmppc: paravirtualization interface Tony Breeds
2008-07-24  2:01   ` Tony Breeds
2008-07-24  8:17   ` Christian Ehrhardt
2008-07-24  8:17     ` Christian Ehrhardt
2008-07-25  1:08     ` Tony Breeds
2008-07-25  1:08       ` Tony Breeds
2008-08-19 10:36 ` [PATCH 0/6][RFC] kvmppc: paravirtualization interface - host part v2 ehrhardt
2008-09-16  6:27 ` [PATCH 0/6][RFC] kvmppc: paravirtualization interface - host part v3 ehrhardt

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=20080724014133.GH20457@bakeyournoodle.com \
    --to=tony@bakeyournoodle.com \
    --cc=ehrhardt@linux.vnet.ibm.com \
    --cc=embedded-hypervisor@power.org \
    --cc=hollisb@us.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 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.