Difference between revisions of "QEMU"

From LinuxMIPS
Jump to: navigation, search
(download)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''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 ==
 
== 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 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 '?'
 
  $ qemu-system-mips64 -cpu '?'
 
  MIPS '4Kc'
 
  MIPS '4Kc'
 +
MIPS '4Km'
 
  MIPS '4KEcR1'
 
  MIPS '4KEcR1'
 +
MIPS '4KEmR1'
 
  MIPS '4KEc'
 
  MIPS '4KEc'
 +
MIPS '4KEm'
 
  MIPS '24Kc'
 
  MIPS '24Kc'
 
  MIPS '24Kf'
 
  MIPS '24Kf'
 +
MIPS '34Kf'
 
  MIPS 'R4000'
 
  MIPS 'R4000'
 +
MIPS 'VR5432'
 
  MIPS '5Kc'
 
  MIPS '5Kc'
 
  MIPS '5Kf'
 
  MIPS '5Kf'
 
  MIPS '20Kc'
 
  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.
+
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 ==
Qemu 0.9.1 supports [[Mips Malta]] architecture with CoreLV card, ''mips'' pseudo-board, ACER PICA-61 (a [[Jazz]] deriviative) and ''mipssim'' simulator.
+
QEMU 1.0 supports [[MIPS Malta]] architecture with CoreLV card, ''mips'' pseudo-board, ACER PICA-61 (a [[Jazz]] deriviative) and ''mipssim'' simulator.
  
 
  $ qemu-system-mips -M ?
 
  $ qemu-system-mips -M ?
 
  Supported machines are:
 
  Supported machines are:
  mips      mips r4k platform (default)
+
  mips      mips r4k platform
malta      MIPS Malta Core LV
+
pica61    Acer Pica 61
+
 
  mipssim    MIPS MIPSsim platform
 
  mipssim    MIPS MIPSsim platform
 +
malta      MIPS Malta Core LV (default)
 +
magnum    MIPS Magnum
 +
pica61    Acer Pica 61
  
 
=== Firmware ===
 
=== Firmware ===
The Qemu distribution does not contain any firmware for MIPS.
+
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.
+
This is only a minor problem as unlike on a real system QEMU's virtual hardware is mostly initialized after a reset.
  
At least some existing firmware for [[Mips Malta]] also works with Qemu, e.g. [[RedBoot]].
+
At least some existing firmware for [[MIPS Malta]] also works with QEMU, e.g. [[RedBoot]].
  
There is also a [http://www.brouhaha.com/~eric/software/mmon/ mmon] port to the Qemu.
+
There is also a [http://www.brouhaha.com/~eric/software/mmon/ mmon] port to QEMU.
  
 
== MIPS pseudo board ==
 
== 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.
+
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 ===
 
=== 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.
+
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.
  
 
=== Timer ===
 
=== Timer ===
Line 49: Line 72:
  
 
=== Graphics card ===
 
=== Graphics card ===
Qemu is emulating a standard VGA graphics card however underlined, bold and blinking attributes are not supported.
+
QEMU is emulating a standard VGA graphics card however underlined, bold and blinking attributes are not supported.
  
 
=== Serial interface ===
 
=== Serial interface ===
Qemu is emulating a PC-style 8250-based serial interface.
+
QEMU is emulating a PC-style 8250-based serial interface.
  
 
=== Network interface ===
 
=== Network interface ===
Qemu is emulating a single ISA NE2000 network card.
+
QEMU is emulating a single ISA NE2000 network card.
  
 
=== Disk interface ===
 
=== Disk interface ===
Qemu emulates a generic PC-style IDE interface.
+
QEMU emulates a generic PC-style IDE interface.
  
 
=== Other peripherals ===
 
=== Other peripherals ===
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 alpha stage.
 
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.
+
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.
+
The Linux kernel has a special configuration to support the QEMU platform, no additional patches are needed.
  
 
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]
 
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]
Line 80: Line 103:
 
  [ralf@box qemu]$
 
  [ralf@box qemu]$
  
There currently is no MIPS BIOS file for Qemu (see [[#Firmware|firmware]]).
+
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  
 
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  
  
Line 87: Line 110:
 
will generate a firmware file that will do the job for now.
 
will generate a firmware file that will do the job for now.
  
Since Qemu 0.8.1 this workaround is obsolete, a missing BIOS file triggers only a warning message.
+
Since QEMU 0.8.1 this workaround is obsolete, a missing BIOS file triggers only a warning message.
  
 
== MIPS HOST SUPPORT ==
 
== MIPS HOST SUPPORT ==
Line 100: Line 123:
  
 
== See also ==
 
== See also ==
* The Qemu homepage at http://www.qemu.org/ .
+
* The QEMU homepage at http://www.qemu.org/ .
 
* [http://wiki.qemu.org/Download Download]
 
* [http://wiki.qemu.org/Download Download]
  
 
== Credits ==
 
== Credits ==
 
Originally authored by French wizzard [[Wikipedia:Fabrice Bellard|Fabrice Bellard]], Jocelyn Mayer did add support for MIPS as a target, others are now trying to complete the project.
 
Originally authored by French wizzard [[Wikipedia:Fabrice Bellard|Fabrice Bellard]], Jocelyn Mayer did add support for MIPS as a target, others are now trying to complete the project.
 +
 +
[[category:virtualization]] [[category:RedBoot]]

Latest revision as of 10:43, 16 August 2012

QEMU is a generic open source processor and system emulator. It achieves good performance from using a Just-in-time compilation.

Processor

QEMU is simulating a range of processors, the standard selection is for the 32 bit emulation a 24Kf MIPS32 processor and for the 64 bit emulation a R4000 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

QEMU 1.0 supports MIPS Malta architecture with CoreLV card, mips pseudo-board, ACER PICA-61 (a Jazz deriviative) and mipssim simulator.

$ qemu-system-mips -M ?
Supported machines are:
mips       mips r4k platform
mipssim    MIPS MIPSsim platform
malta      MIPS Malta Core LV (default)
magnum     MIPS Magnum
pica61     Acer Pica 61

Firmware

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.

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

There is also a mmon port to QEMU.

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 i8259 PIC interrupt controller that is cascaded to the CPU's INT0.

Timer

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

Graphics card

QEMU is emulating a standard VGA graphics card however underlined, bold and blinking attributes are not supported.

Serial interface

QEMU is emulating a PC-style 8250-based serial interface.

Network interface

QEMU is emulating a single ISA NE2000 network card.

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.

Debian installer images with such a kernel are available for big endian and little endian. They are also available on the Debian mirrors

A guide for installing Debian can be found here.

Common Problems

MIPS BIOS not found on startup

[ralf@box qemu]$ qemu-system-mips -kernel /tftboot/192.168.0.1/vmlinux.bin -m 16 -nographic
(qemu) mips_r4k_init: start
mips_r4k_init: load BIOS '/usr/local/share/qemu/mips_bios.bin' size 131072
qemu: could not load MIPS bios '/usr/local/share/qemu/mips_bios.bin'
[ralf@box qemu]$

There currently is no MIPS BIOS file for QEMU (see 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

dd if=/dev/zero of=/usr/local/share/qemu/mips_bios.bin bs=1024 count=128

will generate a firmware file that will do the job for now.

Since QEMU 0.8.1 this workaround is obsolete, a missing BIOS file triggers only a warning message.

MIPS HOST SUPPORT

In 2004, I successfully compiled QEMU on a SGI machine, using a patch found here:

http://libvncserver.sourceforge.net/qemu/

http://libvncserver.sourceforge.net/qemu/qemu-irix.patch.gz

I hope this patch could merge into the new qemu release. Thanks! -- Tinybit <tinybit at tom dot com>

See also

Credits

Originally authored by French wizzard Fabrice Bellard, Jocelyn Mayer did add support for MIPS as a target, others are now trying to complete the project.