MIPS: Support more than 32 CPUs on OCTEON
cover MIPS: Support more than 32 CPUs on OCTEON
From: David Daney <[email protected]>
OCTEON systems can support 2-node NUMA configurations with 48 CPUs per node. The first step to handling these systems is to extend the coremask information passed from the bootloader. Internally to the kernel we carry a mask capable of holding 1024 CPUs. The bootloader structure version is probed at runtime to populate the internal mask. This in turn is used to initialize the SMP structures.
David Daney (2):
MIPS: OCTEON: Remove dead code from cvmx-sysinfo.
MIPS: OCTEON: Extend number of supported CPUs past 32
arch/mips/cavium-octeon/executive/cvmx-sysinfo.c | 72 ++----------------- arch/mips/cavium-octeon/setup.c | 19 ++++- arch/mips/cavium-octeon/smp.c | 4 +- arch/mips/include/asm/octeon/cvmx-bootinfo.h | 14 +++- arch/mips/include/asm/octeon/cvmx-coremask.h | 89 ++++++++++++++++++++++++ arch/mips/include/asm/octeon/cvmx-sysinfo.h | 37 ++-------- 6 files changed, 130 insertions(+), 105 deletions(-) create mode 100644 arch/mips/include/asm/octeon/cvmx-coremask.h
Signature · 1 line
1.7.11.7
PATCH 1/2 MIPS: OCTEON: Remove dead code from cvmx-sysinfo.
From: David Daney <[email protected]>
Get rid of the long unused code.
--- arch/mips/cavium-octeon/executive/cvmx-sysinfo.c | 72 ++---------------------- arch/mips/include/asm/octeon/cvmx-sysinfo.h | 30 +--------- 2 files changed, 5 insertions(+), 97 deletions(-)
arch/mips/cavium-octeon/executive/cvmx-sysinfo.c +4 -68
@@ -32,86 +32,22 @@#include <linux/module.h> #include <asm/octeon/cvmx.h> -#include <asm/octeon/cvmx-spinlock.h> #include <asm/octeon/cvmx-sysinfo.h> -/** +/* * This structure defines the private state maintained by sysinfo module. -* */ -static struct { -struct cvmx_sysinfo sysinfo;/* system information */ -cvmx_spinlock_t lock;/* mutex spinlock */ - -} state = { - .lock =CVMX_SPINLOCK_UNLOCKED_INITIALIZER -}; - +static struct cvmx_sysinfo sysinfo;/* system information */ /* -* Global variables that define the min/max of the memory region set -* up for 32 bit userspace access. -*/ -uint64_t linux_mem32_min; -uint64_t linux_mem32_max; -uint64_t linux_mem32_wired; -uint64_t linux_mem32_offset; - -/** -* This function returns the application information as obtained +* Returns the application information as obtained * by the bootloader. This provides the core mask of the cores * running the same application image, as well as the physical * memory regions available to the core. -* -* Returns Pointer to the boot information structure -* */ struct cvmx_sysinfo *cvmx_sysinfo_get (void ) { -return &(state.sysinfo); +return &sysinfo; }EXPORT_SYMBOL (cvmx_sysinfo_get); -/** -* This function is used in non-simple executive environments (such as -* Linux kernel, u-boot, etc.) to configure the minimal fields that -* are required to use simple executive files directly. -* -* Locking (if required) must be handled outside of this -* function -* -* @phy_mem_desc_ptr: -* Pointer to global physical memory descriptor -* (bootmem descriptor) @board_type: Octeon board -* type enumeration -* -* @board_rev_major: -* Board major revision -* @board_rev_minor: -* Board minor revision -* @cpu_clock_hz: -* CPU clock freqency in hertz -* -* Returns 0: Failure -* 1: success -*/ -int cvmx_sysinfo_minimal_initialize (void *phy_mem_desc_ptr, -uint16_t board_type, -uint8_t board_rev_major, -uint8_t board_rev_minor, -uint32_t cpu_clock_hz) -{ - -/* The sysinfo structure was already initialized */ -if (state.sysinfo.board_type) -return 0 ; - -memset (&(state.sysinfo),0x0 ,sizeof (state.sysinfo)); - state.sysinfo.phy_mem_desc_ptr = phy_mem_desc_ptr; - state.sysinfo.board_type = board_type; - state.sysinfo.board_rev_major = board_rev_major; - state.sysinfo.board_rev_minor = board_rev_minor; - state.sysinfo.cpu_clock_hz = cpu_clock_hz; - -return 1 ; -}
arch/mips/include/asm/octeon/cvmx-sysinfo.h +1 -29
@@ -4,7 +4,7 @@* Contact: [email protected] * This file is part of the OCTEON SDK * -* Copyright (c) 2003-2008 Cavium Networks +* Copyright (c) 2003-2016 Cavium, Inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, as
@@ -121,32 +121,4 @@ struct cvmx_sysinfo {extern struct cvmx_sysinfo *cvmx_sysinfo_get (void ); -/** -* This function is used in non-simple executive environments (such as -* Linux kernel, u-boot, etc.) to configure the minimal fields that -* are required to use simple executive files directly. -* -* Locking (if required) must be handled outside of this -* function -* -* @phy_mem_desc_ptr: Pointer to global physical memory descriptor -* (bootmem descriptor) @board_type: Octeon board -* type enumeration -* -* @board_rev_major: -* Board major revision -* @board_rev_minor: -* Board minor revision -* @cpu_clock_hz: -* CPU clock freqency in hertz -* -* Returns 0: Failure -* 1: success -*/ -extern int cvmx_sysinfo_minimal_initialize (void *phy_mem_desc_ptr, -uint16_t board_type, -uint8_t board_rev_major, -uint8_t board_rev_minor, -uint32_t cpu_clock_hz); -#endif /* __CVMX_SYSINFO_H__ */
Signature · 1 line
1.7.11.7
PATCH 2/2 MIPS: OCTEON: Extend number of supported CPUs past 32
In reply to David DaneyFrom: David Daney <[email protected]>
To support more than 48 CPUs, the bootinfo structure grows a new coremask structure. Add the definition of the structure and add it to struct cvmx_bootinfo. In prom_init(), copy the new coremask data into the sysinfo structure, and use it in smp_setup().
--- arch/mips/cavium-octeon/setup.c | 19 +++++- arch/mips/cavium-octeon/smp.c | 4 +- arch/mips/include/asm/octeon/cvmx-bootinfo.h | 14 ++++- arch/mips/include/asm/octeon/cvmx-coremask.h | 89 ++++++++++++++++++++++++++++ arch/mips/include/asm/octeon/cvmx-sysinfo.h | 7 ++- 5 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 arch/mips/include/asm/octeon/cvmx-coremask.h
arch/mips/cavium-octeon/setup.c +16 -3
@@ -637,9 +637,22 @@ void __init prom_init(void) sysinfo =cvmx_sysinfo_get ();memset (sysinfo,0 ,sizeof (*sysinfo)); sysinfo->system_dram_size = octeon_bootinfo->dram_size <<20 ; - sysinfo->phy_mem_desc_ptr = -cvmx_phys_to_ptr (octeon_bootinfo->phy_mem_desc_addr); - sysinfo->core_mask = octeon_bootinfo->core_mask; + sysinfo->phy_mem_desc_addr = (u64 )phys_to_virt (octeon_bootinfo->phy_mem_desc_addr); + +if ((octeon_bootinfo->major_version >1 ) || + (octeon_bootinfo->major_version ==1 && + octeon_bootinfo->minor_version >=4 )) +cvmx_coremask_copy (&sysinfo->core_mask, + &octeon_bootinfo->ext_core_mask); +else +cvmx_coremask_set64 (&sysinfo->core_mask, + octeon_bootinfo->core_mask); + +/* Some broken u-boot pass garbage in upper bits, clear them out */ +if (!OCTEON_IS_MODEL (OCTEON_CN78XX )) +for (i =512 ; i <1024 ; i++) +cvmx_coremask_clear_core (&sysinfo->core_mask, i); + sysinfo->exception_base_addr = octeon_bootinfo->exception_base_addr; sysinfo->cpu_clock_hz = octeon_bootinfo->eclock_hz; sysinfo->dram_data_rate_hz = octeon_bootinfo->dclock_hz *2 ;
arch/mips/cavium-octeon/smp.c +3 -1
@@ -103,6 +103,8 @@ static void octeon_smp_setup(void)int cpus;int id;int core_mask =octeon_get_boot_coremask (); +struct cvmx_sysinfo *sysinfo =cvmx_sysinfo_get (); +#ifdef CONFIG_HOTPLUG_CPU unsigned int num_cores =cvmx_octeon_num_cores ();#endif
@@ -119,7 +121,7 @@ static void octeon_smp_setup(void)/* The present CPUs get the lowest CPU numbers. */ cpus =1 ;for (id =0 ; id <NR_CPUS ; id++) { -if ((id != coreid) && (core_mask & (1 << id))) { +if ((id != coreid) &&cvmx_coremask_is_core_set (&sysinfo->core_mask, id)) {set_cpu_possible (cpus, true);set_cpu_present (cpus, true); __cpu_number_map[id] = cpus;
arch/mips/include/asm/octeon/cvmx-bootinfo.h +13 -1
@@ -32,6 +32,8 @@#ifndef __CVMX_BOOTINFO_H__#define __CVMX_BOOTINFO_H__ +#include "cvmx-coremask.h" +/* * Current major and minor versions of the CVMX bootinfo block that is * passed from the bootloader to the application. This is versioned
@@ -39,7 +41,7 @@* versions. */ #define CVMX_BOOTINFO_MAJ_VER 1 -#define CVMX_BOOTINFO_MIN_VER 3 +#define CVMX_BOOTINFO_MIN_VER 4#if (CVMX_BOOTINFO_MAJ_VER ==1 )#define CVMX_BOOTINFO_OCTEON_SERIAL_LEN 20
@@ -124,6 +126,13 @@ struct cvmx_bootinfo {*/ uint64_t fdt_addr;#endif +#if (CVMX_BOOTINFO_MIN_VER >=4 ) +/* +* Coremask used for processors with more than 32 cores +* or with OCI. This replaces core_mask. +*/ +struct cvmx_coremask ext_core_mask; +#endif #else /* __BIG_ENDIAN */ /* * Little-Endian: When the CPU mode is switched to
@@ -177,6 +186,9 @@ struct cvmx_bootinfo {#if (CVMX_BOOTINFO_MIN_VER >=3 )uint64_t fdt_addr;#endif +#if (CVMX_BOOTINFO_MIN_VER >=4 ) +struct cvmx_coremask ext_core_mask; +#endif #endif };
arch/mips/include/asm/octeon/cvmx-coremask.h new file +89 -0
89 lines not on this page · raw message
arch/mips/include/asm/octeon/cvmx-sysinfo.h +4 -3
@@ -32,6 +32,8 @@#ifndef __CVMX_SYSINFO_H__#define __CVMX_SYSINFO_H__ +#include "cvmx-coremask.h" +#define OCTEON_SERIAL_LEN 20/** * Structure describing application specific information.
@@ -50,8 +52,7 @@ struct cvmx_sysinfo {uint64_t system_dram_size;/* ptr to memory descriptor block */ -void *phy_mem_desc_ptr; - +uint64_t phy_mem_desc_addr;/* Application image specific variables */ /* stack top address (virtual) */
@@ -63,7 +64,7 @@ struct cvmx_sysinfo {/* heap size in bytes */ uint32_t heap_size;/* coremask defining cores running application */ -uint32_t core_mask; +struct cvmx_coremask core_mask;/* Deprecated, use cvmx_coremask_first_core() to select init core */ uint32_t init_core;
Signature · 1 line
1.7.11.7