提交 836d6798 编写于 作者: H He Sheng 提交者: guzitao

sw64: rename TLB invalidate helpers

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I56OLG

--------------------------------

Rename these helpers and their usages according to SW64 architecture
manuals.
Signed-off-by: NHe Sheng <hesheng@wxiat.com>
Signed-off-by: NGu Zitao <guzitao@wxiat.com>
上级 fca6b4ee
...@@ -193,12 +193,28 @@ __CALL_HMC_RW2(cpuid, unsigned long, unsigned long, unsigned long); ...@@ -193,12 +193,28 @@ __CALL_HMC_RW2(cpuid, unsigned long, unsigned long, unsigned long);
}) })
#define tbi(x, y) __tbi(x, __r17 = (y), "1" (__r17)) #define tbi(x, y) __tbi(x, __r17 = (y), "1" (__r17))
#define tbisi(x) __tbi(1, __r17 = (x), "1" (__r17))
#define tbisd(x) __tbi(2, __r17 = (x), "1" (__r17)) /* Invalidate all TLB, only used by hypervisor */
#define tbis(x) __tbi(3, __r17 = (x), "1" (__r17))
#define tbiap() __tbi(-1, /* no second argument */)
#define tbia() __tbi(-2, /* no second argument */) #define tbia() __tbi(-2, /* no second argument */)
/* Invalidate TLB for all processes with currnet VPN */
#define tbivp() __tbi(-1, /* no second argument */)
/* Invalidate all TLB with current VPN */
#define tbiv() __tbi(0, /* no second argument */)
/* Invalidate ITLB of addr with current UPN and VPN */
#define tbisi(addr) __tbi(1, __r17 = (addr), "1" (__r17))
/* Invalidate DTLB of addr with current UPN and VPN */
#define tbisd(addr) __tbi(2, __r17 = (addr), "1" (__r17))
/* Invalidate TLB of addr with current UPN and VPN */
#define tbis(addr) __tbi(3, __r17 = (addr), "1" (__r17))
/* Invalidate all user TLB with current UPN and VPN */
#define tbiu() __tbi(4, /* no second argument */)
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -72,7 +72,7 @@ __reload_thread(struct pcb_struct *pcb) ...@@ -72,7 +72,7 @@ __reload_thread(struct pcb_struct *pcb)
* need to do "p->mm->context = 0". * need to do "p->mm->context = 0".
* *
* If we need more ASN's than the processor has, we invalidate the old * If we need more ASN's than the processor has, we invalidate the old
* user TLB's (tbiap()) and start a new ASN version. That will automatically * user TLB's (tbivp()) and start a new ASN version. That will automatically
* force a new asn for any other processes the next time they want to * force a new asn for any other processes the next time they want to
* run. * run.
*/ */
...@@ -84,7 +84,7 @@ __get_new_mm_context(struct mm_struct *mm, long cpu) ...@@ -84,7 +84,7 @@ __get_new_mm_context(struct mm_struct *mm, long cpu)
unsigned long next = asn + 1; unsigned long next = asn + 1;
if ((asn & HARDWARE_ASN_MASK) >= HARDWARE_ASN_MASK) { if ((asn & HARDWARE_ASN_MASK) >= HARDWARE_ASN_MASK) {
tbiap(); tbivp();
next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION; next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION;
} }
cpu_last_asn(cpu) = next; cpu_last_asn(cpu) = next;
......
...@@ -28,11 +28,11 @@ static inline void flush_tlb_current_page(struct mm_struct *mm, ...@@ -28,11 +28,11 @@ static inline void flush_tlb_current_page(struct mm_struct *mm,
unsigned long addr) unsigned long addr)
{ {
if (vma->vm_flags & VM_EXEC) { if (vma->vm_flags & VM_EXEC) {
tbi(3, addr); tbis(addr);
if (icache_is_vivt_no_ictag()) if (icache_is_vivt_no_ictag())
imb(); imb();
} else } else
tbi(2, addr); tbisd(addr);
} }
...@@ -65,7 +65,7 @@ static inline void flush_tlb_other(struct mm_struct *mm) ...@@ -65,7 +65,7 @@ static inline void flush_tlb_other(struct mm_struct *mm)
*/ */
static inline void flush_tlb_all(void) static inline void flush_tlb_all(void)
{ {
tbia(); tbiv();
} }
/* Flush a specified user mapping. */ /* Flush a specified user mapping. */
......
...@@ -71,7 +71,7 @@ __smp_callin: ...@@ -71,7 +71,7 @@ __smp_callin:
br $27, 2f # we copy this from above "br $27 1f" br $27, 2f # we copy this from above "br $27 1f"
2: ldgp $29, 0($27) # First order of business, load the GP. 2: ldgp $29, 0($27) # First order of business, load the GP.
subl $31, 2, $16 bis $31, $31, $16 # invalidate all TLB with current VPN
sys_call HMC_tbi sys_call HMC_tbi
sys_call HMC_whami # Get hard cid sys_call HMC_whami # Get hard cid
......
...@@ -27,8 +27,7 @@ void restore_processor_state(void) ...@@ -27,8 +27,7 @@ void restore_processor_state(void)
wrpcbb(vcb->pcbb); wrpcbb(vcb->pcbb);
wrptbr(vcb->ptbr); wrptbr(vcb->ptbr);
sflush(); sflush();
tbia(); tbiv();
imb();
} }
int swsusp_arch_resume(void) int swsusp_arch_resume(void)
......
...@@ -204,9 +204,6 @@ void machine_kexec(struct kimage *image) ...@@ -204,9 +204,6 @@ void machine_kexec(struct kimage *image)
pr_info("Will call new kernel at %08lx\n", image->start); pr_info("Will call new kernel at %08lx\n", image->start);
pr_info("Bye ...\n"); pr_info("Bye ...\n");
//flush_cache_all();
//sflush();
//tbia();
smp_wmb(); smp_wmb();
((noretfun_t) reboot_code_buffer)(); ((noretfun_t) reboot_code_buffer)();
} }
...@@ -511,7 +511,7 @@ EXPORT_SYMBOL(smp_imb); ...@@ -511,7 +511,7 @@ EXPORT_SYMBOL(smp_imb);
static void ipi_flush_tlb_all(void *ignored) static void ipi_flush_tlb_all(void *ignored)
{ {
tbia(); tbiv();
} }
void flush_tlb_all(void) void flush_tlb_all(void)
......
...@@ -104,7 +104,7 @@ switch_to_system_map(void) ...@@ -104,7 +104,7 @@ switch_to_system_map(void)
init_thread_info.pcb.ptbr = newptbr; init_thread_info.pcb.ptbr = newptbr;
init_thread_info.pcb.flags = 1; /* set FEN, clear everything else */ init_thread_info.pcb.flags = 1; /* set FEN, clear everything else */
original_pcb_ptr = load_PCB(&init_thread_info.pcb); original_pcb_ptr = load_PCB(&init_thread_info.pcb);
tbia(); tbiv();
} }
void __init callback_init(void) void __init callback_init(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册