Skip to contentSkip to conversation

MIPS: Initial support of fulong mini pc (machine construction)

PATCH Superseded Huacai Chen 2 participants 4 messages Jun 5, 2010 – Jun 29, 2010

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 6/7 MIPS: Initial support of fulong mini pc (machine construction)

---
 Makefile.target    |    2 +-
 hw/mips_fulong2e.c |  402 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 403 insertions(+), 1 deletions(-)
 create mode 100644 hw/mips_fulong2e.c
Makefile.target +1 -1
index 92ba282..f203c6b 100644
@@ -221,7 +221,7 @@ obj-mips-y += vga.o i8259.o
 obj-mips-y += g364fb.o jazz_led.o
 obj-mips-y += gt64xxx.o mc146818rtc.o
 obj-mips-y += piix4.o cirrus_vga.o
-obj-mips-$(CONFIG_FULONG) += bonito.o vt82c686.o
+obj-mips-$(CONFIG_FULONG) += bonito.o vt82c686.o mips_fulong2e.o
 
 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
 
hw/mips_fulong2e.c new file +402 -0

402 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw

All the patches except the PMON one seems fine, but I am unable to boot a kernel. I had to add support for the missing Godson integer instructions but the kernel (I tried a 2.6.33 one) goes into panic during the boot:

[    0.724000] Checking for the daddi bug... no.
[    0.892000] Cache error exception:
[    0.892000] cp0_errorepc == 0000000000000000
[    0.892000] c0_cacheerr == 00000000
[    0.892000] Decoded c0_cacheerr: primary cache fault in insn reference.
[    0.892000] Error bits:
[    0.892000] IDX: 0x00000000
[    0.892000] Kernel panic - not syncing: Can't handle the cache error!

I got this problem both booting the kernel directly and via PMON. Is there any other patches missing to be able to use the Fulong 2E emulation?

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#2 lore raw

Loongson-specific instructions haven't implememted now. So, if want to boot a linux kernel, we should built a 32bit one and drop -march=loongson2e compiler flags. For simplification, please use the kernel patch (for 2.6.33) in the attachment and then use arch/mips/configs/fuloong2e_defconfig to compile a kernel. Besides, the disk image I used is debian-lenny built by you which is available at http://people.debian.org/~aurel32/qemu/mipsel/debian_lenny_mipsel_small.qcow2.

Quoted 22 lines · Aurelien Jarno

All the patches except the PMON one seems fine, but I am unable to boot a kernel. I had to add support for the missing Godson integer instructions but the kernel (I tried a 2.6.33 one) goes into panic during the boot:

[    0.724000] Checking for the daddi bug... no.
[    0.892000] Cache error exception:
[    0.892000] cp0_errorepc == 0000000000000000
[    0.892000] c0_cacheerr == 00000000
[    0.892000] Decoded c0_cacheerr: primary cache fault in insn reference. [    0.892000] Error bits:
[    0.892000] IDX: 0x00000000
[    0.892000] Kernel panic - not syncing: Can't handle the cache error!

I got this problem both booting the kernel directly and via PMON. Is there any other patches missing to be able to use the Fulong 2E emulation?

--
Aurelien Jarno                          GPG: 1024D/F1BCDB73 [email protected]                 http://www.aurel32.net

Signature · 1 line
Huacai Chen
arch/mips/Makefile +1 -1
index 1893efd..a3b1d60 100644
@@ -133,7 +133,7 @@ cflags-$(CONFIG_CPU_TX49XX)	+= -march=r4600 -Wa,--trap
 # only gcc >= 4.4 have the loongson-specific support
 cflags-$(CONFIG_CPU_LOONGSON2)	+= -Wa,--trap
 cflags-$(CONFIG_CPU_LOONGSON2E) += \
-	$(call cc-option,-march=loongson2e,-march=r4600)
+	$(call cc-option,-march=r4600)
 cflags-$(CONFIG_CPU_LOONGSON2F) += \
 	$(call cc-option,-march=loongson2f,-march=r4600)
 
arch/mips/configs/fuloong2e_defconfig +160 -97

560 lines not on this page · raw message

arch/mips/kernel/cevt-r4k.c +8 -3
index 0b2450c..164b1d2 100644
@@ -144,9 +144,14 @@ int c0_compare_int_usable(void)
 	while ((int)(read_c0_count() - cnt) <= 0)
 		;	/* Wait for expiry  */
 
-	compare_change_hazard();
-	if (!c0_compare_int_pending())
-		return 0;
+	while(1){
+		compare_change_hazard();
+//		if (!c0_compare_int_pending())
+//			return 0;
+        if (c0_compare_int_pending())
+            break;
+
+	}
 
 	write_c0_compare(read_c0_count());
 	compare_change_hazard();
#3 lore raw
Quoted 8 lines · chen huacai

Loongson-specific instructions haven't implememted now. So, if want to boot a linux kernel, we should built a 32bit one and drop -march=loongson2e compiler flags. For simplification, please use the kernel patch (for 2.6.33) in the attachment and then use arch/mips/configs/fuloong2e_defconfig to compile a kernel. Besides, the disk image I used is debian-lenny built by you which is available at http://people.debian.org/~aurel32/qemu/mipsel/debian_lenny_mipsel_small.qcow2.

It indeed works, however I still think there is a problem. 64-bit kernels should also boot when dropping -march=loongson2e. Also after adding the Loongson-specific integer instructions, I am able to boot a 32-bit kernel built with -march=loongson2e, but not a 64-bit kernel.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net