semu icon indicating copy to clipboard operation
semu copied to clipboard

Preliminary SMP support

Open ranvd opened this issue 1 year ago • 6 comments

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 avatar Jun 15 '24 06:06 ranvd

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 avatar Jun 16 '24 02:06 ranvd

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?

ranvd avatar Jun 24 '24 18:06 ranvd

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.

jserv avatar Jun 25 '24 01:06 jserv

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?

ranvd avatar Jun 25 '24 04:06 ranvd

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.,

  • Adapt Linux kernel configurations for SMP-awareness
  • Introduce CLINT for multi-harts
  • Fix atomic instructions for SMP
  • Introduce SMP-aware option and runtime support

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

  • Change device tree related file name
  • Enhance coding sytle in clint.c

Each commit should be fully traceable and well-understood.

jserv avatar Jun 25 '24 05:06 jserv

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

ranvd avatar Jun 30 '24 11:06 ranvd

Can you integrate SMP aware tests in GitHub Actions?

jserv avatar Jul 08 '24 11:07 jserv

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

ranvd avatar Jul 08 '24 13:07 ranvd

Thank @ranvd for contributing!

jserv avatar Jul 10 '24 06:07 jserv