All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: adding cpu lookup functionality
Date: Mon, 2 Feb 2015 13:50:39 +0000	[thread overview]
Message-ID: <20150202135039.GF31847@arm.com> (raw)
In-Reply-To: <1422658466-23984-2-git-send-email-mathieu.poirier@linaro.org>

On Fri, Jan 30, 2015 at 10:54:25PM +0000, mathieu.poirier at linaro.org wrote:
> From: Mathieu Poirier <mathieu.poirier@linaro.org>
> 
> Adding a lookup function allowing for quick and easy mapping
> between processor HWID (as found, for example) in DT specifications
> and the CPU index known to the kernel.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
>  arch/arm64/include/asm/smp_plat.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
> index 59e282311b58..8e4b011303b1 100644
> --- a/arch/arm64/include/asm/smp_plat.h
> +++ b/arch/arm64/include/asm/smp_plat.h
> @@ -19,6 +19,7 @@
>  #ifndef __ASM_SMP_PLAT_H
>  #define __ASM_SMP_PLAT_H
>  
> +#include <linux/cpumask.h>
>  #include <asm/types.h>
>  
>  struct mpidr_hash {
> @@ -40,4 +41,15 @@ static inline u32 mpidr_hash_size(void)
>  extern u64 __cpu_logical_map[NR_CPUS];
>  #define cpu_logical_map(cpu)    __cpu_logical_map[cpu]
>  
> +static inline int get_logical_index(u64 mpidr)
> +{
> +	int cpu;
> +
> +	for (cpu = 0; cpu < nr_cpu_ids; cpu++)
> +		if (cpu_logical_map(cpu) == mpidr)
> +			return cpu;
> +	return -EINVAL;
> +}

Can you not achieve the same thing using arch_find_n_match_cpu_physical_id
in the coresight code?

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: "mathieu.poirier@linaro.org" <mathieu.poirier@linaro.org>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] arm64: adding cpu lookup functionality
Date: Mon, 2 Feb 2015 13:50:39 +0000	[thread overview]
Message-ID: <20150202135039.GF31847@arm.com> (raw)
In-Reply-To: <1422658466-23984-2-git-send-email-mathieu.poirier@linaro.org>

On Fri, Jan 30, 2015 at 10:54:25PM +0000, mathieu.poirier@linaro.org wrote:
> From: Mathieu Poirier <mathieu.poirier@linaro.org>
> 
> Adding a lookup function allowing for quick and easy mapping
> between processor HWID (as found, for example) in DT specifications
> and the CPU index known to the kernel.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
>  arch/arm64/include/asm/smp_plat.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
> index 59e282311b58..8e4b011303b1 100644
> --- a/arch/arm64/include/asm/smp_plat.h
> +++ b/arch/arm64/include/asm/smp_plat.h
> @@ -19,6 +19,7 @@
>  #ifndef __ASM_SMP_PLAT_H
>  #define __ASM_SMP_PLAT_H
>  
> +#include <linux/cpumask.h>
>  #include <asm/types.h>
>  
>  struct mpidr_hash {
> @@ -40,4 +41,15 @@ static inline u32 mpidr_hash_size(void)
>  extern u64 __cpu_logical_map[NR_CPUS];
>  #define cpu_logical_map(cpu)    __cpu_logical_map[cpu]
>  
> +static inline int get_logical_index(u64 mpidr)
> +{
> +	int cpu;
> +
> +	for (cpu = 0; cpu < nr_cpu_ids; cpu++)
> +		if (cpu_logical_map(cpu) == mpidr)
> +			return cpu;
> +	return -EINVAL;
> +}

Can you not achieve the same thing using arch_find_n_match_cpu_physical_id
in the coresight code?

Will

  reply	other threads:[~2015-02-02 13:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 22:54 [PATCH 0/2] Coresight Support for arm64 mathieu.poirier at linaro.org
2015-01-30 22:54 ` mathieu.poirier
2015-01-30 22:54 ` [PATCH 1/2] arm64: adding cpu lookup functionality mathieu.poirier at linaro.org
2015-01-30 22:54   ` mathieu.poirier
2015-02-02 13:50   ` Will Deacon [this message]
2015-02-02 13:50     ` Will Deacon
2015-02-02 21:20     ` Mathieu Poirier
2015-02-02 21:20       ` Mathieu Poirier
2015-02-02 15:36   ` Mark Rutland
2015-02-02 15:36     ` Mark Rutland
2015-01-30 22:54 ` [PATCH 2/2] coresight: Adding coresight support to arm64 mathieu.poirier at linaro.org
2015-01-30 22:54   ` mathieu.poirier
2015-02-02 13:45   ` Will Deacon
2015-02-02 13:45     ` Will Deacon
2015-02-02 22:06     ` Mathieu Poirier
2015-02-02 22:06       ` Mathieu Poirier
2015-02-03 11:58       ` Catalin Marinas
2015-02-03 11:58         ` Catalin Marinas

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=20150202135039.GF31847@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.