arch: arc: optimizations on irq lock/unlock in low level

When SMP is enabled, the irq_lock/unlock will get and
release a global spin lock, but the codes changed in this
commit only need to lock the local cpu. No affect on
uniprocessor, but optimizations for SMP case.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
Wayne Ren 2020-04-06 18:30:36 +08:00 committed by Andrew Boie
commit 819e7aec77
2 changed files with 4 additions and 4 deletions

View file

@ -96,7 +96,7 @@ static void dcache_flush_mlines(u32_t start_addr, u32_t size)
end_addr = start_addr + size - 1;
start_addr &= (u32_t)(~(DCACHE_LINE_SIZE - 1));
key = irq_lock(); /* --enter critical section-- */
key = arch_irq_lock(); /* --enter critical section-- */
do {
z_arc_v2_aux_reg_write(_ARC_V2_DC_FLDL, start_addr);
@ -113,7 +113,7 @@ static void dcache_flush_mlines(u32_t start_addr, u32_t size)
start_addr += DCACHE_LINE_SIZE;
} while (start_addr <= end_addr);
irq_unlock(key); /* --exit critical section-- */
arch_irq_unlock(key); /* --exit critical section-- */
}

View file

@ -29,10 +29,10 @@ u64_t z_tsc_read(void)
u64_t t;
u32_t count;
key = irq_lock();
key = arch_irq_lock();
t = (u64_t)z_tick_get();
count = z_arc_v2_aux_reg_read(_ARC_V2_TMR0_COUNT);
irq_unlock(key);
arch_irq_unlock(key);
t *= k_ticks_to_cyc_floor64(1);
t += (u64_t)count;
return t;