All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Suriyan Ramasami <suriyan.r@gmail.com>, xen-devel@lists.xen.org
Cc: stefano.stabellini@citrix.com
Subject: Re: [PATCH v2 1/1] XEN/ARM: Add Odroid-XU3/XU4 support
Date: Tue, 9 Feb 2016 09:53:15 +0000	[thread overview]
Message-ID: <1455011595.19857.11.camel@citrix.com> (raw)
In-Reply-To: <1454996927-21393-1-git-send-email-suriyan.r@gmail.com>

On Mon, 2016-02-08 at 21:48 -0800, Suriyan Ramasami wrote:
> The Odroid-XU3/XU4 from hardkernel is an Exynos 5422 based board.
> Code from mcpm-exynos.c and mcpm-platsmp.c from the Linux kernel
> has been used to get all the 8 cores from the 2 clusters powered
> on.
> The Linux DTS for these odroid uses "samsung,exynos5800" as
> the machine compatible string. Hence, the same is used herein.
> 
> This change has been tested on the Odroid-XU/XU3/XU4.
> 
> Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Thanks, this now looks good to me, with one question about a comment which
I could resolve upon commit if we agree a wording.

> ---
> Changes between versions as follows:
> 
> v2:
> Try to use common code as much as possible
> 
> v1:
> Initial code submission
> ---
>  xen/arch/arm/platforms/exynos5.c | 61
> ++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 58 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/platforms/exynos5.c
> b/xen/arch/arm/platforms/exynos5.c
> index bf4964d..12aea31 100644
> --- a/xen/arch/arm/platforms/exynos5.c
> +++ b/xen/arch/arm/platforms/exynos5.c
> @@ -34,9 +34,18 @@ static bool_t secure_firmware;
>  #define EXYNOS_ARM_CORE_CONFIG(_nr) (EXYNOS_ARM_CORE0_CONFIG + (0x80 *
> (_nr)))
>  #define EXYNOS_ARM_CORE_STATUS(_nr) (EXYNOS_ARM_CORE_CONFIG(_nr) + 0x4)
>  #define S5P_CORE_LOCAL_PWR_EN       0x3
> +#define S5P_PMU_SPARE2              0x908
>  
>  #define SMC_CMD_CPU1BOOT            (-4)
>  
> +#define EXYNOS5800_CPUS_PER_CLUSTER 4
> +
> +#define EXYNOS5420_KFC_CORE_RESET0  BIT(8)
> +#define EXYNOS5420_KFC_ETM_RESET0   BIT(20)
> +
> +#define EXYNOS5420_KFC_CORE_RESET(_nr) \
> +        ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) <<
> (_nr))
> +
>  static int exynos5_init_time(void)
>  {
>      uint32_t reg;
> @@ -166,14 +175,23 @@ static void exynos_cpu_power_up(void __iomem
> *power, int cpu)
>  static int exynos5_cpu_power_up(void __iomem *power, int cpu)
>  {
>      unsigned int timeout;
> +    unsigned int mpidr, pcpu, pcluster, cpunr;
> +
> +    mpidr = cpu_logical_map(cpu);
> +    pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
> +    pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
>  
> -    if ( !exynos_cpu_power_state(power, cpu) )
> +    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);
> +    dprintk(XENLOG_DEBUG, "cpu: %d pcpu: %d, cluster: %d cpunr: %d\n",
> +            cpu, pcpu, pcluster, cpunr);
> +
> +    if ( !exynos_cpu_power_state(power, cpunr) )
>      {
> -        exynos_cpu_power_up(power, cpu);
> +        exynos_cpu_power_up(power, cpunr);
>          timeout = 10;
>  
>          /* wait max 10 ms until cpu is on */
> -        while ( exynos_cpu_power_state(power, cpu) !=
> S5P_CORE_LOCAL_PWR_EN )
> +        while ( exynos_cpu_power_state(power, cpunr) !=
> S5P_CORE_LOCAL_PWR_EN )
>          {
>              if ( timeout-- == 0 )
>                  break;
> @@ -186,6 +204,42 @@ static int exynos5_cpu_power_up(void __iomem *power,
> int cpu)
>              dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
>              return -ETIMEDOUT;
>          }
> +
> +        /*
> +         * This assumes the cluster number of the big cores(Cortex A15)
> +         * is 0 and the Little cores(Cortex A7) is 1.
> +         * When the system was booted from the Little core,
> +         * they should be reset during power up cpu.
> +         * Note that the below condition is true for Odroid XU3/XU4, and
> +         * false for the XU and the Exynos5800 based boards.

I think the SoC is more relevant/useful in this context than specific
boards. So I think what it is trying to say here is that for systems
matching samsung,exynos5410 pcluster will always be zero, where as for ones
matching samsung,exynos5800 it can be non-zero, and for non-zero clusters
we need to do some extra bringup.

I think the comment should therefore focus on the SoC (maybe giving some
examples of systems, but such a list cannot be exhaustive and could be
omitted IMHO). How about:

    This assumes the cluster number of the big cores (Cortex A15) is 0 and
    the Little cores (Cortex A7) is 1.

    When the system was booted from the Little core they should be reset
    during power up cpu.

    Note that only exynos5800 based SoCs have a pcluster==1 of little cores,
    for exynos5410 there is only pcluster==0.

?

I would also consider perhaps moving the comment up to where pcluster is
calculated, and in particular near the:

    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);

Since this also relies on pcluster==0 for !5800 systems.

What do you think? I could adjust the comment wording and placement on
commit if you are happy.

I have one other question -- does this patch result in a Xen system which
consists of both A7 and A15 pcpus being live at the same time? Does that
actually work given the subtle differences in things like the cache line
length? I would expect there to need to be other patches to support a
heterogeneous core configuration.

Hopefully I've just misunderstood and the effect of this patch is to switch
to just running the A15 processors even after booting on the A7s.

Ian.


> +         */
> +        if ( pcluster &&
> +             pcluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1) ) {
> +            /*
> +             * Before we reset the Little cores, we should wait
> +             * the SPARE2 register is set to 1 because the init
> +             * codes of the iROM will set the register after
> +             * initialization.
> +            */
> +
> +            /* wait max 10ms for the spare register to be set to 1 */
> +            timeout = 10;
> +            while ( !__raw_readl(power + S5P_PMU_SPARE2) )
> +            {
> +                if ( timeout-- == 0 )
> +                    break;
> +
> +                mdelay(1);
> +            }
> +
> +            if ( timeout == 0 )
> +            {
> +                dprintk(XENLOG_ERR, "CPU%d SPARE2 register wait
> failed\n", cpu);
> +                return -ETIMEDOUT;
> +            }
> +            __raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
> +                         power + EXYNOS5_SWRESET);
> +        }
>      }
>      return 0;
>  }
> @@ -298,6 +352,7 @@ static const char * const exynos5250_dt_compat[]
> __initconst =
>  static const char * const exynos5_dt_compat[] __initconst =
>  {
>      "samsung,exynos5410",
> +    "samsung,exynos5800",
>      NULL
>  };
>  
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-02-09  9:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09  5:48 [PATCH v2 1/1] XEN/ARM: Add Odroid-XU3/XU4 support Suriyan Ramasami
2016-02-09  9:53 ` Ian Campbell [this message]
2016-02-09 12:50   ` Suriyan Ramasami
2016-02-09 14:19     ` Ian Campbell
2016-02-09 18:20       ` Suriyan Ramasami
2016-02-10 10:03         ` Ian Campbell
2016-02-11  1:47           ` Suriyan Ramasami
2016-02-11  9:40             ` Ian Campbell
2016-02-15  6:32               ` Suriyan Ramasami
2016-02-16 10:03                 ` Ian Campbell
2016-02-17  2:24                   ` Suriyan Ramasami

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=1455011595.19857.11.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=suriyan.r@gmail.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 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.