Hypervisor.framework provides a lightweight interface to run a virtual
cpu on macOS without the need to install third-party kernel
extensions (KEXTs).
It's supported since macOS 10.10 on machines with Intel VT-x feature
set that includes Extended Page Tables (EPT) and Unrestricted Mode.
QEMU supports Hypervisor.framework since 2.12.
The patch series adds "hvf" domain that uses Hypevisor.framework.
v1:
https://www.redhat.com/archives/libvir-list/2018-October/msg01090.html
Changes since v1:
- [x] Fixed unconditional addition of KVM CPU models into capabilities cache.
That fixed a "make check" issue in qemucapabilitiestest on Linux.
- [x] Fixed missing brace in virQEMUCapsFormatCPUModels in PATCH 6
- [x] Squashed patch 12 into the first patch (second one in the patch series)
- [x] Added hvf domain definition to docs/formatdomain.html.in into the first
patch (second in the patch series)
- [x] Removed redundant argument in virQEMUCapsProbeHVF (patch 3)
- [x] Added separate virQEMUCapsProbeHVF for non-apple platforms (patch 3)
- [x] Added macOS support page
- [x] Marked HVF support for all working domain elements
I wasn't able to resolve the issues below, but I think they should go
into separate patches/patch series:
- [ ] To make qemucapabilitiestests work regardless of OS, accelerator probing
should be done via QMP command.
So, there's a need to add a new generic
command to QEMU "query-accelerator accel=NAME"
- [ ] VIRT_TEST_PRELOAD doesn't work on macOS. There are a few
reasons:
* DYLD_INSERT_LIBRARIES should be used instead of LD_PRELOAD
*
-module flag shouldn't be added to LDFLAGS in tests/Makefile.am.
The flag instructs libtool to creates bundles (MH_BUNDLE) instead of
dynamic libraries (MH_DYLIB) and unlike dylibs they cannot be preloaded.
* Either symbol interposing or flat namespaces should be used to perform
overrides of the calls to the mocks.
I've tried both but neither worked for me, need to make a minimal
example.
I haven't completed the investigation as it looks like a separate work item.
- [ ] Can't retrieve qemucapsprobe replies for macOS because qemucapsprobemock
is not getting injected because of the issue with VIRT_TEST_PRELOAD
- [ ] Can't add to tests/qemuxml2argvtest.c to illustrate the hvf example
because qemucapsprobe doesn't work yet.
Roman Bolshakov (16):
qemu: Add KVM CPUs into cache only if KVM is present
conf: Add hvf domain type
qemu: Define hvf capability
qemu: Query hvf capability on macOS
qemu: Expose hvf domain type if hvf is supported
qemu: Rename kvmCPU to accelCPU
qemu: Introduce virQEMUCapsTypeIsAccelerated
qemu: Introduce virQEMUCapsHaveAccel
qemu: Introduce virQEMUCapsToVirtType
qemu: Introduce virQEMUCapsAccelStr
qemu: Make error message accel-agnostic
qemu: Correct CPU capabilities probing for hvf
news: Mention hvf domain type
docs: Add hvf on QEMU driver page
docs: Note hvf support for domain elements
docs: Add support page for libvirt on macOS
docs/docs.html.in | 3 +
docs/drvqemu.html.in | 49 +++++++-
docs/formatdomain.html.in | 141 ++++++++++++---------
docs/index.html.in | 4 +-
docs/macos.html.in | 229 ++++++++++++++++++++++++++++++++++
docs/news.xml | 12 ++
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 4 +-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 201 +++++++++++++++++++++--------
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 4 +
12 files changed, 534 insertions(+), 116 deletions(-)
create mode 100644 docs/macos.html.in
--
2.19.1