arm64: psci: use struct cpu_action to track startup entry
The struct cpu_action already tracks entry/arg pointers. Use that instead of duplicating the same information. BUG=chrome-os-partner:32112 BRANCH=None TEST=Built and booted. Change-Id: I70e1b471ca15eac2ea4e6ca3dab7d8dc2774a241 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: cdddfd8d74d227cb5cbdf15b6871480839fa20d8 Original-Change-Id: I4070ef0df19bb1141a1a47c4570a894928d6a5a4 Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/227549 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/9396 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
		
				
					committed by
					
						
						Patrick Georgi
					
				
			
			
				
	
			
			
			
						parent
						
							be3e2387c6
						
					
				
				
					commit
					9fd7b1c1a9
				
			@@ -170,17 +170,16 @@ static void psci_cpu_on_callback(void *arg)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	memset(&state, 0, sizeof(state));
 | 
						memset(&state, 0, sizeof(state));
 | 
				
			||||||
	state.elx.spsr = get_eret_el(target_el, SPSR_USE_H);
 | 
						state.elx.spsr = get_eret_el(target_el, SPSR_USE_H);
 | 
				
			||||||
	transition_with_entry(e->cpu_state.entry, e->cpu_state.arg, &state);
 | 
						transition_with_entry(e->cpu_state.startup.run,
 | 
				
			||||||
 | 
									e->cpu_state.startup.arg, &state);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void psci_cpu_on_prepare(struct psci_node *e,
 | 
					static void psci_cpu_on_prepare(struct psci_node *e, const struct cpu_action *a)
 | 
				
			||||||
				void *entry, void *arg)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct psci_node *ancestor;
 | 
						struct psci_node *ancestor;
 | 
				
			||||||
	int state = PSCI_STATE_ON_PENDING;
 | 
						int state = PSCI_STATE_ON_PENDING;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	e->cpu_state.entry = entry;
 | 
						e->cpu_state.startup = *a;
 | 
				
			||||||
	e->cpu_state.arg = arg;
 | 
					 | 
				
			||||||
	ancestor = psci_find_ancestor(e, PSCI_AFFINITY_LEVEL_HIGHEST, state);
 | 
						ancestor = psci_find_ancestor(e, PSCI_AFFINITY_LEVEL_HIGHEST, state);
 | 
				
			||||||
	e->cpu_state.ancestor = ancestor;
 | 
						e->cpu_state.ancestor = ancestor;
 | 
				
			||||||
	psci_set_hierarchy_state(e, ancestor, state);
 | 
						psci_set_hierarchy_state(e, ancestor, state);
 | 
				
			||||||
@@ -188,18 +187,23 @@ static void psci_cpu_on_prepare(struct psci_node *e,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int psci_schedule_cpu_on(struct psci_node *e)
 | 
					static int psci_schedule_cpu_on(struct psci_node *e)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct cpu_info *ci;
 | 
				
			||||||
	struct cpu_action action = {
 | 
						struct cpu_action action = {
 | 
				
			||||||
		.run = &psci_cpu_on_callback,
 | 
							.run = &psci_cpu_on_callback,
 | 
				
			||||||
		.arg = e,
 | 
							.arg = e,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (arch_run_on_cpu_async(e->cpu_state.ci->id, &action))
 | 
						ci = e->cpu_state.ci;
 | 
				
			||||||
 | 
						if (ci == NULL || arch_run_on_cpu_async(ci->id, &action)) {
 | 
				
			||||||
 | 
							psci_set_hierarchy_state(e, e->cpu_state.ancestor,
 | 
				
			||||||
 | 
											PSCI_STATE_OFF);
 | 
				
			||||||
		return PSCI_RET_INTERNAL_FAILURE;
 | 
							return PSCI_RET_INTERNAL_FAILURE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return PSCI_RET_SUCCESS;
 | 
						return PSCI_RET_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void psci_turn_on_self(void *entry, void *arg)
 | 
					void psci_turn_on_self(const struct cpu_action *action)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct psci_node *e = node_self();
 | 
						struct psci_node *e = node_self();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -210,7 +214,7 @@ void psci_turn_on_self(void *entry, void *arg)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	psci_lock();
 | 
						psci_lock();
 | 
				
			||||||
	psci_cpu_on_prepare(e, entry, arg);
 | 
						psci_cpu_on_prepare(e, action);
 | 
				
			||||||
	psci_unlock();
 | 
						psci_unlock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	psci_schedule_cpu_on(e);
 | 
						psci_schedule_cpu_on(e);
 | 
				
			||||||
@@ -223,6 +227,7 @@ static void psci_cpu_on(struct psci_func *pf)
 | 
				
			|||||||
	uint64_t context_id;
 | 
						uint64_t context_id;
 | 
				
			||||||
	int cpu_state;
 | 
						int cpu_state;
 | 
				
			||||||
	struct psci_node *e;
 | 
						struct psci_node *e;
 | 
				
			||||||
 | 
						struct cpu_action action;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	target_mpidr = psci64_arg(pf, PSCI_PARAM_0);
 | 
						target_mpidr = psci64_arg(pf, PSCI_PARAM_0);
 | 
				
			||||||
	entry = psci64_arg(pf, PSCI_PARAM_1);
 | 
						entry = psci64_arg(pf, PSCI_PARAM_1);
 | 
				
			||||||
@@ -248,7 +253,9 @@ static void psci_cpu_on(struct psci_func *pf)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	psci_cpu_on_prepare(e, (void *)entry, (void *)context_id);
 | 
						action.run = (void *)entry;
 | 
				
			||||||
 | 
						action.arg = (void *)context_id;
 | 
				
			||||||
 | 
						psci_cpu_on_prepare(e, &action);
 | 
				
			||||||
	psci_unlock();
 | 
						psci_unlock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	psci32_return(pf, psci_schedule_cpu_on(e));
 | 
						psci32_return(pf, psci_schedule_cpu_on(e));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ static void start_up_cpu(void *arg)
 | 
				
			|||||||
	if (action->run == NULL)
 | 
						if (action->run == NULL)
 | 
				
			||||||
		psci_turn_off_self();
 | 
							psci_turn_off_self();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	psci_turn_on_self(action->run, action->arg);
 | 
						psci_turn_on_self(action);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void cpu_init(int bsp)
 | 
					static void cpu_init(int bsp)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,8 +63,7 @@ struct psci_node;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct psci_cpu_state {
 | 
					struct psci_cpu_state {
 | 
				
			||||||
	struct cpu_info *ci;
 | 
						struct cpu_info *ci;
 | 
				
			||||||
	void *entry;
 | 
						struct cpu_action startup;
 | 
				
			||||||
	void *arg;
 | 
					 | 
				
			||||||
	/* Ancestor of target to update state in CPU_ON case. */
 | 
						/* Ancestor of target to update state in CPU_ON case. */
 | 
				
			||||||
	struct psci_node *ancestor;
 | 
						struct psci_node *ancestor;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -191,7 +190,7 @@ static inline void psci64_return(struct psci_func *pf, int64_t val)
 | 
				
			|||||||
void psci_init(void);
 | 
					void psci_init(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Turn on the current CPU within the PSCI subsystem. */
 | 
					/* Turn on the current CPU within the PSCI subsystem. */
 | 
				
			||||||
void psci_turn_on_self(void *entry, void *arg);
 | 
					void psci_turn_on_self(const struct cpu_action *action);
 | 
				
			||||||
int psci_turn_off_self(void);
 | 
					int psci_turn_off_self(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __ARCH_PSCI_H__ */
 | 
					#endif /* __ARCH_PSCI_H__ */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user