linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
To: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 13/14] MIPS: SGI-IP27: Store cpu speed when scanning for CPUs and use it later
Date: Thu,  9 Jan 2020 13:33:50 +0100	[thread overview]
Message-ID: <20200109123353.5656-14-tbogendoerfer@suse.de> (raw)
In-Reply-To: <20200109123353.5656-1-tbogendoerfer@suse.de>

Remember CPU speed while scanning for available CPUs to avoid
looking it up a second time when printing CPU speed.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 arch/mips/include/asm/mach-ip27/topology.h |  1 +
 arch/mips/sgi-ip27/ip27-common.h           |  1 -
 arch/mips/sgi-ip27/ip27-init.c             |  3 ++-
 arch/mips/sgi-ip27/ip27-smp.c              |  2 ++
 arch/mips/sgi-ip27/ip27-timer.c            | 19 -------------------
 5 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index 3c94ffc06a70..d66cc53feab8 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -7,6 +7,7 @@
 
 struct cpuinfo_ip27 {
 	nasid_t		p_nasid;	/* my node ID in numa-as-id-space */
+	unsigned short	p_speed;	/* cpu speed in MHz */
 	unsigned char	p_slice;	/* Physical position on node board */
 };
 
diff --git a/arch/mips/sgi-ip27/ip27-common.h b/arch/mips/sgi-ip27/ip27-common.h
index cdebf1726e4a..ed008a08464c 100644
--- a/arch/mips/sgi-ip27/ip27-common.h
+++ b/arch/mips/sgi-ip27/ip27-common.h
@@ -6,7 +6,6 @@
 extern nasid_t master_nasid;
 
 extern void cpu_node_probe(void);
-extern void cpu_time_init(void);
 extern void hub_rt_clock_event_init(void);
 extern void hub_rtc_init(nasid_t nasid);
 extern void install_cpu_nmi_handler(int slice);
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index 9822f7a8ad62..84a78bd1386a 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -83,7 +83,8 @@ void per_cpu_init(void)
 
 	per_hub_init(nasid);
 
-	cpu_time_init();
+	pr_info("CPU %d clock is %dMHz.\n", cpu, sn_cpu_info[cpu].p_speed);
+
 	install_ipi();
 
 	/* Install our NMI handler if symmon hasn't installed one. */
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index 3966716835ea..5d2652a1d35a 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -47,6 +47,8 @@ static int node_scan_cpus(nasid_t nasid, int highest)
 				set_cpu_possible(cpuid, true);
 				cputonasid(cpus_found) = nasid;
 				cputoslice(cpus_found) = acpu->cpu_info.physid;
+				sn_cpu_info[cpus_found].p_speed =
+							acpu->cpu_speed;
 				cpus_found++;
 			}
 			acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 9cbbf326fe01..61f3565f3645 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -150,25 +150,6 @@ void __init plat_time_init(void)
 	hub_rt_clock_event_init();
 }
 
-void cpu_time_init(void)
-{
-	lboard_t *board;
-	klcpu_t *cpu;
-	int cpuid;
-
-	/* Don't use ARCS.  ARCS is fragile.  Klconfig is simple and sane.  */
-	board = find_lboard(KL_CONFIG_INFO(get_nasid()), KLTYPE_IP27);
-	if (!board)
-		panic("Can't find board info for myself.");
-
-	cpuid = LOCAL_HUB_L(PI_CPU_NUM) ? IP27_CPU0_INDEX : IP27_CPU1_INDEX;
-	cpu = (klcpu_t *) KLCF_COMP(board, cpuid);
-	if (!cpu)
-		panic("No information about myself?");
-
-	printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed);
-}
-
 void hub_rtc_init(nasid_t nasid)
 {
 
-- 
2.24.1


  parent reply	other threads:[~2020-01-09 12:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 12:33 [PATCH 00/14] Cleanup SGI-IP27 and prepare for SGI-IP35 support Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 01/14] MIPS: SGI-IP27: use nodemask instead of cpumask Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 02/14] MIPS: SGI-IP27: use cpu physid already present while scanning for CPUs Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 03/14] MIPS: SGI-IP27: use asm/sn/agent.h for including HUB related stuff Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 04/14] MIPS: SGI-IP27: get rid of asm/sn/sn0/ip27.h Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 05/14] MIPS: SGI-IP27: move IP27 specific macro to IP27 specific header file Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 06/14] MIPS: SGI-IP27: Move get_nasid() to a IP27 specific file Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 07/14] MIPS: SGI-IP27: Split kldir.h into generic SN and IP27 parts Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 08/14] MIPS: SGI-IP27: Use union instead of typedef Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 09/14] MIPS: SGI-IP27: Use structs for decoding error status registers Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 10/14] MIPS: SGI-IP27: Use specific get_region_shift Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 11/14] MIPS: SGI-IP27: Move all shared IP27 declarations to ip27-common.h Thomas Bogendoerfer
2020-01-09 12:33 ` [PATCH 12/14] MIPS: SGI-IP27: Only reserve interrupts used in Linux Thomas Bogendoerfer
2020-01-09 12:33 ` Thomas Bogendoerfer [this message]
2020-01-09 12:33 ` [PATCH 14/14] MIPS: SGI-IP27: No need for slice_map Thomas Bogendoerfer
2020-01-10 19:25 ` [PATCH 00/14] Cleanup SGI-IP27 and prepare for SGI-IP35 support Paul Burton

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=20200109123353.5656-14-tbogendoerfer@suse.de \
    --to=tbogendoerfer@suse.de \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=ralf@linux-mips.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).