Skip to contentSkip to conversation

lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

PATCH New Anup Patel 4 participants 6 messages Oct 26, 2021 – Nov 2, 2021

lore
Share & tools
lore

Anup Patel

author
#0 lore raw

PATCH 1/1 lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4).

Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction.

This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions.

Fixes 331ff6a162c1 ("lib: Support stage1 and stage2 tlb flushing")
---
 include/sbi/sbi_hfence.h | 5 +++--
 lib/sbi/sbi_hfence.S     | 4 ++--
 lib/sbi/sbi_tlb.c        | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)
include/sbi/sbi_hfence.h +3 -2
index 4420f27..d3958f1 100644
@@ -12,13 +12,14 @@
 #define __SBI_FENCE_H__
 
 /** Invalidate Stage2 TLBs for given VMID and guest physical address */
-void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa, unsigned long vmid);
+void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa_divby_4,
+				unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given VMID */
 void __sbi_hfence_gvma_vmid(unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given guest physical address */
-void __sbi_hfence_gvma_gpa(unsigned long gpa);
+void __sbi_hfence_gvma_gpa(unsigned long gpa_divby_4);
 
 /** Invalidate all possible Stage2 TLBs */
 void __sbi_hfence_gvma_all(void);
lib/sbi/sbi_hfence.S +2 -2
index d05becb..e11e650 100644
@@ -27,7 +27,7 @@
 	.global __sbi_hfence_gvma_vmid_gpa
 __sbi_hfence_gvma_vmid_gpa:
 	/*
-	 * rs1 = a0 (GPA)
+	 * rs1 = a0 (GPA >> 2)
 	 * rs2 = a1 (VMID)
 	 * HFENCE.GVMA a0, a1
 	 * 0110001 01011 01010 000 00000 1110011
@@ -51,7 +51,7 @@ __sbi_hfence_gvma_vmid:
 	.global __sbi_hfence_gvma_gpa
 __sbi_hfence_gvma_gpa:
 	/*
-	 * rs1 = a0 (GPA)
+	 * rs1 = a0 (GPA >> 2)
 	 * rs2 = zero
 	 * HFENCE.GVMA a0
 	 * 0110001 00000 01010 000 00000 1110011
lib/sbi/sbi_tlb.c +2 -2
index efa74a7..4c142ea 100644
@@ -72,7 +72,7 @@ void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo)
 	}
 
 	for (i = 0; i < size; i += PAGE_SIZE) {
-		__sbi_hfence_gvma_gpa(start+i);
+		__sbi_hfence_gvma_gpa((start + i) >> 2);
 	}
 }
 
@@ -148,7 +148,7 @@ void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info *tinfo)
 	}
 
 	for (i = 0; i < size; i += PAGE_SIZE) {
-		__sbi_hfence_gvma_vmid_gpa(start + i, vmid);
+		__sbi_hfence_gvma_vmid_gpa((start + i) >> 2, vmid);
 	}
 }
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

? 2021-10-26???? 17:18 +0530?Anup Patel???

Quoted 10 lines

The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4).

Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction.

Quoted 6 lines

This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions.

Fixes 331ff6a162c1 ("lib: Support stage1 and stage2 tlb flushing")

We can keep the api unchanged and add a shift instruction in __sbi_hfence_gvma_vmid_gpa/__sbi_hfence_gvma_gpa

srli a0,a0,2

Regards,
Xiang W

Quoted 79 lines

---

?include/sbi/sbi_hfence.h | 5 +++--
?lib/sbi/sbi_hfence.S???? | 4 ++--
?lib/sbi/sbi_tlb.c??????? | 4 ++--

?3 files changed, 7 insertions(+), 6 deletions(-)

include/sbi/sbi_hfence.h +0 -0
index 4420f27..d3958f1 100644
@@ -12,13 +12,14 @@

?#define __SBI_FENCE_H__
?
?/** Invalidate Stage2 TLBs for given VMID and guest physical address */
-void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa, unsigned long vmid);
+void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa_divby_4, +???????????????????????????????unsigned long vmid);
?
?/** Invalidate Stage2 TLBs for given VMID */
?void __sbi_hfence_gvma_vmid(unsigned long vmid);
?
?/** Invalidate Stage2 TLBs for given guest physical address */

include/sbi/sbi_hfence.h +1 -1
-void __sbi_hfence_gvma_gpa(unsigned long gpa);
+void __sbi_hfence_gvma_gpa(unsigned long gpa_divby_4);

?
?/** Invalidate all possible Stage2 TLBs */
?void __sbi_hfence_gvma_all(void);

lib/sbi/sbi_hfence.S +0 -0
index d05becb..e11e650 100644
@@ -27,7 +27,7 @@

????????.global __sbi_hfence_gvma_vmid_gpa
?__sbi_hfence_gvma_vmid_gpa:
????????/*
-??????? * rs1 = a0 (GPA)
+??????? * rs1 = a0 (GPA >> 2)
???????? * rs2 = a1 (VMID)
???????? * HFENCE.GVMA a0, a1
???????? * 0110001 01011 01010 000 00000 1110011

lib/sbi/sbi_hfence.S +0 -0
@@ -51,7 +51,7 @@ __sbi_hfence_gvma_vmid:

????????.global __sbi_hfence_gvma_gpa
?__sbi_hfence_gvma_gpa:
????????/*
-??????? * rs1 = a0 (GPA)
+??????? * rs1 = a0 (GPA >> 2)
???????? * rs2 = zero
???????? * HFENCE.GVMA a0
???????? * 0110001 00000 01010 000 00000 1110011

lib/sbi/sbi_tlb.c +0 -0
index efa74a7..4c142ea 100644
@@ -72,7 +72,7 @@ void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info
 *tinfo)
 ????????}

?
????????for (i = 0; i < size; i += PAGE_SIZE) { -???????????????__sbi_hfence_gvma_gpa(start+i); +???????????????__sbi_hfence_gvma_gpa((start + i) >> 2); ????????}
?}
?

lib/sbi/sbi_tlb.c +0 -0
@@ -148,7 +148,7 @@ void sbi_tlb_local_hfence_gvma_vmid(struct
 sbi_tlb_info *tinfo)
 ????????}

?
????????for (i = 0; i < size; i += PAGE_SIZE) { -???????????????__sbi_hfence_gvma_vmid_gpa(start + i, vmid); +???????????????__sbi_hfence_gvma_vmid_gpa((start + i) >> 2, vmid); ????????}
?}
?

Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/1 lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

Quoted 12 lines · Xiang W

? 2021-10-26???? 17:18 +0530?Anup Patel???

Quoted 10 lines

The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4).

Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction.

Quoted 8 lines
Quoted 6 lines

This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions.

Fixes 331ff6a162c1 ("lib: Support stage1 and stage2 tlb flushing")

We can keep the api unchanged and add a shift instruction in __sbi_hfence_gvma_vmid_gpa/__sbi_hfence_gvma_gpa

That's not a good idea because __sbi_hfence_xyz() functions are substitute for missing H-extension support in GCC assembler.

In future these __sbi_hfence_xyz() will be replaced with inline assembly but we will have to specify minimum required GCC and LLVM versions for compiling OpenSBI.

Regards,
Anup

Quoted 86 lines

srli a0,a0,2

Regards,
Xiang W

Quoted 79 lines
---
 include/sbi/sbi_hfence.h | 5 +++--
 lib/sbi/sbi_hfence.S     | 4 ++--
 lib/sbi/sbi_tlb.c        | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)
include/sbi/sbi_hfence.h +3 -2
index 4420f27..d3958f1 100644
@@ -12,13 +12,14 @@
 #define __SBI_FENCE_H__
 
 /** Invalidate Stage2 TLBs for given VMID and guest physical address
 */
-void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa, unsigned long
 vmid);
+void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa_divby_4,
+                               unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given VMID */
 void __sbi_hfence_gvma_vmid(unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given guest physical address */
-void __sbi_hfence_gvma_gpa(unsigned long gpa);
+void __sbi_hfence_gvma_gpa(unsigned long gpa_divby_4);
 

/** Invalidate all possible Stage2 TLBs */
void __sbi_hfence_gvma_all(void);

lib/sbi/sbi_hfence.S +2 -2
index d05becb..e11e650 100644
@@ -27,7 +27,7 @@
        .global __sbi_hfence_gvma_vmid_gpa
 __sbi_hfence_gvma_vmid_gpa:
        /*
-        * rs1 = a0 (GPA)
+        * rs1 = a0 (GPA >> 2)
         * rs2 = a1 (VMID)
         * HFENCE.GVMA a0, a1
         * 0110001 01011 01010 000 00000 1110011
@@ -51,7 +51,7 @@ __sbi_hfence_gvma_vmid:
        .global __sbi_hfence_gvma_gpa
 __sbi_hfence_gvma_gpa:
        /*
-        * rs1 = a0 (GPA)
+        * rs1 = a0 (GPA >> 2)
         * rs2 = zero
         * HFENCE.GVMA a0
         * 0110001 00000 01010 000 00000 1110011
lib/sbi/sbi_tlb.c +2 -3
index efa74a7..4c142ea 100644
@@ -72,7 +72,7 @@ void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info
 *tinfo)
        }
 
        for (i = 0; i < size; i += PAGE_SIZE) {
-               __sbi_hfence_gvma_gpa(start+i);
+               __sbi_hfence_gvma_gpa((start + i) >> 2);
        }
 }
@@ -148,7 +148,7 @@ void sbi_tlb_local_hfence_gvma_vmid(struct
 sbi_tlb_info *tinfo)
        }
 
        for (i = 0; i < size; i += PAGE_SIZE) {
-               __sbi_hfence_gvma_vmid_gpa(start + i, vmid);
+               __sbi_hfence_gvma_vmid_gpa((start + i) >> 2, vmid);
        }
 }
 
--

2.25.1

#3 lore raw

PATCH 1/1 lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

? 2021-10-26???? 17:55 +0530?Anup Patel???

Quoted 23 lines · Xiang W
Quoted 15 lines

? 2021-10-26???? 17:18 +0530?Anup Patel???

Quoted 13 lines

The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4).

Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction.

This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions.

Quoted 6 lines
Quoted 4 lines
Fixes 331ff6a162c1 ("lib: Support stage1 and stage2 tlb

flushing")

We can keep the api unchanged and add a shift instruction in __sbi_hfence_gvma_vmid_gpa/__sbi_hfence_gvma_gpa

Quoted 6 lines

That's not a good idea because __sbi_hfence_xyz() functions are substitute for missing H-extension support in GCC assembler.

In future these __sbi_hfence_xyz() will be replaced with inline assembly but we will have to specify minimum required GCC and LLVM versions for compiling OpenSBI.

Thanks, very helpful explanation

Quoted 93 lines

Regards,
Anup

Quoted 89 lines

srli??? a0,a0,2

Regards,
Xiang W

Quoted 82 lines

---

?include/sbi/sbi_hfence.h | 5 +++--
?lib/sbi/sbi_hfence.S???? | 4 ++--
?lib/sbi/sbi_tlb.c??????? | 4 ++--

?3 files changed, 7 insertions(+), 6 deletions(-)

include/sbi/sbi_hfence.h +0 -0
index 4420f27..d3958f1 100644
@@ -12,13 +12,14 @@

?#define __SBI_FENCE_H__

?/** Invalidate Stage2 TLBs for given VMID and guest physical address
*/
-void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa, unsigned long vmid);
+void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa_divby_4, +?????????????????????????????? unsigned long vmid);

?/** Invalidate Stage2 TLBs for given VMID */
?void __sbi_hfence_gvma_vmid(unsigned long vmid);

?/** Invalidate Stage2 TLBs for given guest physical address */

include/sbi/sbi_hfence.h +1 -1
-void __sbi_hfence_gvma_gpa(unsigned long gpa);
+void __sbi_hfence_gvma_gpa(unsigned long gpa_divby_4);

?/** Invalidate all possible Stage2 TLBs */
?void __sbi_hfence_gvma_all(void);

lib/sbi/sbi_hfence.S +0 -0
index d05becb..e11e650 100644
@@ -27,7 +27,7 @@

??????? .global __sbi_hfence_gvma_vmid_gpa
?__sbi_hfence_gvma_vmid_gpa:
??????? /*
-??????? * rs1 = a0 (GPA)
+??????? * rs1 = a0 (GPA >> 2)
???????? * rs2 = a1 (VMID)
???????? * HFENCE.GVMA a0, a1
???????? * 0110001 01011 01010 000 00000 1110011

lib/sbi/sbi_hfence.S +0 -0
@@ -51,7 +51,7 @@ __sbi_hfence_gvma_vmid:

??????? .global __sbi_hfence_gvma_gpa
?__sbi_hfence_gvma_gpa:
??????? /*
-??????? * rs1 = a0 (GPA)
+??????? * rs1 = a0 (GPA >> 2)
???????? * rs2 = zero
???????? * HFENCE.GVMA a0
???????? * 0110001 00000 01010 000 00000 1110011

lib/sbi/sbi_tlb.c +0 -0
index efa74a7..4c142ea 100644
@@ -72,7 +72,7 @@ void sbi_tlb_local_hfence_gvma(struct

sbi_tlb_info
*tinfo)
??????? }

??????? for (i = 0; i < size; i += PAGE_SIZE) { -?????????????? __sbi_hfence_gvma_gpa(start+i); +?????????????? __sbi_hfence_gvma_gpa((start + i) >> 2); ??????? }
?}

lib/sbi/sbi_tlb.c +1 -1
@@ -148,7 +148,7 @@ void sbi_tlb_local_hfence_gvma_vmid(struct
 sbi_tlb_info *tinfo)
 ??????? }
 
 ??????? for (i = 0; i < size; i += PAGE_SIZE) {
-?????????????? __sbi_hfence_gvma_vmid_gpa(start + i, vmid);
+?????????????? __sbi_hfence_gvma_vmid_gpa((start + i) >> 2,
 vmid);
 ??????? }

?}

--
2.25.1

#4 lore raw

PATCH 1/1 lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

In reply to Anup Patel
Quoted 10 lines · anup patel anup.patel at wdc.com

The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4).

Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction.

Quoted 6 lines

This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions.

Fixes 331ff6a162c1 ("lib: Support stage1 and stage2 tlb flushing")

Looks good to me.

Quoted 80 lines

---

include/sbi/sbi_hfence.h | 5 +++--
lib/sbi/sbi_hfence.S     | 4 ++--
lib/sbi/sbi_tlb.c        | 4 ++--
3 files changed, 7 insertions(+), 6 deletions(-)
include/sbi/sbi_hfence.h +3 -2
index 4420f27..d3958f1 100644
@@ -12,13 +12,14 @@
 #define __SBI_FENCE_H__
 
 /** Invalidate Stage2 TLBs for given VMID and guest physical address */
-void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa, unsigned long vmid);
+void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa_divby_4,
+				unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given VMID */
 void __sbi_hfence_gvma_vmid(unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given guest physical address */
-void __sbi_hfence_gvma_gpa(unsigned long gpa);
+void __sbi_hfence_gvma_gpa(unsigned long gpa_divby_4);
 
 /** Invalidate all possible Stage2 TLBs */
 void __sbi_hfence_gvma_all(void);
lib/sbi/sbi_hfence.S +0 -0
index d05becb..e11e650 100644
@@ -27,7 +27,7 @@
 	.global __sbi_hfence_gvma_vmid_gpa

__sbi_hfence_gvma_vmid_gpa:

	/*
lib/sbi/sbi_hfence.S +1 -1
-	 * rs1 = a0 (GPA)
+	 * rs1 = a0 (GPA >> 2)

* rs2 = a1 (VMID)
* HFENCE.GVMA a0, a1
* 0110001 01011 01010 000 00000 1110011

lib/sbi/sbi_hfence.S +0 -0
@@ -51,7 +51,7 @@ __sbi_hfence_gvma_vmid:
 	.global __sbi_hfence_gvma_gpa

__sbi_hfence_gvma_gpa:

	/*
lib/sbi/sbi_hfence.S +1 -1
-	 * rs1 = a0 (GPA)
+	 * rs1 = a0 (GPA >> 2)

* rs2 = zero
* HFENCE.GVMA a0
* 0110001 00000 01010 000 00000 1110011

lib/sbi/sbi_tlb.c +2 -3
index efa74a7..4c142ea 100644
@@ -72,7 +72,7 @@ void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo)
 	}
 
 	for (i = 0; i < size; i += PAGE_SIZE) {
-		__sbi_hfence_gvma_gpa(start+i);
+		__sbi_hfence_gvma_gpa((start + i) >> 2);
 	}
 }
 
@@ -148,7 +148,7 @@ void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info
 *tinfo)
 	}
 
 	for (i = 0; i < size; i += PAGE_SIZE) {
-		__sbi_hfence_gvma_vmid_gpa(start + i, vmid);
+		__sbi_hfence_gvma_vmid_gpa((start + i) >> 2, vmid);
 	}
 }
 
--

2.25.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Applied
#5 lore raw

PATCH 1/1 lib: sbi: Fix GPA passed to __sbi_hfence_gvma_xyz() functions

Quoted 18 lines · Dong Du
Quoted 13 lines · anup patel anup.patel at wdc.com

The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4).

Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction.

This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions.

Quoted 7 lines
Quoted 3 lines
Fixes 331ff6a162c1 ("lib: Support stage1 and stage2 tlb flushing")

Looks good to me.

Applied this patch to the riscv/opensbi repo

Regards,
Anup

Quoted 81 lines
Quoted 81 lines

---

include/sbi/sbi_hfence.h | 5 +++--
lib/sbi/sbi_hfence.S     | 4 ++--
lib/sbi/sbi_tlb.c        | 4 ++--
3 files changed, 7 insertions(+), 6 deletions(-)
include/sbi/sbi_hfence.h +3 -2
index 4420f27..d3958f1 100644
@@ -12,13 +12,14 @@
 #define __SBI_FENCE_H__
 
 /** Invalidate Stage2 TLBs for given VMID and guest physical address */
-void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa, unsigned long vmid);
+void __sbi_hfence_gvma_vmid_gpa(unsigned long gpa_divby_4,
+                             unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given VMID */
 void __sbi_hfence_gvma_vmid(unsigned long vmid);
 
 /** Invalidate Stage2 TLBs for given guest physical address */
-void __sbi_hfence_gvma_gpa(unsigned long gpa);
+void __sbi_hfence_gvma_gpa(unsigned long gpa_divby_4);
 
 /** Invalidate all possible Stage2 TLBs */
 void __sbi_hfence_gvma_all(void);
lib/sbi/sbi_hfence.S +0 -0
index d05becb..e11e650 100644
@@ -27,7 +27,7 @@
      .global __sbi_hfence_gvma_vmid_gpa

__sbi_hfence_gvma_vmid_gpa:

      /*
lib/sbi/sbi_hfence.S +1 -1
-      * rs1 = a0 (GPA)
+      * rs1 = a0 (GPA >> 2)
       * rs2 = a1 (VMID)
       * HFENCE.GVMA a0, a1
       * 0110001 01011 01010 000 00000 1110011
@@ -51,7 +51,7 @@ __sbi_hfence_gvma_vmid:
      .global __sbi_hfence_gvma_gpa

__sbi_hfence_gvma_gpa:

      /*
lib/sbi/sbi_hfence.S +1 -1
-      * rs1 = a0 (GPA)
+      * rs1 = a0 (GPA >> 2)
       * rs2 = zero
       * HFENCE.GVMA a0
       * 0110001 00000 01010 000 00000 1110011
lib/sbi/sbi_tlb.c +2 -3
index efa74a7..4c142ea 100644
@@ -72,7 +72,7 @@ void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo)
      }
 
      for (i = 0; i < size; i += PAGE_SIZE) {
-             __sbi_hfence_gvma_gpa(start+i);
+             __sbi_hfence_gvma_gpa((start + i) >> 2);
      }
 }
 
@@ -148,7 +148,7 @@ void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info
 *tinfo)
      }
 
      for (i = 0; i < size; i += PAGE_SIZE) {
-             __sbi_hfence_gvma_vmid_gpa(start + i, vmid);
+             __sbi_hfence_gvma_vmid_gpa((start + i) >> 2, vmid);
      }
 }
 
--

2.25.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi