sysprog21 / semu

A minimalist RISC-V system emulator capable of running Linux kernel
MIT License
252 stars 47 forks source link

Preliminary SMP support #46

Closed ranvd closed 3 months ago

ranvd commented 4 months ago

In this commit, semu is able to simulate SMP architecture running on the Linux kernel.

Before simulating SMP on semu, we need to enable SMP support in the Linux kernel. Please cross-compile the Linux kernel with the configuration file located at configs/linux.config.

After recompiling the Linux kernel with SMP support enabled, simply execute make check SMP=1 to simulate a quad-hart RISC-V CPU.

processor   : 0
hart        : 0
isa     : rv32ima_zicntr_zicsr_zifencei_zihpm
mmu     : sv32
mvendorid   : 0x12345678
marchid     : 0x80000001
mimpid      : 0x1
hart isa    : rv32ima_zicntr_zicsr_zifencei_zihpm

processor   : 1
hart        : 1
isa     : rv32ima_zicntr_zicsr_zifencei_zihpm
mmu     : sv32
mvendorid   : 0x12345678
marchid     : 0x80000001
mimpid      : 0x1
hart isa    : rv32ima_zicntr_zicsr_zifencei_zihpm

processor   : 2
hart        : 2
isa     : rv32ima_zicntr_zicsr_zifencei_zihpm
mmu     : sv32
mvendorid   : 0x12345678
marchid     : 0x80000001
mimpid      : 0x1
hart isa    : rv32ima_zicntr_zicsr_zifencei_zihpm

processor   : 3
hart        : 3
isa     : rv32ima_zicntr_zicsr_zifencei_zihpm
mmu     : sv32
mvendorid   : 0x12345678
marchid     : 0x80000001
mimpid      : 0x1
hart isa    : rv32ima_zicntr_zicsr_zifencei_zihpm
ranvd commented 4 months ago

Got it. I will separate this PR into more pull requests, and leave this pull request with the actual implementation of preliminary SMP implementation .

ranvd commented 4 months ago

In the commit log this time, I separate the commits of PLIC, CLINT implementation and LR/SC correction. Does it needed to create new PR for each individual commit?

jserv commented 4 months ago

In the commit log this time, I separate the commits of PLIC, CLINT implementation and LR/SC correction. Does it needed to create new PR for each individual commit?

You can gather them in one pull request, but you should utilize git rebase -i to rework the commits, making them concise.

ranvd commented 4 months ago

You can gather them in one pull request, but you should utilize git rebase -i to rework the commits, making them concise.

Sorry, I can't understand what exactly I should do. The current commit is already rebased to the latest master branch. Does "Rework the commits" mean I need to rewrite the commit message because my commit message is not clear enough to convey the idea of changes?

jserv commented 4 months ago

Does "Rework the commits" mean I need to rewrite the commit message because my commit message is not clear enough to convey the idea of changes?

The requested changes are involved in several functional and minimal commits which refer to their individual change lists. e.g.,

While the following changes should be amended into the above. e.g.,

Each commit should be fully traceable and well-understood.

ranvd commented 4 months ago

I found that some implementations are not consistent with the specifications. I will update this branch afterward.

jserv commented 3 months ago

Can you integrate SMP aware tests in GitHub Actions?

ranvd commented 3 months ago

Okay, I will integrate it by creating a new pull request afterward.

jserv commented 3 months ago

Thank @ranvd for contributing!