Lines Matching full:priority

8  * Exception handlers at EL3, their priority levels, and management.
37 * Convert index into secure priority using the platform-defined priority bits
47 /* Returns whether given priority is in secure priority range */
53 /* Translate priority to the index in the priority array */
54 static unsigned int pri_to_idx(unsigned int priority) in pri_to_idx() argument
58 idx = EHF_PRI_TO_IDX(priority, exception_data.pri_bits); in pri_to_idx()
65 /* Return whether there are outstanding priority activation */
77 * Return the current priority index of this CPU. If no priority is active,
85 /* Current priority is the right-most bit */ in get_pe_highest_active_idx()
90 * Mark priority active by setting the corresponding bit in active_pri_bits and
91 * programming the priority mask.
99 void ehf_activate_priority(unsigned int priority) in ehf_activate_priority() argument
106 * Query interrupt controller for the running priority, or idle priority in ehf_activate_priority()
107 * if no interrupts are being handled. The requested priority must be in ehf_activate_priority()
108 * less (higher priority) than the active running priority. in ehf_activate_priority()
111 if (priority >= run_pri) { in ehf_activate_priority()
112 ERROR("Running priority higher (0x%x) than requested (0x%x)\n", in ehf_activate_priority()
113 run_pri, priority); in ehf_activate_priority()
118 * If there were priority activations already, the requested priority in ehf_activate_priority()
119 * must be less (higher priority) than the current highest priority in ehf_activate_priority()
123 idx = pri_to_idx(priority); in ehf_activate_priority()
126 ERROR("Activation priority mismatch: req=0x%x current=0x%x\n", in ehf_activate_priority()
127 priority, IDX_TO_PRI(cur_pri_idx)); in ehf_activate_priority()
131 /* Set the bit corresponding to the requested priority */ in ehf_activate_priority()
135 * Program priority mask for the activated level. Check that the new in ehf_activate_priority()
136 * priority mask is setting a higher priority level than the existing in ehf_activate_priority()
139 old_mask = plat_ic_set_priority_mask(priority); in ehf_activate_priority()
140 if (priority >= old_mask) { in ehf_activate_priority()
141 ERROR("Requested priority (0x%x) lower than Priority Mask (0x%x)\n", in ehf_activate_priority()
142 priority, old_mask); in ehf_activate_priority()
147 * If this is the first activation, save the priority mask. This will be in ehf_activate_priority()
157 * Mark priority inactive by clearing the corresponding bit in active_pri_bits,
158 * and programming the priority mask.
166 void ehf_deactivate_priority(unsigned int priority) in ehf_deactivate_priority() argument
173 * Query interrupt controller for the running priority, or idle priority in ehf_deactivate_priority()
174 * if no interrupts are being handled. The requested priority must be in ehf_deactivate_priority()
175 * less (higher priority) than the active running priority. in ehf_deactivate_priority()
178 if (priority >= run_pri) { in ehf_deactivate_priority()
179 ERROR("Running priority higher (0x%x) than requested (0x%x)\n", in ehf_deactivate_priority()
180 run_pri, priority); in ehf_deactivate_priority()
185 * Deactivation is allowed only when there are priority activations, and in ehf_deactivate_priority()
186 * the deactivation priority level must match the current activated in ehf_deactivate_priority()
187 * priority. in ehf_deactivate_priority()
190 idx = pri_to_idx(priority); in ehf_deactivate_priority()
193 ERROR("Deactivation priority mismatch: req=0x%x current=0x%x\n", in ehf_deactivate_priority()
194 priority, IDX_TO_PRI(cur_pri_idx)); in ehf_deactivate_priority()
198 /* Clear bit corresponding to highest priority */ in ehf_deactivate_priority()
202 * Restore priority mask corresponding to the next priority, or the in ehf_deactivate_priority()
209 old_mask = plat_ic_set_priority_mask(priority); in ehf_deactivate_priority()
211 if (old_mask > priority) { in ehf_deactivate_priority()
212 ERROR("Deactivation priority (0x%x) lower than Priority Mask (0x%x)\n", in ehf_deactivate_priority()
213 priority, old_mask); in ehf_deactivate_priority()
221 * After leaving Non-secure world, stash current Non-secure Priority Mask, and
222 * set Priority Mask to the highest Non-secure priority so that Non-secure
225 * If the current running priority is in the secure range, or if there are
226 * outstanding priority activations, this function does nothing.
236 /* If the running priority is in the secure range, do nothing */ in ehf_exited_normal_world()
250 /* The previous Priority Mask is not expected to be in secure range */ in ehf_exited_normal_world()
252 ERROR("Priority Mask (0x%x) already in secure range\n", in ehf_exited_normal_world()
257 EHF_LOG("Priority Mask: 0x%x => 0x%x\n", pe_data->ns_pri_mask, in ehf_exited_normal_world()
265 * the Non-secure Priority Mask previously stashed upon leaving Non-secure
268 * If there the current running priority is in the secure range, or if there are
269 * outstanding priority activations, this function does nothing.
279 /* If the running priority is in the secure range, do nothing */ in ehf_entering_normal_world()
285 * If there are explicit activations, do nothing. The Priority Mask will in ehf_entering_normal_world()
291 /* Do nothing if we don't have a valid Priority Mask to restore */ in ehf_entering_normal_world()
298 * When exiting secure world, the current Priority Mask must be in ehf_entering_normal_world()
300 * priority mask set upon calling ehf_allow_ns_preemption() in ehf_entering_normal_world()
304 ERROR("Invalid Priority Mask (0x%x) restored\n", old_pmr); in ehf_entering_normal_world()
308 EHF_LOG("Priority Mask: 0x%x => 0x%x\n", old_pmr, pe_data->ns_pri_mask); in ehf_entering_normal_world()
316 * Program Priority Mask to the original Non-secure priority such that
334 * therefore have stashed the Non-secure priority mask. in ehf_allow_ns_preemption()
338 /* Make sure no priority levels are active when requesting this */ in ehf_allow_ns_preemption()
340 ERROR("PE %lx has priority activations: 0x%x\n", in ehf_allow_ns_preemption()
356 EHF_LOG("Priority Mask: 0x%x => 0x%x\n", old_pmr, pe_data->ns_pri_mask); in ehf_allow_ns_preemption()
370 /* If running priority is in secure range, return false */ in ehf_is_ns_preemption_allowed()
379 * - There wouldn't have been priority activations; in ehf_is_ns_preemption_allowed()
380 * - We would have cleared the stashed the Non-secure Priority Mask. in ehf_is_ns_preemption_allowed()
413 * a higher-priority interrupt of another type. in ehf_el3_interrupt_handler()
420 /* Having acknowledged the interrupt, get the running priority */ in ehf_el3_interrupt_handler()
423 /* Check EL3 interrupt priority is in secure range */ in ehf_el3_interrupt_handler()
427 * Translate the priority to a descriptor index. We do this by masking in ehf_el3_interrupt_handler()
428 * and shifting the running priority value (platform-supplied). in ehf_el3_interrupt_handler()
432 /* Validate priority */ in ehf_el3_interrupt_handler()
438 ERROR("No EL3 exception handler for priority 0x%x\n", in ehf_el3_interrupt_handler()
464 * Make sure that priority water mark has enough bits to represent the in ehf_init()
465 * whole priority array. in ehf_init()
472 * Bit 7 of GIC priority must be 0 for secure interrupts. This means in ehf_init()
489 * Register a handler at the supplied priority. Registration is allowed only if
491 * time. The priority for which the handler is being registered must also accord
504 /* Ensure we register for valid priority */ in ehf_register_priority_handler()
511 ERROR("Handler already registered for priority 0x%x\n", pri); in ehf_register_priority_handler()