test: Enable loongarch64 MP feature in test kernel
This commit is contained in:
2
test.mk
2
test.mk
@@ -251,7 +251,7 @@ uefi-loongarch64-test:
|
|||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
rm -rf test_image loopback_dev
|
rm -rf test_image loopback_dev
|
||||||
qemu-system-loongarch64 -m 1G -net none -M virt -cpu la464 -device ramfb -device qemu-xhci -device usb-kbd -drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-loongarch64.fd,readonly=on -hda test.hdd -serial stdio
|
qemu-system-loongarch64 -m 1G -net none -M virt -cpu la464 -smp 4 -device ramfb -device qemu-xhci -device usb-kbd -drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-loongarch64.fd,readonly=on -hda test.hdd -serial stdio
|
||||||
|
|
||||||
.PHONY: uefi-ia32-test
|
.PHONY: uefi-ia32-test
|
||||||
uefi-ia32-test:
|
uefi-ia32-test:
|
||||||
|
|||||||
@@ -130,13 +130,11 @@ static volatile struct limine_executable_address_request executable_address_requ
|
|||||||
.revision = 0, .response = NULL
|
.revision = 0, .response = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef __loongarch__
|
|
||||||
__attribute__((section(".limine_requests")))
|
__attribute__((section(".limine_requests")))
|
||||||
static volatile struct limine_mp_request _mp_request = {
|
static volatile struct limine_mp_request _mp_request = {
|
||||||
.id = LIMINE_MP_REQUEST_ID,
|
.id = LIMINE_MP_REQUEST_ID,
|
||||||
.revision = 0, .response = NULL
|
.revision = 0, .response = NULL
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__((section(".limine_requests")))
|
__attribute__((section(".limine_requests")))
|
||||||
static volatile struct limine_dtb_request _dtb_request = {
|
static volatile struct limine_dtb_request _dtb_request = {
|
||||||
@@ -266,7 +264,7 @@ void ap_entry(struct limine_mp_info *info) {
|
|||||||
#elif defined (__riscv)
|
#elif defined (__riscv)
|
||||||
e9_printf("My Hart ID: %x", info->hartid);
|
e9_printf("My Hart ID: %x", info->hartid);
|
||||||
#elif defined (__loongarch__)
|
#elif defined (__loongarch__)
|
||||||
(void)info;
|
e9_printf("My Phys ID: %x", info->phys_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__atomic_fetch_add(&ctr, 1, __ATOMIC_SEQ_CST);
|
__atomic_fetch_add(&ctr, 1, __ATOMIC_SEQ_CST);
|
||||||
@@ -511,7 +509,6 @@ FEAT_START
|
|||||||
FEAT_END
|
FEAT_END
|
||||||
|
|
||||||
// TODO: LoongArch MP
|
// TODO: LoongArch MP
|
||||||
#ifndef __loongarch__
|
|
||||||
FEAT_START
|
FEAT_START
|
||||||
e9_printf("");
|
e9_printf("");
|
||||||
if (_mp_request.response == NULL) {
|
if (_mp_request.response == NULL) {
|
||||||
@@ -527,6 +524,8 @@ FEAT_START
|
|||||||
e9_printf("BSP MPIDR: %x", mp_response->bsp_mpidr);
|
e9_printf("BSP MPIDR: %x", mp_response->bsp_mpidr);
|
||||||
#elif defined (__riscv)
|
#elif defined (__riscv)
|
||||||
e9_printf("BSP Hart ID: %x", mp_response->bsp_hartid);
|
e9_printf("BSP Hart ID: %x", mp_response->bsp_hartid);
|
||||||
|
#elif defined (__loongarch__)
|
||||||
|
e9_printf("BSP Phys ID: %x", mp_response->bsp_phys_id);
|
||||||
#endif
|
#endif
|
||||||
e9_printf("CPU count: %d", mp_response->cpu_count);
|
e9_printf("CPU count: %d", mp_response->cpu_count);
|
||||||
for (size_t i = 0; i < mp_response->cpu_count; i++) {
|
for (size_t i = 0; i < mp_response->cpu_count; i++) {
|
||||||
@@ -538,6 +537,8 @@ FEAT_START
|
|||||||
e9_printf("MPIDR: %x", cpu->mpidr);
|
e9_printf("MPIDR: %x", cpu->mpidr);
|
||||||
#elif defined (__riscv)
|
#elif defined (__riscv)
|
||||||
e9_printf("Hart ID: %x", cpu->hartid);
|
e9_printf("Hart ID: %x", cpu->hartid);
|
||||||
|
#elif defined (__loongarch__)
|
||||||
|
e9_printf("Phys ID: %x", cpu->phys_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -547,6 +548,8 @@ FEAT_START
|
|||||||
if (cpu->mpidr != mp_response->bsp_mpidr) {
|
if (cpu->mpidr != mp_response->bsp_mpidr) {
|
||||||
#elif defined (__riscv)
|
#elif defined (__riscv)
|
||||||
if (cpu->hartid != mp_response->bsp_hartid) {
|
if (cpu->hartid != mp_response->bsp_hartid) {
|
||||||
|
#elif defined (__loongarch__)
|
||||||
|
if (cpu->phys_id != mp_response->bsp_phys_id) {
|
||||||
#endif
|
#endif
|
||||||
uint32_t old_ctr = __atomic_load_n(&ctr, __ATOMIC_SEQ_CST);
|
uint32_t old_ctr = __atomic_load_n(&ctr, __ATOMIC_SEQ_CST);
|
||||||
|
|
||||||
@@ -557,7 +560,6 @@ FEAT_START
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FEAT_END
|
FEAT_END
|
||||||
#endif
|
|
||||||
|
|
||||||
FEAT_START
|
FEAT_START
|
||||||
e9_printf("");
|
e9_printf("");
|
||||||
|
|||||||
Reference in New Issue
Block a user