Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Virtual to Physical Addressing Mapping

64 views
Skip to first unread message

Aziz Haider

unread,
Oct 7, 2024, 7:02:23 AM10/7/24
to RISC-V SW Dev
Hi there, I am working on a project to boot Linux on a RISCV architecture based hardware emulator. I have the support of VA-to-PA mapping but sometimes linux gets stuck on random instructions inside _start_kernel function. 

The major problem I am facing is inside setup_vm_final fuction where MMU is on. The emulator gets stuck on SFENCE. Are there any RISCV VA to PA mapping tests or MMU tests that I can use to check my MMU.?

What are the options I would need to add to make linux up and running. My reference is cva6-sdk running on spike.

Tommy Murphy

unread,
Oct 7, 2024, 9:55:36 AM10/7/24
to Aziz Haider, RISC-V SW Dev
> Are there any RISCV VA to PA mapping tests or MMU tests that I can use to check my MMU.?

The riscv-tests test suite includes some virtual memory tests in case they are of any use?


> What are the options I would need to add to make linux up and running. My reference is cva6-sdk running on spike.

Doesn't that target already support Linux?

Tommy Murphy

unread,
Oct 9, 2024, 3:26:43 AM10/9/24
to Aziz Haider, RISC-V SW Dev, Aziz Haider
> Thank you for the response. I found the tests from riscv-tests that run on VA space. But my addressing starts from 0x800000000 and that is causing unexpected error for me. My translation for PA to VA is not set correctly. Can you help me out here like exactly how kernel is built and how it decides the VA space entry, etc.

Might be an idea to ask about this on the riscv-tests repo?


Aziz Haider

unread,
Oct 9, 2024, 7:56:20 AM10/9/24
to RISC-V SW Dev, tommy_...@hotmail.com, Aziz Haider
Can you guide me about this userstart that the we set in Virtual environment. This sets the sepc register causing system to go into " exception trap_instruction_page_fault, epc 0x0000000000001aa4". The very next instruction takes us into VA space. I am unable to understand this behaviour. 

Screenshot 2024-10-09 143718.png
This image is from riscv-tests/env/v/entry.S

We basically load userstart address into a0 and load sepc from a0. That sepc is 0x1aa4 and how does it change to 0x780001aa4 when I change the memory map to 0x800000000 instead of 0x80000000. The userstart I got from dump is this (coudln't find source file)
Screenshot 2024-10-09 144019.png

Aziz Haider

unread,
Oct 9, 2024, 7:56:25 AM10/9/24
to RISC-V SW Dev, tommy_...@hotmail.com, Aziz Haider
Thank you for the response. I found the tests from riscv-tests that run on VA space. But my addressing starts from 0x800000000 and that is causing unexpected error for me. My translation for PA to VA is not set correctly. Can you help me out here like exactly how kernel is built and how it decides the VA space entry, etc.

Reply all
Reply to author
Forward
0 new messages