anv: Add a clfush_range helper function
This commit is contained in:
parent
3c8dc1afd1
commit
42155abdd7
|
@ -418,14 +418,11 @@ struct anv_state_stream {
|
|||
#define CACHELINE_SIZE 64
|
||||
#define CACHELINE_MASK 63
|
||||
|
||||
static void inline
|
||||
anv_state_clflush(struct anv_state state)
|
||||
static inline void
|
||||
anv_clflush_range(void *start, size_t size)
|
||||
{
|
||||
/* state.map may not be cacheline aligned, so round down the start pointer
|
||||
* to a cacheline boundary so we flush all pages that contain the state.
|
||||
*/
|
||||
void *end = state.map + state.alloc_size;
|
||||
void *p = (void *) (((uintptr_t) state.map) & ~CACHELINE_MASK);
|
||||
void *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK);
|
||||
void *end = start + size;
|
||||
|
||||
__builtin_ia32_mfence();
|
||||
while (p < end) {
|
||||
|
@ -434,6 +431,12 @@ anv_state_clflush(struct anv_state state)
|
|||
}
|
||||
}
|
||||
|
||||
static void inline
|
||||
anv_state_clflush(struct anv_state state)
|
||||
{
|
||||
anv_clflush_range(state.map, state.alloc_size);
|
||||
}
|
||||
|
||||
void anv_block_pool_init(struct anv_block_pool *pool,
|
||||
struct anv_device *device, uint32_t block_size);
|
||||
void anv_block_pool_finish(struct anv_block_pool *pool);
|
||||
|
|
Loading…
Reference in New Issue