pmb.qemu: use -cpu host for KVM, make configurable with --cpu (!1886)
For KVM the code is run pretty much natively on the host CPU, so all CPU extensions available on the host CPU can be also used inside the VM. To expose that information to the VM we should pass "-cpu host", so the VM is aware of which CPU is in use. For CPU emulation, QEMU uses a rather minimal CPU on x86_64 by default. It does not have support for SSE3/4 etc, which may be required for some applications to work properly (e.g. Android in Anbox). Add a --cpu flag to make the emulated CPU configurable. Useful values are for example --cpu max to emulate all implemented CPU features.
This commit is contained in:
parent
76dcf8aa0b
commit
7bbc507416
|
@ -126,6 +126,12 @@ def arguments_qemu(subparser):
|
||||||
ret.add_argument("--no-kvm", dest="qemu_kvm", default=True, action='store_false',
|
ret.add_argument("--no-kvm", dest="qemu_kvm", default=True, action='store_false',
|
||||||
help="Avoid using hardware-assisted virtualization with KVM "
|
help="Avoid using hardware-assisted virtualization with KVM "
|
||||||
"even when available (SLOW!)")
|
"even when available (SLOW!)")
|
||||||
|
ret.add_argument("--cpu", dest="qemu_cpu",
|
||||||
|
help="Override emulated QEMU CPU. By default, the host CPU "
|
||||||
|
"will be emulated when using KVM and the QEMU default otherwise "
|
||||||
|
"(usually a CPU with minimal features). "
|
||||||
|
"A useful value is 'max' (emulate all features that are available), "
|
||||||
|
"use --cpu help to get a list of possible values from QEMU.")
|
||||||
|
|
||||||
ret.add_argument("--tablet", dest="qemu_tablet", action='store_true',
|
ret.add_argument("--tablet", dest="qemu_tablet", action='store_true',
|
||||||
default=False, help="Use 'tablet' instead of 'mouse' input "
|
default=False, help="Use 'tablet' instead of 'mouse' input "
|
||||||
|
|
|
@ -146,9 +146,13 @@ def command_qemu(args, arch, img_path):
|
||||||
native = args.arch_native == args.deviceinfo["arch"]
|
native = args.arch_native == args.deviceinfo["arch"]
|
||||||
if args.qemu_kvm and native and os.path.exists("/dev/kvm"):
|
if args.qemu_kvm and native and os.path.exists("/dev/kvm"):
|
||||||
command += ["-enable-kvm"]
|
command += ["-enable-kvm"]
|
||||||
|
command += ["-cpu", "host"]
|
||||||
else:
|
else:
|
||||||
logging.info("WARNING: QEMU is not using KVM and will run slower!")
|
logging.info("WARNING: QEMU is not using KVM and will run slower!")
|
||||||
|
|
||||||
|
if args.qemu_cpu:
|
||||||
|
command += ["-cpu", args.qemu_cpu]
|
||||||
|
|
||||||
display = args.qemu_display
|
display = args.qemu_display
|
||||||
if display != "none":
|
if display != "none":
|
||||||
display += ",gl=" + ("on" if args.qemu_gl else "off")
|
display += ",gl=" + ("on" if args.qemu_gl else "off")
|
||||||
|
|
Loading…
Reference in New Issue