Skip to contentSkip to conversation

Qemu and Linux 2.4

DISCUSSION Vlad Lungu 5 participants 11 messages Sep 11, 2007 – Sep 29, 2007 MIPS

lore
Share & tools
lore

Vlad Lungu

author
#0 lore raw

I know some of you will laugh, but:

- QEMU malta emulation is not really complete, to put it mildly
- the QEMU target is available only for Linux 2.6
- despite popular opinion, 2.4 ain't dead yet, at least in the embedded market

I have a port of the QEMU target for Linux 2.4.34.4 (latest 2.4 kernel on linux-mips.org), with NE2000 card working (in both BE and LE modes). Still rough at the edges, but it works on stock qemu-0.9.0 with -M mips.

If anyone is interested, I can send the patch by e-mail. I have no idea if I can post attachments to the list(s), that's why it's not attached.

Vlad

#1 lore raw
Quoted 3 lines · Vlad Lungu

I know some of you will laugh, but:

- QEMU malta emulation is not really complete, to put it mildly

Out of curiosity, what parts did you miss?

Quoted 8 lines

- the QEMU target is available only for Linux 2.6
- despite popular opinion, 2.4 ain't dead yet, at least in the embedded market

I have a port of the QEMU target for Linux 2.4.34.4 (latest 2.4 kernel on linux-mips.org), with NE2000 card working (in both BE and LE modes). Still rough at the edges, but it works on stock qemu-0.9.0 with -M mips.

I recommend to improve the Qemu Malta emulation, and make it work with 2.4 Malta kernels. (ISTR it used to work, so it shouldn't need a lot to get there.)

Thiemo

author
#2 lore raw
Quoted 6 lines · Thiemo Seufer
Quoted 3 lines · Vlad Lungu

I know some of you will laugh, but:

- QEMU malta emulation is not really complete, to put it mildly

Out of curiosity, what parts did you miss?

Like, for example, the PCI stuff. So I can use the network card. And yes, I am aware of YAMON.

Quoted 11 lines
Quoted 7 lines

- the QEMU target is available only for Linux 2.6
- despite popular opinion, 2.4 ain't dead yet, at least in the embedded market

I have a port of the QEMU target for Linux 2.4.34.4 (latest 2.4 kernel on linux-mips.org), with NE2000 card working (in both BE and LE modes). Still rough at the edges, but it works on stock qemu-0.9.0 with -M mips.

I recommend to improve the Qemu Malta emulation, and make it work with 2.4 Malta kernels. (ISTR it used to work, so it shouldn't need a lot to get there.)

I'm sure that improving the Qemu Malta emulation is a very noble goal, but for people that need a working 2.4 kernel NOW, my patch could be useful. Having the QEMU target in 2.6 surely helped me.

Vlad

#3 lore raw
Quoted 3 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 1 line

- QEMU malta emulation is not really complete, to put it mildly

Out of curiosity, what parts did you miss?

Like, for example, the PCI stuff. So I can use the network card.

PCI stuff in the QEMU/Malta works fine, but pseudo-bootrom does not perform PCI enumeration and leaves uninitialized PCI BARs.

Linux MIPS/Malta 2.4 can not perform PCI enumeration too. The LANCE Ethernet driver *requres* a pre-initialized BARs. The situation even worse, since current Linux 2.4 can't be even built with NEW_PCI and PCI_AUTO options at all (due to linkage error).

http://www.linux-mips.org/wiki/PCI_Subsystem

There is the same PCI problem with NetBSD/evbmips and seems VxWorks/Malta.

Quoted 1 line

And yes, I am aware of YAMON.

AFAIK, YAMON may runs on the MIPS hardware only, and may not be redistribuded in the source or binary form.

Anyway, YAMON binary does not work on the Qemu/Malta. The Galileo chip is far more complicated then Qemu emulation. It contains four DMA channels, four timers e.t.c. e.t.c.

Quoted 5 lines
Quoted 3 lines

I recommend to improve the Qemu Malta emulation, and make it work with 2.4 Malta kernels. (ISTR it used to work, so it shouldn't need a lot to get there.)

I'm sure that improving the Qemu Malta emulation is a very noble goal, but for people that need a working 2.4 kernel NOW, my patch could be useful. Having the QEMU target in 2.6 surely helped me.

The only thing we need is a good bootrom (BIOS) for the MIPS/Malta (Free-YAMON ;)

As a quick'n'disty solution you could initialize PCI BARs of the device number 12 (0x0b, LANCE) with GDB:

(gdb) set variable {int}0xbbe00cf8=0x80005810 <--- I/O address
(gdb) set variable {int}0xbbe00cfc=0x00002001
(gdb) set variable {int}0xbbe00cf8=0x80005814 <--- Mem address (gdb) set variable {int}0xbbe00cfc=0xfc200000
(gdb) set variable {int}0xbbe00cf8=0x80005804 <--- Enable Mem and I/O (gdb) set variable {int}0xbbe00cfc=0x00000003
(gdb) set variable {int}0xbbe00cf8=0x8000583c <---- IRQ=10 tied to Pin A
(gdb) set variable {int}0xbbe00cfc=0xff06010a
(gdb) cont
Continuing.

...
Linux version 2.4.35.3 ([email protected]) (gcc version 3.3.6) #2 Tue Sep 25 18:59:10 MSD 2007
...
pcnet32.c:v1.30h 06.24.2004 [email protected]
pcnet32: PCnet/PCI II 79C970A at 0x2000, 52 54 00 12 34 56 assigned IRQ 10.
eth0: registered as PCnet/PCI II 79C970A
pcnet32: 1 cards_found.
...

# lspci -v
....
00:0b.0 Class 0200: 1022:2000 (rev 10)
       Flags: bus master, fast devsel, latency 64, IRQ 10
       I/O ports at 2000 [size=32]
       Memory at fc200000 (32-bit, non-prefetchable) [size=32]
# ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
#
# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=4.2 ms

--
-=AV=-

*******************************************************************************************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. Messages are susceptible to alteration. Orange Business Services shall not be liable for the message if altered, changed or falsified. If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
*******************************************************************************************************

#4 lore raw
Quoted 7 lines · Alexander Voropay
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

- QEMU malta emulation is not really complete, to put it mildly

Out of curiosity, what parts did you miss?

Like, for example, the PCI stuff. So I can use the network card.

PCI stuff in the QEMU/Malta works fine, but pseudo-bootrom does not perform PCI enumeration and leaves uninitialized PCI BARs.

Quoted 8 lines

Linux MIPS/Malta 2.4 can not perform PCI enumeration too. The LANCE Ethernet driver *requres* a pre-initialized BARs. The situation even worse, since current Linux 2.4 can't be even built with NEW_PCI and PCI_AUTO options at all (due to linkage error).

http://www.linux-mips.org/wiki/PCI_Subsystem

There is the same PCI problem with NetBSD/evbmips and seems VxWorks/Malta.

Both CONFIG_PCI_NEW and PCI_AUTO were amazingly broken in both concept and implementation. It is possible to get them to work well for particular configurations but for the general case nothing else nothing but rewrite can rescue things.

Quoted 4 lines
Quoted 1 line

And yes, I am aware of YAMON.

AFAIK, YAMON may runs on the MIPS hardware only, and may not be redistribuded in the source or binary form.

Alchemy boards run YAMON, too.

Quoted 3 lines

*******************************************************************************************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination

Soley for all the billion internet users, I assume ;-)

Ralf

author
#5 lore raw
Quoted 6 lines · Ralf Baechle

Both CONFIG_PCI_NEW and PCI_AUTO were amazingly broken in both concept and implementation. It is possible to get them to work well for particular configurations but for the general case nothing else nothing but rewrite can rescue things.

Hi Ralf,

I found this the hard way :-(

BTW, what's the status on the latest 2.4 patch I sent you?

Vlad

#6 lore raw
In reply to Alexander Voropay
Quoted 31 lines · Alexander Voropay
Quoted 3 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 1 line

- QEMU malta emulation is not really complete, to put it mildly

Out of curiosity, what parts did you miss?

Like, for example, the PCI stuff. So I can use the network card.

PCI stuff in the QEMU/Malta works fine, but pseudo-bootrom
does not perform PCI enumeration and leaves uninitialized PCI BARs.

Linux MIPS/Malta 2.4 can not perform PCI enumeration too. The LANCE
Ethernet driver *requres* a pre-initialized BARs. The situation even worse, since current Linux 2.4 can't be even built with NEW_PCI and PCI_AUTO options at all (due to linkage error).

http://www.linux-mips.org/wiki/PCI_Subsystem

There is the same PCI problem with NetBSD/evbmips and seems VxWorks/Malta.

Quoted 1 line

And yes, I am aware of YAMON.

AFAIK, YAMON may runs on the MIPS hardware only, and may not
be redistribuded in the source or binary form.

Anyway, YAMON binary does not work on the Qemu/Malta. The Galileo
chip is far more complicated then Qemu emulation. It contains four DMA channels, four timers e.t.c. e.t.c.

Quoted 4 lines
Quoted 3 lines

I recommend to improve the Qemu Malta emulation, and make it work with 2.4 Malta kernels. (ISTR it used to work, so it shouldn't need a lot to get there.)

Quoted 6 lines
Quoted 3 lines

I'm sure that improving the Qemu Malta emulation is a very noble goal, but for people that need a working 2.4 kernel NOW, my patch could be useful. Having the QEMU target in 2.6 surely helped me.

The only thing we need is a good bootrom (BIOS) for the MIPS/Malta
(Free-YAMON ;)

Someone could port OpenBIOS or LinuxBIOS to MIPS.

author
#7 lore raw
Quoted 3 lines · Blue Swirl

Someone could port OpenBIOS or LinuxBIOS to MIPS.

Well, just FYI:

I sort-of-ported U-Boot to Qemu (-M mips). Network performance sucks for some reason (hard enough that tftp-booting a kernel is impossible) and I didn't have time to investigate this yet. But I guess that porting to (-M malta) should not be that hard, and I think there is some PCI support already in U-boot.

Vlad

author
#8 lore raw

[Qemu-devel] U-Boot

Vlad Lungu wrote:

lol, replying to myself

Quoted 10 lines
Quoted 3 lines · Blue Swirl

Someone could port OpenBIOS or LinuxBIOS to MIPS.

Well, just FYI:

I sort-of-ported U-Boot to Qemu (-M mips). Network performance sucks for some reason (hard enough that tftp-booting a kernel is impossible) and I didn't have time to investigate this yet. But I guess that porting to (-M malta) should not be that hard, and I think there is some PCI support already in U-boot.

Reports of poor network performance have been greatly exagerated. Apparently, what it happens is :

- qemu doesn't respond with a next-server or server-name in DHCP, apparently
- U-Boot uses broadcast in this case as the server address
- things don't quite work

Setting IP by hand or using tap for networking and configuring DHCP on the host correctly allows loading bt TFTP (or even nfs-booting with tap). I can boot a vmlinux with embedded ramdisk (a couple of Megs) in maybe 10 seconds. Still getting RX timeouts, but it's no big deal.

I will polish the thing a little and post an update in 1-2 weeks max. Maybe we can have a bootrom for MIPS shipping with Qemu, after all. Even for malta.

Vlad

author
#9 lore raw
In reply to Alexander Voropay
Quoted 9 lines · Alexander Voropay
Quoted 3 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 1 line

- QEMU malta emulation is not really complete, to put it mildly

Out of curiosity, what parts did you miss?

Like, for example, the PCI stuff. So I can use the network card.

PCI stuff in the QEMU/Malta works fine, but pseudo-bootrom does not perform PCI enumeration and leaves uninitialized PCI BARs.

Quoted 8 lines

Linux MIPS/Malta 2.4 can not perform PCI enumeration too. The LANCE Ethernet driver *requres* a pre-initialized BARs. The situation even worse, since current Linux 2.4 can't be even built with NEW_PCI and PCI_AUTO options at all (due to linkage error).

http://www.linux-mips.org/wiki/PCI_Subsystem

There is the same PCI problem with NetBSD/evbmips and seems VxWorks/Malta.

Well, that's a pretty big showstopper, don't you think?

[snip]

Quoted 6 lines

The only thing we need is a good bootrom (BIOS) for the MIPS/Malta (Free-YAMON ;)

As a quick'n'disty solution you could initialize PCI BARs of the device number 12 (0x0b, LANCE) with GDB:

Quoted 10 lines

(gdb) set variable {int}0xbbe00cf8=0x80005810 <--- I/O address
(gdb) set variable {int}0xbbe00cfc=0x00002001
(gdb) set variable {int}0xbbe00cf8=0x80005814 <--- Mem address (gdb) set variable {int}0xbbe00cfc=0xfc200000
(gdb) set variable {int}0xbbe00cf8=0x80005804 <--- Enable Mem and I/O (gdb) set variable {int}0xbbe00cfc=0x00000003
(gdb) set variable {int}0xbbe00cf8=0x8000583c <---- IRQ=10 tied to Pin A
(gdb) set variable {int}0xbbe00cfc=0xff06010a
(gdb) cont
Continuing.

That's dirty alright, but not exactly quick. You kind of need gdb :-)

Vlad

#10 lore raw
In reply to Vlad Lungu
Quoted 6 lines · Vlad Lungu

I know some of you will laugh, but:

- QEMU malta emulation is not really complete, to put it mildly
- the QEMU target is available only for Linux 2.6
- despite popular opinion, 2.4 ain't dead yet, at least in the embedded market

It very much is for new product development. It's a long time that I've seen any 2.4-based development being started for new MIPS platforms. I basically get zero feedback for 2.4.

The last patch submitted for 2.4 was on 2006-06-15 by Chris Dearman btw. Everything else since was just backported fixes from newer kernels and I've given up on that give the overwhelming feedback I keep receiving for 2.4.

Quoted 3 lines

I have a port of the QEMU target for Linux 2.4.34.4 (latest 2.4 kernel on linux-mips.org), with NE2000 card working (in both BE and LE modes). Still rough at the edges, but it works on stock qemu-0.9.0 with -M mips.

Actually 2.4.35.2 / 2.4.36-pre1 are the latest.

Quoted 2 lines

If anyone is interested, I can send the patch by e-mail. I have no idea if I can post attachments to the list(s), that's why it's not attached.

I do take Linux 2.4 patches provided they don't destabilize the 2.4 branch. The few remaining user expect stability, not a Penguin action movie ;-) But aside of that, same submission guidelines as for 2.6.

Cheers,

Ralf