|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 2/5] xen/riscv: implement maddr_to_virt()
Implement the `maddr_to_virt()` function to convert a machine address
to a virtual address. This function is specifically designed to be used
only for the DIRECTMAP region, so a check has been added to ensure that
the address does not exceed `DIRECTMAP_SIZE`.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
xen/arch/riscv/include/asm/mm.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index ebb142502e..0396e66f47 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -25,8 +25,12 @@
static inline void *maddr_to_virt(paddr_t ma)
{
- BUG_ON("unimplemented");
- return NULL;
+ /* Offset in the direct map, accounting for pdx compression */
+ unsigned long va_offset = maddr_to_directmapoff(ma);
+
+ ASSERT(va_offset < DIRECTMAP_SIZE);
+
+ return (void *)(DIRECTMAP_VIRT_START + va_offset);
}
/*
--
2.47.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |