riscv: Add macro for hfence.gvma instruction

Add an inline function hfence_gvma() for hfence.gvma instruction.

Signed-off-by:	Doongar Singh <doonbsd@gmail.com>
Reviewed by:	mhorne, markj
Differential Revision:	https://reviews.freebsd.org/D54857
This commit is contained in:
Doongar Singh
2026-01-26 12:18:22 -04:00
committed by Mitchell Horne
parent e769bc7718
commit 972c488bf4
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -119,6 +119,13 @@ sfence_vma_asid_page(uint64_t asid, uintptr_t addr)
: "memory");
}
static __inline void
hfence_gvma(void)
{
__asm __volatile("hfence.gvma" ::: "memory");
}
#define rdcycle() csr_read64(cycle)
#define rdtime() csr_read64(time)
#define rdinstret() csr_read64(instret)
+1 -1
View File
@@ -625,7 +625,7 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo)
* have been modified, it may be necessary to execute an HFENCE.GVMA
* instruction (see Section 5.3.2) before or after writing hgatp.
*/
__asm __volatile("hfence.gvma" ::: "memory");
hfence_gvma();
csr_write(hgatp, pmap->pm_satp);
if (has_sstc)