xtensa: mmu: Simplify autorefill TLB helpers
Replace all autorefill helpers with only one that invalidates both, DTLB and ITLB, since that is what is really needed. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
3620e6b969
commit
a1bb2b9c64
1 changed files with 14 additions and 101 deletions
|
@ -163,119 +163,32 @@ static ALWAYS_INLINE void xtensa_itlb_entry_write_sync(uint32_t pte, uint32_t en
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Invalidate all ITLB entries.
|
* @brief Invalidate all autorefill DTLB and ITLB entries.
|
||||||
*
|
*
|
||||||
* This should be used carefully since all entries in the instruction TLB
|
* This should be used carefully since all refill entries in the data
|
||||||
* will be erased and the only way to find lookup a physical address will be
|
* and instruction TLB. At least two pages, the current code page and
|
||||||
* through the page tables.
|
* the current stack, will be repopulated by this code as it returns.
|
||||||
*/
|
|
||||||
static inline void xtensa_itlb_invalidate_sync(void)
|
|
||||||
{
|
|
||||||
uint8_t way, i;
|
|
||||||
|
|
||||||
for (way = 0; way < Z_XTENSA_ITLB_WAYS; way++) {
|
|
||||||
for (i = 0; i < (1 << XCHAL_ITLB_ARF_ENTRIES_LOG2); i++) {
|
|
||||||
uint32_t entry = way + (i << Z_XTENSA_PPN_SHIFT);
|
|
||||||
|
|
||||||
xtensa_itlb_entry_invalidate(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__asm__ volatile("isync");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Invalidate all DTLB entries.
|
|
||||||
*
|
*
|
||||||
* This should be used carefully since all entries in the data TLB will be
|
* This needs to be called in any circumstance where the mappings for
|
||||||
* erased and the only way to find lookup a physical address will be through
|
* a previously-used page table change. It does not need to be called
|
||||||
* the page tables.
|
* on context switch, where ASID tagging isolates entries for us.
|
||||||
*/
|
*/
|
||||||
static inline void xtensa_dtlb_invalidate_sync(void)
|
static inline void xtensa_tlb_autorefill_invalidate(void)
|
||||||
{
|
{
|
||||||
uint8_t way, i;
|
uint8_t way, i, entries;
|
||||||
|
|
||||||
for (way = 0; way < Z_XTENSA_DTLB_WAYS; way++) {
|
entries = BIT(MAX(XCHAL_ITLB_ARF_ENTRIES_LOG2,
|
||||||
for (i = 0; i < (1 << XCHAL_DTLB_ARF_ENTRIES_LOG2); i++) {
|
XCHAL_DTLB_ARF_ENTRIES_LOG2));
|
||||||
uint32_t entry = way + (i << Z_XTENSA_PPN_SHIFT);
|
|
||||||
|
|
||||||
xtensa_dtlb_entry_invalidate(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__asm__ volatile("isync");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Invalidates an autorefill DTLB entry.
|
|
||||||
*
|
|
||||||
* Invalidates the page table enrty that maps a given virtual address.
|
|
||||||
*/
|
|
||||||
static inline void xtensa_dtlb_autorefill_invalidate_sync(void *vaddr)
|
|
||||||
{
|
|
||||||
uint8_t way;
|
|
||||||
|
|
||||||
for (way = 0; way < Z_XTENSA_TLB_AUTOREFILL_WAYS; way++) {
|
for (way = 0; way < Z_XTENSA_TLB_AUTOREFILL_WAYS; way++) {
|
||||||
xtensa_dtlb_entry_invalidate(Z_XTENSA_TLB_ENTRY((uint32_t)vaddr, way));
|
for (i = 0; i < entries; i++) {
|
||||||
}
|
|
||||||
__asm__ volatile("dsync");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Invalidates an autorefill ITLB entry.
|
|
||||||
*
|
|
||||||
* Invalidates the page table enrty that maps a given virtual address.
|
|
||||||
*/
|
|
||||||
static inline void xtensa_itlb_autorefill_invalidate_sync(void *vaddr)
|
|
||||||
{
|
|
||||||
uint8_t way;
|
|
||||||
|
|
||||||
for (way = 0; way < Z_XTENSA_TLB_AUTOREFILL_WAYS; way++) {
|
|
||||||
xtensa_itlb_entry_invalidate(Z_XTENSA_TLB_ENTRY((uint32_t)vaddr, way));
|
|
||||||
}
|
|
||||||
__asm__ volatile("isync");
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Invalidate all autorefill ITLB entries.
|
|
||||||
*
|
|
||||||
* This should be used carefully since all entries in the instruction TLB
|
|
||||||
* will be erased and the only way to find lookup a physical address will be
|
|
||||||
* through the page tables.
|
|
||||||
*/
|
|
||||||
static inline void xtensa_itlb_autorefill_invalidate_all_sync(void)
|
|
||||||
{
|
|
||||||
uint8_t way, i;
|
|
||||||
|
|
||||||
for (way = 0; way < Z_XTENSA_TLB_AUTOREFILL_WAYS; way++) {
|
|
||||||
for (i = 0; i < (1 << XCHAL_ITLB_ARF_ENTRIES_LOG2); i++) {
|
|
||||||
uint32_t entry = way + (i << Z_XTENSA_PPN_SHIFT);
|
uint32_t entry = way + (i << Z_XTENSA_PPN_SHIFT);
|
||||||
|
xtensa_dtlb_entry_invalidate_sync(entry);
|
||||||
xtensa_itlb_entry_invalidate(entry);
|
xtensa_itlb_entry_invalidate_sync(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__asm__ volatile("isync");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Invalidate all autorefill DTLB entries.
|
|
||||||
*
|
|
||||||
* This should be used carefully since all entries in the data TLB will be
|
|
||||||
* erased and the only way to find lookup a physical address will be through
|
|
||||||
* the page tables.
|
|
||||||
*/
|
|
||||||
static inline void xtensa_dtlb_autorefill_invalidate_all_sync(void)
|
|
||||||
{
|
|
||||||
uint8_t way, i;
|
|
||||||
|
|
||||||
for (way = 0; way < Z_XTENSA_TLB_AUTOREFILL_WAYS; way++) {
|
|
||||||
for (i = 0; i < (1 << XCHAL_DTLB_ARF_ENTRIES_LOG2); i++) {
|
|
||||||
uint32_t entry = way + (i << Z_XTENSA_PPN_SHIFT);
|
|
||||||
|
|
||||||
xtensa_dtlb_entry_invalidate(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__asm__ volatile("isync");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the page tables.
|
* @brief Set the page tables.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue