xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: suravee.suthikulpanit@amd.com, stefano.stabellini@eu.citrix.com,
	ian.campbell@citrix.com
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2
Date: Thu, 02 Oct 2014 11:51:44 +0100	[thread overview]
Message-ID: <542D2E40.2030806@linaro.org> (raw)
In-Reply-To: <1412193773-31042-2-git-send-email-suravee.suthikulpanit@amd.com>

Hi Suravee,

On 10/01/2014 09:02 PM, suravee.suthikulpanit@amd.com wrote:
> +int __init psci_init_0_1(const struct dt_device_node *psci)
> +{
> +    int ret;
> +
> +    ret = psci_is_smc_method(psci);
> +    if ( ret )
> +        return -EINVAL;
> +
>      if ( !dt_property_read_u32(psci, "cpu_on", &psci_cpu_on_nr) )
>      {
>          printk("/psci node is missing the \"cpu_on\" property\n");
>          return -ENOENT;
>      }
>  
> -    psci_available = 1;
> +    psci_ver = 1;
>  
>      printk(XENLOG_INFO "Using PSCI for SMP bringup\n");

I would modify this printk into "Using PSCI 0.1...".

>  
>      return 0;
>  }
>  
> +int __init psci_init_0_2(const struct dt_device_node *psci)
> +{
> +    int ret;
> +
> +    ret = psci_is_smc_method(psci);
> +    if ( ret )
> +        return -EINVAL;
> +
> +    psci_ver = __invoke_psci_fn_smc(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
> +
> +    if ( psci_ver != 2 )
> +    {
> +        printk("Error: The retrieved PSCI version (%#x) does not support.\n", psci_ver);

NIT: s/does/is/ ?

> +        return -EOPNOTSUPP;
> +    }
> +
> +    psci_cpu_on_nr = PSCI_0_2_FN_CPU_ON;
> +
> +    printk(XENLOG_INFO "Using PSCI-0.2 for SMP bringup\n");
> +
> +    return 0;
> +}
> +
> +int __init psci_init(void)
> +{
> +    const struct dt_device_node *psci;
> +
> +    psci = dt_find_compatible_node(NULL, NULL, "arm,psci");
> +    if ( psci )
> +        return psci_init_0_1(psci);
> +
> +    psci = dt_find_compatible_node(NULL, NULL, "arm,psci-0.2");
> +    if ( psci )
> +        return psci_init_0_2(psci);
> +

I think we need to prefer PSCI 0.2 if the platform supports the both
version of PSCI.


> +    return -ENODEV;
> +}
> +
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/xen/include/asm-arm/psci.h b/xen/include/asm-arm/psci.h
> index 9777c03..ab37984 100644
> --- a/xen/include/asm-arm/psci.h
> +++ b/xen/include/asm-arm/psci.h
> @@ -13,10 +13,12 @@
>  #define PSCI_DISABLED               -8
>  
>  /* availability of PSCI on the host for SMP bringup */
> -extern bool_t psci_available;
> +extern int psci_ver;

I would use unsigned int here, or even better an enum to describe the
different version of PSCI.

Regards,

-- 
Julien Grall

  parent reply	other threads:[~2014-10-02 10:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01 20:02 [PATCH 0/2] Introduce PSCI-0.2 supports suravee.suthikulpanit
2014-10-01 20:02 ` [PATCH 1/2] xen/arm: Initial support for PSCI-0.2 suravee.suthikulpanit
2014-10-02  9:07   ` Stefano Stabellini
2014-10-02 10:51   ` Julien Grall [this message]
2014-10-02 14:19     ` Ian Campbell
2014-10-02 20:17       ` Suravee Suthikulpanit
2014-10-02 14:21   ` Ian Campbell
2014-10-02 19:43     ` Suravee Suthikulpanit
2014-10-01 20:02 ` [PATCH 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default suravee.suthikulpanit
2014-10-02  9:04   ` Stefano Stabellini
2014-10-02 10:54   ` Julien Grall
2014-10-02 19:51     ` Suravee Suthikulpanit
2014-10-02 21:50       ` Julien Grall
2014-10-03  0:00         ` Suravee Suthikulpanit

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=542D2E40.2030806@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).