include: sbi_tlb: Remove scratch parameter from sbi_tlb_request()
authorAnup Patel <anup.patel@wdc.com>
Fri, 27 Mar 2020 05:28:47 +0000 (10:58 +0530)
committerAnup Patel <anup@brainfault.org>
Sat, 28 Mar 2020 08:02:44 +0000 (13:32 +0530)
The sbi_ipi_send_many() should get current HART scratch pointer
on it's own using eventually hence removing scratch parameter from
sbi_tlb_request().

Signed-off-by: Anup Patel <anup.patel@wdc.com>
include/sbi/sbi_tlb.h
lib/sbi/sbi_ecall_legacy.c
lib/sbi/sbi_ecall_replace.c
lib/sbi/sbi_tlb.c

index 67c3900..6a07ee2 100644 (file)
@@ -53,8 +53,7 @@ do { \
 
 #define SBI_TLB_INFO_SIZE              sizeof(struct sbi_tlb_info)
 
-int sbi_tlb_request(struct sbi_scratch *scratch, ulong hmask,
-                   ulong hbase, struct sbi_tlb_info *tinfo);
+int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo);
 
 int sbi_tlb_init(struct sbi_scratch *scratch, bool cold_boot);
 
index 95f612a..c16a611 100644 (file)
@@ -80,7 +80,7 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
                if (ret != SBI_ETRAP) {
                        SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0,
                                          SBI_ITLB_FLUSH, source_hart);
-                       ret = sbi_tlb_request(scratch, hmask, 0, &tlb_info);
+                       ret = sbi_tlb_request(hmask, 0, &tlb_info);
                }
                break;
        case SBI_EXT_0_1_REMOTE_SFENCE_VMA:
@@ -89,7 +89,7 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
                if (ret != SBI_ETRAP) {
                        SBI_TLB_INFO_INIT(&tlb_info, args[1], args[2], 0,
                                          SBI_TLB_FLUSH_VMA, source_hart);
-                       ret = sbi_tlb_request(scratch, hmask, 0, &tlb_info);
+                       ret = sbi_tlb_request(hmask, 0, &tlb_info);
                }
                break;
        case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID:
@@ -98,7 +98,7 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
                if (ret != SBI_ETRAP) {
                        SBI_TLB_INFO_INIT(&tlb_info, args[1], args[2], args[3],
                                          SBI_TLB_FLUSH_VMA_ASID, source_hart);
-                       ret = sbi_tlb_request(scratch, hmask, 0, &tlb_info);
+                       ret = sbi_tlb_request(hmask, 0, &tlb_info);
                }
                break;
        case SBI_EXT_0_1_SHUTDOWN:
index 36a5c5c..585b16c 100644 (file)
@@ -51,7 +51,6 @@ static int sbi_ecall_rfence_handler(unsigned long extid, unsigned long funcid,
        int ret = 0;
        struct sbi_tlb_info tlb_info;
        u32 source_hart = current_hartid();
-       struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
 
        if (funcid >= SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA &&
            funcid <= SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID)
@@ -62,37 +61,37 @@ static int sbi_ecall_rfence_handler(unsigned long extid, unsigned long funcid,
        case SBI_EXT_RFENCE_REMOTE_FENCE_I:
                SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0,
                                  SBI_ITLB_FLUSH, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               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_FLUSH_GVMA, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               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_FLUSH_GVMA_VMID, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               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,
                                  SBI_TLB_FLUSH_VVMA, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               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],
                                  SBI_TLB_FLUSH_VVMA_ASID, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               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_FLUSH_VMA, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               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_FLUSH_VMA_ASID, source_hart);
-               ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info);
+               ret = sbi_tlb_request(args[0], args[1], &tlb_info);
                break;
        default:
                ret = SBI_ENOTSUPP;
index 1b66fdf..64ec28b 100644 (file)
@@ -375,10 +375,10 @@ static struct sbi_ipi_event_ops tlb_ops = {
 
 static u32 tlb_event = SBI_IPI_EVENT_MAX;
 
-int sbi_tlb_request(struct sbi_scratch *scratch, ulong hmask,
-                   ulong hbase, struct sbi_tlb_info *tinfo)
+int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo)
 {
-       return sbi_ipi_send_many(scratch, hmask, hbase, tlb_event, tinfo);
+       return sbi_ipi_send_many(sbi_scratch_thishart_ptr(),
+                                hmask, hbase, tlb_event, tinfo);
 }
 
 int sbi_tlb_init(struct sbi_scratch *scratch, bool cold_boot)