Add options to dmb() and dsb() macros on ARM64
Using plain dsb()/dmb() as full system barriers is usually to much. Adding proper options to those barriers (instead of full system - sy) will most likely reduce the cost of the instructions and will benefit in performance improvement. This commit adds options to barrier macro definitions. Obtained from: Semihalf Reviewed by: andrew, ian Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
9ae8e0064a
commit
458f2175ca
@ -156,13 +156,11 @@ db_write_bytes(vm_offset_t addr, size_t size, char *data)
|
|||||||
}
|
}
|
||||||
*dst++ = *data++;
|
*dst++ = *data++;
|
||||||
}
|
}
|
||||||
|
dsb(ish);
|
||||||
|
|
||||||
dsb();
|
|
||||||
/* Clean D-cache and invalidate I-cache */
|
/* Clean D-cache and invalidate I-cache */
|
||||||
cpu_dcache_wb_range(addr, (vm_size_t)size);
|
cpu_dcache_wb_range(addr, (vm_size_t)size);
|
||||||
cpu_icache_sync_range(addr, (vm_size_t)size);
|
cpu_icache_sync_range(addr, (vm_size_t)size);
|
||||||
dsb();
|
|
||||||
isb();
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ vfp_save_state(struct thread *td)
|
|||||||
td->td_pcb->pcb_fpcr = fpcr;
|
td->td_pcb->pcb_fpcr = fpcr;
|
||||||
td->td_pcb->pcb_fpsr = fpsr;
|
td->td_pcb->pcb_fpsr = fpsr;
|
||||||
|
|
||||||
dsb();
|
dsb(ish);
|
||||||
vfp_disable();
|
vfp_disable();
|
||||||
}
|
}
|
||||||
critical_exit();
|
critical_exit();
|
||||||
|
@ -29,13 +29,29 @@
|
|||||||
#ifndef _MACHINE_ATOMIC_H_
|
#ifndef _MACHINE_ATOMIC_H_
|
||||||
#define _MACHINE_ATOMIC_H_
|
#define _MACHINE_ATOMIC_H_
|
||||||
|
|
||||||
#define isb() __asm __volatile("isb" : : : "memory")
|
#define isb() __asm __volatile("isb" : : : "memory")
|
||||||
#define dsb() __asm __volatile("dsb sy" : : : "memory")
|
|
||||||
#define dmb() __asm __volatile("dmb sy" : : : "memory")
|
|
||||||
|
|
||||||
#define mb() dmb()
|
/*
|
||||||
#define wmb() dmb()
|
* Options for DMB and DSB:
|
||||||
#define rmb() dmb()
|
* oshld Outer Shareable, load
|
||||||
|
* oshst Outer Shareable, store
|
||||||
|
* osh Outer Shareable, all
|
||||||
|
* nshld Non-shareable, load
|
||||||
|
* nshst Non-shareable, store
|
||||||
|
* nsh Non-shareable, all
|
||||||
|
* ishld Inner Shareable, load
|
||||||
|
* ishst Inner Shareable, store
|
||||||
|
* ish Inner Shareable, all
|
||||||
|
* ld Full system, load
|
||||||
|
* st Full system, store
|
||||||
|
* sy Full system, all
|
||||||
|
*/
|
||||||
|
#define dsb(opt) __asm __volatile("dsb " __STRING(opt) : : : "memory")
|
||||||
|
#define dmb(opt) __asm __volatile("dmb " __STRING(opt) : : : "memory")
|
||||||
|
|
||||||
|
#define mb() dmb(sy) /* Full system memory barrier all */
|
||||||
|
#define wmb() dmb(st) /* Full system memory barrier store */
|
||||||
|
#define rmb() dmb(ld) /* Full system memory barrier load */
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
atomic_add_32(volatile uint32_t *p, uint32_t val)
|
atomic_add_32(volatile uint32_t *p, uint32_t val)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user