Merge "qcn3018: Set number of cores for QCN3018"

This commit is contained in:
Linux Build Service Account 2019-06-21 04:36:19 -07:00 committed by Gerrit - the friendly Code Review server
commit 50ed09554a
5 changed files with 57 additions and 2 deletions

View file

@ -82,6 +82,7 @@ void aquantia_phy_reset_init_done(void);
void aquantia_phy_reset_init(void);
int bring_sec_core_up(unsigned int cpuid, unsigned int entry, unsigned int arg);
int is_secondary_core_off(unsigned int cpuid);
int smem_read_cpu_count(void);
struct dumpinfo_t{
char name[16]; /* use only file name in 8.3 format */

View file

@ -469,3 +469,8 @@ __weak void clear_l2cache_err(void)
{
return;
}
__weak int smem_read_cpu_count()
{
return -1;
}

View file

@ -415,6 +415,36 @@ static int authenticate_rootfs_elf(unsigned int rootfs_hdr)
#endif
#endif
static int set_num_cpus(void)
{
char *arg;
char *p;
char bootarg_buf[50];
int numcpus;
numcpus = smem_read_cpu_count();
if (numcpus != -1) { /* QCN3018 */
/* check if nosmp is set in bootargs */
arg = getenv("bootargs");
if (arg) {
p = strstr(arg, "nosmp");
if (p) {
if ((p[strlen("nosmp")] == ' ')
|| (p[strlen("nosmp")] == '\0'))
if ((p == arg) || (*(p - 1) == ' '))
return 0;
}
}
snprintf(bootarg_buf, sizeof(bootarg_buf),
"setenv bootargs ${booargs} maxcpus=%d\n",
numcpus);
return run_command(bootarg_buf, 0);
}
return 0;
}
static int do_boot_signedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
char runcmd[256];
@ -435,6 +465,9 @@ static int do_boot_signedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const a
if (argc == 2 && strncmp(argv[1], "debug", 5) == 0)
debug = 1;
if ((ret = set_num_cpus()))
return ret;
if ((ret = set_fs_bootargs(&ipq_fs_on_nand)))
return ret;
@ -682,6 +715,9 @@ static int do_boot_unsignedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const
if (argc == 2 && strncmp(argv[1], "debug", 5) == 0)
debug = 1;
if ((ret = set_num_cpus()))
return ret;
if ((ret = set_fs_bootargs(&ipq_fs_on_nand)))
return ret;

View file

@ -696,3 +696,15 @@ int bring_sec_core_up(unsigned int cpuid, unsigned int entry, unsigned int arg)
return 0;
}
int smem_read_cpu_count()
{
uint32_t core_no;
if (!smem_read_alloc_entry(SMEM_NUM_CPUINFO, &core_no,
sizeof(uint32_t))) {
if (core_no != 4)
return core_no;
}
return -1;
}

View file

@ -162,9 +162,10 @@ typedef enum {
SMEM_BOOT_FLASH_DENSITY = 482,
SMEM_PARTITION_TABLE_OFFSET = 483,
SMEM_BOOT_DUALPARTINFO = 484,
SMEM_NUM_CPUINFO = 485,
SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
SMEM_LAST_VALID_TYPE = SMEM_BOOT_DUALPARTINFO,
SMEM_MAX_SIZE = SMEM_BOOT_DUALPARTINFO + 1,
SMEM_LAST_VALID_TYPE = SMEM_NUM_CPUINFO,
SMEM_MAX_SIZE = SMEM_NUM_CPUINFO + 1,
} smem_mem_type_t;
unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int len);