[PATCH v2 0/8] hvf: Implement Apple Silicon Support

Alexander Graf posted 8 patches 3 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201130030723.78326-1-agraf@csgraf.de
Maintainers: Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <r.bolshakov@yadro.com>, Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@csgraf.de>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>
MAINTAINERS                  |  14 +-
accel/hvf/entitlements.plist |   8 +
accel/hvf/hvf-all.c          |  56 ++++
accel/hvf/hvf-cpus.c         | 483 ++++++++++++++++++++++++++++
accel/hvf/meson.build        |   7 +
accel/meson.build            |   1 +
include/hw/core/cpu.h        |   3 +-
include/sysemu/hvf_int.h     |  78 +++++
meson.build                  |  41 ++-
scripts/entitlement.sh       |  13 +
target/arm/arm-powerctl.c    |   1 +
target/arm/cpu.c             |   6 +
target/arm/hvf/hvf.c         | 603 +++++++++++++++++++++++++++++++++++
target/arm/hvf/meson.build   |   3 +
target/arm/meson.build       |   2 +
target/i386/hvf/hvf-cpus.c   | 131 --------
target/i386/hvf/hvf-cpus.h   |  25 --
target/i386/hvf/hvf-i386.h   |  48 +--
target/i386/hvf/hvf.c        | 462 ++++-----------------------
target/i386/hvf/meson.build  |   1 -
target/i386/hvf/vmx.h        |  24 +-
target/i386/hvf/x86.c        |  28 +-
target/i386/hvf/x86_descr.c  |  26 +-
target/i386/hvf/x86_emu.c    |  62 ++--
target/i386/hvf/x86_mmu.c    |   4 +-
target/i386/hvf/x86_task.c   |  12 +-
target/i386/hvf/x86hvf.c     | 221 ++++++-------
target/i386/hvf/x86hvf.h     |   2 -
28 files changed, 1557 insertions(+), 808 deletions(-)
create mode 100644 accel/hvf/entitlements.plist
create mode 100644 accel/hvf/hvf-all.c
create mode 100644 accel/hvf/hvf-cpus.c
create mode 100644 accel/hvf/meson.build
create mode 100644 include/sysemu/hvf_int.h
create mode 100755 scripts/entitlement.sh
create mode 100644 target/arm/hvf/hvf.c
create mode 100644 target/arm/hvf/meson.build
delete mode 100644 target/i386/hvf/hvf-cpus.c
delete mode 100644 target/i386/hvf/hvf-cpus.h

[PATCH v2 0/8] hvf: Implement Apple Silicon Support

Posted by Alexander Graf 3 months ago
Now that Apple Silicon is widely available, people are obviously excited
to try and run virtualized workloads on them, such as Linux and Windows.

This patch set implements a fully functional version to get the ball
going on that. With this applied, I can successfully run both Linux and
Windows as guests. I am not aware of any limitations specific to
Hypervisor.framework apart from:

  - Live migration / savevm
  - gdbstub debugging (SP register)


Enjoy!

Alex


v1 -> v2:

  - New patch: hvf: Actually set SIG_IPI mask
  - New patch: hvf: Introduce hvf vcpu struct
  - New patch: hvf: arm: Mark CPU as dirty on reset
  - Removed patch: hw/arm/virt: Disable highmem when on hypervisor.framework
  - Removed patch: arm: Synchronize CPU on PSCI on
  - Fix build on 32bit arm
  - Merge vcpu kick function patch into ARM enablement
  - Implement WFI handling (allows vCPUs to sleep)
  - Synchronize system registers (fixes OVMF crashes and reboot)
  - Don't always call cpu_synchronize_state()
  - Use more fine grained iothread locking
  - Populate aa64mmfr0 from hardware
  - Make safe to ctrl-C entitlement application

Alexander Graf (8):
  hvf: Add hypervisor entitlement to output binaries
  hvf: Move common code out
  hvf: Actually set SIG_IPI mask
  hvf: Introduce hvf vcpu struct
  arm: Set PSCI to 0.2 for HVF
  hvf: arm: Mark CPU as dirty on reset
  hvf: Add Apple Silicon support
  arm: Add Hypervisor.framework build target

 MAINTAINERS                  |  14 +-
 accel/hvf/entitlements.plist |   8 +
 accel/hvf/hvf-all.c          |  56 ++++
 accel/hvf/hvf-cpus.c         | 483 ++++++++++++++++++++++++++++
 accel/hvf/meson.build        |   7 +
 accel/meson.build            |   1 +
 include/hw/core/cpu.h        |   3 +-
 include/sysemu/hvf_int.h     |  78 +++++
 meson.build                  |  41 ++-
 scripts/entitlement.sh       |  13 +
 target/arm/arm-powerctl.c    |   1 +
 target/arm/cpu.c             |   6 +
 target/arm/hvf/hvf.c         | 603 +++++++++++++++++++++++++++++++++++
 target/arm/hvf/meson.build   |   3 +
 target/arm/meson.build       |   2 +
 target/i386/hvf/hvf-cpus.c   | 131 --------
 target/i386/hvf/hvf-cpus.h   |  25 --
 target/i386/hvf/hvf-i386.h   |  48 +--
 target/i386/hvf/hvf.c        | 462 ++++-----------------------
 target/i386/hvf/meson.build  |   1 -
 target/i386/hvf/vmx.h        |  24 +-
 target/i386/hvf/x86.c        |  28 +-
 target/i386/hvf/x86_descr.c  |  26 +-
 target/i386/hvf/x86_emu.c    |  62 ++--
 target/i386/hvf/x86_mmu.c    |   4 +-
 target/i386/hvf/x86_task.c   |  12 +-
 target/i386/hvf/x86hvf.c     | 221 ++++++-------
 target/i386/hvf/x86hvf.h     |   2 -
 28 files changed, 1557 insertions(+), 808 deletions(-)
 create mode 100644 accel/hvf/entitlements.plist
 create mode 100644 accel/hvf/hvf-all.c
 create mode 100644 accel/hvf/hvf-cpus.c
 create mode 100644 accel/hvf/meson.build
 create mode 100644 include/sysemu/hvf_int.h
 create mode 100755 scripts/entitlement.sh
 create mode 100644 target/arm/hvf/hvf.c
 create mode 100644 target/arm/hvf/meson.build
 delete mode 100644 target/i386/hvf/hvf-cpus.c
 delete mode 100644 target/i386/hvf/hvf-cpus.h

-- 
2.24.3 (Apple Git-128)


Re: [PATCH v2 0/8] hvf: Implement Apple Silicon Support

Posted by no-reply@patchew.org 3 months ago
Patchew URL: https://patchew.org/QEMU/20201130030723.78326-1-agraf@csgraf.de/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20201130030723.78326-1-agraf@csgraf.de
Subject: [PATCH v2 0/8] hvf: Implement Apple Silicon Support

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20201130030723.78326-1-agraf@csgraf.de -> patchew/20201130030723.78326-1-agraf@csgraf.de
Switched to a new branch 'test'
ae13163 arm: Add Hypervisor.framework build target
76a368a hvf: Add Apple Silicon support
ed57a9a hvf: arm: Mark CPU as dirty on reset
6d357c1 arm: Set PSCI to 0.2 for HVF
47e1fa7 hvf: Introduce hvf vcpu struct
d10d6e1 hvf: Actually set SIG_IPI mask
5bf37ca hvf: Move common code out
7b8f95a hvf: Add hypervisor entitlement to output binaries

=== OUTPUT BEGIN ===
1/8 Checking commit 7b8f95aad117 (hvf: Add hypervisor entitlement to output binaries)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#16: 
new file mode 100644

total: 0 errors, 1 warnings, 63 lines checked

Patch 1/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/8 Checking commit 5bf37ca7b0a0 (hvf: Move common code out)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#38: 
new file mode 100644

total: 0 errors, 1 warnings, 1088 lines checked

Patch 2/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/8 Checking commit d10d6e1d8ec6 (hvf: Actually set SIG_IPI mask)
4/8 Checking commit 47e1fa754e85 (hvf: Introduce hvf vcpu struct)
WARNING: line over 80 characters
#138: FILE: target/i386/hvf/hvf.c:213:
+    wvmcs(cpu->hvf->fd, VMCS_ENTRY_CTLS, cap2ctrl(hvf_state->hvf_caps->vmx_cap_entry,

ERROR: "(foo*)" should be "(foo *)"
#746: FILE: target/i386/hvf/x86hvf.c:85:
+    if (hv_vcpu_write_fpstate(cpu_state->hvf->fd, (void*)xsave, 4096)) {

ERROR: "(foo*)" should be "(foo *)"
#827: FILE: target/i386/hvf/x86hvf.c:167:
+    if (hv_vcpu_read_fpstate(cpu_state->hvf->fd, (void*)xsave, 4096)) {

total: 2 errors, 1 warnings, 996 lines checked

Patch 4/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

5/8 Checking commit 6d357c130379 (arm: Set PSCI to 0.2 for HVF)
6/8 Checking commit ed57a9a142df (hvf: arm: Mark CPU as dirty on reset)
7/8 Checking commit 76a368a42427 (hvf: Add Apple Silicon support)
WARNING: architecture specific defines should be avoided
#47: FILE: accel/hvf/hvf-cpus.c:63:
+#ifdef __aarch64__

WARNING: architecture specific defines should be avoided
#58: FILE: accel/hvf/hvf-cpus.c:351:
+#ifdef __aarch64__

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#113: 
new file mode 100644

WARNING: line over 80 characters
#299: FILE: target/arm/hvf/hvf.c:182:
+    { HV_SYS_REG_CNTV_CTL_EL0, offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].ctl) },

WARNING: line over 80 characters
#300: FILE: target/arm/hvf/hvf.c:183:
+    { HV_SYS_REG_CNTV_CVAL_EL0, offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval) },

WARNING: line over 80 characters
#458: FILE: target/arm/hvf/hvf.c:341:
+        hv_vcpu_set_pending_interrupt(cpu->hvf->fd, HV_INTERRUPT_TYPE_FIQ, true);

WARNING: line over 80 characters
#463: FILE: target/arm/hvf/hvf.c:346:
+        hv_vcpu_set_pending_interrupt(cpu->hvf->fd, HV_INTERRUPT_TYPE_IRQ, true);

WARNING: line over 80 characters
#616: FILE: target/arm/hvf/hvf.c:499:
+                r = hv_vcpu_get_sys_reg(cpu->hvf->fd, HV_SYS_REG_CNTV_CTL_EL0, &ctl);

WARNING: line over 80 characters
#618: FILE: target/arm/hvf/hvf.c:501:
+                r = hv_vcpu_get_sys_reg(cpu->hvf->fd, HV_SYS_REG_CNTV_CVAL_EL0, &cval);

WARNING: line over 80 characters
#651: FILE: target/arm/hvf/hvf.c:534:
+                    /* Set cpu->hvf->sleeping so that we get a SIG_IPI signal. */

ERROR: memory barrier without comment
#653: FILE: target/arm/hvf/hvf.c:536:
+                    smp_mb();

total: 1 errors, 10 warnings, 673 lines checked

Patch 7/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

8/8 Checking commit ae13163aef39 (arm: Add Hypervisor.framework build target)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#47: 
new file mode 100644

total: 0 errors, 1 warnings, 36 lines checked

Patch 8/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20201130030723.78326-1-agraf@csgraf.de/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com