qca: Add logic to restrict runmulticore command on secondary cores

Change-Id: Ibe1bf89614ddadb770cda2216b696152534daaf7
Signed-off-by: Santan Kumar <santank@codeaurora.org>
This commit is contained in:
Santan Kumar 2018-02-01 16:16:04 +05:30 committed by Gerrit - the friendly Code Review server
parent ce563c425c
commit bf90754ab4
3 changed files with 16 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -62,7 +62,7 @@ asmlinkage void secondary_core_entry(char *argv, int *cmd_complete,
}
/* Update here as ncessary - secondary entry point */
*cmd_result = cli_simple_run_command(argv, 0);
*cmd_result = cli_simple_run_command(argv, CMD_FLAG_SEC_CORE);
*cmd_complete = 1;
state = CPU_POWER_DOWN;
@ -92,7 +92,7 @@ int is_psci_cpu_off(unsigned int cpuid)
return err;
}
static int do_runmulticore(cmd_tbl_t *cmdtp,
int do_runmulticore(cmd_tbl_t *cmdtp,
int flag, int argc, char *const argv[])
{
int j;

View file

@ -510,6 +510,13 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
return 1;
}
#if defined(CONFIG_SMP_PSCI_CMD)
if ((flag & CMD_FLAG_SEC_CORE) &&
(cmdtp->cmd == do_runmulticore)) {
printf("Restricted command '%s' for secondary core\n", argv[0]);
return 1;
}
#endif
/* found - check max args */
if (argc > cmdtp->maxargs)
rc = CMD_RET_USAGE;

View file

@ -111,6 +111,11 @@ extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
#if defined(CONFIG_SMP_PSCI_CMD)
extern int do_runmulticore(cmd_tbl_t *cmdtp,
int flag, int argc, char *const argv[]);
#endif
/*
* Error codes that commands return to cmd_process(). We use the standard 0
* and 1 for success and failure, but add one more case - failure with a
@ -152,6 +157,7 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size);
#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
#define CMD_FLAG_ENV 0x0004 /* command is from the environment */
#define CMD_FLAG_SEC_CORE 0x0008 /* command is from secondary core */
#ifdef CONFIG_AUTO_COMPLETE
# define _CMD_COMPLETE(x) x,