Skip to contentSkip to conversation

Add the Android Emulator hypervisor driver (AEHD) accelerator.

PATCH In review Haitao Shan 4 participants 21 messages Mar 3, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 Add the Android Emulator hypervisor driver (AEHD) accelerator.

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

---
 accel/Kconfig                  |  3 +++
 docs/about/build-platforms.rst |  2 +-
 include/exec/poison.h          |  1 +
 meson.build                    | 16 ++++++++++++++++
 meson_options.txt              |  2 ++
 qemu-options.hx                | 20 ++++++++++----------
 scripts/meson-buildoptions.sh  |  2 ++
 7 files changed, 35 insertions(+), 11 deletions(-)
accel/Kconfig +3 -0
index 8bdedb7d15..187d8f6acf 100644
@@ -16,6 +16,9 @@ config TCG
 config KVM
     bool
 
+config AEHD
+    bool
+
 config XEN
     bool
     select FSDEV_9P if VIRTFS
docs/about/build-platforms.rst +1 -1
index 20b97c3310..184707bd62 100644
@@ -52,7 +52,7 @@ Those hosts are officially supported, with various accelerators:
    * - SPARC
      - tcg
    * - x86
-     - hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
+     - aehd (64 bit only), hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
 
 Other host architectures are not supported. It is possible to build QEMU system
 emulation on an unsupported host architecture using the configure
include/exec/poison.h +1 -0
index 140daa4a85..cb851744d1 100644
@@ -86,6 +86,7 @@
 #pragma GCC poison CONFIG_HVF
 #pragma GCC poison CONFIG_LINUX_USER
 #pragma GCC poison CONFIG_KVM
+#pragma GCC poison CONFIG_AEHD
 #pragma GCC poison CONFIG_SOFTMMU
 #pragma GCC poison CONFIG_WHPX
 #pragma GCC poison CONFIG_XEN
meson.build +16 -0
index 77d2ae87e4..f2b049ceac 100644
@@ -146,6 +146,11 @@ if cpu in ['x86', 'x86_64']
     'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
   }
 endif
+if cpu in ['x86_64']
+  accelerator_targets += {
+    'CONFIG_AEHD': ['i386-softmmu', 'x86_64-softmmu'],
+  }
+endif
 
 modular_tcg = []
 # Darwin does not support references to thread-local variables in modules
@@ -421,6 +426,13 @@ accelerators = []
 if get_option('kvm').allowed() and targetos == 'linux'
   accelerators += 'CONFIG_KVM'
 endif
+if get_option('aehd').allowed() and targetos == 'windows'
+  if get_option('aehd').enabled() and host_machine.cpu() != 'x86_64'
+    error('AEHD requires 64-bit host')
+  else
+    accelerators += 'CONFIG_AEHD'
+  endif
+endif
 if get_option('whpx').allowed() and targetos == 'windows'
   if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
     error('WHPX requires 64-bit host')
@@ -482,6 +494,9 @@ endif
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
   error('KVM not available on this platform')
 endif
+if 'CONFIG_AEHD' not in accelerators and get_option('aehd').enabled()
+  error('AEHD not available on this platform')
+endif
 if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
   error('HVF not available on this platform')
 endif
@@ -3873,6 +3888,7 @@ endif
 summary_info = {}
 if have_system
   summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
+  summary_info += {'AEHD support':      config_all.has_key('CONFIG_AEHD')}
   summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
   summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
   summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
meson_options.txt +2 -0
index fc9447d267..d3e9805b6d 100644
@@ -66,6 +66,8 @@ option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
 
 option('kvm', type: 'feature', value: 'auto',
        description: 'KVM acceleration support')
+option('aehd', type: 'feature', value: 'auto',
+       description: 'AEHD acceleration support')
 option('hax', type: 'feature', value: 'auto',
        description: 'HAX acceleration support')
 option('whpx', type: 'feature', value: 'auto',
qemu-options.hx +10 -10
index beeb4475ba..2870c54a43 100644
@@ -26,7 +26,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "-machine [type=]name[,prop[=value][,...]]\n"
     "                selects emulated machine ('-machine help' for list)\n"
     "                property accel=accel1[:accel2[:...]] selects accelerator\n"
-    "                supported accelerators are kvm, xen, hax, hvf, nvmm, whpx or tcg (default: tcg)\n"
+    "                supported accelerators are kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg (default: tcg)\n"
     "                vmport=on|off|auto controls emulation of vmport (default: auto)\n"
     "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
     "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -59,10 +59,10 @@ SRST
 
     ``accel=accels1[:accels2[:...]]``
         This is used to enable an accelerator. Depending on the target
-        architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available.
-        By default, tcg is used. If there is more than one accelerator
-        specified, the next one is used if the previous one fails to
-        initialize.
+        architecture, kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg can be
+        available. By default, tcg is used. If there is more than one
+        accelerator specified, the next one is used if the previous one
+        fails to initialize.
 
     ``vmport=on|off|auto``
         Enables emulation of VMWare IO port, for vmmouse etc. auto says
@@ -178,7 +178,7 @@ ERST
 
 DEF("accel", HAS_ARG, QEMU_OPTION_accel,
     "-accel [accel=]accelerator[,prop[=value][,...]]\n"
-    "                select accelerator (kvm, xen, hax, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
+    "                select accelerator (kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg; use 'help' for a list)\n"
     "                igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
     "                kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
     "                kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
@@ -190,10 +190,10 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel,
 SRST
 ``-accel name[,prop=value[,...]]``
     This is used to enable an accelerator. Depending on the target
-    architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available. By
-    default, tcg is used. If there is more than one accelerator
-    specified, the next one is used if the previous one fails to
-    initialize.
+    architecture, kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg can be
+    available. By default, tcg is used. If there is more than one
+    accelerator specified, the next one is used if the previous one
+    fails to initialize.
 
     ``igd-passthru=on|off``
         When Xen is in use, this option controls whether Intel
scripts/meson-buildoptions.sh +2 -0
index 009fab1515..f17df07c5d 100644
@@ -289,6 +289,8 @@ _meson_option_parse() {
     --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;;
     --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;;
     --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;;
+    --enable-aehd) printf "%s" -Daehd=enabled ;;
+    --disable-aehd) printf "%s" -Daehd=disabled ;;
     --enable-hax) printf "%s" -Dhax=enabled ;;
     --disable-hax) printf "%s" -Dhax=disabled ;;
     --enable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=true ;;
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
#1 lore raw

PATCH 2/6 Add a few AEHD headers.

aehd-interface.h ---- AEHD DeviceIoControl Definitions
aehd.h ---- AEHD generic header with only aehd_enabled defined.
To be expanded later by following patches.

---
 MAINTAINERS                     |  10 +
 include/sysemu/aehd-interface.h | 878 ++++++++++++++++++++++++++++++++
 include/sysemu/aehd.h           |  25 +
 3 files changed, 913 insertions(+)
 create mode 100644 include/sysemu/aehd-interface.h
 create mode 100644 include/sysemu/aehd.h
MAINTAINERS +10 -0
index 76662969d7..54796da3b4 100644
@@ -526,6 +526,16 @@ S: Maintained
 F: include/sysemu/nvmm.h
 F: target/i386/nvmm/
 
+Guest CPU Cores (AEHD)
+---------------------
+Android Emulator hypervisor driver CPU support
+M: Haitao Shan <[email protected]>
+L: [email protected]
+W: https://github.com/google/android-emulator-hypervisor-driver
+S: Maintained
+F: include/sysemu/aehd-interface.h
+F: include/sysemu/aehd.h
+
 Hosts
 -----
 LINUX
include/sysemu/aehd-interface.h new file +878 -0

878 lines not on this page · raw message

include/sysemu/aehd.h new file +25 -0
new file mode 100644
index 0000000000..7ba4234f60
@@ -0,0 +1,25 @@
+/*
+ * QEMU AEHD support
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_AEHD_H
+#define QEMU_AEHD_H
+
+#ifdef NEED_CPU_H
+# ifdef CONFIG_AEHD
+#  define CONFIG_AEHD_IS_POSSIBLE
+# endif
+#else
+# define CONFIG_AEHD_IS_POSSIBLE
+#endif
+
+#define aehd_enabled()           (0)
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
#2 lore raw

PATCH 3/6 Add the aehd-apic device type.

In reply to Haitao Shan

The aehd-apic device type represents the AEHD in kernel APIC. The irqchips should be always in kernel when AEHD is used.

---
 MAINTAINERS                  |   2 +
 hw/i386/aehd/apic.c          | 204 +++++++++++++++++++++++
 hw/i386/aehd/meson.build     |   4 +
 hw/i386/meson.build          |   1 +
 include/hw/core/cpu.h        |   7 +
 include/sysemu/aehd.h        |  52 ++++++
 target/i386/aehd/aehd-all.c  | 315 +++++++++++++++++++++++++++++++++++
 target/i386/aehd/aehd.c      |  88 ++++++++++
 target/i386/aehd/aehd_int.h  |  50 ++++++
 target/i386/aehd/meson.build |   4 +
 target/i386/cpu-sysemu.c     |   3 +
 target/i386/meson.build      |   1 +
 12 files changed, 731 insertions(+)
 create mode 100644 hw/i386/aehd/apic.c
 create mode 100644 hw/i386/aehd/meson.build
 create mode 100644 target/i386/aehd/aehd-all.c
 create mode 100644 target/i386/aehd/aehd.c
 create mode 100644 target/i386/aehd/aehd_int.h
 create mode 100644 target/i386/aehd/meson.build
MAINTAINERS +2 -0
index 54796da3b4..3db165dd9a 100644
@@ -535,6 +535,8 @@ W: https://github.com/google/android-emulator-hypervisor-driver
 S: Maintained
 F: include/sysemu/aehd-interface.h
 F: include/sysemu/aehd.h
+F: target/i386/aehd/
+F: hw/i386/aehd/
 
 Hosts
 -----
hw/i386/aehd/apic.c new file +204 -0

204 lines not on this page · raw message

hw/i386/aehd/meson.build new file +4 -0
new file mode 100644
index 0000000000..1749860954
@@ -0,0 +1,4 @@
+i386_aehd_ss = ss.source_set()
+i386_aehd_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c'))
+
+i386_ss.add_all(when: 'CONFIG_AEHD', if_true: i386_aehd_ss)
hw/i386/meson.build +1 -0
index 213e2e82b3..eaf61b05fc 100644
@@ -30,6 +30,7 @@ i386_ss.add(when: 'CONFIG_X86_FW_OVMF', if_true: files('pc_sysfw_ovmf.c'),
                                         if_false: files('pc_sysfw_ovmf-stubs.c'))
 
 subdir('kvm')
+subdir('aehd')
 subdir('xen')
 
 i386_ss.add_all(xenpv_ss)
include/hw/core/cpu.h +7 -0
index fb5d9667ca..5ed0600504 100644
@@ -400,6 +400,13 @@ struct CPUState {
     uint32_t kvm_fetch_index;
     uint64_t dirty_pages;
 
+    /* Only used in AEHD */
+#ifdef _WIN32
+    HANDLE aehd_fd;
+    struct AEHDState *aehd_state;
+    struct aehd_run *aehd_run;
+#endif
+
     /* Use by accel-block: CPU is executing an ioctl() */
     QemuLockCnt in_ioctl_lock;
 
include/sysemu/aehd.h +52 -0

61 lines not on this page · raw message

target/i386/aehd/aehd-all.c new file +315 -0

315 lines not on this page · raw message

target/i386/aehd/aehd.c new file +88 -0

88 lines not on this page · raw message

target/i386/aehd/aehd_int.h new file +50 -0

50 lines not on this page · raw message

target/i386/aehd/meson.build new file +4 -0
new file mode 100644
index 0000000000..50880712db
@@ -0,0 +1,4 @@
+i386_softmmu_ss.add(when: 'CONFIG_AEHD', if_true: files(
+  'aehd-all.c',
+  'aehd.c',
+))
target/i386/cpu-sysemu.c +3 -0
index 28115edf44..4d80b58346 100644
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "sysemu/xen.h"
 #include "sysemu/whpx.h"
+#include "sysemu/aehd.h"
 #include "kvm/kvm_i386.h"
 #include "qapi/error.h"
 #include "qapi/qapi-visit-run-state.h"
@@ -258,6 +259,8 @@ APICCommonClass *apic_get_class(Error **errp)
             return NULL;
         }
         apic_type = "kvm-apic";
+    } else if (aehd_enabled()) {
+        apic_type = "aehd-apic";
     } else if (xen_enabled()) {
         apic_type = "xen-apic";
     } else if (whpx_apic_in_platform()) {
target/i386/meson.build +1 -0
index ae38dc9563..76a90b73d5 100644
@@ -25,6 +25,7 @@ i386_softmmu_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files
 i386_user_ss = ss.source_set()
 
 subdir('kvm')
+subdir('aehd')
 subdir('hax')
 subdir('whpx')
 subdir('nvmm')
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
#3 lore raw

Re: [PATCH 3/6] Add the aehd-apic device type.

Hi Haitao,

Quoted 31 lines · Haitao Shan

The aehd-apic device type represents the AEHD in kernel APIC. The irqchips should be always in kernel when AEHD is used.

---
  MAINTAINERS                  |   2 +
  hw/i386/aehd/apic.c          | 204 +++++++++++++++++++++++
  hw/i386/aehd/meson.build     |   4 +
  hw/i386/meson.build          |   1 +
  include/hw/core/cpu.h        |   7 +
  include/sysemu/aehd.h        |  52 ++++++
  target/i386/aehd/aehd-all.c  | 315 +++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd.c      |  88 ++++++++++
  target/i386/aehd/aehd_int.h  |  50 ++++++
  target/i386/aehd/meson.build |   4 +
  target/i386/cpu-sysemu.c     |   3 +
  target/i386/meson.build      |   1 +
  12 files changed, 731 insertions(+)

create mode 100644 hw/i386/aehd/apic.c
create mode 100644 hw/i386/aehd/meson.build
create mode 100644 target/i386/aehd/aehd-all.c
create mode 100644 target/i386/aehd/aehd.c
create mode 100644 target/i386/aehd/aehd_int.h
create mode 100644 target/i386/aehd/meson.build

include/hw/core/cpu.h +0 -0
index fb5d9667ca..5ed0600504 100644

include/hw/core/cpu.h struct CPUState { · line 408

Quoted 9 lines
include/hw/core/cpu.h +6 -0
@@ -400,6 +400,13 @@ struct CPUState {
      uint32_t kvm_fetch_index;
      uint64_t dirty_pages;
 
+    /* Only used in AEHD */
+#ifdef _WIN32
+    HANDLE aehd_fd;
+    struct AEHDState *aehd_state;
+    struct aehd_run *aehd_run;
+#endif

We are difficultly trying to make this structure generic since 2 years now. Since AEHD won't make it to the 8.0 release, I'd rather take the time to get this part well done.

IIRC we ought to use a AccelCPUState pointer here, allocated by AccelCPUClass::cpu_instance_init()

Quoted 70 lines
include/hw/core/cpu.h +0 -0
      /* Use by accel-block: CPU is executing an ioctl() */
      QemuLockCnt in_ioctl_lock;
 
include/sysemu/aehd.h +52 -0
index 7ba4234f60..87fa2f8362 100644
@@ -14,6 +14,12 @@
  #ifndef QEMU_AEHD_H
  #define QEMU_AEHD_H
 
+#include "qemu/queue.h"
+#include "qemu/accel.h"
+#include "hw/core/cpu.h"
+#include "exec/memattrs.h"
+#include "hw/irq.h"
+
  #ifdef NEED_CPU_H
  # ifdef CONFIG_AEHD
  #  define CONFIG_AEHD_IS_POSSIBLE
@@ -23,3 +29,49 @@
  #endif
 
  #define aehd_enabled()           (0)
+
+struct aehd_run;
+struct aehd_lapic_state;
+struct aehd_irq_routing_entry;
+
+struct AEHDState;
+
+#define TYPE_AEHD_ACCEL ACCEL_CLASS_NAME("aehd")
+typedef struct AEHDState AEHDState;
+DECLARE_INSTANCE_CHECKER(AEHDState, AEHD_STATE,
+                         TYPE_AEHD_ACCEL)
+
+extern AEHDState *aehd_state;
+
+#ifdef NEED_CPU_H
+#include "cpu.h"
+
+/* internal API */
+
+int aehd_ioctl(AEHDState *s, int type, void *input, size_t input_size,
+               void *output, size_t output_size);
+int aehd_vm_ioctl(AEHDState *s, int type, void *input, size_t input_size,
+                  void *output, size_t output_size);
+int aehd_vcpu_ioctl(CPUState *cpu, int type, void *input, size_t input_size,
+                    void *output, size_t output_size);
+
+/* Arch specific hooks */
+
+/* Notify arch about newly added MSI routes */
+int aehd_arch_add_msi_route_post(struct aehd_irq_routing_entry *route,
+                                 int vector, PCIDevice *dev);
+/* Notify arch about released MSI routes */
+int aehd_arch_release_virq_post(int virq);
+
+int aehd_set_irq(AEHDState *s, int irq, int level);
+int aehd_irqchip_send_msi(AEHDState *s, MSIMessage msg);
+
+void aehd_put_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
+void aehd_get_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
+
+#endif /* NEED_CPU_H */
+
+void aehd_irqchip_commit_routes(AEHDState *s);
+void aehd_irqchip_release_virq(AEHDState *s, int virq);
+
+#endif
#4 lore raw

Re: [PATCH 3/6] Add the aehd-apic device type.

Quoted 38 lines · Philippe Mathieu-Daudé

Hi Haitao,

Quoted 34 lines · Haitao Shan

The aehd-apic device type represents the AEHD in kernel APIC. The irqchips should be always in kernel when AEHD is used.

---
  MAINTAINERS                  |   2 +
  hw/i386/aehd/apic.c          | 204 +++++++++++++++++++++++
  hw/i386/aehd/meson.build     |   4 +
  hw/i386/meson.build          |   1 +
  include/hw/core/cpu.h        |   7 +
  include/sysemu/aehd.h        |  52 ++++++
  target/i386/aehd/aehd-all.c  | 315 +++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd.c      |  88 ++++++++++
  target/i386/aehd/aehd_int.h  |  50 ++++++
  target/i386/aehd/meson.build |   4 +
  target/i386/cpu-sysemu.c     |   3 +
  target/i386/meson.build      |   1 +
  12 files changed, 731 insertions(+)

create mode 100644 hw/i386/aehd/apic.c
create mode 100644 hw/i386/aehd/meson.build
create mode 100644 target/i386/aehd/aehd-all.c
create mode 100644 target/i386/aehd/aehd.c
create mode 100644 target/i386/aehd/aehd_int.h
create mode 100644 target/i386/aehd/meson.build

include/hw/core/cpu.h +0 -0
index fb5d9667ca..5ed0600504 100644
@@ -400,6 +400,13 @@ struct CPUState {
      uint32_t kvm_fetch_index;
      uint64_t dirty_pages;
 
Quoted 10 lines

include/hw/core/cpu.h struct CPUState { · line 408

Quoted 6 lines
include/hw/core/cpu.h +6 -0
+    /* Only used in AEHD */
+#ifdef _WIN32
+    HANDLE aehd_fd;
+    struct AEHDState *aehd_state;
+    struct aehd_run *aehd_run;
+#endif

We are difficultly trying to make this structure generic since 2 years now. Since AEHD won't make it to the 8.0 release, I'd rather take the time to get this part well done.

Can I know when 8.0 will be released? I don't aim to push my patches as soon as possible. But understanding the timeline can be helpful.

Quoted 3 lines

IIRC we ought to use a AccelCPUState pointer here, allocated by AccelCPUClass::cpu_instance_init()

I would agree. Will this be addressed when 8.0 is released?

Quoted 72 lines
Quoted 71 lines
include/hw/core/cpu.h +0 -0
      /* Use by accel-block: CPU is executing an ioctl() */
      QemuLockCnt in_ioctl_lock;
 
include/sysemu/aehd.h +52 -0
index 7ba4234f60..87fa2f8362 100644
@@ -14,6 +14,12 @@
  #ifndef QEMU_AEHD_H
  #define QEMU_AEHD_H
 
+#include "qemu/queue.h"
+#include "qemu/accel.h"
+#include "hw/core/cpu.h"
+#include "exec/memattrs.h"
+#include "hw/irq.h"
+
  #ifdef NEED_CPU_H
  # ifdef CONFIG_AEHD
  #  define CONFIG_AEHD_IS_POSSIBLE
@@ -23,3 +29,49 @@
  #endif
 
  #define aehd_enabled()           (0)
+
+struct aehd_run;
+struct aehd_lapic_state;
+struct aehd_irq_routing_entry;
+
+struct AEHDState;
+
+#define TYPE_AEHD_ACCEL ACCEL_CLASS_NAME("aehd")
+typedef struct AEHDState AEHDState;
+DECLARE_INSTANCE_CHECKER(AEHDState, AEHD_STATE,
+                         TYPE_AEHD_ACCEL)
+
+extern AEHDState *aehd_state;
+
+#ifdef NEED_CPU_H
+#include "cpu.h"
+
+/* internal API */
+
+int aehd_ioctl(AEHDState *s, int type, void *input, size_t input_size,
+               void *output, size_t output_size);
+int aehd_vm_ioctl(AEHDState *s, int type, void *input, size_t input_size,
+                  void *output, size_t output_size);
+int aehd_vcpu_ioctl(CPUState *cpu, int type, void *input, size_t input_size,
+                    void *output, size_t output_size);
+
+/* Arch specific hooks */
+
+/* Notify arch about newly added MSI routes */
+int aehd_arch_add_msi_route_post(struct aehd_irq_routing_entry *route,
+                                 int vector, PCIDevice *dev);
+/* Notify arch about released MSI routes */
+int aehd_arch_release_virq_post(int virq);
+
+int aehd_set_irq(AEHDState *s, int irq, int level);
+int aehd_irqchip_send_msi(AEHDState *s, MSIMessage msg);
+
+void aehd_put_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
+void aehd_get_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
+
+#endif /* NEED_CPU_H */
+
+void aehd_irqchip_commit_routes(AEHDState *s);
+void aehd_irqchip_release_virq(AEHDState *s, int virq);
+
+#endif
Signature · 1 line
Haitao @Google
#5 lore raw

PATCH 4/6 Add the aehd-ioapic device type.

In reply to Haitao Shan

The aehd-ioapic device type represents the AEHD in kernel IO-APIC. The irqchips should be always in kernel when AEHD is used.

---
 hw/i386/aehd/ioapic.c       | 164 ++++++++++++++++++++++++++++++++++++
 hw/i386/aehd/meson.build    |   1 +
 hw/i386/pc.c                |   3 +
 hw/i386/x86.c               |   3 +
 include/hw/intc/ioapic.h    |   1 +
 include/sysemu/aehd.h       |   4 +
 target/i386/aehd/aehd-all.c |  14 +++
 7 files changed, 190 insertions(+)
 create mode 100644 hw/i386/aehd/ioapic.c
hw/i386/aehd/ioapic.c new file +164 -0
new file mode 100644
index 0000000000..62ffb0172f
@@ -0,0 +1,164 @@
+/*
+ * AEHD in-kernel IOPIC support
+ *
+ * Copyright (c) 2011 Siemens AG
+ *
+ * Authors:
+ *  Jan Kiszka          <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL version 2.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/monitor.h"
+#include "hw/i386/pc.h"
+#include "hw/qdev-properties.h"
+#include "hw/intc/ioapic_internal.h"
+#include "sysemu/aehd.h"
+#include "sysemu/aehd-interface.h"
+
+/* PC Utility function */
+void aehd_pc_setup_irq_routing(bool pci_enabled)
+{
+    AEHDState *s = aehd_state;
+    int i;
+
+    for (i = 0; i < 8; ++i) {
+        if (i == 2) {
+            continue;
+        }
+        aehd_irqchip_add_irq_route(s, i, AEHD_IRQCHIP_PIC_MASTER, i);
+    }
+    for (i = 8; i < 16; ++i) {
+        aehd_irqchip_add_irq_route(s, i, AEHD_IRQCHIP_PIC_SLAVE, i - 8);
+    }
+    if (pci_enabled) {
+        for (i = 0; i < 24; ++i) {
+            if (i == 0) {
+                aehd_irqchip_add_irq_route(s, i, AEHD_IRQCHIP_IOAPIC, 2);
+            } else if (i != 2) {
+                aehd_irqchip_add_irq_route(s, i, AEHD_IRQCHIP_IOAPIC, i);
+            }
+        }
+    }
+    aehd_irqchip_commit_routes(s);
+}
+
+typedef struct AEHDIOAPICState AEHDIOAPICState;
+
+struct AEHDIOAPICState {
+    IOAPICCommonState ioapic;
+    uint32_t aehd_gsi_base;
+};
+
+static void aehd_ioapic_get(IOAPICCommonState *s)
+{
+    struct aehd_irqchip chip;
+    struct aehd_ioapic_state *aioapic;
+    int ret, i;
+
+    chip.chip_id = AEHD_IRQCHIP_IOAPIC;
+    ret = aehd_vm_ioctl(aehd_state, AEHD_GET_IRQCHIP, &chip, sizeof(chip),
+                        &chip, sizeof(chip));
+    if (ret < 0) {
+        fprintf(stderr, "AEHD_GET_IRQCHIP failed: %s\n", strerror(ret));
+        abort();
+    }
+
+    aioapic = &chip.chip.ioapic;
+
+    s->id = aioapic->id;
+    s->ioregsel = aioapic->ioregsel;
+    s->irr = aioapic->irr;
+    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
+        s->ioredtbl[i] = aioapic->redirtbl[i].bits;
+    }
+}
+
+static void aehd_ioapic_put(IOAPICCommonState *s)
+{
+    struct aehd_irqchip chip;
+    struct aehd_ioapic_state *aioapic;
+    int ret, i;
+
+    chip.chip_id = AEHD_IRQCHIP_IOAPIC;
+    aioapic = &chip.chip.ioapic;
+
+    aioapic->id = s->id;
+    aioapic->ioregsel = s->ioregsel;
+    aioapic->base_address = s->busdev.mmio[0].addr;
+    aioapic->irr = s->irr;
+    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
+        aioapic->redirtbl[i].bits = s->ioredtbl[i];
+    }
+
+    ret = aehd_vm_ioctl(aehd_state, AEHD_SET_IRQCHIP,
+                        &chip, sizeof(chip), NULL, 0);
+    if (ret < 0) {
+        fprintf(stderr, "AEHD_GET_IRQCHIP failed: %s\n", strerror(ret));
+        abort();
+    }
+}
+
+static void aehd_ioapic_reset(DeviceState *dev)
+{
+    IOAPICCommonState *s = IOAPIC_COMMON(dev);
+
+    ioapic_reset_common(dev);
+    aehd_ioapic_put(s);
+}
+
+static void aehd_ioapic_set_irq(void *opaque, int irq, int level)
+{
+    AEHDIOAPICState *s = opaque;
+
+    aehd_set_irq(aehd_state, s->aehd_gsi_base + irq, level);
+}
+
+static void aehd_ioapic_realize(DeviceState *dev, Error **errp)
+{
+    IOAPICCommonState *s = IOAPIC_COMMON(dev);
+
+    memory_region_init_io(&s->io_memory, OBJECT(dev), NULL, NULL,
+                          "aehd-ioapic", 0x1000);
+
+    /*
+     * AEHD ioapic only supports 0x11 now. This will only be used when
+     * we want to dump ioapic version.
+     */
+    s->version = 0x11;
+
+    qdev_init_gpio_in(dev, aehd_ioapic_set_irq, IOAPIC_NUM_PINS);
+}
+
+static Property aehd_ioapic_properties[] = {
+    DEFINE_PROP_UINT32("gsi_base", AEHDIOAPICState, aehd_gsi_base, 0),
+    DEFINE_PROP_END_OF_LIST()
+};
+
+static void aehd_ioapic_class_init(ObjectClass *klass, void *data)
+{
+    IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    k->realize   = aehd_ioapic_realize;
+    k->pre_save  = aehd_ioapic_get;
+    k->post_load = aehd_ioapic_put;
+    dc->reset    = aehd_ioapic_reset;
+    device_class_set_props(dc, aehd_ioapic_properties);
+}
+
+static const TypeInfo aehd_ioapic_info = {
+    .name  = TYPE_AEHD_IOAPIC,
+    .parent = TYPE_IOAPIC_COMMON,
+    .instance_size = sizeof(AEHDIOAPICState),
+    .class_init = aehd_ioapic_class_init,
+};
+
+static void aehd_ioapic_register_types(void)
+{
+    type_register_static(&aehd_ioapic_info);
+}
+
+type_init(aehd_ioapic_register_types)
hw/i386/aehd/meson.build +1 -0
index 1749860954..259c9f66f7 100644
@@ -1,4 +1,5 @@
 i386_aehd_ss = ss.source_set()
 i386_aehd_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c'))
+i386_aehd_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))
 
 i386_ss.add_all(when: 'CONFIG_AEHD', if_true: i386_aehd_ss)
hw/i386/pc.c +3 -0
index 992951c107..59513a5c38 100644
@@ -58,6 +58,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/numa.h"
 #include "sysemu/kvm.h"
+#include "sysemu/aehd.h"
 #include "sysemu/xen.h"
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
@@ -405,6 +406,8 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled)
     s = g_new0(GSIState, 1);
     if (kvm_ioapic_in_kernel()) {
         kvm_pc_setup_irq_routing(pci_enabled);
+    } else if (aehd_enabled()) {
+        aehd_pc_setup_irq_routing(pci_enabled);
     }
     *irqs = qemu_allocate_irqs(gsi_handler, s, IOAPIC_NUM_PINS);
 
hw/i386/x86.c +3 -0
index c44846f47b..ffc6f97ce0 100644
@@ -34,6 +34,7 @@
 #include "qapi/visitor.h"
 #include "sysemu/qtest.h"
 #include "sysemu/whpx.h"
+#include "sysemu/aehd.h"
 #include "sysemu/numa.h"
 #include "sysemu/replay.h"
 #include "sysemu/reset.h"
@@ -628,6 +629,8 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
     assert(parent_name);
     if (kvm_ioapic_in_kernel()) {
         dev = qdev_new(TYPE_KVM_IOAPIC);
+    } else if (aehd_enabled()) {
+        dev = qdev_new(TYPE_AEHD_IOAPIC);
     } else {
         dev = qdev_new(TYPE_IOAPIC);
     }
include/hw/intc/ioapic.h +1 -0
index aa122e25e3..6f46543e24 100644
@@ -26,6 +26,7 @@
 #define IO_APIC_SECONDARY_IRQBASE 24 /* primary 0 -> 23, secondary 24 -> 47 */
 
 #define TYPE_KVM_IOAPIC "kvm-ioapic"
+#define TYPE_AEHD_IOAPIC "aehd-ioapic"
 #define TYPE_IOAPIC "ioapic"
 
 void ioapic_eoi_broadcast(int vector);
include/sysemu/aehd.h +4 -0
index 87fa2f8362..534dd95e3c 100644
@@ -66,6 +66,8 @@ int aehd_arch_release_virq_post(int virq);
 int aehd_set_irq(AEHDState *s, int irq, int level);
 int aehd_irqchip_send_msi(AEHDState *s, MSIMessage msg);
 
+void aehd_irqchip_add_irq_route(AEHDState *s, int gsi, int irqchip, int pin);
+
 void aehd_put_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
 void aehd_get_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
 
@@ -74,4 +76,6 @@ void aehd_get_apic_state(DeviceState *d, struct aehd_lapic_state *kapic);
 void aehd_irqchip_commit_routes(AEHDState *s);
 void aehd_irqchip_release_virq(AEHDState *s, int virq);
 
+void aehd_pc_setup_irq_routing(bool pci_enabled);
+
 #endif
target/i386/aehd/aehd-all.c +14 -0
index f2eb80ecde..4c6a670cb7 100644
@@ -124,6 +124,20 @@ static void aehd_add_routing_entry(AEHDState *s,
     set_gsi(s, entry->gsi);
 }
 
+void aehd_irqchip_add_irq_route(AEHDState *s, int irq, int irqchip, int pin)
+{
+    struct aehd_irq_routing_entry e = {};
+
+    assert(pin < s->gsi_count);
+
+    e.gsi = irq;
+    e.type = AEHD_IRQ_ROUTING_IRQCHIP;
+    e.flags = 0;
+    e.u.irqchip.irqchip = irqchip;
+    e.u.irqchip.pin = pin;
+    aehd_add_routing_entry(s, &e);
+}
+
 void aehd_irqchip_release_virq(AEHDState *s, int virq)
 {
     struct aehd_irq_routing_entry *e;
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
#6 lore raw

Re: [PATCH 4/6] Add the aehd-ioapic device type.

Quoted 16 lines · Haitao Shan

The aehd-ioapic device type represents the AEHD in kernel IO-APIC. The irqchips should be always in kernel when AEHD is used.

---
  hw/i386/aehd/ioapic.c       | 164 ++++++++++++++++++++++++++++++++++++
  hw/i386/aehd/meson.build    |   1 +
  hw/i386/pc.c                |   3 +
  hw/i386/x86.c               |   3 +
  include/hw/intc/ioapic.h    |   1 +
  include/sysemu/aehd.h       |   4 +
  target/i386/aehd/aehd-all.c |  14 +++
  7 files changed, 190 insertions(+)

create mode 100644 hw/i386/aehd/ioapic.c

hw/i386/aehd/ioapic.c line 154

Quoted 3 lines
hw/i386/aehd/ioapic.c new file +3 -0
+static const TypeInfo aehd_ioapic_info = {
+    .name  = TYPE_AEHD_IOAPIC,
+    .parent = TYPE_IOAPIC_COMMON,

Instead of duplicating TYPE_KVM_IOAPIC, as a first step we should extract the common code in an abstract TYPE_INKERNEL_IOAPIC object, then TYPE_AEHD_IOAPIC inherits it.

Quoted 3 lines
hw/i386/aehd/ioapic.c new file +3 -0
+    .instance_size = sizeof(AEHDIOAPICState),
+    .class_init = aehd_ioapic_class_init,
+};
#7 lore raw

PATCH 5/6 Add the aehd-i8259 device type.

In reply to Haitao Shan

The aehd-i8259 device type represents the AEHD in kernel PICs. The irqchips should be always in kernel when AEHD is used.

---
 hw/i386/aehd/i8259.c     | 165 +++++++++++++++++++++++++++++++++++++++
 hw/i386/aehd/meson.build |   1 +
 hw/i386/pc.c             |   2 +
 include/hw/intc/i8259.h  |   1 +
 4 files changed, 169 insertions(+)
 create mode 100644 hw/i386/aehd/i8259.c
hw/i386/aehd/i8259.c new file +165 -0
new file mode 100644
index 0000000000..9a18e824dc
@@ -0,0 +1,165 @@
+/*
+ * AEHD in-kernel PIC (i8259) support
+ *
+ * Copyright (c) 2011 Siemens AG
+ *
+ * Authors:
+ *  Jan Kiszka          <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL version 2.
+ * See the COPYING file in the top-level directory.
+ */
+#include "qemu/osdep.h"
+#include "hw/isa/i8259_internal.h"
+#include "hw/i386/apic_internal.h"
+#include "sysemu/aehd.h"
+#include "sysemu/aehd-interface.h"
+
+#define TYPE_AEHD_I8259 "aehd-i8259"
+#define AEHD_PIC_CLASS(class) \
+    OBJECT_CLASS_CHECK(AEHDPICClass, (class), TYPE_AEHD_I8259)
+#define AEHD_PIC_GET_CLASS(obj) \
+    OBJECT_GET_CLASS(AEHDPICClass, (obj), TYPE_AEHD_I8259)
+
+/**
+ * AEHDPICClass:
+ * @parent_realize: The parent's realizefn.
+ */
+typedef struct AEHDPICClass {
+    PICCommonClass parent_class;
+
+    DeviceRealize parent_realize;
+} AEHDPICClass;
+
+static void aehd_pic_get(PICCommonState *s)
+{
+    struct aehd_irqchip chip;
+    struct aehd_pic_state *aepic;
+    int ret;
+
+    chip.chip_id = s->master ? AEHD_IRQCHIP_PIC_MASTER : AEHD_IRQCHIP_PIC_SLAVE;
+    ret = aehd_vm_ioctl(aehd_state, AEHD_GET_IRQCHIP, &chip, sizeof(chip),
+                        &chip, sizeof(chip));
+    if (ret < 0) {
+        fprintf(stderr, "AEHD_GET_IRQCHIP failed: %s\n", strerror(ret));
+        abort();
+    }
+
+    aepic = &chip.chip.pic;
+
+    s->last_irr = aepic->last_irr;
+    s->irr = aepic->irr;
+    s->imr = aepic->imr;
+    s->isr = aepic->isr;
+    s->priority_add = aepic->priority_add;
+    s->irq_base = aepic->irq_base;
+    s->read_reg_select = aepic->read_reg_select;
+    s->poll = aepic->poll;
+    s->special_mask = aepic->special_mask;
+    s->init_state = aepic->init_state;
+    s->auto_eoi = aepic->auto_eoi;
+    s->rotate_on_auto_eoi = aepic->rotate_on_auto_eoi;
+    s->special_fully_nested_mode = aepic->special_fully_nested_mode;
+    s->init4 = aepic->init4;
+    s->elcr = aepic->elcr;
+    s->elcr_mask = aepic->elcr_mask;
+}
+
+static void aehd_pic_put(PICCommonState *s)
+{
+    struct aehd_irqchip chip;
+    struct aehd_pic_state *aepic;
+    int ret;
+
+    chip.chip_id = s->master ? AEHD_IRQCHIP_PIC_MASTER : AEHD_IRQCHIP_PIC_SLAVE;
+
+    aepic = &chip.chip.pic;
+
+    aepic->last_irr = s->last_irr;
+    aepic->irr = s->irr;
+    aepic->imr = s->imr;
+    aepic->isr = s->isr;
+    aepic->priority_add = s->priority_add;
+    aepic->irq_base = s->irq_base;
+    aepic->read_reg_select = s->read_reg_select;
+    aepic->poll = s->poll;
+    aepic->special_mask = s->special_mask;
+    aepic->init_state = s->init_state;
+    aepic->auto_eoi = s->auto_eoi;
+    aepic->rotate_on_auto_eoi = s->rotate_on_auto_eoi;
+    aepic->special_fully_nested_mode = s->special_fully_nested_mode;
+    aepic->init4 = s->init4;
+    aepic->elcr = s->elcr;
+    aepic->elcr_mask = s->elcr_mask;
+
+    ret = aehd_vm_ioctl(aehd_state, AEHD_SET_IRQCHIP,
+                        &chip, sizeof(chip), NULL, 0);
+    if (ret < 0) {
+        fprintf(stderr, "AEHD_GET_IRQCHIP failed: %s\n", strerror(ret));
+        abort();
+    }
+}
+
+static void aehd_pic_reset(DeviceState *dev)
+{
+    PICCommonState *s = PIC_COMMON(dev);
+
+    s->elcr = 0;
+    pic_reset_common(s);
+
+    aehd_pic_put(s);
+}
+
+static void aehd_pic_set_irq(void *opaque, int irq, int level)
+{
+    pic_stat_update_irq(irq, level);
+    aehd_set_irq(aehd_state, irq, level);
+}
+
+static void aehd_pic_realize(DeviceState *dev, Error **errp)
+{
+    PICCommonState *s = PIC_COMMON(dev);
+    AEHDPICClass *kpc = AEHD_PIC_GET_CLASS(dev);
+
+    memory_region_init_io(&s->base_io, OBJECT(dev), NULL, NULL, "aehd-pic", 2);
+    memory_region_init_io(&s->elcr_io, OBJECT(dev), NULL, NULL, "aehd-elcr", 1);
+
+
+    kpc->parent_realize(dev, errp);
+}
+
+qemu_irq *aehd_i8259_init(ISABus *bus)
+{
+    i8259_init_chip(TYPE_AEHD_I8259, bus, true);
+    i8259_init_chip(TYPE_AEHD_I8259, bus, false);
+
+    return qemu_allocate_irqs(aehd_pic_set_irq, NULL, ISA_NUM_IRQS);
+}
+
+static void aehd_i8259_class_init(ObjectClass *klass, void *data)
+{
+    AEHDPICClass *kpc = AEHD_PIC_CLASS(klass);
+    PICCommonClass *k = PIC_COMMON_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->reset     = aehd_pic_reset;
+    kpc->parent_realize = dc->realize;
+    dc->realize   = aehd_pic_realize;
+    k->pre_save   = aehd_pic_get;
+    k->post_load  = aehd_pic_put;
+}
+
+static const TypeInfo aehd_i8259_info = {
+    .name = TYPE_AEHD_I8259,
+    .parent = TYPE_PIC_COMMON,
+    .instance_size = sizeof(PICCommonState),
+    .class_init = aehd_i8259_class_init,
+    .class_size = sizeof(AEHDPICClass),
+};
+
+static void aehd_pic_register_types(void)
+{
+    type_register_static(&aehd_i8259_info);
+}
+
+type_init(aehd_pic_register_types)
hw/i386/aehd/meson.build +1 -0
index 259c9f66f7..90c9a3e2b6 100644
@@ -1,5 +1,6 @@
 i386_aehd_ss = ss.source_set()
 i386_aehd_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c'))
+i386_aehd_ss.add(when: 'CONFIG_I8259', if_true: files('i8259.c'))
 i386_aehd_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))
 
 i386_ss.add_all(when: 'CONFIG_AEHD', if_true: i386_aehd_ss)
hw/i386/pc.c +2 -0
index 59513a5c38..3b45f75fbd 100644
@@ -1356,6 +1356,8 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs)
 
     if (kvm_pic_in_kernel()) {
         i8259 = kvm_i8259_init(isa_bus);
+    } else if (aehd_enabled()) {
+        i8259 = aehd_i8259_init(isa_bus);
     } else if (xen_enabled()) {
         i8259 = xen_interrupt_controller_init();
     } else {
include/hw/intc/i8259.h +1 -0
index c412575775..5ce85ed590 100644
@@ -14,6 +14,7 @@ extern PICCommonState *isa_pic;
  */
 qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq_in);
 qemu_irq *kvm_i8259_init(ISABus *bus);
+qemu_irq *aehd_i8259_init(ISABus *bus);
 int pic_get_output(PICCommonState *s);
 int pic_read_irq(PICCommonState *s);
 
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
#8 lore raw

Re: [PATCH 5/6] Add the aehd-i8259 device type.

Quoted 30 lines · Haitao Shan

The aehd-i8259 device type represents the AEHD in kernel PICs. The irqchips should be always in kernel when AEHD is used.

---
  hw/i386/aehd/i8259.c     | 165 +++++++++++++++++++++++++++++++++++++++
  hw/i386/aehd/meson.build |   1 +
  hw/i386/pc.c             |   2 +
  include/hw/intc/i8259.h  |   1 +
  4 files changed, 169 insertions(+)

create mode 100644 hw/i386/aehd/i8259.c

hw/i386/aehd/i8259.c new file +17 -0
+static void aehd_pic_reset(DeviceState *dev)
+{
+    PICCommonState *s = PIC_COMMON(dev);
+
+    s->elcr = 0;
+    pic_reset_common(s);
+
+    aehd_pic_put(s);
+}
+
+static void aehd_pic_set_irq(void *opaque, int irq, int level)
+{
+    pic_stat_update_irq(irq, level);
+    aehd_set_irq(aehd_state, irq, level);
+}
+
+static void aehd_pic_realize(DeviceState *dev, Error **errp)

hw/i386/aehd/i8259.c line 129

Quoted 10 lines
hw/i386/aehd/i8259.c new file +10 -0
+{
+    PICCommonState *s = PIC_COMMON(dev);
+    AEHDPICClass *kpc = AEHD_PIC_GET_CLASS(dev);
+
+    memory_region_init_io(&s->base_io, OBJECT(dev), NULL, NULL, "aehd-pic", 2);
+    memory_region_init_io(&s->elcr_io, OBJECT(dev), NULL, NULL, "aehd-elcr", 1);
+
+
+    kpc->parent_realize(dev, errp);
+}

Again, this should be drastically simplified by adding a some fields & handlers to the abstract TYPE_INKERNEL_IOAPIC class:

struct InKernelAPICCommonClass {
    APICCommonClass parent_class;

    void (*pic_put)(PICCommonState *s)
    ...
};

Eventually this could even belong to APICCommonClass, but I haven't checked in detail.

#9 lore raw

Re: [PATCH 5/6] Add the aehd-i8259 device type.

Quoted 53 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Haitao Shan

The aehd-i8259 device type represents the AEHD in kernel PICs. The irqchips should be always in kernel when AEHD is used.

---
  hw/i386/aehd/i8259.c     | 165 +++++++++++++++++++++++++++++++++++++++
  hw/i386/aehd/meson.build |   1 +
  hw/i386/pc.c             |   2 +
  include/hw/intc/i8259.h  |   1 +
  4 files changed, 169 insertions(+)

create mode 100644 hw/i386/aehd/i8259.c

hw/i386/aehd/i8259.c new file +17 -0
+static void aehd_pic_reset(DeviceState *dev)
+{
+    PICCommonState *s = PIC_COMMON(dev);
+
+    s->elcr = 0;
+    pic_reset_common(s);
+
+    aehd_pic_put(s);
+}
+
+static void aehd_pic_set_irq(void *opaque, int irq, int level)
+{
+    pic_stat_update_irq(irq, level);
+    aehd_set_irq(aehd_state, irq, level);
+}
+
+static void aehd_pic_realize(DeviceState *dev, Error **errp)

hw/i386/aehd/i8259.c line 129

Quoted 10 lines
hw/i386/aehd/i8259.c new file +10 -0
+{
+    PICCommonState *s = PIC_COMMON(dev);
+    AEHDPICClass *kpc = AEHD_PIC_GET_CLASS(dev);
+
+    memory_region_init_io(&s->base_io, OBJECT(dev), NULL, NULL, "aehd-pic", 2);
+    memory_region_init_io(&s->elcr_io, OBJECT(dev), NULL, NULL, "aehd-elcr", 1);
+
+
+    kpc->parent_realize(dev, errp);
+}

Again, this should be drastically simplified by adding a some fields & handlers to the abstract TYPE_INKERNEL_IOAPIC class:

struct InKernelAPICCommonClass {
     APICCommonClass parent_class;

     void (*pic_put)(PICCommonState *s)
     ...
};
Quoted 2 lines

Eventually this could even belong to APICCommonClass, but I haven't checked in detail.

I got your idea now. I will address it in the next version. And this also replies to the APIC and IOAPIC patch too.

Signature · 1 line
Haitao @Google
#10 lore raw

PATCH 6/6 Add the AEHD implementation.

In reply to Haitao Shan

Implement the AEHD accelerator including the AEHD AccelClass, AccelCPUClass, AccelOpsClass.

---
 hw/i386/x86.c                     |    2 +-
 include/exec/ram_addr.h           |    2 -
 include/sysemu/aehd.h             |   87 ++
 include/sysemu/hw_accel.h         |    1 +
 target/i386/aehd/aehd-accel-ops.c |  119 ++
 target/i386/aehd/aehd-accel-ops.h |   22 +
 target/i386/aehd/aehd-all.c       | 1020 +++++++++++++++
 target/i386/aehd/aehd-cpu.c       |  150 +++
 target/i386/aehd/aehd-cpu.h       |   41 +
 target/i386/aehd/aehd-stub.c      |   22 +
 target/i386/aehd/aehd.c           | 1915 +++++++++++++++++++++++++++++
 target/i386/aehd/aehd_i386.h      |   26 +
 target/i386/aehd/aehd_int.h       |    2 +-
 target/i386/aehd/meson.build      |    4 +
 target/i386/cpu.c                 |   12 +-
 target/i386/cpu.h                 |    5 +-
 target/i386/helper.c              |    3 +
 target/i386/meson.build           |    1 +
 18 files changed, 3428 insertions(+), 6 deletions(-)
 create mode 100644 target/i386/aehd/aehd-accel-ops.c
 create mode 100644 target/i386/aehd/aehd-accel-ops.h
 create mode 100644 target/i386/aehd/aehd-cpu.c
 create mode 100644 target/i386/aehd/aehd-cpu.h
 create mode 100644 target/i386/aehd/aehd-stub.c
 create mode 100644 target/i386/aehd/aehd_i386.h
hw/i386/x86.c +1 -1
index ffc6f97ce0..fdf090f25d 100644
@@ -1251,7 +1251,7 @@ bool x86_machine_is_smm_enabled(const X86MachineState *x86ms)
         return false;
     }
 
-    if (tcg_enabled() || qtest_enabled()) {
+    if (tcg_enabled() || aehd_enabled() || qtest_enabled()) {
         smm_available = true;
     } else if (kvm_enabled()) {
         smm_available = kvm_has_smm();
include/exec/ram_addr.h +0 -2
index f4fb6a2111..4ff1745c30 100644
@@ -332,7 +332,6 @@ static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
     xen_hvm_modified_memory(start, length);
 }
 
-#if !defined(_WIN32)
 static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
                                                           ram_addr_t start,
                                                           ram_addr_t pages)
@@ -424,7 +423,6 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
         }
     }
 }
-#endif /* not _WIN32 */
 
 bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
                                               ram_addr_t length,
include/sysemu/aehd.h +87 -0

118 lines not on this page · raw message

include/sysemu/hw_accel.h +1 -0
index 22903a55f7..a9e5494e08 100644
@@ -14,6 +14,7 @@
 #include "hw/core/cpu.h"
 #include "sysemu/hax.h"
 #include "sysemu/kvm.h"
+#include "sysemu/aehd.h"
 #include "sysemu/hvf.h"
 #include "sysemu/whpx.h"
 #include "sysemu/nvmm.h"
target/i386/aehd/aehd-accel-ops.c new file +119 -0

119 lines not on this page · raw message

target/i386/aehd/aehd-accel-ops.h new file +22 -0
new file mode 100644
index 0000000000..8ee4f5bd55
@@ -0,0 +1,22 @@
+/*
+ * Accelerator CPUS Interface
+ *
+ * Copyright 2020 SUSE LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef AEHD_CPUS_H
+#define AEHD_CPUS_H
+
+#include "sysemu/cpus.h"
+
+int aehd_init_vcpu(CPUState *cpu);
+int aehd_cpu_exec(CPUState *cpu);
+void aehd_destroy_vcpu(CPUState *cpu);
+void aehd_cpu_synchronize_post_reset(CPUState *cpu);
+void aehd_cpu_synchronize_post_init(CPUState *cpu);
+void aehd_cpu_synchronize_pre_loadvm(CPUState *cpu);
+
+#endif /* AEHD_CPUS_H */
target/i386/aehd/aehd-all.c +1020 -0

1,054 lines not on this page · raw message

target/i386/aehd/aehd-cpu.c new file +150 -0

150 lines not on this page · raw message

target/i386/aehd/aehd-cpu.h new file +41 -0

41 lines not on this page · raw message

target/i386/aehd/aehd-stub.c new file +22 -0
new file mode 100644
index 0000000000..25e0682091
@@ -0,0 +1,22 @@
+/*
+ * QEMU AEHD x86 specific function stubs
+ *
+ * Copyright Linaro Limited 2012
+ *
+ * Author: Peter Maydell <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "aehd_i386.h"
+
+#ifndef __OPTIMIZE__
+uint32_t aehd_arch_get_supported_cpuid(AEHDState *env, uint32_t function,
+                                       uint32_t index, int reg)
+{
+    abort();
+}
+#endif
target/i386/aehd/aehd.c +1915 -0

1,445 lines not on this page · raw message

target/i386/aehd/aehd_i386.h new file +26 -0
new file mode 100644
index 0000000000..622a9b1d63

Lines of this file are not shown. View the raw message.

target/i386/aehd/aehd_int.h +1 -1
index 113f3ebf8e..738dfa72ad 100644

Lines of this file are not shown. View the raw message.

target/i386/aehd/meson.build +4 -0
index 50880712db..b4c6364e96 100644

Lines of this file are not shown. View the raw message.

target/i386/cpu.c +11 -1
index f3fbb0bf8b..83c250e64d 100644

Lines of this file are not shown. View the raw message.

target/i386/cpu.h +4 -1
index ea650e68a3..4b18f5442f 100644

Lines of this file are not shown. View the raw message.

target/i386/helper.c +3 -0
index 8857444819..fbf7b12d7a 100644

Lines of this file are not shown. View the raw message.

target/i386/meson.build +1 -0
index 76a90b73d5..57ddfbd4a4 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog

Part of the diff is not shown here. View the raw message.

#11 lore raw

Re: [PATCH 6/6] Add the AEHD implementation.

Quoted 16 lines · Haitao Shan

Implement the AEHD accelerator including the AEHD AccelClass, AccelCPUClass, AccelOpsClass.

---
  hw/i386/x86.c                     |    2 +-
  include/exec/ram_addr.h           |    2 -
  include/sysemu/aehd.h             |   87 ++
  include/sysemu/hw_accel.h         |    1 +
  target/i386/aehd/aehd-accel-ops.c |  119 ++
  target/i386/aehd/aehd-accel-ops.h |   22 +
  target/i386/aehd/aehd-all.c       | 1020 +++++++++++++++
  target/i386/aehd/aehd-cpu.c       |  150 +++
  target/i386/aehd/aehd-cpu.h       |   41 +
  target/i386/aehd/aehd-stub.c      |   22 +
  target/i386/aehd/aehd.c           | 1915 +++++++++++++++++++++++++++++
Quoted 8 lines
  target/i386/aehd/aehd_i386.h      |   26 +
  target/i386/aehd/aehd_int.h       |    2 +-
  target/i386/aehd/meson.build      |    4 +
  target/i386/cpu.c                 |   12 +-
  target/i386/cpu.h                 |    5 +-
  target/i386/helper.c              |    3 +
  target/i386/meson.build           |    1 +
  18 files changed, 3428 insertions(+), 6 deletions(-)

I'm not going to review a 3000+ LoC patch, sorry.

1/ it is too big for my brain and I'm going to miss things 2/ it is likely duplicating KVM identical code; if so we
should refactor to use common code. In particular because we can fix bugs once.

Quoted 11 lines

create mode 100644 target/i386/aehd/aehd-accel-ops.c create mode 100644 target/i386/aehd/aehd-accel-ops.h create mode 100644 target/i386/aehd/aehd-cpu.c create mode 100644 target/i386/aehd/aehd-cpu.h create mode 100644 target/i386/aehd/aehd-stub.c create mode 100644 target/i386/aehd/aehd_i386.h

target/i386/aehd/aehd-accel-ops.c line 9

Quoted 9 lines
target/i386/aehd/aehd-accel-ops.c new file +9 -0
@@ -0,0 +1,119 @@
+/*
+ * QEMU AEHD support
+ *
+ * Copyright IBM, Corp. 2008
+ *           Red Hat, Inc. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *  Glauber Costa     <[email protected]>

In various files you add in this series you use incorrect author / (c). While you copy/paste their implementation, they didn't authored this AEHD implementation (which is based on their work).

#12 lore raw

Re: [PATCH 6/6] Add the AEHD implementation.

Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Haitao Shan

Implement the AEHD accelerator including the AEHD AccelClass, AccelCPUClass, AccelOpsClass.

---
  hw/i386/x86.c                     |    2 +-
  include/exec/ram_addr.h           |    2 -
  include/sysemu/aehd.h             |   87 ++
  include/sysemu/hw_accel.h         |    1 +
  target/i386/aehd/aehd-accel-ops.c |  119 ++
  target/i386/aehd/aehd-accel-ops.h |   22 +
  target/i386/aehd/aehd-all.c       | 1020 +++++++++++++++
  target/i386/aehd/aehd-cpu.c       |  150 +++
  target/i386/aehd/aehd-cpu.h       |   41 +
  target/i386/aehd/aehd-stub.c      |   22 +
  target/i386/aehd/aehd.c           | 1915 +++++++++++++++++++++++++++++
Quoted 8 lines
  target/i386/aehd/aehd_i386.h      |   26 +
  target/i386/aehd/aehd_int.h       |    2 +-
  target/i386/aehd/meson.build      |    4 +
  target/i386/cpu.c                 |   12 +-
  target/i386/cpu.h                 |    5 +-
  target/i386/helper.c              |    3 +
  target/i386/meson.build           |    1 +
  18 files changed, 3428 insertions(+), 6 deletions(-)
Quoted 3 lines

I'm not going to review a 3000+ LoC patch, sorry.

1/ it is too big for my brain and I'm going to miss things

I fully understand. I also struggled quite a bit when preparing the patch set. I know it is good to keep patches as small as possible. At the same time, each patch is required to compile and function independently. As the user space codes for AEHD are kind of a whole, I don't know how to split them.

While I will continue finding a good strategy to split the big patch, do you happen to have some suggestions?

Quoted 3 lines

2/ it is likely duplicating KVM identical code; if so we
should refactor to use common code. In particular because we can fix bugs once.

I agree. Hope the KVM maintainer can give me some
guide or he might disagree completely.

Quoted 18 lines
Quoted 18 lines

create mode 100644 target/i386/aehd/aehd-accel-ops.c create mode 100644 target/i386/aehd/aehd-accel-ops.h create mode 100644 target/i386/aehd/aehd-cpu.c create mode 100644 target/i386/aehd/aehd-cpu.h create mode 100644 target/i386/aehd/aehd-stub.c create mode 100644 target/i386/aehd/aehd_i386.h

target/i386/aehd/aehd-accel-ops.c new file +6 -0
@@ -0,0 +1,119 @@
+/*
+ * QEMU AEHD support
+ *
+ * Copyright IBM, Corp. 2008
+ *           Red Hat, Inc. 2008
+ *
Quoted 8 lines

target/i386/aehd/aehd-accel-ops.c line 9

Quoted 3 lines
target/i386/aehd/aehd-accel-ops.c new file +3 -0
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *  Glauber Costa     <[email protected]>

In various files you add in this series you use incorrect author / (c). While you copy/paste their implementation, they didn't authored this AEHD implementation (which is based on their work).

This is a surprise to me. I thought the practice was to copy and keep the original license header. I should be able to add but probably not to delete.

So just let me confirm, it is OK to remove them while keeping the license text. Or I can change something like:
Originally Authored by:
Original Authors list
Modified by:
Me

Signature · 1 line
Haitao @Google
#13 lore raw
In reply to Haitao Shan
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Replying on patch 1 but it applies to the whole patchset.

There's obvious duplication with kvm here - probably not surprising.

I'd be interested to hear from KVM people to know whether there's interest in unifying code, or they would rather not bother supporting this platform and it's better off being kept separate.

Quoted 180 lines
---
 accel/Kconfig                  |  3 +++
 docs/about/build-platforms.rst |  2 +-
 include/exec/poison.h          |  1 +
 meson.build                    | 16 ++++++++++++++++
 meson_options.txt              |  2 ++
 qemu-options.hx                | 20 ++++++++++----------
 scripts/meson-buildoptions.sh  |  2 ++
 7 files changed, 35 insertions(+), 11 deletions(-)
accel/Kconfig +3 -0
index 8bdedb7d15..187d8f6acf 100644
@@ -16,6 +16,9 @@ config TCG
 config KVM
     bool
 
+config AEHD
+    bool
+
 config XEN
     bool
     select FSDEV_9P if VIRTFS
docs/about/build-platforms.rst +1 -1
index 20b97c3310..184707bd62 100644
@@ -52,7 +52,7 @@ Those hosts are officially supported, with various accelerators:
    * - SPARC
      - tcg
    * - x86
-     - hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
+     - aehd (64 bit only), hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
 
 Other host architectures are not supported. It is possible to build QEMU system
 emulation on an unsupported host architecture using the configure
include/exec/poison.h +1 -0
index 140daa4a85..cb851744d1 100644
@@ -86,6 +86,7 @@
 #pragma GCC poison CONFIG_HVF
 #pragma GCC poison CONFIG_LINUX_USER
 #pragma GCC poison CONFIG_KVM
+#pragma GCC poison CONFIG_AEHD
 #pragma GCC poison CONFIG_SOFTMMU
 #pragma GCC poison CONFIG_WHPX
 #pragma GCC poison CONFIG_XEN
meson.build +16 -0
index 77d2ae87e4..f2b049ceac 100644
@@ -146,6 +146,11 @@ if cpu in ['x86', 'x86_64']
     'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
   }
 endif
+if cpu in ['x86_64']
+  accelerator_targets += {
+    'CONFIG_AEHD': ['i386-softmmu', 'x86_64-softmmu'],
+  }
+endif
 
 modular_tcg = []
 # Darwin does not support references to thread-local variables in modules
@@ -421,6 +426,13 @@ accelerators = []
 if get_option('kvm').allowed() and targetos == 'linux'
   accelerators += 'CONFIG_KVM'
 endif
+if get_option('aehd').allowed() and targetos == 'windows'
+  if get_option('aehd').enabled() and host_machine.cpu() != 'x86_64'
+    error('AEHD requires 64-bit host')
+  else
+    accelerators += 'CONFIG_AEHD'
+  endif
+endif
 if get_option('whpx').allowed() and targetos == 'windows'
   if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
     error('WHPX requires 64-bit host')
@@ -482,6 +494,9 @@ endif
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
   error('KVM not available on this platform')
 endif
+if 'CONFIG_AEHD' not in accelerators and get_option('aehd').enabled()
+  error('AEHD not available on this platform')
+endif
 if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
   error('HVF not available on this platform')
 endif
@@ -3873,6 +3888,7 @@ endif
 summary_info = {}
 if have_system
   summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
+  summary_info += {'AEHD support':      config_all.has_key('CONFIG_AEHD')}
   summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
   summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
   summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
meson_options.txt +2 -0
index fc9447d267..d3e9805b6d 100644
@@ -66,6 +66,8 @@ option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
 
 option('kvm', type: 'feature', value: 'auto',
        description: 'KVM acceleration support')
+option('aehd', type: 'feature', value: 'auto',
+       description: 'AEHD acceleration support')
 option('hax', type: 'feature', value: 'auto',
        description: 'HAX acceleration support')
 option('whpx', type: 'feature', value: 'auto',
qemu-options.hx +10 -10
index beeb4475ba..2870c54a43 100644
@@ -26,7 +26,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "-machine [type=]name[,prop[=value][,...]]\n"
     "                selects emulated machine ('-machine help' for list)\n"
     "                property accel=accel1[:accel2[:...]] selects accelerator\n"
-    "                supported accelerators are kvm, xen, hax, hvf, nvmm, whpx or tcg (default: tcg)\n"
+    "                supported accelerators are kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg (default: tcg)\n"
     "                vmport=on|off|auto controls emulation of vmport (default: auto)\n"
     "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
     "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -59,10 +59,10 @@ SRST
 
     ``accel=accels1[:accels2[:...]]``
         This is used to enable an accelerator. Depending on the target
-        architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available.
-        By default, tcg is used. If there is more than one accelerator
-        specified, the next one is used if the previous one fails to
-        initialize.
+        architecture, kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg can be
+        available. By default, tcg is used. If there is more than one
+        accelerator specified, the next one is used if the previous one
+        fails to initialize.
 
     ``vmport=on|off|auto``
         Enables emulation of VMWare IO port, for vmmouse etc. auto says
@@ -178,7 +178,7 @@ ERST
 
 DEF("accel", HAS_ARG, QEMU_OPTION_accel,
     "-accel [accel=]accelerator[,prop[=value][,...]]\n"
-    "                select accelerator (kvm, xen, hax, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
+    "                select accelerator (kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg; use 'help' for a list)\n"
     "                igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
     "                kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
     "                kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
@@ -190,10 +190,10 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel,
 SRST
 ``-accel name[,prop=value[,...]]``
     This is used to enable an accelerator. Depending on the target
-    architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available. By
-    default, tcg is used. If there is more than one accelerator
-    specified, the next one is used if the previous one fails to
-    initialize.
+    architecture, kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg can be
+    available. By default, tcg is used. If there is more than one
+    accelerator specified, the next one is used if the previous one
+    fails to initialize.
 
     ``igd-passthru=on|off``
         When Xen is in use, this option controls whether Intel
scripts/meson-buildoptions.sh +2 -0
index 009fab1515..f17df07c5d 100644
@@ -289,6 +289,8 @@ _meson_option_parse() {
     --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;;
     --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;;
     --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;;
+    --enable-aehd) printf "%s" -Daehd=enabled ;;
+    --disable-aehd) printf "%s" -Daehd=disabled ;;
     --enable-hax) printf "%s" -Dhax=enabled ;;
     --disable-hax) printf "%s" -Dhax=disabled ;;
     --enable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=true ;;
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
#14 lore raw
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Replying on patch 1 but it applies to the whole patchset.

Indeed this series lacks a cover letter, which would show this huge diffstat:

 MAINTAINERS                       |   12 +
 accel/Kconfig                     |    3 +
 docs/about/build-platforms.rst    |    2 +-
 hw/i386/aehd/apic.c               |  204 +++++++++++++++
 hw/i386/aehd/i8259.c              |  165 ++++++++++++
 hw/i386/aehd/ioapic.c             |  164 ++++++++++++
 hw/i386/aehd/meson.build          |    6 +
 hw/i386/meson.build               |    1 +
 hw/i386/pc.c                      |    5 +
 hw/i386/x86.c                     |    5 +-
 include/exec/poison.h             |    1 +
 include/exec/ram_addr.h           |    2 -
 include/hw/core/cpu.h             |    7 +
 include/hw/intc/i8259.h           |    1 +
 include/hw/intc/ioapic.h          |    1 +
 include/sysemu/aehd-interface.h   |  878 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/sysemu/aehd.h             |  168 ++++++++++++
 include/sysemu/hw_accel.h         |    1 +
 meson.build                       |   16 ++
 meson_options.txt                 |    2 +
 qemu-options.hx                   |   20 +-
 scripts/meson-buildoptions.sh     |    2 +
 target/i386/aehd/aehd-accel-ops.c |  119 +++++++++
 target/i386/aehd/aehd-accel-ops.h |   22 ++
 target/i386/aehd/aehd-all.c       | 1349 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 target/i386/aehd/aehd-cpu.c       |  150 +++++++++++
 target/i386/aehd/aehd-cpu.h       |   41 +++
 target/i386/aehd/aehd-stub.c      |   22 ++
 target/i386/aehd/aehd.c           | 2003 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 target/i386/aehd/aehd_i386.h      |   26 ++
 target/i386/aehd/aehd_int.h       |   50 ++++
 target/i386/aehd/meson.build      |    8 +
 target/i386/cpu-sysemu.c          |    3 +
 target/i386/cpu.c                 |   12 +-
 target/i386/cpu.h                 |    5 +-
 target/i386/helper.c              |    3 +
 target/i386/meson.build           |    2 +
 37 files changed, 5465 insertions(+), 16 deletions(-)
Quoted 6 lines

There's obvious duplication with kvm here - probably not surprising.

I'd be interested to hear from KVM people to know whether there's interest in unifying code, or they would rather not bother supporting this platform and it's better off being kept separate.

I believe the hw part can be unified, reducing the maintenance cost. (I gave Haitao few hints replying to the relevant patches).

Regards,

Phil.

#15 lore raw
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Replying on patch 1 but it applies to the whole patchset.

Indeed this series lacks a cover letter,

I just noticed the cover letter in my inbox, oddly delivered after the patches:
https://lore.kernel.org/qemu-devel/CAGD3tSzW1QoAsn+uGjoAkBegLt1iZ=9YWDFcvqbcHMr0S_5kVw@mail.gmail.com/
(note the patches are disconnected from the cover, and the cover lacks the diffstat).

Quoted 58 lines

which would show
this huge diffstat:

  MAINTAINERS                       |   12 +
  accel/Kconfig                     |    3 +
  docs/about/build-platforms.rst    |    2 +-
  hw/i386/aehd/apic.c               |  204 +++++++++++++++
  hw/i386/aehd/i8259.c              |  165 ++++++++++++
  hw/i386/aehd/ioapic.c             |  164 ++++++++++++
  hw/i386/aehd/meson.build          |    6 +
  hw/i386/meson.build               |    1 +
  hw/i386/pc.c                      |    5 +
  hw/i386/x86.c                     |    5 +-
  include/exec/poison.h             |    1 +
  include/exec/ram_addr.h           |    2 -
  include/hw/core/cpu.h             |    7 +
  include/hw/intc/i8259.h           |    1 +
  include/hw/intc/ioapic.h          |    1 +
  include/sysemu/aehd-interface.h   |  878 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  include/sysemu/aehd.h             |  168 ++++++++++++
  include/sysemu/hw_accel.h         |    1 +
  meson.build                       |   16 ++
  meson_options.txt                 |    2 +
  qemu-options.hx                   |   20 +-
  scripts/meson-buildoptions.sh     |    2 +
  target/i386/aehd/aehd-accel-ops.c |  119 +++++++++
  target/i386/aehd/aehd-accel-ops.h |   22 ++
  target/i386/aehd/aehd-all.c       | 1349 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd-cpu.c       |  150 +++++++++++
  target/i386/aehd/aehd-cpu.h       |   41 +++
  target/i386/aehd/aehd-stub.c      |   22 ++
  target/i386/aehd/aehd.c           | 2003 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd_i386.h      |   26 ++
  target/i386/aehd/aehd_int.h       |   50 ++++
  target/i386/aehd/meson.build      |    8 +
  target/i386/cpu-sysemu.c          |    3 +
  target/i386/cpu.c                 |   12 +-
  target/i386/cpu.h                 |    5 +-
  target/i386/helper.c              |    3 +
  target/i386/meson.build           |    2 +
  37 files changed, 5465 insertions(+), 16 deletions(-)
Quoted 6 lines

There's obvious duplication with kvm here - probably not surprising.

I'd be interested to hear from KVM people to know whether there's interest in unifying code, or they would rather not bother supporting this platform and it's better off being kept separate.

I believe the hw part can be unified, reducing the maintenance cost. (I gave Haitao few hints replying to the relevant patches).

Regards,

Phil.

#16 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Michael S. Tsirkin
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Replying on patch 1 but it applies to the whole patchset.

Indeed this series lacks a cover letter,

I just noticed the cover letter in my inbox, oddly delivered after the patches:
https://lore.kernel.org/qemu-devel/CAGD3tSzW1QoAsn+uGjoAkBegLt1iZ=9YWDFcvqbcHMr0S_5kVw@mail.gmail.com/
(note the patches are disconnected from the cover, and the cover lacks the diffstat).

Again, I am sorry for the trouble. I will figure out how to send cover letter properly together with other patches using "git sendmail".

Quoted 60 lines
Quoted 59 lines

which would show
this huge diffstat:

  MAINTAINERS                       |   12 +
  accel/Kconfig                     |    3 +
  docs/about/build-platforms.rst    |    2 +-
  hw/i386/aehd/apic.c               |  204 +++++++++++++++
  hw/i386/aehd/i8259.c              |  165 ++++++++++++
  hw/i386/aehd/ioapic.c             |  164 ++++++++++++
  hw/i386/aehd/meson.build          |    6 +
  hw/i386/meson.build               |    1 +
  hw/i386/pc.c                      |    5 +
  hw/i386/x86.c                     |    5 +-
  include/exec/poison.h             |    1 +
  include/exec/ram_addr.h           |    2 -
  include/hw/core/cpu.h             |    7 +
  include/hw/intc/i8259.h           |    1 +
  include/hw/intc/ioapic.h          |    1 +
  include/sysemu/aehd-interface.h   |  878
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  include/sysemu/aehd.h             |  168 ++++++++++++
  include/sysemu/hw_accel.h         |    1 +
  meson.build                       |   16 ++
  meson_options.txt                 |    2 +
  qemu-options.hx                   |   20 +-
  scripts/meson-buildoptions.sh     |    2 +
  target/i386/aehd/aehd-accel-ops.c |  119 +++++++++
  target/i386/aehd/aehd-accel-ops.h |   22 ++
  target/i386/aehd/aehd-all.c       | 1349
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd-cpu.c       |  150 +++++++++++
  target/i386/aehd/aehd-cpu.h       |   41 +++
  target/i386/aehd/aehd-stub.c      |   22 ++
  target/i386/aehd/aehd.c           | 2003
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd_i386.h      |   26 ++
  target/i386/aehd/aehd_int.h       |   50 ++++
  target/i386/aehd/meson.build      |    8 +
  target/i386/cpu-sysemu.c          |    3 +
  target/i386/cpu.c                 |   12 +-
  target/i386/cpu.h                 |    5 +-
  target/i386/helper.c              |    3 +
  target/i386/meson.build           |    2 +
  37 files changed, 5465 insertions(+), 16 deletions(-)
Quoted 6 lines

There's obvious duplication with kvm here - probably not surprising.

I'd be interested to hear from KVM people to know whether there's interest in unifying code, or they would rather not bother supporting this platform and it's better off being kept separate.

I believe the hw part can be unified, reducing the maintenance cost. (I gave Haitao few hints replying to the relevant patches).

Regards,

Phil.

Signature · 1 line
Haitao @Google
#17 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Replying on patch 1 but it applies to the whole patchset.

Indeed this series lacks a cover letter, which would show this huge diffstat:

Sorry. I think I made a mistake and I know being new to the community is not an excuse. I will correct it in future. I don't know if "git sendmail" can have a cover letter. So the cover letter was written separately. Again, I am sorry for that.

Quoted 45 lines
  MAINTAINERS                       |   12 +
  accel/Kconfig                     |    3 +
  docs/about/build-platforms.rst    |    2 +-
  hw/i386/aehd/apic.c               |  204 +++++++++++++++
  hw/i386/aehd/i8259.c              |  165 ++++++++++++
  hw/i386/aehd/ioapic.c             |  164 ++++++++++++
  hw/i386/aehd/meson.build          |    6 +
  hw/i386/meson.build               |    1 +
  hw/i386/pc.c                      |    5 +
  hw/i386/x86.c                     |    5 +-
  include/exec/poison.h             |    1 +
  include/exec/ram_addr.h           |    2 -
  include/hw/core/cpu.h             |    7 +
  include/hw/intc/i8259.h           |    1 +
  include/hw/intc/ioapic.h          |    1 +
  include/sysemu/aehd-interface.h   |  878
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  include/sysemu/aehd.h             |  168 ++++++++++++
  include/sysemu/hw_accel.h         |    1 +
  meson.build                       |   16 ++
  meson_options.txt                 |    2 +
  qemu-options.hx                   |   20 +-
  scripts/meson-buildoptions.sh     |    2 +
  target/i386/aehd/aehd-accel-ops.c |  119 +++++++++
  target/i386/aehd/aehd-accel-ops.h |   22 ++
  target/i386/aehd/aehd-all.c       | 1349
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd-cpu.c       |  150 +++++++++++
  target/i386/aehd/aehd-cpu.h       |   41 +++
  target/i386/aehd/aehd-stub.c      |   22 ++
  target/i386/aehd/aehd.c           | 2003
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  target/i386/aehd/aehd_i386.h      |   26 ++
  target/i386/aehd/aehd_int.h       |   50 ++++
  target/i386/aehd/meson.build      |    8 +
  target/i386/cpu-sysemu.c          |    3 +
  target/i386/cpu.c                 |   12 +-
  target/i386/cpu.h                 |    5 +-
  target/i386/helper.c              |    3 +
  target/i386/meson.build           |    2 +
  37 files changed, 5465 insertions(+), 16 deletions(-)
Quoted 2 lines

There's obvious duplication with kvm here - probably not surprising.

Quoted 7 lines
Quoted 4 lines

I'd be interested to hear from KVM people to know whether there's interest in unifying code, or they would rather not bother supporting this platform and it's better off being kept separate.

I believe the hw part can be unified, reducing the maintenance cost. (I gave Haitao few hints replying to the relevant patches).

Thanks. I will follow up in the relevant patch thread.

Quoted 4 lines

Regards,

Phil.

Signature · 1 line
Haitao @Google
#18 lore raw
Quoted 12 lines · Haitao Shan
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Replying on patch 1 but it applies to the whole patchset.

Quoted 7 lines
Quoted 2 lines

Indeed this series lacks a cover letter, which would show this huge diffstat:

Sorry. I think I made a mistake and I know being new to the community is not an excuse. I will correct it in future. I don't know if "git sendmail" can have a cover letter. So the cover letter was written separately. Again, I am sorry for that.

FWIW, I can recommend using the 'git-publish'[1] tool instead of git sendemail. git-publish helps to just "do the right thing" without you needing to know the details. It will prompt for a cover letter to be entered, include the diffstat, and CC any maintainers related to files your patch touches. It figures this all our from the .gitpublish file that is in the root of the QEMU git repo.

If you want test send some mails, then just tell git-publsh to send to yourself instead of qemu-devel.

With regards,
Daniel

[1] https://github.com/stefanha/git-publish

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#19 lore raw
Quoted 30 lines · Daniel P. Berrangé
Quoted 12 lines · Haitao Shan
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Replying on patch 1 but it applies to the whole patchset.

Quoted 7 lines
Quoted 2 lines

Indeed this series lacks a cover letter, which would show this huge diffstat:

Sorry. I think I made a mistake and I know being new to the community is not an excuse. I will correct it in future. I don't know if "git sendmail" can have a cover letter. So the cover letter was written separately. Again, I am sorry for that.

FWIW, I can recommend using the 'git-publish'[1] tool instead of git sendemail. git-publish helps to just "do the right thing" without you needing to know the details. It will prompt for a cover letter to be entered, include the diffstat, and CC any maintainers related to files your patch touches. It figures this all our from the .gitpublish file that is in the root of the QEMU git repo.

Quoted 2 lines

If you want test send some mails, then just tell git-publsh to send to yourself instead of qemu-devel.

Got it. Thank you very much for your advice. I am going to do the experiment now.

Quoted 10 lines

With regards,
Daniel

[1] https://github.com/stefanha/git-publish
--

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Signature · 1 line
Haitao @Google
#20 lore raw
In reply to Michael S. Tsirkin
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Haitao Shan

Add the configure support for the Android Emulator hypervisor driver accelerator. The Android Emulator hypervisor driver is a Windows driver made by porting the KVM from kernel 4.9-rc7.

Quoted 8 lines

Replying on patch 1 but it applies to the whole patchset.

There's obvious duplication with kvm here - probably not surprising.

I'd be interested to hear from KVM people to know whether there's interest in unifying code, or they would rather not bother supporting this platform and it's better off being kept separate.

Thanks for the reply.

When I first started working on the new
hypervisor (I am also the author of the hypervisor itself), I tried to make it "unified" with the KVM. But I soon gave up. One of the reasons is type "long or unsigned long". It is used everywhere by the KVM (or perhaps the kernel itself) to represent memory addresses. But the Microsoft compiler does not think "long == 64bit integer" targeting 64bit Windows. I could not think of a way to change it beautifully and make AEHD ready for periodically rebasing to the latest KVM.

Since being fully compatible with KVM was not a goal any more, I also gave up support of some of KVM legacies. For example, those related to enlightened guests be it KVM or HyperV enlightenment. The userspace can assume certain capabilities without checking, for example, in kernel irqchip.

Currently, the decision for the AEHD is to clone once and go seperated with KVM.

With that said, it was still possible to share codes in the user space code with KVM. But I was afraid whether the qemu KVM part could see this as a burden if I tried to hack the KVM user space to support AEHD. Anyway, KVM keeps revolving. There might be more and more conditioned code branches simply to make AEHD happy, should the user space code be "unified".

Quoted 182 lines
Quoted 181 lines
---
 accel/Kconfig                  |  3 +++
 docs/about/build-platforms.rst |  2 +-
 include/exec/poison.h          |  1 +
 meson.build                    | 16 ++++++++++++++++
 meson_options.txt              |  2 ++
 qemu-options.hx                | 20 ++++++++++----------
 scripts/meson-buildoptions.sh  |  2 ++
 7 files changed, 35 insertions(+), 11 deletions(-)
accel/Kconfig +3 -0
index 8bdedb7d15..187d8f6acf 100644
@@ -16,6 +16,9 @@ config TCG
 config KVM
     bool
 
+config AEHD
+    bool
+
 config XEN
     bool
     select FSDEV_9P if VIRTFS
docs/about/build-platforms.rst +1 -1
index 20b97c3310..184707bd62 100644
@@ -52,7 +52,7 @@ Those hosts are officially supported, with various accelerators:
    * - SPARC
      - tcg
    * - x86
-     - hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
+     - aehd (64 bit only), hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
 
 Other host architectures are not supported. It is possible to build QEMU system
 emulation on an unsupported host architecture using the configure
include/exec/poison.h +1 -0
index 140daa4a85..cb851744d1 100644
@@ -86,6 +86,7 @@
 #pragma GCC poison CONFIG_HVF
 #pragma GCC poison CONFIG_LINUX_USER
 #pragma GCC poison CONFIG_KVM
+#pragma GCC poison CONFIG_AEHD
 #pragma GCC poison CONFIG_SOFTMMU
 #pragma GCC poison CONFIG_WHPX
 #pragma GCC poison CONFIG_XEN
meson.build +16 -0
index 77d2ae87e4..f2b049ceac 100644
@@ -146,6 +146,11 @@ if cpu in ['x86', 'x86_64']
     'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
   }
 endif
+if cpu in ['x86_64']
+  accelerator_targets += {
+    'CONFIG_AEHD': ['i386-softmmu', 'x86_64-softmmu'],
+  }
+endif
 
 modular_tcg = []
 # Darwin does not support references to thread-local variables in modules
@@ -421,6 +426,13 @@ accelerators = []
 if get_option('kvm').allowed() and targetos == 'linux'
   accelerators += 'CONFIG_KVM'
 endif
+if get_option('aehd').allowed() and targetos == 'windows'
+  if get_option('aehd').enabled() and host_machine.cpu() != 'x86_64'
+    error('AEHD requires 64-bit host')
+  else
+    accelerators += 'CONFIG_AEHD'
+  endif
+endif
 if get_option('whpx').allowed() and targetos == 'windows'
   if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
     error('WHPX requires 64-bit host')
@@ -482,6 +494,9 @@ endif
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
   error('KVM not available on this platform')
 endif
+if 'CONFIG_AEHD' not in accelerators and get_option('aehd').enabled()
+  error('AEHD not available on this platform')
+endif
 if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
   error('HVF not available on this platform')
 endif
@@ -3873,6 +3888,7 @@ endif
 summary_info = {}
 if have_system
   summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
+  summary_info += {'AEHD support':      config_all.has_key('CONFIG_AEHD')}
   summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
   summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
   summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
meson_options.txt +2 -0
index fc9447d267..d3e9805b6d 100644
@@ -66,6 +66,8 @@ option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
 
 option('kvm', type: 'feature', value: 'auto',
        description: 'KVM acceleration support')
+option('aehd', type: 'feature', value: 'auto',
+       description: 'AEHD acceleration support')
 option('hax', type: 'feature', value: 'auto',
        description: 'HAX acceleration support')
 option('whpx', type: 'feature', value: 'auto',
qemu-options.hx +10 -10
index beeb4475ba..2870c54a43 100644
@@ -26,7 +26,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "-machine [type=]name[,prop[=value][,...]]\n"
     "                selects emulated machine ('-machine help' for list)\n"
     "                property accel=accel1[:accel2[:...]] selects accelerator\n"
-    "                supported accelerators are kvm, xen, hax, hvf, nvmm, whpx or tcg (default: tcg)\n"
+    "                supported accelerators are kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg (default: tcg)\n"
     "                vmport=on|off|auto controls emulation of vmport (default: auto)\n"
     "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
     "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -59,10 +59,10 @@ SRST
 
     ``accel=accels1[:accels2[:...]]``
         This is used to enable an accelerator. Depending on the target
-        architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available.
-        By default, tcg is used. If there is more than one accelerator
-        specified, the next one is used if the previous one fails to
-        initialize.
+        architecture, kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg can be
+        available. By default, tcg is used. If there is more than one
+        accelerator specified, the next one is used if the previous one
+        fails to initialize.
 
     ``vmport=on|off|auto``
         Enables emulation of VMWare IO port, for vmmouse etc. auto says
@@ -178,7 +178,7 @@ ERST
 
 DEF("accel", HAS_ARG, QEMU_OPTION_accel,
     "-accel [accel=]accelerator[,prop[=value][,...]]\n"
-    "                select accelerator (kvm, xen, hax, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
+    "                select accelerator (kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg; use 'help' for a list)\n"
     "                igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
     "                kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
     "                kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
@@ -190,10 +190,10 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel,
 SRST
 ``-accel name[,prop=value[,...]]``
     This is used to enable an accelerator. Depending on the target
-    architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available. By
-    default, tcg is used. If there is more than one accelerator
-    specified, the next one is used if the previous one fails to
-    initialize.
+    architecture, kvm, xen, hax, hvf, nvmm, whpx, aehd or tcg can be
+    available. By default, tcg is used. If there is more than one
+    accelerator specified, the next one is used if the previous one
+    fails to initialize.
 
     ``igd-passthru=on|off``
         When Xen is in use, this option controls whether Intel
scripts/meson-buildoptions.sh +2 -1
index 009fab1515..f17df07c5d 100644
@@ -289,6 +289,8 @@ _meson_option_parse() {
     --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;;
     --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;;
     --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;;
+    --enable-aehd) printf "%s" -Daehd=enabled ;;
+    --disable-aehd) printf "%s" -Daehd=disabled ;;
     --enable-hax) printf "%s" -Dhax=enabled ;;
     --disable-hax) printf "%s" -Dhax=disabled ;;
     --enable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=true ;;
--

2.40.0.rc0.216.gc4246ad0f0-goog

Signature · 1 line
Haitao @Google