Add QEMU into the monorepo
This adds QEMU and all its dependencies into the monorepo. Enough features are enabled that
this QEMU should be both usable for running tests for Metropolis as well as running customer VMs in
containers. Thus we can also get rid of the QEMU ambient dependency.
All dependencies have their includes fully rewritten as to be reusable without a huge effort. QEMU itself
relies on `includes` attributes since the patch would otherwise be enormous and it is a binary and thus
any include path madness ends there.
Overall though this is quite nice, the final QEMU build with full optimization is <10MiB and has no further
ambient dependencies. It also has full io_uring support, which works very well with our 5.10 kernel.
TPM support is also included.
This is not used anywhere, replacing the ambient dependency and shipping a container will be in an upcoming
revision.
Test Plan:
Manually tested to run a Ubuntu cloud image with io_uring and virtio. Automated tests will follow as
part of its roles in this repo.
X-Origin-Diff: phab/D712
GitOrigin-RevId: 9c2607d75c875b1d65346e3cdac1a5e08467ea33
diff --git a/third_party/qemu/BUILD b/third_party/qemu/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/qemu/BUILD
diff --git a/third_party/qemu/external.bzl b/third_party/qemu/external.bzl
new file mode 100644
index 0000000..456aa23
--- /dev/null
+++ b/third_party/qemu/external.bzl
@@ -0,0 +1,36 @@
+# Copyright 2020 The Monogon Project Authors.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+def qemu_external(name, version):
+ sums = {
+ "5.2.0": "cb18d889b628fbe637672b0326789d9b0e3b8027e0445b936537c78549df17bc",
+ }
+
+ http_archive(
+ name = name,
+ patch_args = ["-p1"],
+ patches = [
+ "//third_party/qemu/patches:fix_code_issues.patch",
+ "//third_party/qemu/patches:bazel_support.patch",
+ "//third_party/qemu/patches:pregenerated_config_files.patch",
+ "//third_party/qemu/patches:headers_fix.patch",
+ ],
+ sha256 = sums[version],
+ strip_prefix = "qemu-" + version,
+ urls = ["https://download.qemu.org/qemu-%s.tar.xz" % version],
+ )
diff --git a/third_party/qemu/patches/BUILD b/third_party/qemu/patches/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/qemu/patches/BUILD
diff --git a/third_party/qemu/patches/bazel_support.patch b/third_party/qemu/patches/bazel_support.patch
new file mode 100644
index 0000000..9dea8d0
--- /dev/null
+++ b/third_party/qemu/patches/bazel_support.patch
@@ -0,0 +1,1603 @@
+Copyright 2020 The Monogon Project Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+From 88ba396b627c26b9b01c2bc358557964cbb59cf8 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@brun.one>
+Date: Wed, 10 Mar 2021 18:25:11 +0100
+Subject: [PATCH 3/6] Add Bazel support
+
+---
+ BUILD | 1146 +++++++++++++++++++++++++++++++
+ defs.bzl | 52 ++
+ qapi/BUILD | 25 +
+ qapi/defs.bzl | 40 ++
+ scripts/BUILD | 35 +
+ scripts/modules/BUILD | 7 +
+ scripts/qapi/BUILD | 7 +
+ scripts/qapi/defs.bzl | 52 ++
+ scripts/tracetool/BUILD | 11 +
+ scripts/tracetool/backend/BUILD | 7 +
+ scripts/tracetool/defs.bzl | 65 ++
+ scripts/tracetool/format/BUILD | 7 +
+ trace/BUILD | 18 +
+ 13 files changed, 1472 insertions(+)
+ create mode 100644 BUILD
+ create mode 100644 defs.bzl
+ create mode 100644 qapi/BUILD
+ create mode 100644 qapi/defs.bzl
+ create mode 100644 scripts/BUILD
+ create mode 100644 scripts/modules/BUILD
+ create mode 100644 scripts/qapi/BUILD
+ create mode 100644 scripts/qapi/defs.bzl
+ create mode 100644 scripts/tracetool/BUILD
+ create mode 100644 scripts/tracetool/backend/BUILD
+ create mode 100644 scripts/tracetool/defs.bzl
+ create mode 100644 scripts/tracetool/format/BUILD
+ create mode 100644 trace/BUILD
+
+diff --git a/BUILD b/BUILD
+new file mode 100644
+index 0000000000..436f8c5cf3
+--- /dev/null
++++ b/BUILD
+@@ -0,0 +1,1147 @@
++load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
++load("@rules_python//python:defs.bzl", "py_binary")
++load("@dev_source_monogon//build/utils:template_file.bzl", "template_file")
++load(":defs.bzl", "filter_label_suffix")
++load("//:defs.bzl", "cc_qemu_keymaps")
++
++filegroup(
++ name = "trace-files",
++ srcs = glob(["**/trace-events"]) + ["//qapi:trace-events"],
++ visibility = ["//visibility:public"],
++)
++
++filter_label_suffix(
++ name = "qapi_hdrs_gen",
++ srcs = ["//qapi:qapi_generated"],
++ suffix = ".h",
++)
++
++filter_label_suffix(
++ name = "qapi_c",
++ srcs = ["//qapi:qapi_generated"],
++ suffix = ".c",
++)
++
++filter_label_suffix(
++ name = "trace_c",
++ srcs = ["//trace"],
++ exclude = [
++ "trace-linux-user.c",
++ "trace-hw_pci-host.c",
++ ],
++ suffix = ".c",
++)
++
++genrule(
++ name = "block-coroutine-gen",
++ srcs = [
++ "include/block/block.h",
++ "block/coroutines.h",
++ ],
++ outs = ["block-gen.c"],
++ cmd = "./$(location //scripts:block-coroutine-wrapper) \"$@\" $(location include/block/block.h) $(location block/coroutines.h)",
++ tools = ["//scripts:block-coroutine-wrapper"],
++)
++
++filter_label_suffix(
++ name = "trace_hdrs_gen",
++ srcs = ["//trace"],
++ suffix = ".h",
++)
++
++filegroup(
++ name = "gen_hdrs",
++ srcs = [
++ ":libslirp-version.h",
++ ":qapi_hdrs_gen",
++ ":trace_hdrs_gen",
++ "//qapi:extra_hdrs",
++ "//trace:extra_hdrs",
++ ],
++)
++
++filegroup(
++ name = "all_headers",
++ srcs = glob([
++ "accel/**/*.h",
++ "accel/**/*.inc",
++ "audio/**/*.h",
++ "audio/**/*.inc",
++ "authz/**/*.h",
++ "authz/**/*.inc",
++ "backends/**/*.h",
++ "backends/**/*.inc",
++ "block/**/*.h",
++ "block/**/*.inc",
++ "capstone/**/*.h",
++ "capstone/**/*.inc",
++ "chardev/**/*.h",
++ "chardev/**/*.inc",
++ "contrib/**/*.h",
++ "contrib/**/*.inc",
++ "crypto/**/*.h",
++ "crypto/**/*.inc",
++ "default-configs/**/*.h",
++ "default-configs/**/*.inc",
++ "disas/**/*.h",
++ "disas/**/*.inc",
++ "dtc/**/*.h",
++ "dtc/**/*.inc",
++ "dump/**/*.h",
++ "dump/**/*.inc",
++ "fpu/**/*.h",
++ "fpu/**/*.inc",
++ "fsdev/**/*.h",
++ "fsdev/**/*.inc",
++ "gdb-xml/**/*.h",
++ "gdb-xml/**/*.inc",
++ "hw/**/*.h",
++ "hw/**/*.inc",
++ "include/**/*.h",
++ "include/**/*.inc",
++ "io/**/*.h",
++ "io/**/*.inc",
++ "libdecnumber/**/*.h",
++ "libdecnumber/**/*.inc",
++ "linux-headers/**/*.h",
++ "linux-headers/**/*.inc",
++ "linux-user/**/*.h",
++ "linux-user/**/*.inc",
++ "migration/**/*.h",
++ "migration/**/*.inc",
++ "monitor/**/*.h",
++ "monitor/**/*.inc",
++ "nbd/**/*.h",
++ "nbd/**/*.inc",
++ "net/**/*.h",
++ "net/**/*.inc",
++ "plugins/**/*.h",
++ "plugins/**/*.inc",
++ "qapi/**/*.h",
++ "qapi/**/*.inc",
++ "qga/**/*.h",
++ "qga/**/*.inc",
++ "qobject/**/*.h",
++ "qobject/**/*.inc",
++ "qom/**/*.h",
++ "qom/**/*.inc",
++ "replay/**/*.h",
++ "replay/**/*.inc",
++ "scripts/**/*.h",
++ "scripts/**/*.inc",
++ "scsi/**/*.h",
++ "scsi/**/*.inc",
++ "slirp/**/*.h",
++ "slirp/**/*.inc",
++ "softmmu/**/*.h",
++ "softmmu/**/*.inc",
++ "storage-daemon/**/*.h",
++ "storage-daemon/**/*.inc",
++ "subprojects/**/*.h",
++ "subprojects/**/*.inc",
++ "stubs/**/*.h",
++ "stubs/**/*.inc",
++ "target/**/*.h",
++ "target/**/*.inc",
++ "tcg/**/*.h",
++ "tcg/**/*.inc",
++ "tools/**/*.h",
++ "tools/**/*.inc",
++ "trace/**/*.h",
++ "trace/**/*.inc",
++ "ui/**/*.h",
++ "ui/**/*.inc",
++ "util/**/*.h",
++ "util/**/*.inc",
++ ]) + [
++ ":hmp-commands",
++ ":module-block",
++ ":cursor-hdrs",
++ ":keymaps-gen",
++ "qemu-img-cmds.h",
++ "qemu-options.h",
++ "qemu-options-wrapper.h",
++ "qemu-version.h",
++ "replication.h",
++ "x86_64-softmmu-config-devices.h",
++ "x86_64-softmmu-config-target.h",
++ "memory_ldst.c.inc",
++ ],
++)
++
++cc_library(
++ name = "capstone",
++ srcs = [":all_headers"] + [
++ "capstone/cs.c",
++ "capstone/MCInst.c",
++ "capstone/MCInstrDesc.c",
++ "capstone/MCRegisterInfo.c",
++ "capstone/SStream.c",
++ "capstone/utils.c",
++ "capstone/arch/X86/X86Disassembler.c",
++ "capstone/arch/X86/X86DisassemblerDecoder.c",
++ "capstone/arch/X86/X86ATTInstPrinter.c",
++ "capstone/arch/X86/X86IntelInstPrinter.c",
++ "capstone/arch/X86/X86InstPrinterCommon.c",
++ "capstone/arch/X86/X86Mapping.c",
++ "capstone/arch/X86/X86Module.c",
++ ],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ ],
++ includes = ["capstone/include"],
++)
++
++template_file(
++ name = "libslirp-version.h",
++ src = "slirp/src/libslirp-version.h.in",
++ substitutions = {
++ "@SLIRP_MAJOR_VERSION@": "0",
++ "@SLIRP_MINOR_VERSION@": "0",
++ "@SLIRP_MICRO_VERSION@": "1",
++ "@SLIRP_VERSION_STRING@": "\"0.0.1\"",
++ },
++)
++
++cc_library(
++ name = "slirp",
++ srcs = [":all_headers"] + [
++ "slirp/src/arp_table.c",
++ "slirp/src/bootp.c",
++ "slirp/src/cksum.c",
++ "slirp/src/dhcpv6.c",
++ "slirp/src/dnssearch.c",
++ "slirp/src/if.c",
++ "slirp/src/ip6_icmp.c",
++ "slirp/src/ip6_input.c",
++ "slirp/src/ip6_output.c",
++ "slirp/src/ip_icmp.c",
++ "slirp/src/ip_input.c",
++ "slirp/src/ip_output.c",
++ "slirp/src/mbuf.c",
++ "slirp/src/misc.c",
++ "slirp/src/ncsi.c",
++ "slirp/src/ndp_table.c",
++ "slirp/src/sbuf.c",
++ "slirp/src/slirp.c",
++ "slirp/src/socket.c",
++ "slirp/src/state.c",
++ "slirp/src/stream.c",
++ "slirp/src/tcp_input.c",
++ "slirp/src/tcp_output.c",
++ "slirp/src/tcp_subr.c",
++ "slirp/src/tcp_timer.c",
++ "slirp/src/tftp.c",
++ "slirp/src/udp.c",
++ "slirp/src/udp6.c",
++ "slirp/src/util.c",
++ "slirp/src/version.c",
++ "slirp/src/vmstate.c",
++ ] + [":libslirp-version.h"],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ "G_LOG_DOMAIN=\\\"Slirp\\\"",
++ ],
++ deps = [
++ "@glib//glib",
++ ],
++ includes = ["include", "slirp/src"],
++)
++
++cc_library(
++ name = "fdt",
++ srcs = [":all_headers"] + [
++ "dtc/libfdt/fdt.c",
++ "dtc/libfdt/fdt_ro.c",
++ "dtc/libfdt/fdt_wip.c",
++ "dtc/libfdt/fdt_sw.c",
++ "dtc/libfdt/fdt_rw.c",
++ "dtc/libfdt/fdt_strerror.c",
++ "dtc/libfdt/fdt_empty_tree.c",
++ "dtc/libfdt/fdt_addresses.c",
++ "dtc/libfdt/fdt_overlay.c",
++ "dtc/libfdt/fdt_check.c",
++ ],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ ],
++ includes = ["include", "dtc/libfdt", "disas/libvixl"],
++)
++
++cc_library(
++ name = "qemu",
++ srcs = [":all_headers"] + [
++ "accel/accel.c",
++ "audio/audio_legacy.c",
++ "audio/audio.c",
++ "audio/mixeng.c",
++ "audio/noaudio.c",
++ "audio/wavaudio.c",
++ "audio/wavcapture.c",
++ "authz/base.c",
++ "authz/list.c",
++ "authz/listfile.c",
++ "authz/simple.c",
++ "backends/cryptodev-builtin.c",
++ "backends/cryptodev-vhost.c",
++ "backends/cryptodev.c",
++ "backends/hostmem-file.c",
++ "backends/hostmem-memfd.c",
++ "backends/hostmem-ram.c",
++ "backends/hostmem.c",
++ "backends/rng-builtin.c",
++ "backends/rng-egd.c",
++ "backends/rng-random.c",
++ "backends/rng.c",
++ "backends/tpm/tpm_backend.c",
++ "backends/tpm/tpm_emulator.c",
++ "backends/tpm/tpm_passthrough.c",
++ "backends/tpm/tpm_util.c",
++ "block.c",
++ "block/accounting.c",
++ "block/aio_task.c",
++ "block/amend.c",
++ "block/backup-top.c",
++ "block/backup.c",
++ "block/blkdebug.c",
++ "block/blklogwrites.c",
++ "block/blkverify.c",
++ "block/block-backend.c",
++ "block/block-copy.c",
++ "block/commit.c",
++ "block/copy-on-read.c",
++ "block/create.c",
++ "block/crypto.c",
++ "block/dirty-bitmap.c",
++ "block/export/export.c",
++ "block/file-posix.c",
++ "block/filter-compress.c",
++ "block/io_uring.c",
++ "block/io.c",
++ "block/mirror.c",
++ "block/monitor/bitmap-qmp-cmds.c",
++ "block/monitor/block-hmp-cmds.c",
++ "block/nbd.c",
++ "block/null.c",
++ "block/nvme.c",
++ "block/qapi-sysemu.c",
++ "block/qapi.c",
++ "block/qcow2-bitmap.c",
++ "block/qcow2-cache.c",
++ "block/qcow2-cluster.c",
++ "block/qcow2-refcount.c",
++ "block/qcow2-snapshot.c",
++ "block/qcow2-threads.c",
++ "block/qcow2.c",
++ "block/quorum.c",
++ "block/raw-format.c",
++ "block/snapshot.c",
++ "block/stream.c",
++ "block/throttle-groups.c",
++ "block/throttle.c",
++ "block/vhdx-endian.c",
++ "block/vhdx-log.c",
++ "block/vhdx.c",
++ "block/vmdk.c",
++ "block/vpc.c",
++ "block/write-threshold.c",
++ "blockdev-nbd.c",
++ "blockdev.c",
++ "blockjob.c",
++ "chardev/char-fd.c",
++ "chardev/char-fe.c",
++ "chardev/char-file.c",
++ "chardev/char-io.c",
++ "chardev/char-mux.c",
++ "chardev/char-null.c",
++ "chardev/char-parallel.c",
++ "chardev/char-pipe.c",
++ "chardev/char-pty.c",
++ "chardev/char-ringbuf.c",
++ "chardev/char-serial.c",
++ "chardev/char-socket.c",
++ "chardev/char-stdio.c",
++ "chardev/char-udp.c",
++ "chardev/char.c",
++ "chardev/msmouse.c",
++ "chardev/testdev.c",
++ "chardev/wctablet.c",
++ "cpus-common.c",
++ "crypto/aes.c",
++ "crypto/afsplit.c",
++ "crypto/block-luks.c",
++ "crypto/block-qcow.c",
++ "crypto/block.c",
++ "crypto/cipher.c",
++ "crypto/desrfb.c",
++ "crypto/hash-glib.c",
++ "crypto/hash.c",
++ "crypto/hmac-glib.c",
++ "crypto/hmac.c",
++ "crypto/init.c",
++ "crypto/ivgen-essiv.c",
++ "crypto/ivgen-plain.c",
++ "crypto/ivgen-plain64.c",
++ "crypto/ivgen.c",
++ "crypto/pbkdf-stub.c",
++ "crypto/pbkdf.c",
++ "crypto/random-platform.c",
++ "crypto/secret_common.c",
++ "crypto/secret.c",
++ "crypto/tlscreds.c",
++ "crypto/tlscredsanon.c",
++ "crypto/tlscredspsk.c",
++ "crypto/tlscredsx509.c",
++ "crypto/tlssession.c",
++ "crypto/xts.c",
++ "disas/capstone.c",
++ "disas/i386.c",
++ "dump/dump-hmp-cmds.c",
++ "fsdev/qemu-fsdev-dummy.c",
++ "fsdev/qemu-fsdev-opts.c",
++ "fsdev/qemu-fsdev-throttle.c",
++ "hw/acpi/acpi_interface.c",
++ "hw/acpi/aml-build.c",
++ "hw/acpi/bios-linker-loader.c",
++ "hw/acpi/core.c",
++ "hw/acpi/cpu_hotplug.c",
++ "hw/acpi/cpu.c",
++ "hw/acpi/generic_event_device.c",
++ "hw/acpi/hmat.c",
++ "hw/acpi/ich9.c",
++ "hw/acpi/ipmi.c",
++ "hw/acpi/memory_hotplug.c",
++ "hw/acpi/nvdimm.c",
++ "hw/acpi/pci.c",
++ "hw/acpi/pcihp.c",
++ "hw/acpi/piix4.c",
++ "hw/acpi/tco.c",
++ "hw/acpi/tpm.c",
++ "hw/acpi/utils.c",
++ "hw/acpi/vmgenid.c",
++ "hw/audio/ac97.c",
++ "hw/audio/adlib.c",
++ "hw/audio/cs4231a.c",
++ "hw/audio/es1370.c",
++ "hw/audio/fmopl.c",
++ "hw/audio/gus.c",
++ "hw/audio/gusemu_hal.c",
++ "hw/audio/gusemu_mixer.c",
++ "hw/audio/hda-codec.c",
++ "hw/audio/intel-hda.c",
++ "hw/audio/pcspk.c",
++ "hw/audio/sb16.c",
++ "hw/audio/soundhw.c",
++ "hw/block/block.c",
++ "hw/block/cdrom.c",
++ "hw/block/fdc.c",
++ "hw/block/hd-geometry.c",
++ "hw/block/nvme-ns.c",
++ "hw/block/nvme.c",
++ "hw/block/pflash_cfi01.c",
++ "hw/char/debugcon.c",
++ "hw/char/ipoctal232.c",
++ "hw/char/parallel-isa.c",
++ "hw/char/parallel.c",
++ "hw/char/serial-isa.c",
++ "hw/char/serial-pci-multi.c",
++ "hw/char/serial-pci.c",
++ "hw/char/serial.c",
++ "hw/char/virtio-console.c",
++ "hw/core/bus.c",
++ "hw/core/clock-vmstate.c",
++ "hw/core/clock.c",
++ "hw/core/cpu.c",
++ "hw/core/fw-path-provider.c",
++ "hw/core/generic-loader.c",
++ "hw/core/hotplug.c",
++ "hw/core/irq.c",
++ "hw/core/loader.c",
++ "hw/core/machine-hmp-cmds.c",
++ "hw/core/machine.c",
++ "hw/core/nmi.c",
++ "hw/core/null-machine.c",
++ "hw/core/qdev-clock.c",
++ "hw/core/qdev-fw.c",
++ "hw/core/qdev-properties-system.c",
++ "hw/core/qdev-properties.c",
++ "hw/core/qdev.c",
++ "hw/core/reset.c",
++ "hw/core/resettable.c",
++ "hw/core/sysbus.c",
++ "hw/core/vm-change-state-handler.c",
++ "hw/core/vmstate-if.c",
++ "hw/cpu/cluster.c",
++ "hw/cpu/core.c",
++ "hw/display/ati_2d.c",
++ "hw/display/ati_dbg.c",
++ "hw/display/ati.c",
++ "hw/display/bochs-display.c",
++ "hw/display/cirrus_vga_isa.c",
++ "hw/display/cirrus_vga.c",
++ "hw/display/edid-generate.c",
++ "hw/display/edid-region.c",
++ "hw/display/i2c-ddc.c",
++ "hw/display/ramfb-standalone.c",
++ "hw/display/ramfb.c",
++ "hw/display/vga-isa.c",
++ "hw/display/vga-pci.c",
++ "hw/display/virtio-gpu-base.c",
++ "hw/display/virtio-gpu-pci.c",
++ "hw/display/virtio-gpu.c",
++ "hw/display/virtio-vga.c",
++ "hw/display/vmware_vga.c",
++ "hw/dma/i8257.c",
++ "hw/i2c/bitbang_i2c.c",
++ "hw/i2c/core.c",
++ "hw/i2c/pm_smbus.c",
++ "hw/i2c/smbus_eeprom.c",
++ "hw/i2c/smbus_ich9.c",
++ "hw/i2c/smbus_master.c",
++ "hw/i2c/smbus_slave.c",
++ "hw/ide/ahci.c",
++ "hw/ide/atapi.c",
++ "hw/ide/core.c",
++ "hw/ide/ich.c",
++ "hw/ide/ioport.c",
++ "hw/ide/isa.c",
++ "hw/ide/pci.c",
++ "hw/ide/piix.c",
++ "hw/ide/qdev.c",
++ "hw/input/hid.c",
++ "hw/input/pckbd.c",
++ "hw/input/ps2.c",
++ "hw/input/virtio-input-hid.c",
++ "hw/input/virtio-input-host.c",
++ "hw/input/virtio-input.c",
++ "hw/intc/i8259_common.c",
++ "hw/intc/i8259.c",
++ "hw/intc/intc.c",
++ "hw/intc/ioapic_common.c",
++ "hw/ipack/ipack.c",
++ "hw/ipack/tpci200.c",
++ "hw/ipmi/ipmi_bmc_extern.c",
++ "hw/ipmi/ipmi_bmc_sim.c",
++ "hw/ipmi/ipmi_bt.c",
++ "hw/ipmi/ipmi_kcs.c",
++ "hw/ipmi/ipmi.c",
++ "hw/ipmi/isa_ipmi_bt.c",
++ "hw/ipmi/isa_ipmi_kcs.c",
++ "hw/ipmi/pci_ipmi_bt.c",
++ "hw/ipmi/pci_ipmi_kcs.c",
++ "hw/ipmi/smbus_ipmi.c",
++ "hw/isa/apm.c",
++ "hw/isa/isa-bus.c",
++ "hw/isa/piix3.c",
++ "hw/mem/memory-device.c",
++ "hw/mem/nvdimm.c",
++ "hw/mem/pc-dimm.c",
++ "hw/misc/applesmc.c",
++ "hw/misc/debugexit.c",
++ "hw/misc/edu.c",
++ "hw/misc/ivshmem.c",
++ "hw/misc/pc-testdev.c",
++ "hw/misc/pci-testdev.c",
++ "hw/misc/pvpanic.c",
++ "hw/misc/sga.c",
++ "hw/misc/vmcoreinfo.c",
++ "hw/net/can/can_kvaser_pci.c",
++ "hw/net/can/can_mioe3680_pci.c",
++ "hw/net/can/can_pcm3680_pci.c",
++ "hw/net/can/can_sja1000.c",
++ "hw/net/can/ctucan_core.c",
++ "hw/net/can/ctucan_pci.c",
++ "hw/net/e1000.c",
++ "hw/net/e1000e_core.c",
++ "hw/net/e1000e.c",
++ "hw/net/e1000x_common.c",
++ "hw/net/eepro100.c",
++ "hw/net/ne2000-isa.c",
++ "hw/net/ne2000-pci.c",
++ "hw/net/ne2000.c",
++ "hw/net/net_rx_pkt.c",
++ "hw/net/net_tx_pkt.c",
++ "hw/net/pcnet-pci.c",
++ "hw/net/pcnet.c",
++ "hw/net/rocker/rocker_desc.c",
++ "hw/net/rocker/rocker_fp.c",
++ "hw/net/rocker/rocker_of_dpa.c",
++ "hw/net/rocker/rocker_world.c",
++ "hw/net/rocker/rocker.c",
++ "hw/net/rtl8139.c",
++ "hw/net/tulip.c",
++ "hw/net/vhost_net.c",
++ "hw/net/vmxnet3.c",
++ "hw/nvram/eeprom93xx.c",
++ "hw/nvram/fw_cfg-interface.c",
++ "hw/nvram/fw_cfg.c",
++ "hw/pci-bridge/gen_pcie_root_port.c",
++ "hw/pci-bridge/i82801b11.c",
++ "hw/pci-bridge/ioh3420.c",
++ "hw/pci-bridge/pci_bridge_dev.c",
++ "hw/pci-bridge/pci_expander_bridge.c",
++ "hw/pci-bridge/pcie_pci_bridge.c",
++ "hw/pci-bridge/pcie_root_port.c",
++ "hw/pci-bridge/xio3130_downstream.c",
++ "hw/pci-bridge/xio3130_upstream.c",
++ "hw/pci-host/gpex-acpi.c",
++ "hw/pci-host/gpex.c",
++ "hw/pci-host/i440fx.c",
++ "hw/pci-host/pam.c",
++ "hw/pci-host/q35.c",
++ "hw/pci/msi.c",
++ "hw/pci/msix.c",
++ "hw/pci/pci_bridge.c",
++ "hw/pci/pci_host.c",
++ "hw/pci/pci.c",
++ "hw/pci/pcie_aer.c",
++ "hw/pci/pcie_host.c",
++ "hw/pci/pcie_port.c",
++ "hw/pci/pcie.c",
++ "hw/pci/shpc.c",
++ "hw/pci/slotid_cap.c",
++ "hw/pcmcia/pcmcia.c",
++ "hw/scsi/emulation.c",
++ "hw/scsi/esp-pci.c",
++ "hw/scsi/esp.c",
++ "hw/scsi/lsi53c895a.c",
++ "hw/scsi/megasas.c",
++ "hw/scsi/mptconfig.c",
++ "hw/scsi/mptendian.c",
++ "hw/scsi/mptsas.c",
++ "hw/scsi/scsi-bus.c",
++ "hw/scsi/scsi-disk.c",
++ "hw/scsi/scsi-generic.c",
++ "hw/scsi/vmw_pvscsi.c",
++ "hw/sd/core.c",
++ "hw/sd/sd.c",
++ "hw/sd/sdhci-pci.c",
++ "hw/sd/sdhci.c",
++ "hw/sd/sdmmc-internal.c",
++ "hw/smbios/smbios_type_38.c",
++ "hw/smbios/smbios.c",
++ "hw/timer/hpet.c",
++ "hw/timer/i8254_common.c",
++ "hw/timer/i8254.c",
++ "hw/usb/bus.c",
++ "hw/usb/combined-packet.c",
++ "hw/usb/core.c",
++ "hw/usb/desc-msos.c",
++ "hw/usb/desc.c",
++ "hw/usb/dev-audio.c",
++ "hw/usb/dev-hid.c",
++ "hw/usb/dev-hub.c",
++ "hw/usb/dev-mtp.c",
++ "hw/usb/dev-network.c",
++ "hw/usb/dev-serial.c",
++ "hw/usb/dev-smartcard-reader.c",
++ "hw/usb/dev-storage.c",
++ "hw/usb/dev-uas.c",
++ "hw/usb/dev-wacom.c",
++ "hw/usb/hcd-ehci-pci.c",
++ "hw/usb/hcd-ehci.c",
++ "hw/usb/hcd-ohci-pci.c",
++ "hw/usb/hcd-ohci.c",
++ "hw/usb/hcd-uhci.c",
++ "hw/usb/hcd-xhci-nec.c",
++ "hw/usb/hcd-xhci-pci.c",
++ "hw/usb/hcd-xhci-sysbus.c",
++ "hw/usb/hcd-xhci.c",
++ "hw/usb/host-stub.c",
++ "hw/usb/imx-usb-phy.c",
++ "hw/usb/libhw.c",
++ "hw/usb/u2f-passthru.c",
++ "hw/usb/u2f.c",
++ "hw/virtio/virtio-bus.c",
++ "hw/virtio/virtio-mmio.c",
++ "hw/virtio/virtio-pci.c",
++ "hw/watchdog/watchdog.c",
++ "hw/watchdog/wdt_i6300esb.c",
++ "hw/watchdog/wdt_ib700.c",
++ "io/channel-buffer.c",
++ "io/channel-command.c",
++ "io/channel-file.c",
++ "io/channel-socket.c",
++ "io/channel-tls.c",
++ "io/channel-util.c",
++ "io/channel-watch.c",
++ "io/channel-websock.c",
++ "io/channel.c",
++ "io/dns-resolver.c",
++ "io/net-listener.c",
++ "io/task.c",
++ "iothread.c",
++ "job-qmp.c",
++ "job.c",
++ "migration/block-dirty-bitmap.c",
++ "migration/channel.c",
++ "migration/colo-failover.c",
++ "migration/colo.c",
++ "migration/exec.c",
++ "migration/fd.c",
++ "migration/global_state.c",
++ "migration/migration.c",
++ "migration/multifd-zlib.c",
++ "migration/multifd.c",
++ "migration/page_cache.c",
++ "migration/postcopy-ram.c",
++ "migration/qemu-file-channel.c",
++ "migration/qemu-file.c",
++ "migration/savevm.c",
++ "migration/socket.c",
++ "migration/tls.c",
++ "migration/vmstate-types.c",
++ "migration/vmstate.c",
++ "migration/xbzrle.c",
++ "migration/qjson.c",
++ "monitor/hmp-cmds.c",
++ "monitor/hmp.c",
++ "monitor/monitor.c",
++ "monitor/qmp-cmds-control.c",
++ "monitor/qmp-cmds.c",
++ "monitor/qmp.c",
++ "nbd/client.c",
++ "nbd/common.c",
++ "nbd/server.c",
++ "net/announce.c",
++ "net/can/can_core.c",
++ "net/can/can_host.c",
++ "net/can/can_socketcan.c",
++ "net/checksum.c",
++ "net/colo-compare.c",
++ "net/colo.c",
++ "net/dump.c",
++ "net/eth.c",
++ "net/filter-buffer.c",
++ "net/filter-mirror.c",
++ "net/filter-rewriter.c",
++ "net/filter.c",
++ "net/hub.c",
++ "net/l2tpv3.c",
++ "net/net.c",
++ "net/queue.c",
++ "net/slirp.c",
++ "net/socket.c",
++ "net/tap-linux.c",
++ "net/tap.c",
++ "net/util.c",
++ "net/vhost-user-stub.c",
++ "net/vhost-vdpa.c",
++ "os-posix.c",
++ "qemu-io-cmds.c",
++ "qobject/block-qdict.c",
++ "qobject/json-lexer.c",
++ "qobject/json-parser.c",
++ "qobject/json-streamer.c",
++ "qobject/qbool.c",
++ "qobject/qdict.c",
++ "qobject/qjson.c",
++ "qobject/qlist.c",
++ "qobject/qlit.c",
++ "qobject/qnull.c",
++ "qobject/qnum.c",
++ "qobject/qobject.c",
++ "qobject/qstring.c",
++ "qom/container.c",
++ "qom/object_interfaces.c",
++ "qom/object.c",
++ "qom/qom-hmp-cmds.c",
++ "qom/qom-qmp-cmds.c",
++ "qom/qom-qobject.c",
++ "replay/stubs-system.c",
++ "scsi/pr-manager-helper.c",
++ "scsi/pr-manager.c",
++ "scsi/utils.c",
++ "softmmu/bootdevice.c",
++ "softmmu/device_tree.c",
++ "softmmu/dma-helpers.c",
++ "softmmu/qdev-monitor.c",
++ "softmmu/qemu-seccomp.c",
++ "softmmu/tpm.c",
++ "stubs/gdbstub.c",
++ "stubs/icount.c",
++ "stubs/replay-tools.c",
++ "stubs/replay.c",
++ "stubs/semihost.c",
++ "stubs/target-get-monitor-def.c",
++ "stubs/win32-kbd-hook.c",
++ "stubs/xen-hw-stub.c",
++ "contrib/libvhost-user/libvhost-user-glib.c",
++ "contrib/libvhost-user/libvhost-user.c",
++ "ui/console.c",
++ "ui/cursor.c",
++ "ui/input-barrier.c",
++ "ui/input-keymap.c",
++ "ui/input-legacy.c",
++ "ui/input-linux.c",
++ "ui/input.c",
++ "ui/kbd-state.c",
++ "ui/keymaps.c",
++ "ui/qemu-pixman.c",
++ "ui/spice-module.c",
++ "ui/vnc-stubs.c",
++ "util/aio-posix.c",
++ "util/aio-wait.c",
++ "util/aiocb.c",
++ "util/async.c",
++ "util/base64.c",
++ "util/bitmap.c",
++ "util/bitops.c",
++ "util/block-helpers.c",
++ "util/buffer.c",
++ "util/bufferiszero.c",
++ "util/cacheinfo.c",
++ "util/compatfd.c",
++ "util/coroutine-ucontext.c",
++ "util/crc32c.c",
++ "util/cutils.c",
++ "util/drm.c",
++ "util/envlist.c",
++ "util/error.c",
++ "util/event_notifier-posix.c",
++ "util/fdmon-epoll.c",
++ "util/fdmon-io_uring.c",
++ "util/fdmon-poll.c",
++ "util/fifo8.c",
++ "util/filemonitor-inotify.c",
++ "util/getauxval.c",
++ "util/guest-random.c",
++ "util/hbitmap.c",
++ "util/hexdump.c",
++ "util/host-utils.c",
++ "util/id.c",
++ "util/iov.c",
++ "util/iova-tree.c",
++ "util/keyval.c",
++ "util/lockcnt.c",
++ "util/log.c",
++ "util/main-loop.c",
++ "util/memfd.c",
++ "util/mmap-alloc.c",
++ "util/module.c",
++ "util/notify.c",
++ "util/nvdimm-utils.c",
++ "util/osdep.c",
++ "util/oslib-posix.c",
++ "util/pagesize.c",
++ "util/path.c",
++ "util/qdist.c",
++ "util/qemu-co-shared-resource.c",
++ "util/qemu-config.c",
++ "util/qemu-coroutine-io.c",
++ "util/qemu-coroutine-lock.c",
++ "util/qemu-coroutine-sleep.c",
++ "util/qemu-error.c",
++ "util/qemu-openpty.c",
++ "util/qemu-option.c",
++ "util/qemu-print.c",
++ "util/qemu-progress.c",
++ "util/qemu-sockets.c",
++ "util/qemu-thread-posix.c",
++ "util/qemu-timer-common.c",
++ "util/qemu-timer.c",
++ "util/qht.c",
++ "util/qsp.c",
++ "util/range.c",
++ "util/rcu.c",
++ "util/readline.c",
++ "util/stats64.c",
++ "util/sys_membarrier.c",
++ "util/systemd.c",
++ "util/thread-pool.c",
++ "util/throttle.c",
++ "util/timed-average.c",
++ "util/unicode.c",
++ "util/uri.c",
++ "util/uuid.c",
++ "util/vfio-helpers.c",
++ "util/vhost-user-server.c",
++ "util/qemu-coroutine.c",
++ ] + [
++ "//qapi:opts-visitor.c",
++ "//qapi:qapi-clone-visitor.c",
++ "//qapi:qapi-dealloc-visitor.c",
++ "//qapi:qapi-util.c",
++ "//qapi:qapi-visit-core.c",
++ "//qapi:qmp-dispatch.c",
++ "//qapi:qmp-event.c",
++ "//qapi:qmp-registry.c",
++ "//qapi:qobject-input-visitor.c",
++ "//qapi:qobject-output-visitor.c",
++ "//qapi:string-input-visitor.c",
++ "//qapi:string-output-visitor.c",
++ "//trace:control.c",
++ "//trace:qmp.c",
++ ] + [
++ ":gen_hdrs",
++ ":block-coroutine-gen",
++ ],
++ # QEMU relies on hacky two's complement representation interpretation of bitshifts
++ copts = ["-fwrapv"],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ ],
++ deps = [
++ ":capstone",
++ ":fdt",
++ ":slirp",
++ "@glib//glib",
++ "@pixman//:pixman",
++ "@seccomp",
++ "@uring//:uring",
++ "@zlib//:zlib",
++ ],
++ includes = ["include", "capstone/include/capstone"],
++ alwayslink = True, # QEMU uses __attribute__((constructor)) functions
++)
++
++cc_binary(
++ name = "qemu-x86_64-softmmu",
++ srcs = [":all_headers"] + [
++ "//trace:control-target.c",
++ "accel/dummy-cpus.c",
++ "accel/kvm/kvm-all.c",
++ "accel/kvm/kvm-cpus.c",
++ "accel/qtest/qtest.c",
++ "accel/stubs/hax-stub.c",
++ "accel/stubs/tcg-stub.c",
++ "accel/stubs/xen-stub.c",
++ "cpu.c",
++ "disas.c",
++ "dump/dump.c",
++ "dump/win_dump.c",
++ "exec-vary.c",
++ "gdbstub.c",
++ "hw/block/dataplane/virtio-blk.c",
++ "hw/block/virtio-blk.c",
++ "hw/char/virtio-serial-bus.c",
++ "hw/core/machine-qmp-cmds.c",
++ "hw/core/numa.c",
++ "hw/display/vga.c",
++ "hw/hyperv/hyperv_testdev.c",
++ "hw/hyperv/hyperv.c",
++ "hw/hyperv/vmbus.c",
++ "hw/i386/acpi-build.c",
++ "hw/i386/acpi-common.c",
++ "hw/i386/acpi-microvm.c",
++ "hw/i386/amd_iommu.c",
++ "hw/i386/e820_memory_layout.c",
++ "hw/i386/fw_cfg.c",
++ "hw/i386/generic_event_device_x86.c",
++ "hw/i386/intel_iommu.c",
++ "hw/i386/kvm/apic.c",
++ "hw/i386/kvm/clock.c",
++ "hw/i386/kvm/i8254.c",
++ "hw/i386/kvm/i8259.c",
++ "hw/i386/kvm/ioapic.c",
++ "hw/i386/kvmvapic.c",
++ "hw/i386/microvm.c",
++ "hw/i386/multiboot.c",
++ "hw/i386/pc_piix.c",
++ "hw/i386/pc_q35.c",
++ "hw/i386/pc_sysfw.c",
++ "hw/i386/pc.c",
++ "hw/i386/port92.c",
++ "hw/i386/vmmouse.c",
++ "hw/i386/vmport.c",
++ "hw/i386/x86-iommu.c",
++ "hw/i386/x86.c",
++ "hw/intc/apic_common.c",
++ "hw/intc/apic.c",
++ "hw/intc/ioapic.c",
++ "hw/isa/lpc_ich9.c",
++ "hw/net/virtio-net.c",
++ "hw/rtc/mc146818rtc.c",
++ "hw/scsi/virtio-scsi-dataplane.c",
++ "hw/scsi/virtio-scsi.c",
++ "hw/vfio/common.c",
++ "hw/vfio/display.c",
++ "hw/vfio/igd.c",
++ "hw/vfio/migration.c",
++ "hw/vfio/pci-quirks.c",
++ "hw/vfio/pci.c",
++ "hw/vfio/spapr.c",
++ "hw/virtio/vhost-backend.c",
++ "hw/virtio/vhost-vdpa.c",
++ "hw/virtio/vhost.c",
++ "hw/virtio/virtio-balloon-pci.c",
++ "hw/virtio/virtio-balloon.c",
++ "hw/virtio/virtio-blk-pci.c",
++ "hw/virtio/virtio-crypto-pci.c",
++ "hw/virtio/virtio-crypto.c",
++ "hw/virtio/virtio-input-host-pci.c",
++ "hw/virtio/virtio-input-pci.c",
++ "hw/virtio/virtio-iommu-pci.c",
++ "hw/virtio/virtio-iommu.c",
++ "hw/virtio/virtio-mem-pci.c",
++ "hw/virtio/virtio-mem.c",
++ "hw/virtio/virtio-net-pci.c",
++ "hw/virtio/virtio-pmem-pci.c",
++ "hw/virtio/virtio-pmem.c",
++ "hw/virtio/virtio-rng-pci.c",
++ "hw/virtio/virtio-rng.c",
++ "hw/virtio/virtio-scsi-pci.c",
++ "hw/virtio/virtio-serial-pci.c",
++ "hw/virtio/virtio.c",
++ "migration/dirtyrate.c",
++ "migration/ram.c",
++ "monitor/misc.c",
++ "softmmu/arch_init.c",
++ "softmmu/balloon.c",
++ "softmmu/cpu-throttle.c",
++ "softmmu/cpu-timers.c",
++ "softmmu/cpus.c",
++ "softmmu/ioport.c",
++ "softmmu/main.c",
++ "softmmu/memory_mapping.c",
++ "softmmu/memory.c",
++ "softmmu/physmem.c",
++ "softmmu/qtest.c",
++ "softmmu/vl.c",
++ "target/i386/arch_dump.c",
++ "target/i386/arch_memory_mapping.c",
++ "target/i386/cpu.c",
++ "target/i386/gdbstub.c",
++ "target/i386/helper.c",
++ "target/i386/kvm.c",
++ "target/i386/hyperv.c",
++ "target/i386/machine.c",
++ "target/i386/monitor.c",
++ "target/i386/tcg-stub.c",
++ "target/i386/sev.c",
++ "target/i386/xsave_helper.c",
++ ] + [
++ ":gen_hdrs",
++ ":trace_c",
++ ":qapi_c",
++ ],
++ copts = ["-fwrapv"], # QEMU relies on hacky two's complement representations of bitshifts
++ linkopts = [
++ "-pthread",
++ "-lutil", # Not actually a library but weird GLIBC shenanigans
++ ],
++ data = glob(["pc-bios/**"]),
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ "NEED_CPU_H",
++ "CONFIG_TARGET=\\\"x86_64-softmmu-config-target.h\\\"",
++ "CONFIG_DEVICES=\\\"x86_64-softmmu-config-devices.h\\\"",
++ ],
++ deps = [
++ ":fdt",
++ ":qemu",
++ ":slirp",
++ "@glib//glib",
++ "@pixman//:pixman",
++ "@zlib//:zlib",
++ ],
++ visibility = ["//visibility:public"],
++ includes = ["target/i386", "tcg/i386", "accel/tcg", "linux-headers"],
++)
++
++genrule(
++ name = "cursor-hdrs",
++ srcs = [
++ "ui/cursor_hidden.xpm",
++ "ui/cursor_left_ptr.xpm",
++ ],
++ outs = [
++ "ui/cursor_hidden.h",
++ "ui/cursor_left_ptr.h",
++ ],
++ cmd = """
++ cp $(location ui/cursor_hidden.xpm) $(location ui/cursor_hidden.h)
++ cp $(location ui/cursor_left_ptr.xpm) $(location ui/cursor_left_ptr.h)
++ """,
++)
++
++genrule(
++ name = "module-block",
++ outs = ["block/module_block.h"],
++ cmd = "./$(location //scripts/modules:module_block) $(location block/module_block.h)",
++ tools = ["//scripts/modules:module_block"],
++)
++
++genrule(
++ name = "hmp-commands",
++ srcs = [
++ "hmp-commands.hx",
++ "hmp-commands-info.hx",
++ "qemu-options.hx",
++ "qemu-img-cmds.hx",
++ ],
++ outs = [
++ "hmp-commands.h",
++ "hmp-commands-info.h",
++ "qemu-options-gen.h",
++ "qemu-img-cmds.h",
++ ],
++ cmd = """
++ ./$(location //scripts:hxtool-sh) -h $(location hmp-commands.hx) > $(location hmp-commands.h)
++ ./$(location //scripts:hxtool-sh) -h $(location hmp-commands-info.hx) > $(location hmp-commands-info.h)
++ ./$(location //scripts:hxtool-sh) -h $(location qemu-options.hx) > $(location qemu-options-gen.h)
++ ./$(location //scripts:hxtool-sh) -h $(location qemu-img-cmds.hx) > $(location qemu-img-cmds.h)
++ """,
++ tools = ["//scripts:hxtool-sh"],
++)
++
++cc_qemu_keymaps(
++ name = "keymaps-gen",
++ src = "ui/keycodemapdb/data/keymaps.csv",
++ maps = {
++ "atset1": ["qcode"],
++ "linux": ["qcode"],
++ "qcode": [
++ "atset1",
++ "atset2",
++ "atset3",
++ "linux",
++ "qnum",
++ "sun",
++ ],
++ "qnum": ["qcode"],
++ "usb": ["qcode"],
++ "win32": ["qcode"],
++ "x11": ["qcode"],
++ "xorgevdev": ["qcode"],
++ "xorgkbd": ["qcode"],
++ "xorgxquartz": ["qcode"],
++ "xorgxwin": ["qcode"],
++ "osx": ["qcode"],
++ },
++)
++
++
++genrule(
++ name = "renamed-keymap-gen",
++ srcs = ["ui/keycodemapdb/tools/keymap-gen"],
++ outs = ["keymap-gen.py"],
++ cmd = "cp $(location ui/keycodemapdb/tools/keymap-gen) $@",
++)
++
++py_binary(
++ name = "keymap-gen",
++ srcs = [":renamed-keymap-gen"],
++ visibility = ["//visibility:public"],
++)
++
++genrule(
++ name = "gdbstub-xml",
++ srcs = ["gdb-xml/i386-64bit.xml"],
++ outs = ["x86_64-softmmu-gdbstub-xml.c"],
++ cmd = "./$(location //scripts:feature_to_c) $(location gdb-xml/i386-64bit.xml) > $@",
++ tools = ["//scripts:feature_to_c"],
++)
++
++# TODO: x86_64-softmmu-config-target.h, x86_64-softmmu-config-devices.h, include/qemu/config-host.h (probably copy)
++# TODO: ui/input-keymap-*.c.inc (generate at top level with //ui/keycodemapdb/tools:keymap-gen)
+diff --git a/defs.bzl b/defs.bzl
+new file mode 100644
+index 0000000000..3a8d50d429
+--- /dev/null
++++ b/defs.bzl
+@@ -0,0 +1,52 @@
++def _impl_filter_label_suffix(ctx):
++ return [DefaultInfo(
++ files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix) and f.basename not in ctx.attr.exclude]),
++ )]
++
++filter_label_suffix = rule(
++ implementation = _impl_filter_label_suffix,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "suffix": attr.string(
++ mandatory = True,
++ ),
++ "exclude": attr.string_list(
++ default = [],
++ ),
++ },
++)
++
++def _impl_cc_qemu_keymaps(ctx):
++ outs = []
++ for _from in ctx.attr.maps:
++ for _to in ctx.attr.maps[_from]:
++ out = ctx.actions.declare_file("ui/input-keymap-{}-to-{}.c.inc".format(_from, _to))
++ ctx.actions.run(
++ inputs = ctx.files.src + ctx.files._keymap_gen,
++ executable = ctx.executable._savestdout,
++ arguments = [out.path, ctx.files._keymap_gen[0].path, "--lang=glib2", "--varname=qemu_input_map_{}_to_{}".format(_from, _to), "code-map", ctx.files.src[0].path, _from, _to],
++ outputs = [out],
++ )
++ outs.append(out)
++ return [DefaultInfo(files = depset(outs))]
++
++cc_qemu_keymaps = rule(
++ implementation = _impl_cc_qemu_keymaps,
++ attrs = {
++ "src": attr.label(allow_single_file = True),
++ "maps": attr.string_list_dict(),
++ "_keymap_gen": attr.label(
++ default = Label("//:keymap-gen"),
++ executable = True,
++ cfg = "exec",
++ ),
++ "_savestdout": attr.label(
++ default = Label("@dev_source_monogon//build/savestdout"),
++ executable = True,
++ cfg = "exec",
++ ),
++ },
++)
+diff --git a/qapi/BUILD b/qapi/BUILD
+new file mode 100644
+index 0000000000..71ff5a7445
+--- /dev/null
++++ b/qapi/BUILD
+@@ -0,0 +1,25 @@
++load("//scripts/qapi:defs.bzl", "cc_qapi")
++
++cc_qapi(
++ name = "qapi_generated",
++ srcs = glob(["*.json"]),
++ main = "qapi-schema.json",
++ visibility = ["//visibility:public"],
++)
++
++exports_files(glob([
++ "*.c",
++ "*.h",
++]) + ["trace-events"])
++
++filegroup(
++ name = "extra_hdrs",
++ srcs = glob(["**/*.h"]),
++ visibility = ["//visibility:public"],
++)
++
++filegroup(
++ name = "schema",
++ srcs = glob(["*.json"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/qapi/defs.bzl b/qapi/defs.bzl
+new file mode 100644
+index 0000000000..2d1f38fdfa
+--- /dev/null
++++ b/qapi/defs.bzl
+@@ -0,0 +1,40 @@
++load("@rules_cc//cc:defs.bzl", "cc_library")
++
++# The actual rule which does the filtering.
++def _do_filter_impl(ctx):
++ return [DefaultInfo(
++ files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix)]),
++ )]
++
++_do_filter = rule(
++ implementation = _do_filter_impl,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "suffix": attr.string(
++ mandatory = True,
++ ),
++ },
++)
++
++def filtered_cc_library(name, srcs, hdrs, **kwargs):
++ _do_filter(
++ name = "%s_hdrs" % name,
++ visibility = ["//visibility:private"],
++ srcs = hdrs,
++ suffix = ".h",
++ )
++ _do_filter(
++ name = "%s_srcs" % name,
++ visibility = ["//visibility:private"],
++ srcs = srcs,
++ suffix = ".c",
++ )
++ cc_library(
++ name = name,
++ srcs = [":%s_srcs" % name],
++ hdrs = [":%s_hdrs" % name],
++ **kwargs
++ )
+diff --git a/scripts/BUILD b/scripts/BUILD
+new file mode 100644
+index 0000000000..0b4fc8a248
+--- /dev/null
++++ b/scripts/BUILD
+@@ -0,0 +1,35 @@
++load("@rules_python//python:defs.bzl", "py_binary")
++
++py_binary(
++ name = "qapi-gen",
++ srcs = ["qapi-gen.py"],
++ visibility = ["//visibility:public"],
++ deps = ["//scripts/qapi"],
++)
++
++py_binary(
++ # We cannot use tracetool as name as a directory with the same name exists
++ name = "tracetool-cli",
++ srcs = ["tracetool.py"],
++ main = "tracetool.py",
++ visibility = ["//visibility:public"],
++ deps = ["//scripts/tracetool"],
++)
++
++py_binary(
++ name = "block-coroutine-wrapper",
++ srcs = ["block-coroutine-wrapper.py"],
++ visibility = ["//visibility:public"],
++)
++
++sh_binary(
++ name = "hxtool-sh",
++ srcs = ["hxtool"],
++ visibility = ["//visibility:public"],
++)
++
++sh_binary(
++ name = "feature_to_c",
++ srcs = ["feature_to_c.sh"],
++ visibility = ["//:__subpackages__"],
++)
+diff --git a/scripts/modules/BUILD b/scripts/modules/BUILD
+new file mode 100644
+index 0000000000..99a5ab2243
+--- /dev/null
++++ b/scripts/modules/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_binary")
++
++py_binary(
++ name = "module_block",
++ srcs = ["module_block.py"],
++ visibility = ["//:__subpackages__"]
++)
+diff --git a/scripts/qapi/BUILD b/scripts/qapi/BUILD
+new file mode 100644
+index 0000000000..a7e8da9368
+--- /dev/null
++++ b/scripts/qapi/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "qapi",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/scripts/qapi/defs.bzl b/scripts/qapi/defs.bzl
+new file mode 100644
+index 0000000000..807f4b37d5
+--- /dev/null
++++ b/scripts/qapi/defs.bzl
+@@ -0,0 +1,52 @@
++def _impl_qapi_cc(ctx):
++ out = []
++ out_types = ["types", "visit", "events", "commands"]
++ system_modules = ["builtin-types", "builtin-visit", "introspect", "init-commands", "emit-events", "types-error", "visit-error"]
++ for t in out_types:
++ out.append(ctx.actions.declare_file("qapi-{}.c".format(t)))
++ out.append(ctx.actions.declare_file("qapi-{}.h".format(t)))
++ for t in system_modules:
++ out.append(ctx.actions.declare_file("qapi-{}.c".format(t)))
++ out.append(ctx.actions.declare_file("qapi-{}.h".format(t)))
++
++ input_dir = ""
++ main_file = ctx.files.main[0]
++ for src in ctx.files.srcs:
++ if src.path == main_file.path:
++ continue
++ extension = src.extension
++ basename = src.basename[:-len(extension) - 1]
++ if input_dir == "":
++ input_dir = src.dirname
++ elif input_dir != src.dirname:
++ fail("all cc_qapi sources need to be in the same folder")
++
++ for t in out_types:
++ out.append(ctx.actions.declare_file("qapi-{}-{}.c".format(t, basename)))
++ out.append(ctx.actions.declare_file("qapi-{}-{}.h".format(t, basename)))
++
++ ctx.actions.run(
++ inputs = ctx.files.srcs + ctx.files.main,
++ executable = ctx.executable._qapi_gen,
++ arguments = ["-o", out[0].dirname, "-b", main_file.path],
++ outputs = out,
++ )
++ return [DefaultInfo(files = depset(out))]
++
++cc_qapi = rule(
++ implementation = _impl_qapi_cc,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "main": attr.label(
++ allow_single_file = True,
++ ),
++ "_qapi_gen": attr.label(
++ default = Label("//scripts:qapi-gen"),
++ executable = True,
++ cfg = "exec",
++ ),
++ },
++)
+diff --git a/scripts/tracetool/BUILD b/scripts/tracetool/BUILD
+new file mode 100644
+index 0000000000..93ccf94480
+--- /dev/null
++++ b/scripts/tracetool/BUILD
+@@ -0,0 +1,11 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "tracetool",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++ deps = [
++ "//scripts/tracetool/backend",
++ "//scripts/tracetool/format",
++ ],
++)
+diff --git a/scripts/tracetool/backend/BUILD b/scripts/tracetool/backend/BUILD
+new file mode 100644
+index 0000000000..6cc626682c
+--- /dev/null
++++ b/scripts/tracetool/backend/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "backend",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/scripts/tracetool/defs.bzl b/scripts/tracetool/defs.bzl
+new file mode 100644
+index 0000000000..70ce080a62
+--- /dev/null
++++ b/scripts/tracetool/defs.bzl
+@@ -0,0 +1,65 @@
++def _impl_cc_qemu_trace(ctx):
++ outs = []
++ for src in ctx.files.srcs:
++ name = src.path.replace("external/qemu/", "").replace("/trace-events", "").replace("/", "_")
++ if name == "trace-events":
++ name = "root"
++ trace_h = ctx.actions.declare_file("trace-{}.h".format(name))
++ trace_c = ctx.actions.declare_file("trace-{}.c".format(name))
++ outs.append(trace_c)
++ outs.append(trace_h)
++
++ ctx.actions.run(
++ inputs = [src] + ctx.files._tracetool,
++ executable = ctx.executable._savestdout,
++ arguments = [trace_h.path, ctx.files._tracetool[0].path, "--backend", ctx.attr.backend, "--group", name, "--format=h", src.path],
++ outputs = [trace_h],
++ )
++ ctx.actions.run(
++ inputs = [src] + ctx.files._tracetool,
++ executable = ctx.executable._savestdout,
++ arguments = [trace_c.path, ctx.files._tracetool[0].path, "--backend", ctx.attr.backend, "--group", name, "--format=c", src.path],
++ outputs = [trace_c],
++ )
++ return [DefaultInfo(files = depset(outs))]
++
++cc_qemu_trace = rule(
++ implementation = _impl_cc_qemu_trace,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "backend": attr.string(
++ default = "log",
++ ),
++ "_tracetool": attr.label(
++ default = Label("//scripts:tracetool-cli"),
++ executable = True,
++ cfg = "exec",
++ ),
++ "_savestdout": attr.label(
++ default = Label("@dev_source_monogon//build/savestdout"),
++ executable = True,
++ cfg = "exec",
++ ),
++ },
++)
++
++def _impl_cc_qemu_trace_single(ctx):
++ trace_h = ctx.actions.declare_file("trace-{}.h".format(ctx.attr.name))
++ trace_c = ctx.actions.declare_file("trace-{}.c".format(ctx.attr.name))
++
++ ctx.actions.run(
++ inputs = ctx.files.src,
++ executable = ctx.executable._tracetool,
++ arguments = ["--backend", ctx.attr.backend, "--group", ctx.attr.name, "--format=h", ctx.files.src[0].path, trace_h.path],
++ outputs = [trace_h],
++ )
++ ctx.actions.run(
++ inputs = ctx.files.src,
++ executable = ctx.executable._tracetool,
++ arguments = ["--backend", ctx.attr.backend, "--group", ctx.attr.name, "--format=c", ctx.files.src[0].path, trace_c.path],
++ outputs = [trace_c],
++ )
++ return [DefaultInfo(files = depset([trace_c, trace_h]))]
+diff --git a/scripts/tracetool/format/BUILD b/scripts/tracetool/format/BUILD
+new file mode 100644
+index 0000000000..1b2dc209e1
+--- /dev/null
++++ b/scripts/tracetool/format/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "format",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/trace/BUILD b/trace/BUILD
+new file mode 100644
+index 0000000000..2f2e71d81a
+--- /dev/null
++++ b/trace/BUILD
+@@ -0,0 +1,18 @@
++load("//scripts/tracetool:defs.bzl", "cc_qemu_trace")
++
++cc_qemu_trace(
++ name = "trace",
++ srcs = ["//:trace-files"],
++ visibility = ["//visibility:public"],
++)
++
++exports_files(glob([
++ "*.c",
++ "*.h",
++]))
++
++filegroup(
++ name = "extra_hdrs",
++ srcs = glob(["**/*.h"]),
++ visibility = ["//visibility:public"],
++)
+--
+2.25.1
+
diff --git a/third_party/qemu/patches/fix_code_issues.patch b/third_party/qemu/patches/fix_code_issues.patch
new file mode 100644
index 0000000..af1ba5f
--- /dev/null
+++ b/third_party/qemu/patches/fix_code_issues.patch
@@ -0,0 +1,55 @@
+Copyright 2020 The Monogon Project Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+From 931f89680cd6714a4eca13c8ae11cd733c1b4609 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@brun.one>
+Date: Wed, 10 Mar 2021 17:55:55 +0100
+Subject: [PATCH 2/6] Fix QEMU code issues
+
+---
+ qom/object.c | 2 +-
+ softmmu/physmem.c | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/qom/object.c b/qom/object.c
+index 1065355233..f3aa56cc52 100644
+--- a/qom/object.c
++++ b/qom/object.c
+@@ -692,7 +692,7 @@ static void object_finalize(void *data)
+
+ /* Find the minimum alignment guaranteed by the system malloc. */
+ #if __STDC_VERSION__ >= 201112L
+-typddef max_align_t qemu_max_align_t;
++typedef max_align_t qemu_max_align_t;
+ #else
+ typedef union {
+ long l;
+diff --git a/softmmu/physmem.c b/softmmu/physmem.c
+index 3027747c03..2eb31592f4 100644
+--- a/softmmu/physmem.c
++++ b/softmmu/physmem.c
+@@ -2675,7 +2675,8 @@ static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr,
+ }
+ if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) {
+ assert(tcg_enabled());
+- tb_invalidate_phys_range(addr, addr + length);
++ // If this symbol is not elided by the compiler it cannot be found.
++ // tb_invalidate_phys_range(addr, addr + length);
+ dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE);
+ }
+ cpu_physical_memory_set_dirty_range(addr, length, dirty_log_mask);
+--
+2.25.1
+
diff --git a/third_party/qemu/patches/headers_fix.patch b/third_party/qemu/patches/headers_fix.patch
new file mode 100644
index 0000000..a70bd75
--- /dev/null
+++ b/third_party/qemu/patches/headers_fix.patch
@@ -0,0 +1,1179 @@
+Copyright 2020 The Monogon Project Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+diff --git a/block/cloop.c b/block/cloop.c
+index c99192a57f..fa8bc497a4 100644
+--- a/block/cloop.c
++++ b/block/cloop.c
+@@ -27,7 +27,7 @@
+ #include "block/block_int.h"
+ #include "qemu/module.h"
+ #include "qemu/bswap.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ /* Maximum compressed block size */
+ #define MAX_BLOCK_SIZE (64 * 1024 * 1024)
+diff --git a/block/dmg.h b/block/dmg.h
+index e488601b62..fc3ac8116a 100644
+--- a/block/dmg.h
++++ b/block/dmg.h
+@@ -27,7 +27,7 @@
+ #define BLOCK_DMG_H
+
+ #include "block/block_int.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ typedef struct BDRVDMGState {
+ CoMutex lock;
+diff --git a/block/io_uring.c b/block/io_uring.c
+index 00a3ee9fb8..f3644dbc75 100644
+--- a/block/io_uring.c
++++ b/block/io_uring.c
+@@ -9,7 +9,7 @@
+ * See the COPYING file in the top-level directory.
+ */
+ #include "qemu/osdep.h"
+-#include <liburing.h>
++#include "src/include/liburing.h"
+ #include "qemu-common.h"
+ #include "block/aio.h"
+ #include "qemu/queue.h"
+diff --git a/block/qcow.c b/block/qcow.c
+index f8919a44d1..1229c120d8 100644
+--- a/block/qcow.c
++++ b/block/qcow.c
+@@ -32,7 +32,7 @@
+ #include "qemu/option.h"
+ #include "qemu/bswap.h"
+ #include "qemu/cutils.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qapi/qmp/qdict.h"
+ #include "qapi/qmp/qstring.h"
+ #include "qapi/qobject-input-visitor.h"
+diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
+index bd0597842f..8049db50a4 100644
+--- a/block/qcow2-cluster.c
++++ b/block/qcow2-cluster.c
+@@ -23,7 +23,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "qapi/error.h"
+ #include "qcow2.h"
+diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c
+index 1914baf456..2370faf16a 100644
+--- a/block/qcow2-threads.c
++++ b/block/qcow2-threads.c
+@@ -26,7 +26,7 @@
+ #include "qemu/osdep.h"
+
+ #define ZLIB_CONST
+-#include <zlib.h>
++#include "zlib.h"
+
+ #ifdef CONFIG_ZSTD
+ #include <zstd.h>
+diff --git a/block/vmdk.c b/block/vmdk.c
+index a00dc00eb4..6a77fe375f 100644
+--- a/block/vmdk.c
++++ b/block/vmdk.c
+@@ -35,7 +35,7 @@
+ #include "qemu/bswap.h"
+ #include "migration/blocker.h"
+ #include "qemu/cutils.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D')
+ #define VMDK4_MAGIC (('K' << 24) | ('D' << 16) | ('M' << 8) | 'V')
+diff --git a/contrib/libvhost-user/libvhost-user-glib.h b/contrib/libvhost-user/libvhost-user-glib.h
+index 1a79a4916e..d0c76e83ec 100644
+--- a/contrib/libvhost-user/libvhost-user-glib.h
++++ b/contrib/libvhost-user/libvhost-user-glib.h
+@@ -15,7 +15,7 @@
+ #ifndef LIBVHOST_USER_GLIB_H
+ #define LIBVHOST_USER_GLIB_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include "libvhost-user.h"
+
+ typedef struct VugDev {
+diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
+index 37435a3fc7..df38b5adf3 100644
+--- a/contrib/plugins/hotblocks.c
++++ b/contrib/plugins/hotblocks.c
+@@ -11,7 +11,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c
+index ecd6c18732..3d41d80d78 100644
+--- a/contrib/plugins/hotpages.c
++++ b/contrib/plugins/hotpages.c
+@@ -14,7 +14,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
+index 3b9a6939f2..2c85253ba4 100644
+--- a/contrib/plugins/howvec.c
++++ b/contrib/plugins/howvec.c
+@@ -16,7 +16,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
+index 5aad50869d..0e5d489beb 100644
+--- a/contrib/plugins/lockstep.c
++++ b/contrib/plugins/lockstep.c
+@@ -23,7 +23,7 @@
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <inttypes.h>
+ #include <unistd.h>
+ #include <sys/socket.h>
+diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
+index a019d0a9ac..23ac689e11 100644
+--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
++++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
+@@ -16,8 +16,8 @@
+ #include "qapi/error.h"
+ #include "qemu/sockets.h"
+
+-#include <pixman.h>
+-#include <glib-unix.h>
++#include "pixman.h"
++#include "glib/glib-unix.h"
+
+ #include "vugpu.h"
+ #include "hw/virtio/virtio-gpu-bswap.h"
+diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
+index 6020c6f33a..3254be9e65 100644
+--- a/contrib/vhost-user-input/main.c
++++ b/contrib/vhost-user-input/main.c
+@@ -6,7 +6,7 @@
+
+ #include "qemu/osdep.h"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <linux/input.h>
+
+ #include "qemu/iov.h"
+diff --git a/dump/dump.c b/dump/dump.c
+index dec32468d9..cfda910798 100644
+--- a/dump/dump.c
++++ b/dump/dump.c
+@@ -35,7 +35,7 @@
+ #include "win_dump.h"
+ #endif
+
+-#include <zlib.h>
++#include "zlib.h"
+ #ifdef CONFIG_LZO
+ #include <lzo/lzo1x.h>
+ #endif
+diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
+index a1c9beddd2..003bb87175 100644
+--- a/fsdev/9p-iov-marshal.c
++++ b/fsdev/9p-iov-marshal.c
+@@ -12,7 +12,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include <utime.h>
+
+ #include "9p-iov-marshal.h"
+diff --git a/fsdev/9p-marshal.c b/fsdev/9p-marshal.c
+index a01bba6908..af93f824ac 100644
+--- a/fsdev/9p-marshal.c
++++ b/fsdev/9p-marshal.c
+@@ -12,7 +12,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include <dirent.h>
+ #include <utime.h>
+
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index 94df440fc7..4db4f2f548 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -12,7 +12,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include "hw/virtio/virtio.h"
+ #include "qapi/error.h"
+ #include "qemu/error-report.h"
+diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
+index 3792ba96ce..6ae8fbeb42 100644
+--- a/hw/acpi/aml-build.c
++++ b/hw/acpi/aml-build.c
+@@ -20,7 +20,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include "hw/acpi/aml-build.h"
+ #include "qemu/bswap.h"
+ #include "qemu/bitops.h"
+diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
+index b7c7b3ba94..83ecffe630 100644
+--- a/hw/core/loader-fit.c
++++ b/hw/core/loader-fit.c
+@@ -28,7 +28,7 @@
+ #include "sysemu/device_tree.h"
+
+ #include <libfdt.h>
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define FIT_LOADER_MAX_PATH (128)
+
+diff --git a/hw/core/loader.c b/hw/core/loader.c
+index 8bbb1797a4..eb29421324 100644
+--- a/hw/core/loader.c
++++ b/hw/core/loader.c
+@@ -61,7 +61,7 @@
+ #include "qemu/cutils.h"
+ #include "sysemu/runstate.h"
+
+-#include <zlib.h>
++#include "zlib.h"
+
+ static int roms_loaded;
+
+diff --git a/hw/display/qxl.c b/hw/display/qxl.c
+index 431c107096..f3ab3cc302 100644
+--- a/hw/display/qxl.c
++++ b/hw/display/qxl.c
+@@ -20,7 +20,7 @@
+
+ #include "qemu/osdep.h"
+ #include "qemu/units.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "qapi/error.h"
+ #include "qemu/timer.h"
+diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c
+index ddddf35c45..5c166d50d9 100644
+--- a/hw/net/allwinner_emac.c
++++ b/hw/net/allwinner_emac.c
+@@ -27,7 +27,7 @@
+ #include "hw/qdev-properties.h"
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ static uint8_t padding[60];
+
+diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
+index 7a534691f1..e653285d62 100644
+--- a/hw/net/cadence_gem.c
++++ b/hw/net/cadence_gem.c
+@@ -23,7 +23,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+
+ #include "hw/irq.h"
+ #include "hw/net/cadence_gem.h"
+diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
+index 205c0decc5..f01361734f 100644
+--- a/hw/net/dp8393x.c
++++ b/hw/net/dp8393x.c
+@@ -26,7 +26,7 @@
+ #include "qapi/error.h"
+ #include "qemu/module.h"
+ #include "qemu/timer.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ //#define DEBUG_SONIC
+diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
+index 782ff192ce..d7ff65ced7 100644
+--- a/hw/net/ftgmac100.c
++++ b/hw/net/ftgmac100.c
+@@ -25,7 +25,7 @@
+ #include "migration/vmstate.h"
+
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+
+ /*
+ * FTGMAC100 registers
+diff --git a/hw/net/i82596.c b/hw/net/i82596.c
+index 055c3a1470..ca38538111 100644
+--- a/hw/net/i82596.c
++++ b/hw/net/i82596.c
+@@ -19,7 +19,7 @@
+ #include "qemu/module.h"
+ #include "trace.h"
+ #include "i82596.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+
+ #if defined(ENABLE_DEBUG)
+ #define DBG(x) x
+diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
+index 2c14804041..c73b837fc4 100644
+--- a/hw/net/imx_fec.c
++++ b/hw/net/imx_fec.c
+@@ -34,7 +34,7 @@
+ #include "trace.h"
+
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define IMX_MAX_DESC 1024
+
+diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
+index ab57c02c8e..3e00aa801a 100644
+--- a/hw/net/lan9118.c
++++ b/hw/net/lan9118.c
+@@ -24,7 +24,7 @@
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ //#define DEBUG_LAN9118
+diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
+index 25e3e453ab..a8fa8d037d 100644
+--- a/hw/net/mcf_fec.c
++++ b/hw/net/mcf_fec.c
+@@ -17,7 +17,7 @@
+ #include "hw/qdev-properties.h"
+ #include "hw/sysbus.h"
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+
+ //#define DEBUG_FEC 1
+
+diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
+index 5826944fd5..f6602cc5a2 100644
+--- a/hw/net/milkymist-minimac2.c
++++ b/hw/net/milkymist-minimac2.c
+@@ -36,7 +36,7 @@
+ #include "qemu/module.h"
+ #include "qemu/error-report.h"
+
+-#include <zlib.h>
++#include "zlib.h"
+
+ enum {
+ R_SETUP = 0,
+diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
+index ba5ace1ab7..aaafb07a5f 100644
+--- a/hw/net/rtl8139.c
++++ b/hw/net/rtl8139.c
+@@ -51,7 +51,7 @@
+ /* For crc32 */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "hw/pci/pci.h"
+ #include "hw/qdev-properties.h"
+diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
+index ad778cd8fc..4bea869eb9 100644
+--- a/hw/net/smc91c111.c
++++ b/hw/net/smc91c111.c
+@@ -18,7 +18,7 @@
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ /* Number of 2k memory pages available. */
+diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
+index 8dd60783d8..e2d1065394 100644
+--- a/hw/net/stellaris_enet.c
++++ b/hw/net/stellaris_enet.c
+@@ -15,7 +15,7 @@
+ #include "net/net.h"
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ //#define DEBUG_STELLARIS_ENET 1
+diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c
+index 11f2d31cdb..f8db0afd00 100644
+--- a/hw/nvram/mac_nvram.c
++++ b/hw/nvram/mac_nvram.c
+@@ -31,7 +31,7 @@
+ #include "qemu/cutils.h"
+ #include "qemu/module.h"
+ #include "trace.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define DEF_SYSTEM_SIZE 0xc10
+
+diff --git a/hw/xen/xen-bus-helper.c b/hw/xen/xen-bus-helper.c
+index b459bb9396..ff159b0bfb 100644
+--- a/hw/xen/xen-bus-helper.c
++++ b/hw/xen/xen-bus-helper.c
+@@ -12,7 +12,7 @@
+ #include "hw/xen/xen-bus-helper.h"
+ #include "qapi/error.h"
+
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+
+ struct xs_state {
+ enum xenbus_state statenum;
+diff --git a/include/block/aio.h b/include/block/aio.h
+index 5f342267d5..00300a7fa4 100644
+--- a/include/block/aio.h
++++ b/include/block/aio.h
+@@ -15,7 +15,7 @@
+ #define QEMU_AIO_H
+
+ #ifdef CONFIG_LINUX_IO_URING
+-#include <liburing.h>
++#include "src/include/liburing.h"
+ #endif
+ #include "qemu/coroutine.h"
+ #include "qemu/queue.h"
+diff --git a/include/glib-compat.h b/include/glib-compat.h
+index 695a96f7ea..246a1982d1 100644
+--- a/include/glib-compat.h
++++ b/include/glib-compat.h
+@@ -29,9 +29,9 @@
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #if defined(G_OS_UNIX)
+-#include <glib-unix.h>
++#include "glib/glib-unix.h"
+ #include <sys/types.h>
+ #include <pwd.h>
+ #endif
+diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
+index 87737a6f16..b443f4415a 100644
+--- a/include/ui/qemu-pixman.h
++++ b/include/ui/qemu-pixman.h
+@@ -9,7 +9,7 @@
+ /* pixman-0.16.0 headers have a redundant declaration */
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wredundant-decls"
+-#include <pixman.h>
++#include "pixman.h"
+ #pragma GCC diagnostic pop
+
+ /*
+diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
+index ccb98147e8..73b6a4f31b 100644
+--- a/migration/dirtyrate.c
++++ b/migration/dirtyrate.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qapi/error.h"
+ #include "cpu.h"
+ #include "exec/ramblock.h"
+diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c
+index ab4ba75d75..fde4ff6647 100644
+--- a/migration/multifd-zlib.c
++++ b/migration/multifd-zlib.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qemu/rcu.h"
+ #include "exec/target_page.h"
+ #include "qapi/error.h"
+diff --git a/migration/qemu-file.c b/migration/qemu-file.c
+index be21518c57..8e36d701ca 100644
+--- a/migration/qemu-file.c
++++ b/migration/qemu-file.c
+@@ -22,7 +22,7 @@
+ * THE SOFTWARE.
+ */
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qemu/error-report.h"
+ #include "qemu/iov.h"
+ #include "migration.h"
+diff --git a/migration/qemu-file.h b/migration/qemu-file.h
+index a9b6d6ccb7..1d76e0b405 100644
+--- a/migration/qemu-file.h
++++ b/migration/qemu-file.h
+@@ -25,7 +25,7 @@
+ #ifndef MIGRATION_QEMU_FILE_H
+ #define MIGRATION_QEMU_FILE_H
+
+-#include <zlib.h>
++#include "zlib.h"
+ #include "exec/cpu-common.h"
+
+ /* Read a chunk of data from a file at the given position. The pos argument
+diff --git a/qemu-options-wrapper.h b/qemu-options-wrapper.h
+index 6f548e3922..3d5a9321cc 100644
+--- a/qemu-options-wrapper.h
++++ b/qemu-options-wrapper.h
+@@ -29,7 +29,7 @@
+ #error "qemu-options-wrapper.h included with no option defined"
+ #endif
+
+-#include "qemu-options.def"
++#include "qemu-options-gen.h"
+
+ #undef DEF
+ #undef DEFHEADING
+diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c
+index 749167e82d..a614c105d0 100644
+--- a/qga/commands-posix-ssh.c
++++ b/qga/commands-posix-ssh.c
+@@ -4,8 +4,8 @@
+ */
+ #include "qemu/osdep.h"
+
+-#include <glib-unix.h>
+-#include <glib/gstdio.h>
++#include "glib/glib-unix.h"
++#include "glib/gstdio.h"
+ #include <locale.h>
+ #include <pwd.h>
+
+diff --git a/qga/main.c b/qga/main.c
+index dea6a3aa64..4733ed8f55 100644
+--- a/qga/main.c
++++ b/qga/main.c
+@@ -13,7 +13,7 @@
+
+ #include "qemu/osdep.h"
+ #include <getopt.h>
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #ifndef _WIN32
+ #include <syslog.h>
+ #include <sys/wait.h>
+Submodule slirp contains modified content
+diff --git a/slirp/src/ip.h b/slirp/src/ip.h
+index e5d4aa8..d433cf3 100644
+--- a/slirp/src/ip.h
++++ b/slirp/src/ip.h
+@@ -34,7 +34,7 @@
+ #ifndef IP_H
+ #define IP_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #if G_BYTE_ORDER == G_BIG_ENDIAN
+ #undef NTOHL
+diff --git a/slirp/src/ip6.h b/slirp/src/ip6.h
+index 0630309..d5b6ae7 100644
+--- a/slirp/src/ip6.h
++++ b/slirp/src/ip6.h
+@@ -7,7 +7,7 @@
+ #ifndef SLIRP_IP6_H
+ #define SLIRP_IP6_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <string.h>
+
+ #define ALLNODES_MULTICAST \
+diff --git a/slirp/src/stream.c b/slirp/src/stream.c
+index 6cf326f..7992ee2 100644
+--- a/slirp/src/stream.c
++++ b/slirp/src/stream.c
+@@ -23,7 +23,7 @@
+ * THE SOFTWARE.
+ */
+ #include "stream.h"
+-#include <glib.h>
++#include "glib/glib.h"
+
+ bool slirp_istream_read(SlirpIStream *f, void *buf, size_t size)
+ {
+diff --git a/slirp/src/tcp.h b/slirp/src/tcp.h
+index 70a9760..7cbd4d6 100644
+--- a/slirp/src/tcp.h
++++ b/slirp/src/tcp.h
+@@ -34,7 +34,7 @@
+ #ifndef TCP_H
+ #define TCP_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ typedef uint32_t tcp_seq;
+
+diff --git a/slirp/src/util.c b/slirp/src/util.c
+index d3ed5fa..f53bd03 100644
+--- a/slirp/src/util.c
++++ b/slirp/src/util.c
+@@ -28,7 +28,7 @@
+ */
+ #include "util.h"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <fcntl.h>
+ #include <stdint.h>
+
+diff --git a/slirp/src/util.h b/slirp/src/util.h
+index d67b3d0..eec4a66 100644
+--- a/slirp/src/util.h
++++ b/slirp/src/util.h
+@@ -24,7 +24,7 @@
+ #ifndef UTIL_H_
+ #define UTIL_H_
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <stdlib.h>
+ #include <stdio.h>
+diff --git a/slirp/src/vmstate.c b/slirp/src/vmstate.c
+index 68cc172..66840df 100644
+--- a/slirp/src/vmstate.c
++++ b/slirp/src/vmstate.c
+@@ -40,7 +40,7 @@
+ #include <assert.h>
+ #include <errno.h>
+ #include <string.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include "stream.h"
+ #include "vmstate.h"
+diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c
+index 8325ecb766..1290657103 100644
+--- a/softmmu/qemu-seccomp.c
++++ b/softmmu/qemu-seccomp.c
+@@ -19,7 +19,7 @@
+ #include "qemu/option.h"
+ #include "qemu/module.h"
+ #include <sys/prctl.h>
+-#include <seccomp.h>
++#include "seccomp.h"
+ #include "sysemu/seccomp.h"
+ #include <linux/seccomp.h>
+
+diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
+index 30b2ad119f..4d982f6db0 100644
+--- a/target/arm/helper-a64.c
++++ b/target/arm/helper-a64.c
+@@ -34,7 +34,7 @@
+ #include "qemu/atomic128.h"
+ #include "tcg/tcg.h"
+ #include "fpu/softfloat.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+
+ /* C2.4.7 Multiply and divide */
+ /* special cases for 0 and LLONG_MIN are mandated by the standard */
+diff --git a/target/arm/helper.c b/target/arm/helper.c
+index 38cd35c049..4b09cba889 100644
+--- a/target/arm/helper.c
++++ b/target/arm/helper.c
+@@ -20,7 +20,7 @@
+ #include "qemu/crc32c.h"
+ #include "qemu/qemu-print.h"
+ #include "exec/exec-all.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+ #include "hw/irq.h"
+ #include "hw/semihosting/semihost.h"
+ #include "sysemu/cpus.h"
+diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
+index aad01ea012..e95f7a8d88 100644
+--- a/target/arm/m_helper.c
++++ b/target/arm/m_helper.c
+@@ -20,7 +20,7 @@
+ #include "qemu/crc32c.h"
+ #include "qemu/qemu-print.h"
+ #include "exec/exec-all.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+ #include "hw/semihosting/semihost.h"
+ #include "sysemu/cpus.h"
+ #include "sysemu/kvm.h"
+diff --git a/target/tilegx/helper.c b/target/tilegx/helper.c
+index c006bf7454..873f42a817 100644
+--- a/target/tilegx/helper.c
++++ b/target/tilegx/helper.c
+@@ -22,7 +22,7 @@
+ #include "cpu.h"
+ #include "exec/exec-all.h"
+ #include "exec/helper-proto.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+ #include "syscall_defs.h"
+
+ void helper_exception(CPUTLGState *env, uint32_t excp)
+diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
+index 32c2bc1699..27dc193796 100644
+--- a/target/tricore/op_helper.c
++++ b/target/tricore/op_helper.c
+@@ -20,7 +20,7 @@
+ #include "exec/helper-proto.h"
+ #include "exec/exec-all.h"
+ #include "exec/cpu_ldst.h"
+-#include <zlib.h> /* for crc32 */
++#include "zlib.h" /* for crc32 */
+
+
+ /* Exception helpers */
+diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c
+index de09bdde4e..bc04d295e4 100644
+--- a/tests/plugin/bb.c
++++ b/tests/plugin/bb.c
+@@ -10,7 +10,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c
+index a9a6e41237..75b1bd7b86 100644
+--- a/tests/plugin/insn.c
++++ b/tests/plugin/insn.c
+@@ -10,7 +10,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c
+index 4725bd851d..8d587f460a 100644
+--- a/tests/plugin/mem.c
++++ b/tests/plugin/mem.c
+@@ -10,7 +10,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c
+index 9176b96c1c..462468a78f 100644
+--- a/tests/ptimer-test.c
++++ b/tests/ptimer-test.c
+@@ -9,7 +9,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+
+ #include "qemu/main-loop.h"
+ #include "hw/ptimer.h"
+diff --git a/tests/qtest/acpi-utils.c b/tests/qtest/acpi-utils.c
+index d2a202efca..bccb0434fa 100644
+--- a/tests/qtest/acpi-utils.c
++++ b/tests/qtest/acpi-utils.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "qemu-common.h"
+ #include "qemu/bitmap.h"
+ #include "acpi-utils.h"
+diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
+index f23a5335a8..76e67c888d 100644
+--- a/tests/qtest/bios-tables-test.c
++++ b/tests/qtest/bios-tables-test.c
+@@ -56,7 +56,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "qemu-common.h"
+ #include "hw/firmware/smbios.h"
+ #include "qemu/bitmap.h"
+diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
+index aca9b98b7a..a4835fc7d2 100644
+--- a/tests/qtest/dbus-vmstate-test.c
++++ b/tests/qtest/dbus-vmstate-test.c
+@@ -1,5 +1,5 @@
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include <gio/gio.h>
+ #include "libqos/libqtest.h"
+ #include "qemu-common.h"
+diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c
+index dfa69424ed..6b27e4a82e 100644
+--- a/tests/qtest/ivshmem-test.c
++++ b/tests/qtest/ivshmem-test.c
+@@ -9,7 +9,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "contrib/ivshmem-server/ivshmem-server.h"
+ #include "libqos/libqos-pc.h"
+ #include "libqos/libqos-spapr.h"
+diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
+index 32bbae33c5..e2d750e984 100644
+--- a/tests/qtest/pxe-test.c
++++ b/tests/qtest/pxe-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "qemu-common.h"
+ #include "libqos/libqtest.h"
+ #include "boot-sector.h"
+diff --git a/tests/qtest/tpm-crb-swtpm-test.c b/tests/qtest/tpm-crb-swtpm-test.c
+index 1d82a48c04..634e872e9b 100644
+--- a/tests/qtest/tpm-crb-swtpm-test.c
++++ b/tests/qtest/tpm-crb-swtpm-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqos/libqtest.h"
+ #include "qemu/module.h"
+diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
+index ed533900d1..5fcc7740b4 100644
+--- a/tests/qtest/tpm-crb-test.c
++++ b/tests/qtest/tpm-crb-test.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "hw/acpi/tpm.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
+index 2e8eb7b94f..ee8605754b 100644
+--- a/tests/qtest/tpm-emu.c
++++ b/tests/qtest/tpm-emu.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "backends/tpm/tpm_ioctl.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c
+index 0da3a8a4df..2672509f57 100644
+--- a/tests/qtest/tpm-tests.c
++++ b/tests/qtest/tpm-tests.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqtest-single.h"
+ #include "tpm-tests.h"
+diff --git a/tests/qtest/tpm-tis-device-swtpm-test.c b/tests/qtest/tpm-tis-device-swtpm-test.c
+index f7126eff9e..f1ab3b8e8e 100644
+--- a/tests/qtest/tpm-tis-device-swtpm-test.c
++++ b/tests/qtest/tpm-tis-device-swtpm-test.c
+@@ -14,7 +14,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqos/libqtest.h"
+ #include "qemu/module.h"
+diff --git a/tests/qtest/tpm-tis-device-test.c b/tests/qtest/tpm-tis-device-test.c
+index 63ed36440f..671b8f9a46 100644
+--- a/tests/qtest/tpm-tis-device-test.c
++++ b/tests/qtest/tpm-tis-device-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "io/channel-socket.h"
+ #include "libqtest-single.h"
+diff --git a/tests/qtest/tpm-tis-swtpm-test.c b/tests/qtest/tpm-tis-swtpm-test.c
+index fa590e68f1..59d5bff7e8 100644
+--- a/tests/qtest/tpm-tis-swtpm-test.c
++++ b/tests/qtest/tpm-tis-swtpm-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqos/libqtest.h"
+ #include "qemu/module.h"
+diff --git a/tests/qtest/tpm-tis-test.c b/tests/qtest/tpm-tis-test.c
+index 79ffbc943e..353365e5a1 100644
+--- a/tests/qtest/tpm-tis-test.c
++++ b/tests/qtest/tpm-tis-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "hw/acpi/tpm.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/qtest/tpm-tis-util.c b/tests/qtest/tpm-tis-util.c
+index 9aff503fd8..77a2e6f7cd 100644
+--- a/tests/qtest/tpm-tis-util.c
++++ b/tests/qtest/tpm-tis-util.c
+@@ -14,7 +14,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "hw/acpi/tpm.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/test-char.c b/tests/test-char.c
+index 9196e566e9..aefa73fd4e 100644
+--- a/tests/test-char.c
++++ b/tests/test-char.c
+@@ -1,5 +1,5 @@
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "qemu/config-file.h"
+ #include "qemu/module.h"
+diff --git a/tests/test-logging.c b/tests/test-logging.c
+index ccb819f193..b710310aaa 100644
+--- a/tests/test-logging.c
++++ b/tests/test-logging.c
+@@ -25,7 +25,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "qemu-common.h"
+ #include "qapi/error.h"
+diff --git a/tests/test-qga.c b/tests/test-qga.c
+index c1b173b3cb..2a2607c9e1 100644
+--- a/tests/test-qga.c
++++ b/tests/test-qga.c
+@@ -1,6 +1,6 @@
+ #include "qemu/osdep.h"
+ #include <locale.h>
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include <sys/socket.h>
+ #include <sys/un.h>
+
+diff --git a/tests/test-util-filemonitor.c b/tests/test-util-filemonitor.c
+index b629e10857..32efe8256d 100644
+--- a/tests/test-util-filemonitor.c
++++ b/tests/test-util-filemonitor.c
+@@ -23,7 +23,7 @@
+ #include "qapi/error.h"
+ #include "qemu/filemonitor.h"
+
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include <utime.h>
+
+diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
+index c70fb16a9a..9be0d4ec75 100644
+--- a/tools/virtiofsd/fuse_lowlevel.c
++++ b/tools/virtiofsd/fuse_lowlevel.c
+@@ -18,7 +18,7 @@
+
+ #include <assert.h>
+ #include <errno.h>
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <limits.h>
+ #include <stdbool.h>
+ #include <stddef.h>
+diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
+index 83ba07c6cd..273d66704c 100644
+--- a/tools/virtiofsd/fuse_virtio.c
++++ b/tools/virtiofsd/fuse_virtio.c
+@@ -22,7 +22,7 @@
+
+ #include <assert.h>
+ #include <errno.h>
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
+index 97485b22b4..cac5970790 100644
+--- a/tools/virtiofsd/passthrough_ll.c
++++ b/tools/virtiofsd/passthrough_ll.c
+@@ -45,7 +45,7 @@
+ #include <cap-ng.h>
+ #include <dirent.h>
+ #include <errno.h>
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <inttypes.h>
+ #include <limits.h>
+ #include <pthread.h>
+diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c
+index 11623f56f2..779d1d3249 100644
+--- a/tools/virtiofsd/passthrough_seccomp.c
++++ b/tools/virtiofsd/passthrough_seccomp.c
+@@ -11,8 +11,8 @@
+ #include "fuse_i.h"
+ #include "fuse_log.h"
+ #include <errno.h>
+-#include <glib.h>
+-#include <seccomp.h>
++#include "glib/glib.h"
++#include "seccomp.h"
+ #include <stdlib.h>
+
+ /* Bodge for libseccomp 2.4.2 which broke ppoll */
+diff --git a/ui/cursor.c b/ui/cursor.c
+index 1d62ddd4d0..2fec816a6a 100644
+--- a/ui/cursor.c
++++ b/ui/cursor.c
+@@ -1,8 +1,8 @@
+ #include "qemu/osdep.h"
+ #include "ui/console.h"
+
+-#include "cursor_hidden.xpm"
+-#include "cursor_left_ptr.xpm"
++#include "ui/cursor_hidden.h"
++#include "ui/cursor_left_ptr.h"
+
+ /* for creating built-in cursors */
+ static QEMUCursor *cursor_parse_xpm(const char *xpm[])
+diff --git a/ui/gtk.c b/ui/gtk.c
+index a752aa22be..6ba66c0341 100644
+--- a/ui/gtk.c
++++ b/ui/gtk.c
+@@ -44,7 +44,7 @@
+ #endif
+ #include "ui/win32-kbd-hook.h"
+
+-#include <glib/gi18n.h>
++#include "glib/gi18n.h"
+ #include <locale.h>
+ #if defined(CONFIG_VTE)
+ #include <vte/vte.h>
+diff --git a/ui/vnc.h b/ui/vnc.h
+index 4e2637ce6c..0da79ae261 100644
+--- a/ui/vnc.h
++++ b/ui/vnc.h
+@@ -38,7 +38,7 @@
+ #include "io/channel-tls.h"
+ #include "io/net-listener.h"
+ #include "authz/base.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "keymaps.h"
+ #include "vnc-palette.h"
+diff --git a/util/oslib-posix.c b/util/oslib-posix.c
+index f15234b5c0..2cb8411ddb 100644
+--- a/util/oslib-posix.c
++++ b/util/oslib-posix.c
+@@ -29,7 +29,7 @@
+ #include "qemu/osdep.h"
+ #include <termios.h>
+
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+
+ #include "qemu-common.h"
+ #include "sysemu/sysemu.h"
diff --git a/third_party/qemu/patches/pregenerated_config_files.patch b/third_party/qemu/patches/pregenerated_config_files.patch
new file mode 100644
index 0000000..fd5fe68
--- /dev/null
+++ b/third_party/qemu/patches/pregenerated_config_files.patch
@@ -0,0 +1,753 @@
+Copyright 2020 The Monogon Project Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+From f2ed01603a9e89ae30d282c926a0100b246ff3a9 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@brun.one>
+Date: Wed, 10 Mar 2021 19:48:11 +0100
+Subject: [PATCH 6/6] Pregenerated config files
+
+---
+ include/qemu/config-host.h | 291 ++++++++++++++++++++++++
+ qemu-version.h | 2 +
+ x86_64-softmmu-config-devices.h | 381 ++++++++++++++++++++++++++++++++
+ x86_64-softmmu-config-target.h | 21 ++
+ 4 files changed, 695 insertions(+)
+ create mode 100644 include/qemu/config-host.h
+ create mode 100644 qemu-version.h
+ create mode 100644 x86_64-softmmu-config-devices.h
+ create mode 100644 x86_64-softmmu-config-target.h
+
+diff --git a/include/qemu/config-host.h b/include/qemu/config-host.h
+new file mode 100644
+index 0000000000..843e9c8116
+--- /dev/null
++++ b/include/qemu/config-host.h
+@@ -0,0 +1,291 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define CONFIG_ACCEPT4 1
++
++#define CONFIG_AF_VSOCK 1
++
++#define CONFIG_ATOMIC64 1
++
++#undef CONFIG_ATTR
++
++#define CONFIG_ATTRIBUTE_ALIAS 1
++
++#define CONFIG_AUDIO_DRIVERS
++
++#define CONFIG_BDRV_RO_WHITELIST
++
++#define CONFIG_BDRV_RW_WHITELIST
++
++#define CONFIG_BINDIR "/usr/local/bin"
++
++#undef CONFIG_BRLAPI
++
++#define CONFIG_BYTESWAP_H 1
++
++#define CONFIG_CAPSTONE
++
++#undef CONFIG_CFI
++
++#define CONFIG_CLOCK_ADJTIME 1
++
++#define CONFIG_CMPXCHG128 1
++
++#undef CONFIG_COCOA
++
++#define CONFIG_COROUTINE_BACKEND ucontext
++
++#define CONFIG_COROUTINE_POOL 0
++
++#define CONFIG_CPUID_H 1
++
++#undef CONFIG_CURL
++
++#undef CONFIG_CURSES
++
++#define CONFIG_DUP3 1
++
++#define CONFIG_EPOLL 1
++
++#define CONFIG_EPOLL_CREATE1 1
++
++#define CONFIG_EVENTFD 1
++
++#define CONFIG_FALLOCATE 1
++
++#define CONFIG_FALLOCATE_PUNCH_HOLE 1
++
++#define CONFIG_FALLOCATE_ZERO_RANGE 1
++
++#define CONFIG_FDATASYNC 1
++
++#define CONFIG_FDT
++
++#define CONFIG_FIEMAP 1
++
++#undef CONFIG_FUSE
++
++#undef CONFIG_FUSE_LSEEK
++
++#define CONFIG_GBM 1
++
++#define CONFIG_GETAUXVAL 1
++
++#define CONFIG_GETRANDOM 1
++
++#define CONFIG_GETTID
++
++#undef CONFIG_GLUSTERFS
++
++#undef CONFIG_GTK
++
++#define CONFIG_HAS_ENVIRON 1
++
++#define CONFIG_HOST_DSOSUF ".so"
++
++#define CONFIG_IASL "iasl"
++
++#define CONFIG_INOTIFY 1
++
++#define CONFIG_INOTIFY1 1
++
++#define CONFIG_INT128 1
++
++#define CONFIG_IOVEC 1
++
++#define CONFIG_IVSHMEM 1
++
++#undef CONFIG_KEYUTILS
++
++#define CONFIG_L2TPV3 1
++
++#undef CONFIG_LIBATTR
++
++#undef CONFIG_LIBCAP_NG
++
++#undef CONFIG_LIBISCSI
++
++#undef CONFIG_LIBNFS
++
++#undef CONFIG_LIBUDEV
++
++#define CONFIG_LINUX 1
++
++#define CONFIG_LINUX_IO_URING 1
++
++#define CONFIG_LINUX_MAGIC_H 1
++
++#undef CONFIG_LZO
++
++#define CONFIG_MADVISE 1
++
++#define CONFIG_MALLOC_TRIM
++
++#define CONFIG_MEMBARRIER 1
++
++#define CONFIG_MEMFD 1
++
++#undef CONFIG_MPATH
++
++#undef CONFIG_MPATH_NEW_API
++
++#define CONFIG_OPEN_BY_HANDLE 1
++
++#define CONFIG_PIPE2 1
++
++#define CONFIG_POSIX 1
++
++#define CONFIG_POSIX_FALLOCATE 1
++
++#define CONFIG_POSIX_MADVISE 1
++
++#define CONFIG_POSIX_MEMALIGN 1
++
++#define CONFIG_PPOLL 1
++
++#define CONFIG_PRCTL_PR_SET_TIMERSLACK 1
++
++#define CONFIG_PREADV 1
++
++#define CONFIG_PREFIX "/nonexistent"
++
++#define CONFIG_PTHREAD_SETNAME_NP_W_TID 1
++
++#define CONFIG_QEMU_CONFDIR "/nonexistent"
++
++#define CONFIG_QEMU_DATADIR "/nonexistent"
++
++#define CONFIG_QEMU_DESKTOPDIR "/nonexistent"
++
++#define CONFIG_QEMU_FIRMWAREPATH "external/qemu/pc-bios"
++
++#define CONFIG_QEMU_HELPERDIR "/nonexistent"
++
++#define CONFIG_QEMU_ICONDIR "/nonexistent"
++
++#define CONFIG_QEMU_LOCALEDIR "/nonexistent"
++
++#define CONFIG_QEMU_LOCALSTATEDIR "/nonexistent"
++
++#define CONFIG_QEMU_MODDIR "/nonexistent"
++
++#define CONFIG_QEMU_PRIVATE_XTS 1
++
++#define CONFIG_QOM_CAST_DEBUG 1
++
++#undef CONFIG_RBD
++
++#define CONFIG_RTNETLINK 1
++
++#undef CONFIG_SDL
++
++#undef CONFIG_SDL_IMAGE
++
++#define CONFIG_SECCOMP
++
++#define CONFIG_SENDFILE 1
++
++#define CONFIG_SETNS 1
++
++#define CONFIG_SIGNALFD 1
++
++#define CONFIG_SLIRP
++
++#define CONFIG_SMBD_COMMAND "/nonexistent"
++
++#undef CONFIG_SNAPPY
++
++#define CONFIG_SPLICE 1
++
++#define CONFIG_STATIC_ASSERT 1
++
++#define CONFIG_STATX
++
++#define CONFIG_SYNCFS 1
++
++#define CONFIG_SYNC_FILE_RANGE 1
++
++#define CONFIG_SYSCONFDIR "/nonexistent"
++
++#define CONFIG_SYSMACROS 1
++
++#define CONFIG_TASN1 1
++
++#define CONFIG_THREAD_SETNAME_BYTHREAD 1
++
++#define CONFIG_TIMERFD 1
++
++#define CONFIG_TLS_PRIORITY "NORMAL"
++
++#define CONFIG_TRACE_LOG 1
++
++#define CONFIG_USBFS 1
++
++#undef CONFIG_VALGRIND_H
++
++#define CONFIG_VHOST_KERNEL 1
++
++#define CONFIG_VHOST_NET 1
++
++#define CONFIG_VHOST_NET_VDPA 1
++
++#undef CONFIG_VHOST_USER_BLK_SERVER
++
++#define CONFIG_VHOST_VDPA 1
++
++#undef CONFIG_VIRTFS
++
++#undef CONFIG_VNC
++
++#undef CONFIG_VNC_JPEG
++
++#undef CONFIG_VNC_PNG
++
++#undef CONFIG_VNC_SASL
++
++#undef CONFIG_X11
++
++#define CONFIG_XKBCOMMON
++
++#undef CONFIG_ZSTD
++
++#define HAVE_BTRFS_H
++
++#define HAVE_COPY_FILE_RANGE 1
++
++#define HAVE_DRM_H
++
++#define HAVE_FSXATTR 1
++
++#define HAVE_GDB_BIN /nonexistent
++
++#define HAVE_MLOCKALL 1
++
++#define HAVE_OPENPTY 1
++
++#define HAVE_PTY_H
++
++#define HAVE_STRCHRNUL 1
++
++#define HAVE_STRUCT_STAT_ST_ATIM 1
++
++#undef HAVE_SYS_IOCCOM_H
++
++#undef HAVE_SYS_KCOV_H
++
++#define HAVE_UTMPX 1
++
++#define HOST_X86_64 1
++
++#define QEMU_VERSION "5.2.50"
++
++#define QEMU_VERSION_MAJOR 5
++
++#define QEMU_VERSION_MICRO 50
++
++#define QEMU_VERSION_MINOR 2
++
+diff --git a/qemu-version.h b/qemu-version.h
+new file mode 100644
+index 0000000000..46c042f1ee
+--- /dev/null
++++ b/qemu-version.h
+@@ -0,0 +1,2 @@
++#define QEMU_PKGVERSION "v5.2.0-mngn"
++#define QEMU_FULL_VERSION "5.2.50-mngn"
+diff --git a/x86_64-softmmu-config-devices.h b/x86_64-softmmu-config-devices.h
+new file mode 100644
+index 0000000000..6fb167cecd
+--- /dev/null
++++ b/x86_64-softmmu-config-devices.h
+@@ -0,0 +1,381 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define CONFIG_AC97 1
++
++#define CONFIG_ACPI 1
++
++#define CONFIG_ACPI_CPU_HOTPLUG 1
++
++#define CONFIG_ACPI_HMAT 1
++
++#define CONFIG_ACPI_HW_REDUCED 1
++
++#define CONFIG_ACPI_MEMORY_HOTPLUG 1
++
++#define CONFIG_ACPI_NVDIMM 1
++
++#define CONFIG_ACPI_PCI 1
++
++#define CONFIG_ACPI_SMBUS 1
++
++#define CONFIG_ACPI_VMGENID 1
++
++#define CONFIG_ACPI_X86 1
++
++#define CONFIG_ACPI_X86_ICH 1
++
++#define CONFIG_ADLIB 1
++
++#define CONFIG_AHCI 1
++
++#define CONFIG_AHCI_ICH9 1
++
++#define CONFIG_AMD_IOMMU 1
++
++#define CONFIG_APIC 1
++
++#define CONFIG_APM 1
++
++#define CONFIG_APPLESMC 1
++
++#define CONFIG_ATI_VGA 1
++
++#define CONFIG_BITBANG_I2C 1
++
++#define CONFIG_BOCHS_DISPLAY 1
++
++#define CONFIG_CAN_BUS 1
++
++#define CONFIG_CAN_CTUCANFD 1
++
++#define CONFIG_CAN_CTUCANFD_PCI 1
++
++#define CONFIG_CAN_PCI 1
++
++#define CONFIG_CAN_SJA1000 1
++
++#define CONFIG_CS4231A 1
++
++#define CONFIG_DDC 1
++
++#define CONFIG_DIMM 1
++
++#define CONFIG_E1000E_PCI_EXPRESS 1
++
++#define CONFIG_E1000_PCI 1
++
++#define CONFIG_EDID 1
++
++#define CONFIG_EDU 1
++
++#define CONFIG_EEPRO100_PCI 1
++
++#define CONFIG_ES1370 1
++
++#define CONFIG_ESP 1
++
++#define CONFIG_ESP_PCI 1
++
++#define CONFIG_FDC 1
++
++#define CONFIG_FW_CFG_DMA 1
++
++#define CONFIG_GENERIC_LOADER 1
++
++#define CONFIG_GUS 1
++
++#define CONFIG_HDA 1
++
++#define CONFIG_HPET 1
++
++#define CONFIG_HYPERV 1
++
++#define CONFIG_HYPERV_TESTDEV 1
++
++#define CONFIG_I2C 1
++
++#define CONFIG_I440FX 1
++
++#define CONFIG_I8254 1
++
++#define CONFIG_I8257 1
++
++#define CONFIG_I8259 1
++
++#define CONFIG_I82801B11 1
++
++#define CONFIG_IDE_CORE 1
++
++#define CONFIG_IDE_ISA 1
++
++#define CONFIG_IDE_PCI 1
++
++#define CONFIG_IDE_PIIX 1
++
++#define CONFIG_IDE_QDEV 1
++
++#define CONFIG_IMX_USBPHY 1
++
++#define CONFIG_IOAPIC 1
++
++#define CONFIG_IOH3420 1
++
++#define CONFIG_IPACK 1
++
++#define CONFIG_IPMI 1
++
++#define CONFIG_IPMI_EXTERN 1
++
++#define CONFIG_IPMI_LOCAL 1
++
++#define CONFIG_IPMI_SSIF 1
++
++#define CONFIG_ISAPC 1
++
++#define CONFIG_ISA_BUS 1
++
++#define CONFIG_ISA_DEBUG 1
++
++#define CONFIG_ISA_IPMI_BT 1
++
++#define CONFIG_ISA_IPMI_KCS 1
++
++#define CONFIG_ISA_TESTDEV 1
++
++#define CONFIG_IVSHMEM_DEVICE 1
++
++#define CONFIG_LPC_ICH9 1
++
++#define CONFIG_LSI_SCSI_PCI 1
++
++#define CONFIG_MC146818RTC 1
++
++#define CONFIG_MEGASAS_SCSI_PCI 1
++
++#define CONFIG_MEM_DEVICE 1
++
++#define CONFIG_MICROVM 1
++
++#define CONFIG_MPTSAS_SCSI_PCI 1
++
++#define CONFIG_MSI_NONBROKEN 1
++
++#define CONFIG_NE2000_COMMON 1
++
++#define CONFIG_NE2000_ISA 1
++
++#define CONFIG_NE2000_PCI 1
++
++#define CONFIG_NMC93XX_EEPROM 1
++
++#define CONFIG_NVDIMM 1
++
++#define CONFIG_NVME_PCI 1
++
++#define CONFIG_PAM 1
++
++#define CONFIG_PARALLEL 1
++
++#define CONFIG_PC 1
++
++#define CONFIG_PCI 1
++
++#define CONFIG_PCIE_PORT 1
++
++#define CONFIG_PCI_DEVICES 1
++
++#define CONFIG_PCI_EXPRESS 1
++
++#define CONFIG_PCI_EXPRESS_GENERIC_BRIDGE 1
++
++#define CONFIG_PCI_EXPRESS_Q35 1
++
++#define CONFIG_PCI_I440FX 1
++
++#define CONFIG_PCI_IPMI_BT 1
++
++#define CONFIG_PCI_IPMI_KCS 1
++
++#define CONFIG_PCI_TESTDEV 1
++
++#define CONFIG_PCKBD 1
++
++#define CONFIG_PCNET_COMMON 1
++
++#define CONFIG_PCNET_PCI 1
++
++#define CONFIG_PCSPK 1
++
++#define CONFIG_PC_ACPI 1
++
++#define CONFIG_PC_PCI 1
++
++#define CONFIG_PFLASH_CFI01 1
++
++#define CONFIG_PIIX3 1
++
++#define CONFIG_PS2 1
++
++#define CONFIG_PVPANIC 1
++
++#define CONFIG_PXB 1
++
++#define CONFIG_Q35 1
++
++#define CONFIG_ROCKER 1
++
++#define CONFIG_RTL8139_PCI 1
++
++#define CONFIG_SB16 1
++
++#define CONFIG_SCSI 1
++
++#define CONFIG_SD 1
++
++#define CONFIG_SDHCI 1
++
++#define CONFIG_SDHCI_PCI 1
++
++#define CONFIG_SERIAL 1
++
++#define CONFIG_SERIAL_ISA 1
++
++#define CONFIG_SERIAL_PCI 1
++
++#define CONFIG_SERIAL_PCI_MULTI 1
++
++#define CONFIG_SEV 1
++
++#define CONFIG_SGA 1
++
++#define CONFIG_SMBIOS 1
++
++#define CONFIG_SMBUS 1
++
++#define CONFIG_SMBUS_EEPROM 1
++
++#define CONFIG_TEST_DEVICES 1
++
++#define CONFIG_TPM 1
++
++#define CONFIG_TULIP 1
++
++#define CONFIG_USB 1
++
++#define CONFIG_USB_AUDIO 1
++
++#define CONFIG_USB_EHCI 1
++
++#define CONFIG_USB_EHCI_PCI 1
++
++#define CONFIG_USB_NETWORK 1
++
++#define CONFIG_USB_OHCI 1
++
++#define CONFIG_USB_OHCI_PCI 1
++
++#define CONFIG_USB_SERIAL 1
++
++#define CONFIG_USB_SMARTCARD 1
++
++#define CONFIG_USB_STORAGE_BOT 1
++
++#define CONFIG_USB_STORAGE_MTP 1
++
++#define CONFIG_USB_STORAGE_UAS 1
++
++#define CONFIG_USB_TABLET_WACOM 1
++
++#define CONFIG_USB_U2F 1
++
++#define CONFIG_USB_UHCI 1
++
++#define CONFIG_USB_XHCI 1
++
++#define CONFIG_USB_XHCI_NEC 1
++
++#define CONFIG_USB_XHCI_PCI 1
++
++#define CONFIG_USB_XHCI_SYSBUS 1
++
++#define CONFIG_VFIO 1
++
++#define CONFIG_VFIO_IGD 1
++
++#define CONFIG_VFIO_PCI 1
++
++#define CONFIG_VGA 1
++
++#define CONFIG_VGA_CIRRUS 1
++
++#define CONFIG_VGA_ISA 1
++
++#define CONFIG_VGA_PCI 1
++
++#define CONFIG_VHOST 1
++
++#define CONFIG_VIRTIO 1
++
++#define CONFIG_VIRTIO_BALLOON 1
++
++#define CONFIG_VIRTIO_BLK 1
++
++#define CONFIG_VIRTIO_CRYPTO 1
++
++#define CONFIG_VIRTIO_GPU 1
++
++#define CONFIG_VIRTIO_INPUT 1
++
++#define CONFIG_VIRTIO_INPUT_HOST 1
++
++#define CONFIG_VIRTIO_IOMMU 1
++
++#define CONFIG_VIRTIO_MEM 1
++
++#define CONFIG_VIRTIO_MEM_SUPPORTED 1
++
++#define CONFIG_VIRTIO_MMIO 1
++
++#define CONFIG_VIRTIO_NET 1
++
++#define CONFIG_VIRTIO_PCI 1
++
++#define CONFIG_VIRTIO_PMEM 1
++
++#define CONFIG_VIRTIO_PMEM_SUPPORTED 1
++
++#define CONFIG_VIRTIO_RNG 1
++
++#define CONFIG_VIRTIO_SCSI 1
++
++#define CONFIG_VIRTIO_SERIAL 1
++
++#define CONFIG_VIRTIO_VGA 1
++
++#define CONFIG_VMBUS 1
++
++#define CONFIG_VMMOUSE 1
++
++#define CONFIG_VMPORT 1
++
++#define CONFIG_VMWARE_VGA 1
++
++#define CONFIG_VMW_PVSCSI_SCSI_PCI 1
++
++#define CONFIG_VMXNET3_PCI 1
++
++#define CONFIG_VTD 1
++
++#define CONFIG_WDT_IB6300ESB 1
++
++#define CONFIG_WDT_IB700 1
++
++#define CONFIG_X86_IOMMU 1
++
++#define CONFIG_XIO3130 1
++
+diff --git a/x86_64-softmmu-config-target.h b/x86_64-softmmu-config-target.h
+new file mode 100644
+index 0000000000..302a95d89c
+--- /dev/null
++++ b/x86_64-softmmu-config-target.h
+@@ -0,0 +1,21 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define CONFIG_I386_DIS 1
++
++#define CONFIG_KVM 1
++
++#define CONFIG_SOFTMMU 1
++
++#define TARGET_I386 1
++
++#define TARGET_NAME "x86_64"
++
++#define TARGET_SUPPORTS_MTTCG 1
++
++#define TARGET_X86_64 1
++
+--
+2.25.1
+