forked from Mirrors/opensbi
lib: sbi_tlb: Fix remote TLB HFENCE VVMA implementation
The HFENCE VVMA instructions flushes TLB based on the VMID present in HGATP CSR. To handle this, we get the current VMID for SBI HFENCE VVMA call and we use this current VMID to do remote TLB HFENCE VVMA on desired set of HARTs. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -46,6 +46,7 @@ static int sbi_ecall_rfence_handler(unsigned long extid, unsigned long funcid,
|
||||
struct sbi_trap_info *out_trap)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long vmid;
|
||||
struct sbi_tlb_info tlb_info;
|
||||
u32 source_hart = current_hartid();
|
||||
|
||||
@@ -56,37 +57,41 @@ static int sbi_ecall_rfence_handler(unsigned long extid, unsigned long funcid,
|
||||
|
||||
switch (funcid) {
|
||||
case SBI_EXT_RFENCE_REMOTE_FENCE_I:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0,
|
||||
SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, 0,
|
||||
SBI_ITLB_FLUSH, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0,
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, 0,
|
||||
SBI_TLB_FLUSH_GVMA, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4],
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, args[4],
|
||||
SBI_TLB_FLUSH_GVMA_VMID, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0,
|
||||
vmid = (csr_read(CSR_HGATP) & HGATP_VMID_MASK);
|
||||
vmid = vmid >> HGATP_VMID_SHIFT;
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, vmid,
|
||||
SBI_TLB_FLUSH_VVMA, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4],
|
||||
vmid = (csr_read(CSR_HGATP) & HGATP_VMID_MASK);
|
||||
vmid = vmid >> HGATP_VMID_SHIFT;
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4], vmid,
|
||||
SBI_TLB_FLUSH_VVMA_ASID, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0,
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, 0,
|
||||
SBI_TLB_FLUSH_VMA, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4],
|
||||
SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4], 0,
|
||||
SBI_TLB_FLUSH_VMA_ASID, source_hart);
|
||||
ret = sbi_tlb_request(args[0], args[1], &tlb_info);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user