Re: [v3 PATCH 2/8] RISC-V: Move cpuid to hartid mapping to SMP.

From: Atish Patra
Date: Fri Feb 08 2019 - 17:57:19 EST


On 2/8/19 1:03 AM, Christoph Hellwig wrote:
On Thu, Feb 07, 2019 at 05:51:15PM -0800, Atish Patra wrote:
Currently, logical CPU id to physical hartid mapping is
defined for both smp and non-smp configurations. This
is not required as we need this only for smp configuration.
The mapping function can define directly boot_cpu_hartid
for non-smp use case.

Please use up your available 72 chars for the changelog. (probably also
in other patches).


Sorry. I will fix all patches to use 72 chars.


The reverse mapping function i.e. hartid to cpuid can be called
for any valid but not booted harts. So it should return default
cpu 0 only if it is a boot hartid.

Signed-off-by: Atish Patra <atish.patra@xxxxxxx>
Reviewed-by: Anup Patel <anup@xxxxxxxxxxxxxx>
---
arch/riscv/include/asm/smp.h | 14 +++++++++++---
arch/riscv/kernel/setup.c | 9 ---------
arch/riscv/kernel/smp.c | 9 +++++++++
3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h
index 41aa73b4..21fd2d75 100644
--- a/arch/riscv/include/asm/smp.h
+++ b/arch/riscv/include/asm/smp.h
@@ -22,12 +22,13 @@
/*
* Mapping between linux logical cpu index and hartid.
*/
-extern unsigned long __cpuid_to_hartid_map[NR_CPUS];
-#define cpuid_to_hartid_map(cpu) __cpuid_to_hartid_map[cpu]
+extern unsigned long boot_cpu_hartid;
struct seq_file;

We usually try to keep forward declatations at the top of the file.

Can you add the new external declaration below the forward one?

Sure.

Regards,
Atish
Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>