-
Notifications
You must be signed in to change notification settings - Fork 9
L1, L2 cache enable in the Interrupt example #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
how you started gem5 on the command line? |
As in your documentation, ./build/ARM/gem5.opt ./configs/example/fs.py and also tried with adding the Interrupt example runs fine, but when I stop it and look at gem5/m5out/stats.txt, |
Hi, As I fell to the same issue, it turns out that in order to be able to have cacheable accesses you need to do a proper set up of the system. Boot.s :
|
Can you create a proper example and open a Pull request for it? I would highly appreciate! |
Hi, I know it is very late response, but just wanted to add the following: I think the given example has an error (I think the error is in the ARM documentation as well). It says: So the correct code (given the comment on the code) should be: Perhaps I misread the documentation, but both armv7 and armv8 documentation is quite clear about this and the most used configuration would be "Normal memory, Inner Write-Back Write-Allocate Cacheable." . I'm not entirely sure how this setting is used though. Since I would expect that the MMU only reads L1/L2 tables I guess it doesn't matter if you use "Write-Through, no Write-Allocate", since there is simply no write coming from MMU? But then why would there be no bit cacheable/non-cacheable? Or does this give info on how reads are to be performed? If somebody could explain how this configuration (TTBR0) is used then this would be greatly appreciated. |
It could be that your right. Can you test it and open a PR? |
The code provided for enabling the cache results in the following error. Any suggestions on how to troubleshoot and resolve this issue? Command: build/ARM/gem5.opt configs/example/fs.py --bare-metal --kernel=/home/kashishm/gem5_backup/gem5.bare-metal/Simple/main.elf --machine-type=VExpress_GEM5_V1 --cpu-type=MinorCPU --caches --l1d_size=32kB --l1i_size=32kB Error: gem5.opt: build/ARM/dev/arm/pl011.cc:70: virtual gem5::Tick gem5::Pl011::read(gem5::PacketPtr): Assertion `pkt->getSize() <= 4' failed. |
You probably need mark the IO region of gem5 as non-cacheable memory. Marking the lower 2GiB of the address space as non-cacheable device memory region should fix the issue. |
@derchr |
You could use this as a baseline:
Make sure to properly designate the DRAM area in the linker script:
And place the desired sections either into the bootmem or the DRAM: This would only be an example. The concrete address values probably depend on your system configuration. For that, I would highly recommend the previously cited resource and also this section of the ARM Cortex-A Series Programmer's Guide: https://developer.arm.com/documentation/den0024/a/The-Memory-Management-Unit |
Here are the assembly, linker, and application code I'm currently utilizing. Could you assist me in ensuring that the configuration is correct? boot.s `// Put a 64-bit value with little endianness. _Reset: boot.ld main.cpp // // Define macro for UART end-of-transmission address // //Define macro for the value representing session termination int main(int argc, char* argv[])
}` |
You could check with the debug flags of gem5 whether the caches are properly enabled. Otherwise I would suggest to use my provided boot.S as a base to simplify the booting script as some of the real-world initialization steps might not be necessary in a gem5 simulation. |
Hi,
I find your code really helpful for the development base in firmware simulation,
but it turns out that L1, L2 cache simulation (such as hit/miss rate) results do not appear in the stats.txt.
Is it because the cache was not enabled yet in the kernel code?
(I'm a newbie in kernel or system area, so i don't really understand what's going on)
If that's the case, is it complicated to write a code for initializing the cache in the boot.S file?
Thank you!
The text was updated successfully, but these errors were encountered: