lib: Drop _fifo from the name of various sbi_tlb_fifo_xyz() functions

This patch drops _fifo from the name of various sbi_tlb_fifo_xyz()
functions because all these functions deal with remote TLB managment
and FIFO is the per-HART data structure used internally by remote
TLB implementation.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Anup Patel
2020-01-15 13:21:47 +05:30
committed by Anup Patel
parent 5f762d14f0
commit 817d50d0d4
4 changed files with 46 additions and 56 deletions

View File

@@ -43,9 +43,9 @@ struct sbi_tlb_info {
#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info) #define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
int sbi_tlb_fifo_request(struct sbi_scratch *scratch, ulong hmask, int sbi_tlb_request(struct sbi_scratch *scratch, ulong hmask,
ulong hbase, struct sbi_tlb_info *tinfo); ulong hbase, struct sbi_tlb_info *tinfo);
int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot); int sbi_tlb_init(struct sbi_scratch *scratch, bool cold_boot);
#endif #endif

View File

@@ -180,16 +180,14 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.size = 0; tlb_info.size = 0;
tlb_info.type = SBI_ITLB_FLUSH; tlb_info.type = SBI_ITLB_FLUSH;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA: case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
tlb_info.start = (unsigned long)args[2]; tlb_info.start = (unsigned long)args[2];
tlb_info.size = (unsigned long)args[3]; tlb_info.size = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_GVMA; tlb_info.type = SBI_TLB_FLUSH_GVMA;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID: case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
tlb_info.start = (unsigned long)args[2]; tlb_info.start = (unsigned long)args[2];
@@ -197,16 +195,14 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.asid = (unsigned long)args[4]; tlb_info.asid = (unsigned long)args[4];
tlb_info.type = SBI_TLB_FLUSH_GVMA_VMID; tlb_info.type = SBI_TLB_FLUSH_GVMA_VMID;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA: case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
tlb_info.start = (unsigned long)args[2]; tlb_info.start = (unsigned long)args[2];
tlb_info.size = (unsigned long)args[3]; tlb_info.size = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_VVMA; tlb_info.type = SBI_TLB_FLUSH_VVMA;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID: case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
tlb_info.start = (unsigned long)args[2]; tlb_info.start = (unsigned long)args[2];
@@ -214,16 +210,14 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.asid = (unsigned long)args[4]; tlb_info.asid = (unsigned long)args[4];
tlb_info.type = SBI_TLB_FLUSH_VVMA_ASID; tlb_info.type = SBI_TLB_FLUSH_VVMA_ASID;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA: case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
tlb_info.start = (unsigned long)args[2]; tlb_info.start = (unsigned long)args[2];
tlb_info.size = (unsigned long)args[3]; tlb_info.size = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_VMA; tlb_info.type = SBI_TLB_FLUSH_VMA;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID: case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
tlb_info.start = (unsigned long)args[2]; tlb_info.start = (unsigned long)args[2];
@@ -231,8 +225,7 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.asid = (unsigned long)args[4]; tlb_info.asid = (unsigned long)args[4];
tlb_info.type = SBI_TLB_FLUSH_VMA_ASID; tlb_info.type = SBI_TLB_FLUSH_VMA_ASID;
tlb_info.shart_mask = 1UL << source_hart; tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_tlb_fifo_request(scratch, args[0], args[1], ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
&tlb_info);
break; break;
default: default:
@@ -282,8 +275,7 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0], ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0],
&hmask, out_trap); &hmask, out_trap);
if (ret != SBI_ETRAP) if (ret != SBI_ETRAP)
ret = sbi_tlb_fifo_request(scratch, hmask, 0, ret = sbi_tlb_request(scratch, hmask, 0, &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_0_1_REMOTE_SFENCE_VMA: case SBI_EXT_0_1_REMOTE_SFENCE_VMA:
tlb_info.start = (unsigned long)args[1]; tlb_info.start = (unsigned long)args[1];
@@ -293,8 +285,7 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0], ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0],
&hmask, out_trap); &hmask, out_trap);
if (ret != SBI_ETRAP) if (ret != SBI_ETRAP)
ret = sbi_tlb_fifo_request(scratch, hmask, 0, ret = sbi_tlb_request(scratch, hmask, 0, &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID: case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID:
tlb_info.start = (unsigned long)args[1]; tlb_info.start = (unsigned long)args[1];
@@ -305,8 +296,7 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0], ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0],
&hmask, out_trap); &hmask, out_trap);
if (ret != SBI_ETRAP) if (ret != SBI_ETRAP)
ret = sbi_tlb_fifo_request(scratch, hmask, 0, ret = sbi_tlb_request(scratch, hmask, 0, &tlb_info);
&tlb_info);
break; break;
case SBI_EXT_0_1_SHUTDOWN: case SBI_EXT_0_1_SHUTDOWN:
sbi_system_shutdown(scratch, 0); sbi_system_shutdown(scratch, 0);

View File

@@ -232,7 +232,7 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot)
ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off);
ipi_data->ipi_type = 0x00; ipi_data->ipi_type = 0x00;
ret = sbi_tlb_fifo_init(scratch, cold_boot); ret = sbi_tlb_init(scratch, cold_boot);
if (ret) if (ret)
return ret; return ret;

View File

@@ -32,7 +32,7 @@ static void sbi_tlb_flush_all(void)
__asm__ __volatile("sfence.vma"); __asm__ __volatile("sfence.vma");
} }
static void sbi_tlb_fifo_hfence_vvma(struct sbi_tlb_info *tinfo) static void sbi_tlb_hfence_vvma(struct sbi_tlb_info *tinfo)
{ {
unsigned long start = tinfo->start; unsigned long start = tinfo->start;
unsigned long size = tinfo->size; unsigned long size = tinfo->size;
@@ -48,7 +48,7 @@ static void sbi_tlb_fifo_hfence_vvma(struct sbi_tlb_info *tinfo)
} }
} }
static void sbi_tlb_fifo_hfence_gvma(struct sbi_tlb_info *tinfo) static void sbi_tlb_hfence_gvma(struct sbi_tlb_info *tinfo)
{ {
unsigned long start = tinfo->start; unsigned long start = tinfo->start;
unsigned long size = tinfo->size; unsigned long size = tinfo->size;
@@ -64,7 +64,7 @@ static void sbi_tlb_fifo_hfence_gvma(struct sbi_tlb_info *tinfo)
} }
} }
static void sbi_tlb_fifo_sfence_vma(struct sbi_tlb_info *tinfo) static void sbi_tlb_sfence_vma(struct sbi_tlb_info *tinfo)
{ {
unsigned long start = tinfo->start; unsigned long start = tinfo->start;
unsigned long size = tinfo->size; unsigned long size = tinfo->size;
@@ -83,7 +83,7 @@ static void sbi_tlb_fifo_sfence_vma(struct sbi_tlb_info *tinfo)
} }
} }
static void sbi_tlb_fifo_hfence_vvma_asid(struct sbi_tlb_info *tinfo) static void sbi_tlb_hfence_vvma_asid(struct sbi_tlb_info *tinfo)
{ {
unsigned long start = tinfo->start; unsigned long start = tinfo->start;
unsigned long size = tinfo->size; unsigned long size = tinfo->size;
@@ -105,7 +105,7 @@ static void sbi_tlb_fifo_hfence_vvma_asid(struct sbi_tlb_info *tinfo)
} }
} }
static void sbi_tlb_fifo_hfence_gvma_vmid(struct sbi_tlb_info *tinfo) static void sbi_tlb_hfence_gvma_vmid(struct sbi_tlb_info *tinfo)
{ {
unsigned long start = tinfo->start; unsigned long start = tinfo->start;
unsigned long size = tinfo->size; unsigned long size = tinfo->size;
@@ -127,7 +127,7 @@ static void sbi_tlb_fifo_hfence_gvma_vmid(struct sbi_tlb_info *tinfo)
} }
} }
static void sbi_tlb_fifo_sfence_vma_asid(struct sbi_tlb_info *tinfo) static void sbi_tlb_sfence_vma_asid(struct sbi_tlb_info *tinfo)
{ {
unsigned long start = tinfo->start; unsigned long start = tinfo->start;
unsigned long size = tinfo->size; unsigned long size = tinfo->size;
@@ -160,22 +160,22 @@ static void sbi_tlb_local_flush(struct sbi_tlb_info *tinfo)
{ {
switch (tinfo->type) { switch (tinfo->type) {
case SBI_TLB_FLUSH_VMA: case SBI_TLB_FLUSH_VMA:
sbi_tlb_fifo_sfence_vma(tinfo); sbi_tlb_sfence_vma(tinfo);
break; break;
case SBI_TLB_FLUSH_VMA_ASID: case SBI_TLB_FLUSH_VMA_ASID:
sbi_tlb_fifo_sfence_vma_asid(tinfo); sbi_tlb_sfence_vma_asid(tinfo);
break; break;
case SBI_TLB_FLUSH_GVMA: case SBI_TLB_FLUSH_GVMA:
sbi_tlb_fifo_hfence_gvma(tinfo); sbi_tlb_hfence_gvma(tinfo);
break; break;
case SBI_TLB_FLUSH_GVMA_VMID: case SBI_TLB_FLUSH_GVMA_VMID:
sbi_tlb_fifo_hfence_gvma_vmid(tinfo); sbi_tlb_hfence_gvma_vmid(tinfo);
break; break;
case SBI_TLB_FLUSH_VVMA: case SBI_TLB_FLUSH_VVMA:
sbi_tlb_fifo_hfence_vvma(tinfo); sbi_tlb_hfence_vvma(tinfo);
break; break;
case SBI_TLB_FLUSH_VVMA_ASID: case SBI_TLB_FLUSH_VVMA_ASID:
sbi_tlb_fifo_hfence_vvma_asid(tinfo); sbi_tlb_hfence_vvma_asid(tinfo);
break; break;
case SBI_ITLB_FLUSH: case SBI_ITLB_FLUSH:
__asm__ __volatile("fence.i"); __asm__ __volatile("fence.i");
@@ -206,7 +206,7 @@ static void sbi_tlb_entry_process(struct sbi_scratch *scratch,
} }
} }
static void sbi_tlb_fifo_process_count(struct sbi_scratch *scratch, int count) static void sbi_tlb_process_count(struct sbi_scratch *scratch, int count)
{ {
struct sbi_tlb_info tinfo; struct sbi_tlb_info tinfo;
u32 deq_count = 0; u32 deq_count = 0;
@@ -222,7 +222,7 @@ static void sbi_tlb_fifo_process_count(struct sbi_scratch *scratch, int count)
} }
} }
static void sbi_tlb_fifo_process(struct sbi_scratch *scratch) static void sbi_tlb_process(struct sbi_scratch *scratch)
{ {
struct sbi_tlb_info tinfo; struct sbi_tlb_info tinfo;
struct sbi_fifo *tlb_fifo = struct sbi_fifo *tlb_fifo =
@@ -232,7 +232,7 @@ static void sbi_tlb_fifo_process(struct sbi_scratch *scratch)
sbi_tlb_entry_process(scratch, &tinfo); sbi_tlb_entry_process(scratch, &tinfo);
} }
static void sbi_tlb_fifo_sync(struct sbi_scratch *scratch) static void sbi_tlb_sync(struct sbi_scratch *scratch)
{ {
unsigned long *tlb_sync = unsigned long *tlb_sync =
sbi_scratch_offset_ptr(scratch, tlb_sync_off); sbi_scratch_offset_ptr(scratch, tlb_sync_off);
@@ -242,14 +242,14 @@ static void sbi_tlb_fifo_sync(struct sbi_scratch *scratch)
* While we are waiting for remote hart to set the sync, * While we are waiting for remote hart to set the sync,
* consume fifo requests to avoid deadlock. * consume fifo requests to avoid deadlock.
*/ */
sbi_tlb_fifo_process_count(scratch, 1); sbi_tlb_process_count(scratch, 1);
} }
return; return;
} }
static inline int __sbi_tlb_fifo_range_check(struct sbi_tlb_info *curr, static inline int __sbi_tlb_range_check(struct sbi_tlb_info *curr,
struct sbi_tlb_info *next) struct sbi_tlb_info *next)
{ {
unsigned long curr_end; unsigned long curr_end;
unsigned long next_end; unsigned long next_end;
@@ -291,7 +291,7 @@ static inline int __sbi_tlb_fifo_range_check(struct sbi_tlb_info *curr,
* before continuing the while loop. This method is preferred over wfi/ipi because * before continuing the while loop. This method is preferred over wfi/ipi because
* of MMIO cost involved in later method. * of MMIO cost involved in later method.
*/ */
static int sbi_tlb_fifo_update_cb(void *in, void *data) static int sbi_tlb_update_cb(void *in, void *data)
{ {
struct sbi_tlb_info *curr; struct sbi_tlb_info *curr;
struct sbi_tlb_info *next; struct sbi_tlb_info *next;
@@ -306,18 +306,18 @@ static int sbi_tlb_fifo_update_cb(void *in, void *data)
if (next->type == SBI_TLB_FLUSH_VMA_ASID && if (next->type == SBI_TLB_FLUSH_VMA_ASID &&
curr->type == SBI_TLB_FLUSH_VMA_ASID) { curr->type == SBI_TLB_FLUSH_VMA_ASID) {
if (next->asid == curr->asid) if (next->asid == curr->asid)
ret = __sbi_tlb_fifo_range_check(curr, next); ret = __sbi_tlb_range_check(curr, next);
} else if (next->type == SBI_TLB_FLUSH_VMA && } else if (next->type == SBI_TLB_FLUSH_VMA &&
curr->type == SBI_TLB_FLUSH_VMA) { curr->type == SBI_TLB_FLUSH_VMA) {
ret = __sbi_tlb_fifo_range_check(curr, next); ret = __sbi_tlb_range_check(curr, next);
} }
return ret; return ret;
} }
static int sbi_tlb_fifo_update(struct sbi_scratch *scratch, static int sbi_tlb_update(struct sbi_scratch *scratch,
struct sbi_scratch *remote_scratch, struct sbi_scratch *remote_scratch,
u32 remote_hartid, void *data) u32 remote_hartid, void *data)
{ {
int ret; int ret;
struct sbi_fifo *tlb_fifo_r; struct sbi_fifo *tlb_fifo_r;
@@ -345,7 +345,7 @@ static int sbi_tlb_fifo_update(struct sbi_scratch *scratch,
tlb_fifo_r = sbi_scratch_offset_ptr(remote_scratch, tlb_fifo_off); tlb_fifo_r = sbi_scratch_offset_ptr(remote_scratch, tlb_fifo_off);
ret = sbi_fifo_inplace_update(tlb_fifo_r, data, sbi_tlb_fifo_update_cb); ret = sbi_fifo_inplace_update(tlb_fifo_r, data, sbi_tlb_update_cb);
if (ret != SBI_FIFO_UNCHANGED) { if (ret != SBI_FIFO_UNCHANGED) {
return 1; return 1;
} }
@@ -359,7 +359,7 @@ static int sbi_tlb_fifo_update(struct sbi_scratch *scratch,
* TODO: Introduce a wait/wakeup event mechanism to handle * TODO: Introduce a wait/wakeup event mechanism to handle
* this properly. * this properly.
*/ */
sbi_tlb_fifo_process_count(scratch, 1); sbi_tlb_process_count(scratch, 1);
sbi_dprintf(remote_scratch, "hart%d: hart%d tlb fifo full\n", sbi_dprintf(remote_scratch, "hart%d: hart%d tlb fifo full\n",
curr_hartid, remote_hartid); curr_hartid, remote_hartid);
} }
@@ -369,20 +369,20 @@ static int sbi_tlb_fifo_update(struct sbi_scratch *scratch,
static struct sbi_ipi_event_ops tlb_ops = { static struct sbi_ipi_event_ops tlb_ops = {
.name = "IPI_TLB", .name = "IPI_TLB",
.update = sbi_tlb_fifo_update, .update = sbi_tlb_update,
.sync = sbi_tlb_fifo_sync, .sync = sbi_tlb_sync,
.process = sbi_tlb_fifo_process, .process = sbi_tlb_process,
}; };
static u32 tlb_event = SBI_IPI_EVENT_MAX; static u32 tlb_event = SBI_IPI_EVENT_MAX;
int sbi_tlb_fifo_request(struct sbi_scratch *scratch, ulong hmask, int sbi_tlb_request(struct sbi_scratch *scratch, ulong hmask,
ulong hbase, struct sbi_tlb_info *tinfo) ulong hbase, struct sbi_tlb_info *tinfo)
{ {
return sbi_ipi_send_many(scratch, hmask, hbase, tlb_event, tinfo); return sbi_ipi_send_many(scratch, hmask, hbase, tlb_event, tinfo);
} }
int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot) int sbi_tlb_init(struct sbi_scratch *scratch, bool cold_boot)
{ {
int ret; int ret;
void *tlb_mem; void *tlb_mem;