diff options
-rw-r--r-- | include/sbi/sbi_scratch.h | 1 | ||||
-rw-r--r-- | include/sbi/sbi_tlb.h | 7 | ||||
-rw-r--r-- | lib/sbi/sbi_ecall.c | 53 | ||||
-rw-r--r-- | lib/sbi/sbi_tlb.c | 8 |
4 files changed, 33 insertions, 36 deletions
diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h index 2e6fd5a..d70c80d 100644 --- a/include/sbi/sbi_scratch.h +++ b/include/sbi/sbi_scratch.h @@ -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 { diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h index 83f9458..38a9418 100644 --- a/include/sbi/sbi_tlb.h +++ b/include/sbi/sbi_tlb.h @@ -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 diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c index 6bf33ad..29df26b 100644 --- a/lib/sbi/sbi_ecall.c +++ b/lib/sbi/sbi_ecall.c @@ -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,19 +197,16 @@ 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, - &tlb_info); + ret = sbi_tlb_fifo_request(scratch, args[0], args[1], + &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA: tlb_info.start = (unsigned long)args[2]; 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,19 +214,16 @@ 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, - &tlb_info); + ret = sbi_tlb_fifo_request(scratch, args[0], args[1], + &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA: tlb_info.start = (unsigned long)args[2]; 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,10 +231,8 @@ 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, - &tlb_info); + ret = sbi_tlb_fifo_request(scratch, args[0], args[1], + &tlb_info); break; default: @@ -291,9 +282,8 @@ 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, - &tlb_info); + ret = sbi_tlb_fifo_request(scratch, hmask, 0, + &tlb_info); break; case SBI_EXT_0_1_REMOTE_SFENCE_VMA: tlb_info.start = (unsigned long)args[1]; @@ -303,9 +293,8 @@ 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, - &tlb_info); + ret = sbi_tlb_fifo_request(scratch, hmask, 0, + &tlb_info); break; case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID: tlb_info.start = (unsigned long)args[1]; @@ -313,13 +302,11 @@ 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, - &tlb_info); + ret = sbi_tlb_fifo_request(scratch, hmask, 0, + &tlb_info); break; case SBI_EXT_0_1_SHUTDOWN: sbi_system_shutdown(scratch, 0); diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c index d821516..c07f4a4 100644 --- a/lib/sbi/sbi_tlb.c +++ b/lib/sbi/sbi_tlb.c @@ -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; |