'''Qemu''' is a generic open source processor and system emulator. It achieves good performance from using a [[Wikipedia:Just-in-time_compilation|Just-in-time compilation]].

+

'''QEMU''' is a generic open source processor and system emulator. It achieves good performance from using a [[Wikipedia:Just-in-time_compilation|Just-in-time compilation]].

+

+

== Processor ==

+

QEMU is simulating a range of processors, the standard selection is for the 32 bit emulation a [[24K|24Kf]] [[MIPS32]] processor and for the 64 bit emulation a [[R4000]] [[Instruction_Set_Architecture#MIPS_III|MIPS III]] processor.

+

+

$ qemu-system-mips -cpu '?'

+

MIPS '4Kc'

+

MIPS '4Km'

+

MIPS '4KEcR1'

+

MIPS '4KEmR1'

+

MIPS '4KEc'

+

MIPS '4KEm'

+

MIPS '24Kc'

+

MIPS '24Kf'

+

MIPS '34Kf'

+

+

$ qemu-system-mips64 -cpu '?'

+

MIPS '4Kc'

+

MIPS '4Km'

+

MIPS '4KEcR1'

+

MIPS '4KEmR1'

+

MIPS '4KEc'

+

MIPS '4KEm'

+

MIPS '24Kc'

+

MIPS '24Kf'

+

MIPS '34Kf'

+

MIPS 'R4000'

+

MIPS 'VR5432'

+

MIPS '5Kc'

+

MIPS '5Kf'

+

MIPS '20Kc'

+

MIPS 'MIPS64R2-generic'

+

MIPS 'Loongson-2E'

+

MIPS 'Loongson-2F'

+

+

All processor emulations claim to have primary caches however the cache effects are not simulated and cacheops are treated as noops.

+

This is a design decision to improve performance over accuracy.

+

No benchmarking has been done however it is expected that the performance of the virtual MIPS system will be comparable to emulation of the other processors.

== System architecture ==

== System architecture ==

−

This paragraph describes the architecture of the MIPS system that currently is being emulated by Qemu. As Qemu is still very much work in progress this is expected to change.

There currently is no firmware for Qemu. This is only a minor problem as unlike on a real system Qemu's virtual hardware is mostly initialized after a reset.

+

The QEMU distribution does not contain any firmware for MIPS.

+

This is only a minor problem as unlike on a real system QEMU's virtual hardware is mostly initialized after a reset.

−

=== Memory map ===

+

At least some existing firmware for [[MIPS Malta]] also works with QEMU, e.g. [[RedBoot]].

−

Qemu is emulating a simply machine with [[Wikipedia:Industry_Standard_Architecture|ISA]]-like bus. ISA IO space mapped to the 0x14000000 (PHYS) and ISA memory at the 0x10000000 (PHYS, 16Mb in size). All peripherial devices are attached to this "bus" with the standart PC ISA addresses.

+

−

=== Processor ===

+

There is also a [http://www.brouhaha.com/~eric/software/mmon/ mmon] port to QEMU.

−

Qemu is simulating a [[4K|4Kc]] [[MIPS32]] processor with a 16 entry [[TLB]]. Both I-cache and D-cache are 4kB each, 2-way set-associative with 16&nbsp;bytes per cacheline however the cache effects are not simulated and cacheops are treated as noops. This is a design decission to improve performance over accuracy. No benchmarking has been done however it is expected that the performance of the virtual MIPS system will be comparable to emulation of the other processors.

+

−

Qemu's source code can also be configured to be built with support for a 4Km processor. However being TLB-less this processor is not of interest for Linux, so does not currently receive any sort of attention.

+

== MIPS pseudo board ==

+

+

This paragraph describes the architecture of the MIPS system (''mips'') that currently is being emulated by QEMU.

+

As QEMU is still very much work in progress this is expected to change.

+

+

=== Memory map ===

+

QEMU emulates a simple machine with [[Wikipedia:Industry_Standard_Architecture|ISA]]-like bus. ISA IO space mapped to the 0x14000000 (PHYS) and ISA memory at the 0x10000000 (PHYS, 16Mb in size). All peripherial devices are attached to this "bus" with the standard PC ISA addresses.

=== Interrupt controller ===

=== Interrupt controller ===

−

Qemu is emulating the standard builtin interrrupt controller including soft interrupts and the count/compare interrupt of [[R4000]]-class processors. Cascaded externally to that is a [[Wikipedia:Intel_8259|i8259]] [[Wikipedia:Programmable Interrupt Controller|PIC]] interrupt controller that is cascaded to the CPU's INT0.

+

QEMU is emulating the standard builtin interrrupt controller including soft interrupts and the count/compare interrupt of [[R4000]]-class processors. Cascaded externally to that is a [[Wikipedia:Intel_8259|i8259]] [[Wikipedia:Programmable Interrupt Controller|PIC]] interrupt controller that is cascaded to the CPU's INT0.

Qemu supports other peripherals however support for them has not been integrated or tested into the MIPS port.

+

QEMU supports other peripherals however support for them has not been integrated or tested into the MIPS port.

== Status ==

== Status ==

−

At this time the MIPS support still is in pre-alpha stage. There is no [[firmware]] for qemu yet and the kernel will only run to the point where it enters userspace.

+

At this time the MIPS support still is in alpha stage.

+

There is not much [[#Firmware|firmware]] for QEMU yet, so QEMU does the basic initialization as well as loading kernel and ramdisk itself.

+

The Linux kernel has a special configuration to support the QEMU platform, no additional patches are needed.

−

== Patches ==

+

Debian installer images with such a kernel are available for [http://people.debian.org/~ths/d-i/mips/images/daily/qemu/netboot/ big endian] and [http://people.debian.org/~ths/d-i/mipsel/images/daily/qemu/netboot/ little endian]. They are also available on the [http://ftp.debian.org/debian/dists/etch/main/installer-mipsel/current/images/qemu/ Debian mirrors]

−

MIPS support is integrated into Qemu (CVS HEAD, still experimental), but not in the Linux kernel,

+

−

so maybe you'll need to apply some patches.

+

−

=== Kernel patches ===

+

A guide for installing Debian can be found [http://www.aurel32.net/info/debian_mips_qemu.php here].

−

Qemu currently doesn't emulate any existing MIPS system. Therefore the Linux kernel needs [ftp://ftp.linux-mips.org/pub/linux/mips/qemu patches] to add support the Qemu platform. The patch is meant to be applied on top of a Linux&nbsp;2.6 kernel from the [[Net_Resources#Anonymous_CVS|CVS]] archive. The patches are already merged in the current [[Git]] archive.

+

−

+

−

=== Qemu patches ===

+

−

All MIPS Qemu patches have been integrated into the [http://savannah.nongnu.org/cvs/?group=qemu Qemu CVS].

+

== Common Problems ==

== Common Problems ==

Line 54:

Line 103:

[ralf@box qemu]$

[ralf@box qemu]$

−

There currently is no MIPS BIOS file for Qemu. However if passed a -kernel argument qemu will not call the firmware at all, so this does no harm at all. Therefore, a command such as

+

There currently is no MIPS BIOS file for QEMU (see [[#Firmware|firmware]]).

+

However if passed a -kernel argument qemu will not call the firmware at all, so this does no harm at all. Therefore, a command such as

All processor emulations claim to have primary caches however the cache effects are not simulated and cacheops are treated as noops.
This is a design decision to improve performance over accuracy.
No benchmarking has been done however it is expected that the performance of the virtual MIPS system will be comparable to emulation of the other processors.

MIPS pseudo board

This paragraph describes the architecture of the MIPS system (mips) that currently is being emulated by QEMU.
As QEMU is still very much work in progress this is expected to change.

Memory map

QEMU emulates a simple machine with ISA-like bus. ISA IO space mapped to the 0x14000000 (PHYS) and ISA memory at the 0x10000000 (PHYS, 16Mb in size). All peripherial devices are attached to this "bus" with the standard PC ISA addresses.

Interrupt controller

QEMU is emulating the standard builtin interrrupt controller including soft interrupts and the count/compare interrupt of R4000-class processors. Cascaded externally to that is a i8259PIC interrupt controller that is cascaded to the CPU's INT0.

Timer

In addition to the CPU builtin timer Linux support the i8254PIT (Programmable Interval Timer) which is cascaded to the PIC's interrupt 0 input.

Serial interface

Network interface

Disk interface

QEMU emulates a generic PC-style IDE interface.

Other peripherals

QEMU supports other peripherals however support for them has not been integrated or tested into the MIPS port.

Status

At this time the MIPS support still is in alpha stage.
There is not much firmware for QEMU yet, so QEMU does the basic initialization as well as loading kernel and ramdisk itself.
The Linux kernel has a special configuration to support the QEMU platform, no additional patches are needed.