summaryrefslogtreecommitdiff
path: root/big-little/lib/ipi.c
diff options
context:
space:
mode:
Diffstat (limited to 'big-little/lib/ipi.c')
-rw-r--r--big-little/lib/ipi.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/big-little/lib/ipi.c b/big-little/lib/ipi.c
index 936cda8..5b49d20 100644
--- a/big-little/lib/ipi.c
+++ b/big-little/lib/ipi.c
@@ -49,25 +49,25 @@ static unsigned hyp_ipi_check[16];
*/
static unsigned get_free_ipi(void)
{
- unsigned shift, cpu_if_bit, cpu_id = read_cpuid(), cluster_id =
- read_clusterid();
- int ctr;
+ unsigned shift, cpu_if_bit, cpu_id = read_cpuid(), cluster_id =
+ read_clusterid();
+ int ctr;
- cpu_if_bit = 1 << get_cpuif(cluster_id, cpu_id);
+ cpu_if_bit = 1 << get_cpuif(cluster_id, cpu_id);
- /* Find the register offset */
- for (ctr = 3; ctr >= 0; ctr--)
- /* Check whether IPI<shift> has already been generated by us */
- for (shift = 0; shift < 4; shift++) {
- if (read32
- (GIC_ID_PHY_BASE + GICD_SPENDSGIR +
- (ctr << 2)) & (cpu_if_bit << (shift << 3)))
- continue;
+ /* Find the register offset */
+ for (ctr = 3; ctr >= 0; ctr--)
+ /* Check whether IPI<shift> has already been generated by us */
+ for (shift = 0; shift < 4; shift++) {
+ if (read32
+ (GIC_ID_PHY_BASE + GICD_SPENDSGIR +
+ (ctr << 2)) & (cpu_if_bit << (shift << 3)))
+ continue;
- return (ctr << 2) + shift;
- }
+ return (ctr << 2) + shift;
+ }
- return MAX_IPI;
+ return MAX_IPI;
}
/*
@@ -76,38 +76,38 @@ static unsigned get_free_ipi(void)
*/
unsigned send_hyp_ipi(unsigned cpuif_mask, unsigned type)
{
- unsigned rc = TRUE;
- unsigned ipi_no = 0;
-
- /*
- * First choose a non-pending IPI to avoid a clash with the OS.
- */
- ipi_no = get_free_ipi();
- if (ipi_no == MAX_IPI) {
- rc = FALSE;
- return rc;
- }
-
- /*
- * For this IPI set the mask in our global variable. We do it, payload software
- * does not. But, first check whether any earlier IPIs have already been acked
- */
- while (TRUE) {
- spin_lock(&lock_ipi_check);
- if (hyp_ipi_check[ipi_no] & 0xff) {
- spin_unlock(&lock_ipi_check);
- } else {
- hyp_ipi_check[ipi_no] = (type << 8) | cpuif_mask;
- dsb();
- spin_unlock(&lock_ipi_check);
- break;
- }
- };
-
- /* Send the IPI to the cpu_mask */
- gic_send_ipi(cpuif_mask, ipi_no);
-
- return rc;
+ unsigned rc = TRUE;
+ unsigned ipi_no = 0;
+
+ /*
+ * First choose a non-pending IPI to avoid a clash with the OS.
+ */
+ ipi_no = get_free_ipi();
+ if (ipi_no == MAX_IPI) {
+ rc = FALSE;
+ return rc;
+ }
+
+ /*
+ * For this IPI set the mask in our global variable. We do it, payload software
+ * does not. But, first check whether any earlier IPIs have already been acked
+ */
+ while (TRUE) {
+ spin_lock(&lock_ipi_check);
+ if (hyp_ipi_check[ipi_no] & 0xff) {
+ spin_unlock(&lock_ipi_check);
+ } else {
+ hyp_ipi_check[ipi_no] = (type << 8) | cpuif_mask;
+ dsb();
+ spin_unlock(&lock_ipi_check);
+ break;
+ }
+ };
+
+ /* Send the IPI to the cpu_mask */
+ gic_send_ipi(cpuif_mask, ipi_no);
+
+ return rc;
}
/*
@@ -116,20 +116,20 @@ unsigned send_hyp_ipi(unsigned cpuif_mask, unsigned type)
*/
unsigned get_hyp_ipi(unsigned cpu_if, unsigned ipi_no)
{
- unsigned type = 0;
-
- spin_lock(&lock_ipi_check);
- /*
- * If this IPI was sent by the big-little code then our cpu_if bit must have
- * been set in the ipi_check flag. Reset the bit and indicate that its an
- * internal IPI.
- */
- if (hyp_ipi_check[ipi_no] & (1 << cpu_if)) {
- type = hyp_ipi_check[ipi_no] >> 8;
- hyp_ipi_check[ipi_no] &= ~(1 << cpu_if);
- dsb();
- }
- spin_unlock(&lock_ipi_check);
-
- return type;
+ unsigned type = 0;
+
+ spin_lock(&lock_ipi_check);
+ /*
+ * If this IPI was sent by the big-little code then our cpu_if bit must have
+ * been set in the ipi_check flag. Reset the bit and indicate that its an
+ * internal IPI.
+ */
+ if (hyp_ipi_check[ipi_no] & (1 << cpu_if)) {
+ type = hyp_ipi_check[ipi_no] >> 8;
+ hyp_ipi_check[ipi_no] &= ~(1 << cpu_if);
+ dsb();
+ }
+ spin_unlock(&lock_ipi_check);
+
+ return type;
}