Reputation: 75
I know generally QEMU use so called dynamic translation technique: it translates instructions of target machine into micro operations, and then translate these micro operations into host machine instructions via Tiny Code Generator(TCG). That is: instruction of target -> micro operations micro operations -> TCG -> instruction of host
However, if the architecture of target and host machine are the same, say both are x86, theoretically it does not necessary need to use the TCG to translate, since the instruction sets are the same. In this case, does QEMU still use TCG?
Upvotes: 3
Views: 2161
Reputation: 2431
In addition to Robin's answer:
It is important to remember that unless you specify in the command line, QEMU
will invariably, by default, use TCG
for translation.
For example, the below command line arguments will start up QEMU in TCG mode, even when the host and target architecture is the same, in my case, it is x86_64
./qemu-system-x86_64 -m 10G -machine pc-i440fx-2.5 -drive file=~/ubuntu16.04.server.qcow2,format=qcow2
If the command for QEMU start-up was something like this -
./qemu-system-x86_64 -m 10G -machine pc-i440fx-2.5 -accel kvm -drive file=~/ubuntu16.04.server.qcow2,format=qcow2
where in it is clearly specified that the accelerator choice is kvm, only then will QEMU start-up in KVM mode.
However, it is true that if the target and host arhcitecture is the same, QEMU can be allowed to run in KVM mode (if that is what you want), rather than TCG mode.
Upvotes: 3
Reputation: 60
From what I read on this blog: qemu can use KVM in this case
KVM is a virtualization feature in the Linux kernel that lets a program like qemu safely execute guest code directly on the host CPU. This is only possible when the target architecture is supported by the host CPU; today that means x86-on-x86 virtualization only.
Upvotes: 1