Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
cvmx-l2c.c File Reference
#include <linux/irqflags.h>
#include <asm/octeon/cvmx.h>
#include <asm/octeon/cvmx-l2c.h>
#include <asm/octeon/cvmx-spinlock.h>

Go to the source code of this file.

Data Structures

union  __cvmx_l2c_tag
 
struct  __cvmx_l2c_tag::cvmx_l2c_tag_cn50xx
 
struct  __cvmx_l2c_tag::cvmx_l2c_tag_cn30xx
 
struct  __cvmx_l2c_tag::cvmx_l2c_tag_cn31xx
 
struct  __cvmx_l2c_tag::cvmx_l2c_tag_cn38xx
 
struct  __cvmx_l2c_tag::cvmx_l2c_tag_cn58xx
 

Functions

int cvmx_l2c_get_core_way_partition (uint32_t core)
 
int cvmx_l2c_set_core_way_partition (uint32_t core, uint32_t mask)
 
int cvmx_l2c_set_hw_way_partition (uint32_t mask)
 
int cvmx_l2c_get_hw_way_partition (void)
 
void cvmx_l2c_config_perf (uint32_t counter, enum cvmx_l2c_event event, uint32_t clear_on_read)
 
uint64_t cvmx_l2c_read_perf (uint32_t counter)
 
int cvmx_l2c_lock_line (uint64_t addr)
 
int cvmx_l2c_lock_mem_region (uint64_t start, uint64_t len)
 
void cvmx_l2c_flush (void)
 
int cvmx_l2c_unlock_line (uint64_t address)
 
int cvmx_l2c_unlock_mem_region (uint64_t start, uint64_t len)
 
union cvmx_l2c_tag cvmx_l2c_get_tag (uint32_t association, uint32_t index)
 
uint32_t cvmx_l2c_address_to_index (uint64_t addr)
 
int cvmx_l2c_get_cache_size_bytes (void)
 
int cvmx_l2c_get_set_bits (void)
 
int cvmx_l2c_get_num_sets (void)
 
int cvmx_l2c_get_num_assoc (void)
 
void cvmx_l2c_flush_line (uint32_t assoc, uint32_t index)
 

Variables

cvmx_spinlock_t cvmx_l2c_spinlock
 

Function Documentation

uint32_t cvmx_l2c_address_to_index ( uint64_t  addr)

Returns the cache index for a given physical address

: physical address

Returns L2 cache index

Definition at line 717 of file cvmx-l2c.c.

void cvmx_l2c_config_perf ( uint32_t  counter,
enum cvmx_l2c_event  event,
uint32_t  clear_on_read 
)

Configure one of the four L2 Cache performance counters to capture event occurrences.

: The counter to configure. Range 0..3. : The type of L2 Cache event occurrence to count. : When asserted, any read of the performance counter clears the counter.

Note
The routine does not clear the counter.

Definition at line 168 of file cvmx-l2c.c.

void cvmx_l2c_flush ( void  )

Flushes (and unlocks) the entire L2 cache. IMPORTANT: Must only be run by one core at a time due to use of L2C debug features.

Definition at line 424 of file cvmx-l2c.c.

void cvmx_l2c_flush_line ( uint32_t  assoc,
uint32_t  index 
)

Flush a line from the L2 cache This should only be called from one core at a time, as this routine sets the core to the 'debug' core in order to flush the line.

: Association (or way) to flush : Index to flush

Definition at line 849 of file cvmx-l2c.c.

int cvmx_l2c_get_cache_size_bytes ( void  )

Returns Returns the size of the L2 cache in bytes, -1 on error (unrecognized model)

Definition at line 745 of file cvmx-l2c.c.

int cvmx_l2c_get_core_way_partition ( uint32_t  core)

Return the L2 Cache way partitioning for a given core.

: The core processor of interest.

Returns The mask specifying the partitioning. 0 bits in mask indicates the cache 'ways' that a core can evict from. -1 on error

Definition at line 48 of file cvmx-l2c.c.

int cvmx_l2c_get_hw_way_partition ( void  )

Return the L2 Cache way partitioning for the hw blocks.

Returns The mask specifying the reserved way. 0 bits in mask indicates the cache 'ways' that a core can evict from. -1 on error

Definition at line 160 of file cvmx-l2c.c.

int cvmx_l2c_get_num_assoc ( void  )

Return the number of associations in the L2 Cache

Returns

Definition at line 782 of file cvmx-l2c.c.

int cvmx_l2c_get_num_sets ( void  )

Return the number of sets in the L2 Cache

Returns

Definition at line 776 of file cvmx-l2c.c.

int cvmx_l2c_get_set_bits ( void  )

Return log base 2 of the number of sets in the L2 cache Returns

Definition at line 755 of file cvmx-l2c.c.

union cvmx_l2c_tag cvmx_l2c_get_tag ( uint32_t  association,
uint32_t  index 
)
write

Read the L2 controller tag for a given location in L2

: Which association to read line from : Which way to read from.

Returns l2c tag structure for line requested.

Definition at line 637 of file cvmx-l2c.c.

int cvmx_l2c_lock_line ( uint64_t  addr)

Locks a line in the L2 cache at the specified physical address

: physical address of line to lock

Returns 0 on success, 1 if line not locked.

Definition at line 309 of file cvmx-l2c.c.

int cvmx_l2c_lock_mem_region ( uint64_t  start,
uint64_t  len 
)

Locks a specified memory region in the L2 cache.

Note that if not all lines can be locked, that means that all but one of the ways (associations) available to the locking core are locked. Having only 1 association available for normal caching may have a significant adverse affect on performance. Care should be taken to ensure that enough of the L2 cache is left unlocked to allow for normal caching of DRAM.

: Physical address of the start of the region to lock : Length (in bytes) of region to lock

Returns Number of requested lines that where not locked. 0 on success (all locked)

Definition at line 407 of file cvmx-l2c.c.

uint64_t cvmx_l2c_read_perf ( uint32_t  counter)

Read the given L2 Cache performance counter. The counter must be configured before reading, but this routine does not enforce this requirement.

: The counter to configure. Range 0..3.

Returns The current counter value.

Definition at line 232 of file cvmx-l2c.c.

int cvmx_l2c_set_core_way_partition ( uint32_t  core,
uint32_t  mask 
)

Partitions the L2 cache for a core

: The core that the partitioning applies to. : The partitioning of the ways expressed as a binary mask. A 0 bit allows the core to evict cache lines from a way, while a 1 bit blocks the core from evicting any lines from that way. There must be at least one allowed way (0 bit) in the mask.

Note
If any ways are blocked for all cores and the HW blocks, then those ways will never have any cache lines evicted from them. All cores and the hardware blocks are free to read from all ways regardless of the partitioning.

Definition at line 83 of file cvmx-l2c.c.

int cvmx_l2c_set_hw_way_partition ( uint32_t  mask)

Partitions the L2 cache for the hardware blocks.

: The partitioning of the ways expressed as a binary mask. A 0 bit allows the core to evict cache lines from a way, while a 1 bit blocks the core from evicting any lines from that way. There must be at least one allowed way (0 bit) in the mask.

Note
If any ways are blocked for all cores and the HW blocks, then those ways will never have any cache lines evicted from them. All cores and the hardware blocks are free to read from all ways regardless of the partitioning.

Definition at line 141 of file cvmx-l2c.c.

int cvmx_l2c_unlock_line ( uint64_t  address)

Unlock and flush a cache line from the L2 cache. IMPORTANT: Must only be run by one core at a time due to use of L2C debug features. Note that this function will flush a matching but unlocked cache line. (If address is not in L2, no lines are flushed.)

: Physical address to unlock

Returns 0: line not unlocked 1: line unlocked

Definition at line 452 of file cvmx-l2c.c.

int cvmx_l2c_unlock_mem_region ( uint64_t  start,
uint64_t  len 
)

Unlocks a region of memory that is locked in the L2 cache

: start physical address : length (in bytes) to unlock

Returns Number of locked lines that the call unlocked

Definition at line 498 of file cvmx-l2c.c.

Variable Documentation

cvmx_spinlock_t cvmx_l2c_spinlock

Definition at line 46 of file cvmx-l2c.c.