Thread (31 messages) 31 messages, 11 authors, 2014-12-11
STALE4216d
Revisions (19)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v1 [diff vs current]
  7. v1 [diff vs current]
  8. v1 [diff vs current]
  9. v1 [diff vs current]
  10. v1 [diff vs current]
  11. v1 [diff vs current]
  12. v1 [diff vs current]
  13. v1 current
  14. v2 [diff vs current]
  15. v2 [diff vs current]
  16. v2 [diff vs current]
  17. v4 [diff vs current]
  18. v5 [diff vs current]
  19. v6 [diff vs current]

[PATCH 3/9] ARM: MB86S7X: Add MCPM support

From: Jassi Brar <hidden>
Date: 2014-11-27 04:59:44

On 25 November 2014 at 23:12, Nicolas Pitre [off-list ref] wrote:
quoted
+
+static void
+mb86s7x_set_wficolor(unsigned clstr, unsigned cpu, unsigned clr)
+{
+     u8 val;
+
+     if (clr & ~AT_WFI_COLOR_MASK)
+             return;
Shouldn't this be a BUG() rather than a return?
There are only 2 callers of this and they use explicit defines
AT_WFI_DO_xxx, so the check is actually lame and could be removed.
quoted
+
+     val = readb_relaxed(mb86s7x_shm_base
+                         + WFI_COLOR_OFFSET + clstr * 2 + cpu);
+     val &= ~AT_WFI_COLOR_MASK;
+     val |= clr;
+     writeb_relaxed(val, mb86s7x_shm_base
+                    + WFI_COLOR_OFFSET + clstr * 2 + cpu);
+}
+
+static int mb86s7x_pm_power_up(unsigned int cpu, unsigned int cluster)
+{
+     int ret = 0;
+
+     if (cluster >= S7X_MAX_CLUSTER || cpu >= S7X_MAX_CPU)
+             return -EINVAL;
+
+     pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
+
+     local_irq_disable();
+     arch_spin_lock(&mb86s7x_pm_lock);
+
+     mb86s7x_pm_use_count[cluster][cpu]++;
+
+     if (mb86s7x_pm_use_count[cluster][cpu] == 1) {
+             struct mb86s7x_cpu_gate cmd;
+
+             arch_spin_unlock(&mb86s7x_pm_lock);
+             local_irq_enable();
From that point onward, nothing prevents concurrent execution in
mb86s7x_pm_suspend() racing to call mb86s7x_set_wficolor() resulting in
an incoherent state depending on who wins the race.
yeah, the set_wficolor() better be before we release the arch_spin_unlock.

Thanks,
Jassi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help