lib: Introduce sbi_tlb_fifo_request() API

Instead of directly calling sbi_ipi_send_many(), we introduce
sbi_tlb_fifo_request() for halting a set of HARTs.

This way in future we can assign any IPI event number for remote
FENCE within sbi_tlb.c only.

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 11:42:51 +05:30
committed by Anup Patel
parent da9b76b957
commit a8b4b83b7f
4 changed files with 33 additions and 36 deletions

View File

@@ -44,7 +44,6 @@
#ifndef __ASSEMBLY__
#include <sbi/sbi_types.h>
#include <sbi/sbi_ipi.h>
/** Representation of per-HART scratch space */
struct sbi_scratch {

View File

@@ -47,8 +47,11 @@ int sbi_tlb_fifo_update(struct sbi_scratch *scratch, u32 hartid, void *data);
void sbi_tlb_fifo_process(struct sbi_scratch *scratch);
int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot);
void sbi_tlb_fifo_sync(struct sbi_scratch *scratch);
int sbi_tlb_fifo_request(struct sbi_scratch *scratch, ulong hmask,
ulong hbase, struct sbi_tlb_info *tinfo);
int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot);
#endif

View File

@@ -180,17 +180,16 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.size = 0;
tlb_info.type = SBI_ITLB_FLUSH;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE, &tlb_info);
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
tlb_info.start = (unsigned long)args[2];
tlb_info.size = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_GVMA;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE, &tlb_info);
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
tlb_info.start = (unsigned long)args[2];
@@ -198,9 +197,7 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.asid = (unsigned long)args[4];
tlb_info.type = SBI_TLB_FLUSH_GVMA_VMID;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE,
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
@@ -208,9 +205,8 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.size = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_VVMA;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE, &tlb_info);
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
tlb_info.start = (unsigned long)args[2];
@@ -218,9 +214,7 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.asid = (unsigned long)args[4];
tlb_info.type = SBI_TLB_FLUSH_VVMA_ASID;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE,
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
@@ -228,9 +222,8 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.size = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_VMA;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE, &tlb_info);
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
tlb_info.start = (unsigned long)args[2];
@@ -238,9 +231,7 @@ int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, unsigned long funcid,
tlb_info.asid = (unsigned long)args[4];
tlb_info.type = SBI_TLB_FLUSH_VMA_ASID;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_ipi_send_many(scratch, args[0], args[1],
SBI_IPI_EVENT_FENCE,
ret = sbi_tlb_fifo_request(scratch, args[0], args[1],
&tlb_info);
break;
@@ -291,8 +282,7 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0],
&hmask, out_trap);
if (ret != SBI_ETRAP)
ret = sbi_ipi_send_many(scratch, hmask, 0,
SBI_IPI_EVENT_FENCE,
ret = sbi_tlb_fifo_request(scratch, hmask, 0,
&tlb_info);
break;
case SBI_EXT_0_1_REMOTE_SFENCE_VMA:
@@ -303,8 +293,7 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0],
&hmask, out_trap);
if (ret != SBI_ETRAP)
ret = sbi_ipi_send_many(scratch, hmask, 0,
SBI_IPI_EVENT_FENCE,
ret = sbi_tlb_fifo_request(scratch, hmask, 0,
&tlb_info);
break;
case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID:
@@ -313,12 +302,10 @@ int sbi_ecall_0_1_handler(struct sbi_scratch *scratch, unsigned long extid,
tlb_info.asid = (unsigned long)args[3];
tlb_info.type = SBI_TLB_FLUSH_VMA_ASID;
tlb_info.shart_mask = 1UL << source_hart;
ret = sbi_load_hart_mask_unpriv(scratch, (ulong *)args[0],
&hmask, out_trap);
if (ret != SBI_ETRAP)
ret = sbi_ipi_send_many(scratch, hmask, 0,
SBI_IPI_EVENT_FENCE,
ret = sbi_tlb_fifo_request(scratch, hmask, 0,
&tlb_info);
break;
case SBI_EXT_0_1_SHUTDOWN:

View File

@@ -14,6 +14,7 @@
#include <sbi/sbi_error.h>
#include <sbi/sbi_fifo.h>
#include <sbi/sbi_hart.h>
#include <sbi/sbi_ipi.h>
#include <sbi/sbi_scratch.h>
#include <sbi/sbi_tlb.h>
#include <sbi/sbi_hfence.h>
@@ -366,6 +367,13 @@ int sbi_tlb_fifo_update(struct sbi_scratch *rscratch, u32 hartid, void *data)
return 0;
}
int sbi_tlb_fifo_request(struct sbi_scratch *scratch, ulong hmask,
ulong hbase, struct sbi_tlb_info *tinfo)
{
return sbi_ipi_send_many(scratch, hmask, hbase,
SBI_IPI_EVENT_FENCE, tinfo);
}
int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot)
{
void *tlb_mem;