From f2ed1a2c937aaa54d1cc98b00841943d48ce41ea Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Tue, 26 Mar 2024 18:31:47 -0600 Subject: qemu: Remove versions older then 8.1, no longer compatible Versions older then 8.1 are no longer compatible with the runqemu. Signed-off-by: Mark Hatle --- meta-xilinx-core/conf/layer.conf | 14 +- .../qemu/qemu-xilinx-package-split-7.1.inc | 46 - .../qemu/qemu-xilinx_2023%.bbappend | 1 - .../recipes-devtools/qemu/qemu_7.1%.bbappend | 1 - .../qemu/qemu-devicetrees_2022.1.bb | 8 - .../qemu/qemu-devicetrees_2022.2.bb | 6 - .../qemu/qemu-devicetrees_2023.1.bb | 6 - .../qemu/qemu-devicetrees_2023.2.bb | 6 - .../recipes-devtools/qemu/qemu-xilinx-2022.1.inc | 8 - .../recipes-devtools/qemu/qemu-xilinx-2022.2.inc | 8 - .../recipes-devtools/qemu/qemu-xilinx-2023.1.inc | 3 - .../recipes-devtools/qemu/qemu-xilinx-2023.2.inc | 3 - ...net-tulip-Restrict-DMA-engine-to-memories.patch | 64 - ...dition-environment-space-to-boot-loader-q.patch | 36 - ...ardev-connect-socket-to-a-spawned-command.patch | 246 --- .../0003-apic-fixup-fallthrough-to-PIC.patch | 47 - ...ure-Add-pkg-config-handling-for-libgcrypt.patch | 32 - ...05-qemu-Do-not-include-file-if-not-exists.patch | 35 - ...me-user-space-mmap-tweaks-to-address-musl.patch | 52 - .../0007-qemu-Determinism-fixes.patch | 34 - ....build-use-relative-path-to-refer-to-file.patch | 38 - ...SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch | 49 - ...rotect-against-buggy-or-malicious-guest-d.patch | 43 - .../qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch | 59 - .../qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch | 27 - .../qemu/qemu-xilinx-7.1.0/cross.patch | 38 - .../qemu/qemu-xilinx-7.1.0/powerpc_rom.bin | Bin 4096 -> 0 bytes .../qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch | 46 - .../qemu/qemu-xilinx-7.1.0/run-ptest | 13 - .../recipes-devtools/qemu/qemu-xilinx-7.1.inc | 65 - .../qemu/qemu-xilinx-native-7.1.inc | 4 - .../qemu/qemu-xilinx-native_2022.1.bb | 21 - .../qemu/qemu-xilinx-native_2022.2.bb | 21 - .../qemu/qemu-xilinx-native_2023.1.bb | 21 - .../qemu/qemu-xilinx-native_2023.2.bb | 21 - .../qemu/qemu-xilinx-system-native_2022.1.bb | 38 - .../qemu/qemu-xilinx-system-native_2022.2.bb | 38 - .../qemu/qemu-xilinx-system-native_2023.1.bb | 38 - .../qemu/qemu-xilinx-system-native_2023.2.bb | 38 - .../recipes-devtools/qemu/qemu-xilinx_2022.1.bb | 38 - .../recipes-devtools/qemu/qemu-xilinx_2022.2.bb | 36 - .../recipes-devtools/qemu/qemu-xilinx_2023.1.bb | 38 - .../recipes-devtools/qemu/qemu-xilinx_2023.2.bb | 38 - .../recipes-graphics/mali/kernel-module-mali.bb | 13 +- .../recipes-devtools/qemu/qemu-xen_7.1.inc | 33 - ...syntax-error-that-causes-FTBFS-in-some-co.patch | 40 - ...plugging-emulated-devices-skip-virtio-dev.patch | 51 - ...return-error-from-xen_create_ioreq_server.patch | 55 - ...-add-pseudo-RAM-region-for-grant-mappings.patch | 252 --- ...en-mapcache-move-xen-mapcache.c-to-hw-xen.patch | 88 - ...003-hw-i386-xen-rearrange-xen_hvm_init_pc.patch | 106 - ...-qemu_map_ram_ptr-use-qemu_ram_ptr_length.patch | 113 -- ...ove-x86-specific-fields-out-of-XenIOState.patch | 180 -- ..._ram_addr_from_mapcache-return-1-in-case-.patch | 49 - ...-add-MemoryRegion-map-and-unmap-callbacks.patch | 150 -- ...ate-arch_handle_ioreq-and-arch_xen_set_me.patch | 192 -- ...-map-and-unmap-callbacks-for-grant-region.patch | 255 --- ...e-common-functions-to-hw-xen-xen-hvm-comm.patch | 2094 -------------------- .../0007-xen-mapcache-Fix-build-on-Arm.patch | 37 - ...req-creation-on-ioreq-registration-failur.patch | 42 - ...n-xen-all-export-xenstore_record_dm_state.patch | 48 - .../0008-hw-arm-Add-grant-mapping.patch | 39 - ...n-hvm-enable-xen-hvm-common-build-for-ARM.patch | 43 - .../0010-hw-arm-introduce-xenpv-machine.patch | 230 --- ...-do-not-set-have_xen_pci_passthrough-for-.patch | 33 - ...n-arm-call-qemu_find_tpm_be-if-CONFIG_TPM.patch | 72 - ...3-arm-xenpv-fix-TPM-address-print-warning.patch | 27 - ...ate-virtio-mmio-devices-during-initializa.patch | 83 - ...tialize-RAM-and-add-hi-low-memory-regions.patch | 105 - ...-accel-xen-and-drop-extra-interface-openi.patch | 79 - .../qemu/qemu-xilinx_2023%.bbappend | 5 - .../recipes-devtools/qemu/qemu_7.1%.bbappend | 5 - 72 files changed, 10 insertions(+), 5933 deletions(-) delete mode 100644 meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split-7.1.inc delete mode 100644 meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend delete mode 100644 meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu_7.1%.bbappend delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0007-qemu-Determinism-fixes.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb delete mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xen_7.1.inc delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-pt-fix-syntax-error-that-causes-FTBFS-in-some-co.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-when-unplugging-emulated-devices-skip-virtio-dev.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen_common-return-error-from-xen_create_ioreq_server.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-add-pseudo-RAM-region-for-grant-mappings.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-mapcache-move-xen-mapcache.c-to-hw-xen.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-hw-i386-xen-rearrange-xen_hvm_init_pc.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-softmmu-let-qemu_map_ram_ptr-use-qemu_ram_ptr_length.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-hvm-move-x86-specific-fields-out-of-XenIOState.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-let-xen_ram_addr_from_mapcache-return-1-in-case-.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-memory-add-MemoryRegion-map-and-unmap-callbacks.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-xen-hvm-create-arch_handle_ioreq-and-arch_xen_set_me.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-add-map-and-unmap-callbacks-for-grant-region.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-hvm-move-common-functions-to-hw-xen-xen-hvm-comm.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-mapcache-Fix-build-on-Arm.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-skip-ioreq-creation-on-ioreq-registration-failur.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-accel-xen-xen-all-export-xenstore_record_dm_state.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-hw-arm-Add-grant-mapping.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0009-xen-hvm-enable-xen-hvm-common-build-for-ARM.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0010-hw-arm-introduce-xenpv-machine.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0011-meson.build-do-not-set-have_xen_pci_passthrough-for-.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0012-xen-arm-call-qemu_find_tpm_be-if-CONFIG_TPM.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0013-arm-xenpv-fix-TPM-address-print-warning.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0014-xen_arm-Create-virtio-mmio-devices-during-initializa.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0015-xen_arm-Initialize-RAM-and-add-hi-low-memory-regions.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0016-xen_arm-Add-accel-xen-and-drop-extra-interface-openi.patch delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend delete mode 100644 meta-xilinx-virtualization/recipes-devtools/qemu/qemu_7.1%.bbappend diff --git a/meta-xilinx-core/conf/layer.conf b/meta-xilinx-core/conf/layer.conf index d6b93f9d..78b78c7a 100644 --- a/meta-xilinx-core/conf/layer.conf +++ b/meta-xilinx-core/conf/layer.conf @@ -46,16 +46,12 @@ XILINX_RELEASE_VERSION ??= "v2024.1" BUILDCFG_VARS:append = " SOC_VARIANT XILINX_RELEASE_VERSION" -XILINX_QEMU_VERSION[v2022.1] = "v7.1.0-xilinx-v2022.1%" -XILINX_QEMU_VERSION[v2022.2] = "v7.1.0-xilinx-v2022.2%" -XILINX_QEMU_VERSION[v2023.1] = "v7.1.0-xilinx-v2023.1%" -XILINX_QEMU_VERSION[v2023.2] = "v7.1.0-xilinx-v2023.2%" XILINX_QEMU_VERSION[v2024.1] = "v8.1.0-xilinx-v2024.1%" -PREFERRED_VERSION_qemu ?= "${@ '7.1%' if not (d.getVar('XILINX_RELEASE_VERSION') or 'undefined').startswith('v2024') else '8.1%'}" -PREFERRED_VERSION_qemu-xilinx ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" -PREFERRED_VERSION_qemu-xilinx-native ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" -PREFERRED_VERSION_qemu-xilinx-system-native ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" -PREFERRED_VERSION_qemu-devicetrees ?= "xilinx-${XILINX_RELEASE_VERSION}%" +PREFERRED_VERSION_qemu ?= "${@ '8.1%' if not (d.getVar('XILINX_RELEASE_VERSION') or 'undefined').startswith('v2024') else '8.1%'}" +PREFERRED_VERSION_qemu-xilinx ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'v8.1%'}" +PREFERRED_VERSION_qemu-xilinx-native ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'v8.1%'}" +PREFERRED_VERSION_qemu-xilinx-system-native ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'v8.1%'}" +PREFERRED_VERSION_qemu-devicetrees ?= "xilinx-v2024.1%" DEFAULT_XILINX_QEMU = "qemu-xilinx" DEFAULT_XILINX_QEMU:arm = "qemu" diff --git a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split-7.1.inc b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split-7.1.inc deleted file mode 100644 index d07090bd..00000000 --- a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split-7.1.inc +++ /dev/null @@ -1,46 +0,0 @@ -PACKAGES:prepend:class-target = "${PN}-x86_64 \ - ${PN}-aarch64 \ - ${PN}-arm \ - ${PN}-i386 \ - ${PN}-system-i386 \ - ${PN}-microblaze \ - ${PN}-support \ - ${PN}-keymaps \ - ${PN}-firmware \ - " - -FILES:${PN}-x86_64:class-target = "${bindir}/qemu-system-x86_64 ${bindir}/qemu-x86_64" -RDEPENDS:${PN}-x86_64:append:class-target = " ${PN}" -INSANE_SKIP:${PN}-x86_64:class-target = "file-rdeps" - -FILES:${PN}-i386:class-target = "${bindir}/qemu-i386" -RDEPENDS:${PN}-i386:append:class-target = " ${PN}" -INSANE_SKIP:${PN}-i386:class-target = "file-rdeps" - -FILES:${PN}-system-i386:class-target = "${bindir}/qemu-system-i386" -RDEPENDS:${PN}-system-i386:append:class-target = " ${PN}" -INSANE_SKIP:${PN}-system-i386:class-target = "file-rdeps" - -FILES:${PN}-aarch64:class-target = "${bindir}/qemu-system-aarch64 ${bindir}/qemu-aarch64" -RDEPENDS:${PN}-aarch64:append:class-target = " ${PN}" -INSANE_SKIP:${PN}-aarch64:class-target = "file-rdeps" - -FILES:${PN}-arm:class-target = "${bindir}/qemu-system-arm ${bindir}/qemu-arm" -RDEPENDS:${PN}-arm:append:class-target = " ${PN}" -INSANE_SKIP:${PN}-arm:class-target = "file-rdeps" - -FILES:${PN}-microblaze:class-target = "${bindir}/qemu-system-microblaze* ${bindir}/qemu-microblaze*" -RDEPENDS:${PN}-microblaze:append:class-target = " ${PN}" -INSANE_SKIP:${PN}-arm:class-target = "file-rdeps" - -FILES:${PN}-support:class-target = "${bindir}/* ${libexecdir}/*" -RDEPENDS:${PN}-support:class-target = "${PN} bash" - -FILES:${PN}-firmware:class-target = "${datadir}/${PN}/*.bin ${datadir}/${PN}/*.rom ${datadir}/${PN}/*.img ${datadir}/${PN}/openbios* ${datadir}/${PN}/*.dtb ${datadir}/${PN}/u-boot*" -RDEPENDS:${PN}-firmware:class-target = "${PN}" -INSANE_SKIP:${PN}-firmware:class-target = "arch" - -FILES:${PN}-keymaps:class-target = "${datadir}/${PN}/keymaps/*" -RDEPENDS:${PN}-keymaps:class-target = "${PN}" - -PACKAGECONFIG:append:class-target = " virtfs" diff --git a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend deleted file mode 100644 index c9f04327..00000000 --- a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('DISTRO_FEATURES', 'vmsep', 'qemu-xilinx-package-split-7.1.inc', '', d)} diff --git a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu_7.1%.bbappend b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu_7.1%.bbappend deleted file mode 100644 index c9f04327..00000000 --- a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu_7.1%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('DISTRO_FEATURES', 'vmsep', 'qemu-xilinx-package-split-7.1.inc', '', d)} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb deleted file mode 100644 index 7c734cd6..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb +++ /dev/null @@ -1,8 +0,0 @@ - -require qemu-devicetrees.inc - -BRANCH ?= "xlnx_rel_v2022.1" -SRCREV ?= "0499324af1178057c3730b0989c8fb5c5bbc4cf8" - -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -SRC_URI:append = " file://0001-Makefile-Use-python3-instead-of-python.patch" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb deleted file mode 100644 index 6675ba3e..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb +++ /dev/null @@ -1,6 +0,0 @@ - -require qemu-devicetrees.inc - -BRANCH ?= "xlnx_rel_v2022.2" -SRCREV ?= "cf5d357e16c13ac447861f908e83951ffb7b4301" - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb deleted file mode 100644 index dc1feda4..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb +++ /dev/null @@ -1,6 +0,0 @@ - -require qemu-devicetrees.inc - -BRANCH ?= "xlnx_rel_v2023.1" -SRCREV ?= "56538937584f527fb408347c3b430142e74723e8" - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb deleted file mode 100644 index d41743c1..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb +++ /dev/null @@ -1,6 +0,0 @@ - -require qemu-devicetrees.inc - -BRANCH ?= "xlnx_rel_v2023.2" -SRCREV ?= "d1013382d9a5ef816cd020e7840813b7a2d65c51" - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc deleted file mode 100644 index bb8fac70..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc +++ /dev/null @@ -1,8 +0,0 @@ -# Note this isn't really the 2022.1 or 2022.2 version of qemu-xilinx -# Instead it's the current master version, as qemu 6.1.0 doesn't -# work reliabily anymore. - -XILINX_QEMU_VERSION = "v7.1.0" -BRANCH = "master" -SRCREV = "21adc9f99e813fb24fb65421259b5b0614938376" - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc deleted file mode 100644 index bb8fac70..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc +++ /dev/null @@ -1,8 +0,0 @@ -# Note this isn't really the 2022.1 or 2022.2 version of qemu-xilinx -# Instead it's the current master version, as qemu 6.1.0 doesn't -# work reliabily anymore. - -XILINX_QEMU_VERSION = "v7.1.0" -BRANCH = "master" -SRCREV = "21adc9f99e813fb24fb65421259b5b0614938376" - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc deleted file mode 100644 index 06ac05a1..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc +++ /dev/null @@ -1,3 +0,0 @@ -XILINX_QEMU_VERSION = "v7.1.0" -BRANCH = "xlnx_rel_v2023.1" -SRCREV = "21adc9f99e813fb24fb65421259b5b0614938376" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc deleted file mode 100644 index db6e1528..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc +++ /dev/null @@ -1,3 +0,0 @@ -XILINX_QEMU_VERSION = "v7.1.0" -BRANCH = "xlnx_rel_v2023.2" -SRCREV = "23b643ba1683a47ef49447a45643fe2172d6f8ca" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch deleted file mode 100644 index 6c85a77b..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch +++ /dev/null @@ -1,64 +0,0 @@ -CVE: CVE-2022-2962 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 5c5c50b0a73d78ffe18336c9996fef5eae9bbbb0 Mon Sep 17 00:00:00 2001 -From: Zheyu Ma -Date: Sun, 21 Aug 2022 20:43:43 +0800 -Subject: [PATCH] net: tulip: Restrict DMA engine to memories - -The DMA engine is started by I/O access and then itself accesses the -I/O registers, triggering a reentrancy bug. - -The following log can reveal it: -==5637==ERROR: AddressSanitizer: stack-overflow - #0 0x5595435f6078 in tulip_xmit_list_update qemu/hw/net/tulip.c:673 - #1 0x5595435f204a in tulip_write qemu/hw/net/tulip.c:805:13 - #2 0x559544637f86 in memory_region_write_accessor qemu/softmmu/memory.c:492:5 - #3 0x5595446379fa in access_with_adjusted_size qemu/softmmu/memory.c:554:18 - #4 0x5595446372fa in memory_region_dispatch_write qemu/softmmu/memory.c - #5 0x55954468b74c in flatview_write_continue qemu/softmmu/physmem.c:2825:23 - #6 0x559544683662 in flatview_write qemu/softmmu/physmem.c:2867:12 - #7 0x5595446833f3 in address_space_write qemu/softmmu/physmem.c:2963:18 - #8 0x5595435fb082 in dma_memory_rw_relaxed qemu/include/sysemu/dma.h:87:12 - #9 0x5595435fb082 in dma_memory_rw qemu/include/sysemu/dma.h:130:12 - #10 0x5595435fb082 in dma_memory_write qemu/include/sysemu/dma.h:171:12 - #11 0x5595435fb082 in stl_le_dma qemu/include/sysemu/dma.h:272:1 - #12 0x5595435fb082 in stl_le_pci_dma qemu/include/hw/pci/pci.h:910:1 - #13 0x5595435fb082 in tulip_desc_write qemu/hw/net/tulip.c:101:9 - #14 0x5595435f7e3d in tulip_xmit_list_update qemu/hw/net/tulip.c:706:9 - #15 0x5595435f204a in tulip_write qemu/hw/net/tulip.c:805:13 - -Fix this bug by restricting the DMA engine to memories regions. - -Signed-off-by: Zheyu Ma -Signed-off-by: Jason Wang ---- - hw/net/tulip.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/net/tulip.c b/hw/net/tulip.c -index 097e905bec..b9e42c322a 100644 ---- a/hw/net/tulip.c -+++ b/hw/net/tulip.c -@@ -70,7 +70,7 @@ static const VMStateDescription vmstate_pci_tulip = { - static void tulip_desc_read(TULIPState *s, hwaddr p, - struct tulip_descriptor *desc) - { -- const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; -+ const MemTxAttrs attrs = { .memory = true }; - - if (s->csr[0] & CSR0_DBO) { - ldl_be_pci_dma(&s->dev, p, &desc->status, attrs); -@@ -88,7 +88,7 @@ static void tulip_desc_read(TULIPState *s, hwaddr p, - static void tulip_desc_write(TULIPState *s, hwaddr p, - struct tulip_descriptor *desc) - { -- const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; -+ const MemTxAttrs attrs = { .memory = true }; - - if (s->csr[0] & CSR0_DBO) { - stl_be_pci_dma(&s->dev, p, desc->status, attrs); --- -2.34.1 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch deleted file mode 100644 index 6fb160e6..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch +++ /dev/null @@ -1,36 +0,0 @@ -From de64af82950a6908f9407dfc92b83c17e2af3eab Mon Sep 17 00:00:00 2001 -From: Jason Wessel -Date: Fri, 28 Mar 2014 17:42:43 +0800 -Subject: [PATCH 01/12] qemu: Add addition environment space to boot loader - qemu-system-mips - -Upstream-Status: Inappropriate - OE uses deep paths - -If you create a project with very long directory names like 128 characters -deep and use NFS, the kernel arguments will be truncated. The kernel will -accept longer strings such as 1024 bytes, but the qemu boot loader defaulted -to only 256 bytes. This patch expands the limit. - -Signed-off-by: Jason Wessel -Signed-off-by: Roy Li - ---- - hw/mips/malta.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/mips/malta.c b/hw/mips/malta.c -index 628851172..12d37f35d 100644 ---- a/hw/mips/malta.c -+++ b/hw/mips/malta.c -@@ -61,7 +61,7 @@ - #define ENVP_PADDR 0x2000 - #define ENVP_VADDR cpu_mips_phys_to_kseg0(NULL, ENVP_PADDR) - #define ENVP_NB_ENTRIES 16 --#define ENVP_ENTRY_SIZE 256 -+#define ENVP_ENTRY_SIZE 1024 - - /* Hardware addresses */ - #define FLASH_ADDRESS 0x1e000000ULL --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch deleted file mode 100644 index 63a99c96..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 14cd62607c9de232edf0a9b8503bd02783e03411 Mon Sep 17 00:00:00 2001 -From: Alistair Francis -Date: Thu, 21 Dec 2017 11:35:16 -0800 -Subject: [PATCH 02/12] chardev: connect socket to a spawned command - -The command is started in a shell (sh -c) with stdin connect to QEMU -via a Unix domain stream socket. QEMU then exchanges data via its own -end of the socket, just like it normally does. - -"-chardev socket" supports some ways of connecting via protocols like -telnet, but that is only a subset of the functionality supported by -tools socat. To use socat instead, for example to connect via a socks -proxy, use: - - -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ - -device usb-serial,chardev=socat - -Beware that commas in the command must be escaped as double commas. - -Or interactively in the console: - (qemu) chardev-add socket,id=cat,cmd=cat - (qemu) device_add usb-serial,chardev=cat - ^ac - # cat >/dev/ttyUSB0 - hello - hello - -Another usage is starting swtpm from inside QEMU. swtpm will -automatically shut down once it looses the connection to the parent -QEMU, so there is no risk of lingering processes: - - -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ - -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ - -device tpm-tis,tpmdev=tpm0 - -The patch was discussed upstream, but QEMU developers believe that the -code calling QEMU should be responsible for managing additional -processes. In OE-core, that would imply enhancing runqemu and -oeqa. This patch is a simpler solution. - -Because it is not going upstream, the patch was written so that it is -as simple as possible. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Patrick Ohly - ---- - chardev/char-socket.c | 100 ++++++++++++++++++++++++++++++++++++++++++ - chardev/char.c | 3 ++ - qapi/char.json | 5 +++ - 3 files changed, 108 insertions(+) - -diff --git a/chardev/char-socket.c b/chardev/char-socket.c -index fab2d791d..c79641f24 100644 ---- a/chardev/char-socket.c -+++ b/chardev/char-socket.c -@@ -1315,6 +1315,67 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, - return true; - } - -+#ifndef _WIN32 -+static void chardev_open_socket_cmd(Chardev *chr, -+ const char *cmd, -+ Error **errp) -+{ -+ int fds[2] = { -1, -1 }; -+ QIOChannelSocket *sioc = NULL; -+ pid_t pid = -1; -+ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; -+ -+ /* -+ * We need a Unix domain socket for commands like swtpm and a single -+ * connection, therefore we cannot use qio_channel_command_new_spawn() -+ * without patching it first. Duplicating the functionality is easier. -+ */ -+ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { -+ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); -+ goto error; -+ } -+ -+ pid = qemu_fork(errp); -+ if (pid < 0) { -+ goto error; -+ } -+ -+ if (!pid) { -+ /* child */ -+ dup2(fds[1], STDIN_FILENO); -+ execv(argv[0], (char * const *)argv); -+ _exit(1); -+ } -+ -+ /* -+ * Hand over our end of the socket pair to the qio channel. -+ * -+ * We don't reap the child because it is expected to keep -+ * running. We also don't support the "reconnect" option for the -+ * same reason. -+ */ -+ sioc = qio_channel_socket_new_fd(fds[0], errp); -+ if (!sioc) { -+ goto error; -+ } -+ fds[0] = -1; -+ -+ g_free(chr->filename); -+ chr->filename = g_strdup_printf("cmd:%s", cmd); -+ tcp_chr_new_client(chr, sioc); -+ -+ error: -+ if (fds[0] >= 0) { -+ close(fds[0]); -+ } -+ if (fds[1] >= 0) { -+ close(fds[1]); -+ } -+ if (sioc) { -+ object_unref(OBJECT(sioc)); -+ } -+} -+#endif - - static void qmp_chardev_open_socket(Chardev *chr, - ChardevBackend *backend, -@@ -1323,6 +1384,9 @@ static void qmp_chardev_open_socket(Chardev *chr, - { - SocketChardev *s = SOCKET_CHARDEV(chr); - ChardevSocket *sock = backend->u.socket.data; -+#ifndef _WIN32 -+ const char *cmd = sock->cmd; -+#endif - bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; - bool is_listen = sock->has_server ? sock->server : true; - bool is_telnet = sock->has_telnet ? sock->telnet : false; -@@ -1393,6 +1457,14 @@ static void qmp_chardev_open_socket(Chardev *chr, - - update_disconnected_filename(s); - -+#ifndef _WIN32 -+ if (cmd) { -+ chardev_open_socket_cmd(chr, cmd, errp); -+ -+ /* everything ready (or failed permanently) before we return */ -+ *be_opened = true; -+ } else -+#endif - if (s->is_listen) { - if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, - is_waitconnect, errp) < 0) { -@@ -1412,6 +1484,9 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - const char *host = qemu_opt_get(opts, "host"); - const char *port = qemu_opt_get(opts, "port"); - const char *fd = qemu_opt_get(opts, "fd"); -+#ifndef _WIN32 -+ const char *cmd = qemu_opt_get(opts, "cmd"); -+#endif - #ifdef CONFIG_LINUX - bool tight = qemu_opt_get_bool(opts, "tight", true); - bool abstract = qemu_opt_get_bool(opts, "abstract", false); -@@ -1419,6 +1494,20 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - SocketAddressLegacy *addr; - ChardevSocket *sock; - -+#ifndef _WIN32 -+ if (cmd) { -+ /* -+ * Here we have to ensure that no options are set which are incompatible with -+ * spawning a command, otherwise unmodified code that doesn't know about -+ * command spawning (like socket_reconnect_timeout()) might get called. -+ */ -+ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { -+ error_setg(errp, "chardev: socket: cmd does not support any additional options"); -+ return; -+ } -+ } else -+#endif -+ - if ((!!path + !!fd + !!host) > 1) { - error_setg(errp, - "None or one of 'path', 'fd' or 'host' option required."); -@@ -1469,13 +1558,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds")); - sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); - sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); -+#ifndef _WIN32 -+ sock->cmd = g_strdup(cmd); -+#endif - - addr = g_new0(SocketAddressLegacy, 1); -+#ifndef _WIN32 -+ if (path || cmd) { -+#else - if (path) { -+#endif - UnixSocketAddress *q_unix; - addr->type = SOCKET_ADDRESS_TYPE_UNIX; - q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); -+#ifndef _WIN32 -+ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); -+#else - q_unix->path = g_strdup(path); -+#endif - #ifdef CONFIG_LINUX - q_unix->has_tight = true; - q_unix->tight = tight; -diff --git a/chardev/char.c b/chardev/char.c -index 0169d8dde..ce9a21f41 100644 ---- a/chardev/char.c -+++ b/chardev/char.c -@@ -835,6 +835,9 @@ QemuOptsList qemu_chardev_opts = { - },{ - .name = "path", - .type = QEMU_OPT_STRING, -+ },{ -+ .name = "cmd", -+ .type = QEMU_OPT_STRING, - },{ - .name = "host", - .type = QEMU_OPT_STRING, -diff --git a/qapi/char.json b/qapi/char.json -index 7b4215157..37feabdac 100644 ---- a/qapi/char.json -+++ b/qapi/char.json -@@ -250,6 +250,10 @@ - # - # @addr: socket address to listen on (server=true) - # or connect to (server=false) -+# @cmd: command to run via "sh -c" with stdin as one end of -+# a AF_UNIX SOCK_DSTREAM socket pair. The other end -+# is used by the chardev. Either an addr or a cmd can -+# be specified, but not both. - # @tls-creds: the ID of the TLS credentials object (since 2.6) - # @tls-authz: the ID of the QAuthZ authorization object against which - # the client's x509 distinguished name will be validated. This -@@ -276,6 +280,7 @@ - ## - { 'struct': 'ChardevSocket', - 'data': { 'addr': 'SocketAddressLegacy', -+ '*cmd': 'str', - '*tls-creds': 'str', - '*tls-authz' : 'str', - '*server': 'bool', --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch deleted file mode 100644 index f350ffce..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch +++ /dev/null @@ -1,47 +0,0 @@ -From dc2a8ccd440ee3741b61606eafed3f7e092f4312 Mon Sep 17 00:00:00 2001 -From: Mark Asselstine -Date: Tue, 26 Feb 2013 11:43:28 -0500 -Subject: [PATCH 03/12] apic: fixup fallthrough to PIC - -Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC -interrupts through the local APIC if the local APIC config says so.] -missed a check to ensure the local APIC is enabled. Since if the local -APIC is disabled it doesn't matter what the local APIC config says. - -If this check isn't done and the guest has disabled the local APIC the -guest will receive a general protection fault, similar to what is seen -here: - -https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html - -The GPF is caused by an attempt to service interrupt 0xffffffff. This -comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() -(with the local APIC disabled apic_get_interrupt() returns -1). -apic_accept_pic_intr() returns 0 and thus the interrupt number which -is returned from cpu_get_pic_interrupt(), and which is attempted to be -serviced, is -1. - -Signed-off-by: Mark Asselstine -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] -Signed-off-by: He Zhe - ---- - hw/intc/apic.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/intc/apic.c b/hw/intc/apic.c -index 3df11c34d..9506c88ce 100644 ---- a/hw/intc/apic.c -+++ b/hw/intc/apic.c -@@ -605,7 +605,7 @@ int apic_accept_pic_intr(DeviceState *dev) - APICCommonState *s = APIC(dev); - uint32_t lvt0; - -- if (!s) -+ if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) - return -1; - - lvt0 = s->lvt[APIC_LVT_LINT0]; --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch deleted file mode 100644 index 6faebd4e..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch +++ /dev/null @@ -1,32 +0,0 @@ -From d8265abdce5dc2bf74b3fccdf2b7257b4f3894f0 Mon Sep 17 00:00:00 2001 -From: He Zhe -Date: Wed, 28 Aug 2019 19:56:28 +0800 -Subject: [PATCH 04/12] configure: Add pkg-config handling for libgcrypt - -libgcrypt may also be controlled by pkg-config, this patch adds pkg-config -handling for libgcrypt. - -Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html] - -Signed-off-by: He Zhe - ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index 861de93c4..d45ff2d7c 100644 ---- a/meson.build -+++ b/meson.build -@@ -1063,7 +1063,7 @@ endif - if not gnutls_crypto.found() - if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() - gcrypt = dependency('libgcrypt', version: '>=1.8', -- method: 'config-tool', -+ method: 'pkg-config', - required: get_option('gcrypt'), - kwargs: static_kwargs) - # Debian has removed -lgpg-error from libgcrypt-config --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch deleted file mode 100644 index 3f3c39f9..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f39e7bfc5ed07b5ecaeb705c4eae4855ca120d47 Mon Sep 17 00:00:00 2001 -From: Oleksiy Obitotskyy -Date: Wed, 25 Mar 2020 21:21:35 +0200 -Subject: [PATCH 05/12] qemu: Do not include file if not exists - -Script configure checks for if_alg.h and check failed but -if_alg.h still included. - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07188.html] -Signed-off-by: Oleksiy Obitotskyy - -[update patch context] -Signed-off-by: Sakib Sajal - ---- - linux-user/syscall.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index f65045efe..340e0c6f0 100644 ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -113,7 +113,9 @@ - #include - #include - #include -+#if defined(CONFIG_AF_ALG) - #include -+#endif - #include - #include - #ifdef HAVE_BTRFS_H --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch deleted file mode 100644 index 75c03693..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 375cae3dd6151ef33cae8f243f6a2c2da6c0c356 Mon Sep 17 00:00:00 2001 -From: Richard Purdie -Date: Fri, 8 Jan 2021 17:27:06 +0000 -Subject: [PATCH 06/12] qemu: Add some user space mmap tweaks to address musl - 32 bit - -When using qemu-i386 to build qemux86 webkitgtk on musl, it sits in an -infinite loop of mremap calls of ever decreasing/increasing addresses. - -I suspect something in the musl memory allocation code loops indefinitely -if it only sees ENOMEM and only exits when it hits EFAULT. - -According to the docs, trying to mremap outside the address space -can/should return EFAULT and changing this allows the build to succeed. - -A better return value for the other cases of invalid addresses is EINVAL -rather than ENOMEM so adjust the other part of the test to this. - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html] -Signed-off-by: Richard Purdie -Date: Mon, 1 Mar 2021 13:00:47 +0000 -Subject: [PATCH 07/12] qemu: Determinism fixes - -When sources are included within debug information, a couple of areas of the -qemu build are not reproducible due to either full buildpaths or timestamps. - -Replace the full paths with relative ones. I couldn't figure out how to get -meson to pass relative paths but we can fix that in the script. - -Upstream-Status: Pending [some version of all/part of this may be accepted] -RP 2021/3/1 - ---- - scripts/decodetree.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/decodetree.py b/scripts/decodetree.py -index a03dc6b5e..4ea24c1f3 100644 ---- a/scripts/decodetree.py -+++ b/scripts/decodetree.py -@@ -1328,7 +1328,7 @@ def main(): - toppat = ExcMultiPattern(0) - - for filename in args: -- input_file = filename -+ input_file = os.path.relpath(filename) - f = open(filename, 'rt', encoding='utf-8') - parse_file(f, toppat) - f.close() --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch deleted file mode 100644 index 43d3c7cf..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2bf9388b801d4389e2d57e95a7897bfc1c42786e Mon Sep 17 00:00:00 2001 -From: Changqing Li -Date: Thu, 14 Jan 2021 06:33:04 +0000 -Subject: [PATCH 08/12] tests/meson.build: use relative path to refer to files - -Fix error like: -Fatal error: can't create tests/ptimer-test.p/..._qemu-5.2.0_hw_core_ptimer.c.o: File name too long - -when build path is too long, use meson.source_root() will make this -filename too long. Fixed by using relative path to refer to files - -Upstream-Status: Submitted [send to qemu-devel] - -Signed-off-by: Changqing Li - ---- - tests/unit/meson.build | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/unit/meson.build b/tests/unit/meson.build -index 96b295263..e4c3246dc 100644 ---- a/tests/unit/meson.build -+++ b/tests/unit/meson.build -@@ -44,9 +44,9 @@ tests = { - 'test-keyval': [testqapi], - 'test-logging': [], - 'test-uuid': [], -- 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], -+ 'ptimer-test': ['ptimer-test-stubs.c', '../../hw/core/ptimer.c'], - 'test-qapi-util': [], -- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], -+ 'test-smp-parse': [qom, '../../hw/core/machine-smp.c'], - } - - if have_system or have_tools --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch deleted file mode 100644 index 23d0a698..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch +++ /dev/null @@ -1,49 +0,0 @@ -From ebf4bb2f51da83af0c61480414cfa156f7308b34 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 21 Mar 2022 10:09:38 -0700 -Subject: [PATCH 09/12] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux - systems - -linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures -which include asm-generic/mman.h and mips/powerpc are not including this -file in linux/mman.h, therefore these should be defined for such -architectures on Linux as well. This fixes build on mips/musl/linux - -Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05298.html] -Signed-off-by: Khem Raj -Cc: Zhang Yi -Cc: Michael S. Tsirkin - ---- - util/mmap-alloc.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c -index 893d86435..86d3cda24 100644 ---- a/util/mmap-alloc.c -+++ b/util/mmap-alloc.c -@@ -10,14 +10,18 @@ - * later. See the COPYING file in the top-level directory. - */ - -+#include "qemu/osdep.h" - #ifdef CONFIG_LINUX - #include --#else /* !CONFIG_LINUX */ -+#endif /* CONFIG_LINUX */ -+ -+#ifndef MAP_SYNC - #define MAP_SYNC 0x0 -+#endif /* MAP_SYNC */ -+#ifndef MAP_SHARED_VALIDATE - #define MAP_SHARED_VALIDATE 0x0 --#endif /* CONFIG_LINUX */ -+#endif /* MAP_SHARED_VALIDATE */ - --#include "qemu/osdep.h" - #include "qemu/mmap-alloc.h" - #include "qemu/host-utils.h" - #include "qemu/cutils.h" --- -2.30.2 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch deleted file mode 100644 index 810c74fa..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch +++ /dev/null @@ -1,43 +0,0 @@ -CVE: CVE-2022-1050 -Upstream-Status: Submitted [https://lore.kernel.org/qemu-devel/20220403095234.2210-1-yuval.shaia.ml@gmail.com/] -Signed-off-by: Ross Burton - -From dbdef95c272e8f3ec037c3db4197c66002e30995 Mon Sep 17 00:00:00 2001 -From: Yuval Shaia -Date: Sun, 3 Apr 2022 12:52:34 +0300 -Subject: [PATCH] hw/pvrdma: Protect against buggy or malicious guest driver - -Guest driver might execute HW commands when shared buffers are not yet -allocated. -This could happen on purpose (malicious guest) or because of some other -guest/host address mapping error. -We need to protect againts such case. - -Fixes: CVE-2022-1050 - -Reported-by: Raven -Signed-off-by: Yuval Shaia ---- - hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c -index da7ddfa548..89db963c46 100644 ---- a/hw/rdma/vmw/pvrdma_cmd.c -+++ b/hw/rdma/vmw/pvrdma_cmd.c -@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev) - - dsr_info = &dev->dsr_info; - -+ if (!dsr_info->dsr) { -+ /* Buggy or malicious guest driver */ -+ rdma_error_report("Exec command without dsr, req or rsp buffers"); -+ goto out; -+ } -+ - if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) / - sizeof(struct cmd_handler)) { - rdma_error_report("Unsupported command"); --- -2.34.1 - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch deleted file mode 100644 index 3b4a6694..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch +++ /dev/null @@ -1,59 +0,0 @@ -CVE: CVE-2022-3165 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From d307040b18bfcb1393b910f1bae753d5c12a4dc7 Mon Sep 17 00:00:00 2001 -From: Mauro Matteo Cascella -Date: Sun, 25 Sep 2022 22:45:11 +0200 -Subject: [PATCH] ui/vnc-clipboard: fix integer underflow in - vnc_client_cut_text_ext - -Extended ClientCutText messages start with a 4-byte header. If len < 4, -an integer underflow occurs in vnc_client_cut_text_ext. The result is -used to decompress data in a while loop in inflate_buffer, leading to -CPU consumption and denial of service. Prevent this by checking dlen in -protocol_client_msg. - -Fixes: CVE-2022-3165 -Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support") -Reported-by: TangPeng -Signed-off-by: Mauro Matteo Cascella -Message-Id: <20220925204511.1103214-1-mcascell@redhat.com> -Signed-off-by: Gerd Hoffmann ---- - ui/vnc.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/ui/vnc.c b/ui/vnc.c -index 6a05d06147..acb3629cd8 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) - if (len == 1) { - return 8; - } -+ uint32_t dlen = abs(read_s32(data, 4)); - if (len == 8) { -- uint32_t dlen = abs(read_s32(data, 4)); - if (dlen > (1 << 20)) { - error_report("vnc: client_cut_text msg payload has %u bytes" - " which exceeds our limit of 1MB.", dlen); -@@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) - } - - if (read_s32(data, 4) < 0) { -- vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)), -- read_u32(data, 8), data + 12); -+ if (dlen < 4) { -+ error_report("vnc: malformed payload (header less than 4 bytes)" -+ " in extended clipboard pseudo-encoding."); -+ vnc_client_error(vs); -+ break; -+ } -+ vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12); - break; - } - vnc_client_cut_text(vs, read_u32(data, 4), data + 8); --- -GitLab - diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch deleted file mode 100644 index 071691f8..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch +++ /dev/null @@ -1,27 +0,0 @@ -target/arm: mark SP_EL1 with ARM_CP_EL3_NO_EL2_KEEP - -SP_EL1 must be kept when EL3 is present but EL2 is not. Therefore mark -it with ARM_CP_EL3_NO_EL2_KEEP. - -Fixes: 696ba3771894 ("target/arm: Handle cpreg registration for missing EL") -Signed-off-by: Jerome Forissier - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-09/msg04515.html] - ---- - target/arm/helper.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: qemu-7.1.0/target/arm/helper.c -=================================================================== ---- qemu-7.1.0.orig/target/arm/helper.c -+++ qemu-7.1.0/target/arm/helper.c -@@ -4971,7 +4971,7 @@ static const ARMCPRegInfo v8_cp_reginfo[ - .fieldoffset = offsetof(CPUARMState, sp_el[0]) }, - { .name = "SP_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 1, .opc2 = 0, -- .access = PL2_RW, .type = ARM_CP_ALIAS, -+ .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_KEEP, - .fieldoffset = offsetof(CPUARMState, sp_el[1]) }, - { .name = "SPSel", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch deleted file mode 100644 index ca2ad361..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 76c3fc4c87231bed32974ebbbdb5079cff45a6b7 Mon Sep 17 00:00:00 2001 -From: Richard Purdie -Date: Tue, 5 Jan 2021 23:00:14 +0000 -Subject: [PATCH 12/12] qemu: Upgrade 5.1.0->5.2.0 - -We need to be able to trigger configure's cross code but we don't want -to set cross_prefix as it does other things we don't want. Patch things -so we can do what we need in the target config case. - -Upstream-Status: Inappropriate [may be rewritten in a way upstream may accept?] -Signed-off-by: Richard Purdie - ---- - configure | 4 ---- - 1 file changed, 4 deletions(-) - -Index: qemu-7.1.0/configure -=================================================================== ---- qemu-7.1.0.orig/configure -+++ qemu-7.1.0/configure -@@ -2710,7 +2710,6 @@ if test "$skip_meson" = no; then - echo "strip = [$(meson_quote $strip)]" >> $cross - echo "widl = [$(meson_quote $widl)]" >> $cross - echo "windres = [$(meson_quote $windres)]" >> $cross -- if test "$cross_compile" = "yes"; then - cross_arg="--cross-file config-meson.cross" - echo "[host_machine]" >> $cross - echo "system = '$targetos'" >> $cross -@@ -2728,9 +2727,6 @@ if test "$skip_meson" = no; then - else - echo "endian = 'little'" >> $cross - fi -- else -- cross_arg="--native-file config-meson.cross" -- fi - mv $cross config-meson.cross - - rm -rf meson-private meson-info meson-logs diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin deleted file mode 100644 index c4044296..00000000 Binary files a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin and /dev/null differ diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch deleted file mode 100644 index abad1cfe..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch +++ /dev/null @@ -1,46 +0,0 @@ -Avoid conflicts between sys/mount.h and linux/mount.h that are seen -with glibc 2.36 - -Source: https://github.com/archlinux/svntogit-packages/blob/packages/qemu/trunk/qemu-7.0.0-glibc-2.36.patch - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -95,7 +95,25 @@ - #include - #include - #include -+ -+#ifdef HAVE_SYS_MOUNT_FSCONFIG -+/* -+ * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h, -+ * which in turn prevents use of linux/fs.h. So we have to -+ * define the constants ourselves for now. -+ */ -+#define FS_IOC_GETFLAGS _IOR('f', 1, long) -+#define FS_IOC_SETFLAGS _IOW('f', 2, long) -+#define FS_IOC_GETVERSION _IOR('v', 1, long) -+#define FS_IOC_SETVERSION _IOW('v', 2, long) -+#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) -+#define FS_IOC32_GETFLAGS _IOR('f', 1, int) -+#define FS_IOC32_SETFLAGS _IOW('f', 2, int) -+#define FS_IOC32_GETVERSION _IOR('v', 1, int) -+#define FS_IOC32_SETVERSION _IOW('v', 2, int) -+#else - #include -+#endif - #include - #if defined(CONFIG_FIEMAP) - #include ---- a/meson.build -+++ b/meson.build -@@ -1686,6 +1686,8 @@ config_host_data.set('HAVE_OPTRESET', - cc.has_header_symbol('getopt.h', 'optreset')) - config_host_data.set('HAVE_IPPROTO_MPTCP', - cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP')) -+config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG', -+ cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')) - - # has_member - config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID', diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest deleted file mode 100644 index f9a4e8fb..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -#This script is used to run qemu test suites -# - -ptestdir=$(dirname "$(readlink -f "$0")") -export SRC_PATH=$ptestdir - -cd $ptestdir/tests -tests=$(find . -name "test-*" ! -name "*.p") -for f in $tests; do - $f | sed '/^ok/ s/ok/PASS:/g' -done diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc deleted file mode 100644 index 4b0aceb8..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc +++ /dev/null @@ -1,65 +0,0 @@ -SUMMARY = "Xilinx's fork of a fast open source processor emulator" -HOMEPAGE = "https://github.com/xilinx/qemu/" - -# This qemu fork is NOT compatible with running on a 32-bit system -# See: https://github.com/Xilinx/qemu/issues/35 -COMPATIBLE_HOST:arm = "null" - -# x86_64 is needed to build nativesdks -QEMU_TARGETS = "aarch64 arm microblaze microblazeel x86_64" - -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ - file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f \ - " -DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" - -FILESEXTRAPATHS:prepend := "${THISDIR}/qemu-xilinx-7.1.0:" - -PV = "${XILINX_QEMU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" -REPO ?= "gitsm://github.com/Xilinx/qemu.git;protocol=https" - -BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" -SRC_URI = "${REPO};${BRANCHARG}" - -FILESEXTRAPATHS:append := ":${COREBASE}/meta/recipes-devtools/qemu/qemu" - -SRC_URI += "\ - file://powerpc_rom.bin \ - file://run-ptest \ - file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ - file://0002-chardev-connect-socket-to-a-spawned-command.patch \ - file://0003-apic-fixup-fallthrough-to-PIC.patch \ - file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \ - file://0005-qemu-Do-not-include-file-if-not-exists.patch \ - file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ - file://0007-qemu-Determinism-fixes.patch \ - file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ - file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ - file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ - file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \ - file://arm-cpreg-fix.patch \ - file://CVE-2022-3165.patch \ - file://qemu-guest-agent.init \ - file://qemu-guest-agent.udev \ - " - -# Workaround for 8.2 patch that doesn't apply -SRC_URI:remove = "file://0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch" -SRC_URI:remove = "file://0012-linux-user-workaround-for-missing-MAP_SHARED_VALIDAT.patch" - -S = "${WORKDIR}/git" - -PACKAGECONFIG ??= " \ - fdt sdl kvm gcrypt pie slirp \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ -" -PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm gcrypt pie slirp" - -# Disable this -PACKAGECONFIG[debuginfo] = "" -PACKAGECONFIG[pipewire] = "" -PACKAGECONFIG[sndio] = "" - -DISABLE_STATIC:pn-${PN} = "" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc deleted file mode 100644 index e664a580..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc +++ /dev/null @@ -1,4 +0,0 @@ -require recipes-devtools/qemu/qemu-native.inc -require qemu-xilinx-7.1.inc - -DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb deleted file mode 100644 index bfdb916d..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb +++ /dev/null @@ -1,21 +0,0 @@ -require qemu-xilinx-2022.1.inc -require qemu-xilinx-native-7.1.inc -require qemu-native-alt.inc - -BPN = "qemu-xilinx" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb deleted file mode 100644 index f91eb891..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb +++ /dev/null @@ -1,21 +0,0 @@ -require qemu-xilinx-2022.2.inc -require qemu-xilinx-native-7.1.inc -require qemu-native-alt.inc - -BPN = "qemu-xilinx" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb deleted file mode 100644 index a19b2cc3..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb +++ /dev/null @@ -1,21 +0,0 @@ -require qemu-xilinx-2023.1.inc -require qemu-xilinx-native-7.1.inc -require qemu-native-alt.inc - -BPN = "qemu-xilinx" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb deleted file mode 100644 index 78ffedca..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb +++ /dev/null @@ -1,21 +0,0 @@ -require qemu-xilinx-2023.2.inc -require qemu-xilinx-native-7.1.inc -require qemu-native-alt.inc - -BPN = "qemu-xilinx" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb deleted file mode 100644 index ba733ede..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-system-native-alt.inc -require qemu-xilinx-2022.1.inc -require qemu-xilinx-native-7.1.inc - -PROVIDES = "qemu-system-native" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" - -PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" -DEPENDS += "qemu-xilinx-multiarch-helper-native" - -do_install:append() { - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons - rm -rf ${D}${includedir}/qemu-plugin.h - - # Install qmp.py to be used with testimage - install -d ${D}${libdir}/qemu-python/qmp/ - install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb deleted file mode 100644 index 17386afe..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-system-native-alt.inc -require qemu-xilinx-2022.2.inc -require qemu-xilinx-native-7.1.inc - -PROVIDES = "qemu-system-native" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" - -PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" -DEPENDS += "qemu-xilinx-multiarch-helper-native" - -do_install:append() { - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons - rm -rf ${D}${includedir}/qemu-plugin.h - - # Install qmp.py to be used with testimage - install -d ${D}${libdir}/qemu-python/qmp/ - install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb deleted file mode 100644 index 3264c260..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-system-native-alt.inc -require qemu-xilinx-2023.1.inc -require qemu-xilinx-native-7.1.inc - -PROVIDES = "qemu-system-native" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" - -PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" -DEPENDS += "qemu-xilinx-multiarch-helper-native" - -do_install:append() { - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons - rm -rf ${D}${includedir}/qemu-plugin.h - - # Install qmp.py to be used with testimage - install -d ${D}${libdir}/qemu-python/qmp/ - install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb deleted file mode 100644 index fdf3be2e..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-system-native-alt.inc -require qemu-xilinx-2023.2.inc -require qemu-xilinx-native-7.1.inc - -PROVIDES = "qemu-system-native" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" - -PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" -DEPENDS += "qemu-xilinx-multiarch-helper-native" - -do_install:append() { - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons - rm -rf ${D}${includedir}/qemu-plugin.h - - # Install qmp.py to be used with testimage - install -d ${D}${libdir}/qemu-python/qmp/ - install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb deleted file mode 100644 index 96b26101..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-xilinx-2022.1.inc -require recipes-devtools/qemu/qemu.inc -require qemu-xilinx-7.1.inc -require qemu-alt.inc - -# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific -DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" -MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" -MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" -PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" -PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" - -BBCLASSEXTEND = "nativesdk" - -RDEPENDS:${PN}:class-target += "bash" - -PROVIDES:class-nativesdk = "nativesdk-qemu" -RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" - -do_install:append:class-nativesdk() { - ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb deleted file mode 100644 index c6e91fdd..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb +++ /dev/null @@ -1,36 +0,0 @@ -require qemu-xilinx-2022.2.inc -require recipes-devtools/qemu/qemu.inc -require qemu-xilinx-7.1.inc -require qemu-alt.inc - -# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific -DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" -MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" -PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" - -BBCLASSEXTEND = "nativesdk" - -RDEPENDS:${PN}:class-target += "bash" - -PROVIDES:class-nativesdk = "nativesdk-qemu" -RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" - -do_install:append:class-nativesdk() { - ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb deleted file mode 100644 index fca09883..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-xilinx-2023.1.inc -require recipes-devtools/qemu/qemu.inc -require qemu-xilinx-7.1.inc -require qemu-alt.inc - -# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific -DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" -MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" -MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" -PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" -PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" - -BBCLASSEXTEND = "nativesdk" - -RDEPENDS:${PN}:class-target += "bash" - -PROVIDES:class-nativesdk = "nativesdk-qemu" -RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" - -do_install:append:class-nativesdk() { - ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} -} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb deleted file mode 100644 index 070ae65f..00000000 --- a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb +++ /dev/null @@ -1,38 +0,0 @@ -require qemu-xilinx-2023.2.inc -require recipes-devtools/qemu/qemu.inc -require qemu-xilinx-7.1.inc -require qemu-alt.inc - -# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific -DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" -MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" -MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" -PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" -PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" - -BBCLASSEXTEND = "nativesdk" - -RDEPENDS:${PN}:class-target += "bash" - -PROVIDES:class-nativesdk = "nativesdk-qemu" -RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" - -# Latest poky has changed the defaults, restore them to something compatible -# with this QEMU. When we update to QEMU 8.x this won't be necessary. -EXTRA_OECONF:remove = "--disable-download" -EXTRA_OECONF:remove = "--disable-docs" -EXTRA_OECONF:remove = "--disable-af-xdp" - -EXTRA_OECONF:append = "\ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ -" - -EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" - -do_install:append:class-nativesdk() { - ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} -} diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb index cd3ba3d1..1e584241 100644 --- a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb @@ -1,7 +1,7 @@ SUMMARY = "A Mali 400 Linux Kernel module" SECTION = "kernel/modules" -LICENSE = "GPL-2.0-only" +LICENSE = "GPLv2" LIC_FILES_CHKSUM = " \ file://linux/license/gpl/mali_kernel_license.h;md5=f5af2d61f4c1eb262cb6a557aaa1070a \ " @@ -30,22 +30,19 @@ SRC_URI = " \ file://0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch \ file://0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch \ file://0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch \ - file://0024-Use-community-device-tree-names.patch \ - file://0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch \ - file://0026-Fix-gpu-driver-probe-failure.patch \ - file://0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch \ - file://0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch \ " SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" -inherit features_check module +inherit module PARALLEL_MAKE = "-j 1" S = "${WORKDIR}/DX910-SW-99002-${PV}/driver/src/devicedrv/mali" -REQUIRED_MACHINE_FEATURES = "mali400" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp-eg = "zynqmp-eg" +COMPATIBLE_MACHINE:zynqmp-ev = "zynqmp-ev" EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \ ARCH="${ARCH}" \ diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xen_7.1.inc b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xen_7.1.inc deleted file mode 100644 index 1210a3de..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xen_7.1.inc +++ /dev/null @@ -1,33 +0,0 @@ -# Xen-4.17 specific changes are only applicable on the target -SRC_URI_XEN = "" -SRC_URI_XEN:class-target = " \ - file://0001-xen-pt-fix-syntax-error-that-causes-FTBFS-in-some-co.patch \ - file://0001-xen_common-return-error-from-xen_create_ioreq_server.patch \ - file://0002-xen-mapcache-move-xen-mapcache.c-to-hw-xen.patch \ - file://0003-hw-i386-xen-rearrange-xen_hvm_init_pc.patch \ - file://0004-xen-hvm-move-x86-specific-fields-out-of-XenIOState.patch \ - file://0005-xen-hvm-create-arch_handle_ioreq-and-arch_xen_set_me.patch \ - file://0006-xen-hvm-move-common-functions-to-hw-xen-xen-hvm-comm.patch \ - file://0007-xen-skip-ioreq-creation-on-ioreq-registration-failur.patch \ - file://0008-accel-xen-xen-all-export-xenstore_record_dm_state.patch \ - file://0009-xen-hvm-enable-xen-hvm-common-build-for-ARM.patch \ - file://0010-hw-arm-introduce-xenpv-machine.patch \ - file://0011-meson.build-do-not-set-have_xen_pci_passthrough-for-.patch \ - file://0012-xen-arm-call-qemu_find_tpm_be-if-CONFIG_TPM.patch \ - file://0013-arm-xenpv-fix-TPM-address-print-warning.patch \ - file://0014-xen_arm-Create-virtio-mmio-devices-during-initializa.patch \ - file://0015-xen_arm-Initialize-RAM-and-add-hi-low-memory-regions.patch \ - file://0016-xen_arm-Add-accel-xen-and-drop-extra-interface-openi.patch \ - file://0001-xen-when-unplugging-emulated-devices-skip-virtio-dev.patch \ - file://0002-xen-add-pseudo-RAM-region-for-grant-mappings.patch \ - file://0003-softmmu-let-qemu_map_ram_ptr-use-qemu_ram_ptr_length.patch \ - file://0004-xen-let-xen_ram_addr_from_mapcache-return-1-in-case-.patch \ - file://0005-memory-add-MemoryRegion-map-and-unmap-callbacks.patch \ - file://0006-xen-add-map-and-unmap-callbacks-for-grant-region.patch \ - file://0007-xen-mapcache-Fix-build-on-Arm.patch \ - file://0008-hw-arm-Add-grant-mapping.patch \ - " - -FILESEXTRAPATHS:prepend:class-target := "${THISDIR}/qemu-xilinx-7.1:" - -SRC_URI .= "${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${SRC_URI_XEN}', '', d)}" diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-pt-fix-syntax-error-that-causes-FTBFS-in-some-co.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-pt-fix-syntax-error-that-causes-FTBFS-in-some-co.patch deleted file mode 100644 index 99eaeeaf..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-pt-fix-syntax-error-that-causes-FTBFS-in-some-co.patch +++ /dev/null @@ -1,40 +0,0 @@ -From ba24456b93a205b728475d5f0880f3ec495e383a Mon Sep 17 00:00:00 2001 -From: Chuck Zmudzinski -Date: Mon, 31 Oct 2022 17:35:52 -0400 -Subject: [PATCH] xen/pt: fix syntax error that causes FTBFS in some - configurations -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When Qemu is built with --enable-xen and --disable-xen-pci-passthrough -and the target os is linux, the build fails with: - -meson.build:3477:2: ERROR: File xen_pt_stub.c does not exist. - -Fixes: 582ea95f5f93 ("meson: convert hw/xen") - -Signed-off-by: Chuck Zmudzinski -Reviewed-by: Philippe Mathieu-Daudé -Message-Id: <5f1342a13c09af77b1a7b0aeaba5955bcea89731.1667242033.git.brchuckz@aol.com> -Signed-off-by: Laurent Vivier ---- - hw/xen/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xen/meson.build b/hw/xen/meson.build -index 08dc1f6857..ae0ace3046 100644 ---- a/hw/xen/meson.build -+++ b/hw/xen/meson.build -@@ -18,7 +18,7 @@ if have_xen_pci_passthrough - 'xen_pt_msi.c', - )) - else -- xen_specific_ss.add('xen_pt_stub.c') -+ xen_specific_ss.add(files('xen_pt_stub.c')) - endif - - specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) --- -2.17.0 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-when-unplugging-emulated-devices-skip-virtio-dev.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-when-unplugging-emulated-devices-skip-virtio-dev.patch deleted file mode 100644 index 71dfb3be..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen-when-unplugging-emulated-devices-skip-virtio-dev.patch +++ /dev/null @@ -1,51 +0,0 @@ -From e2b85efc82bc26a838f666c8282528ee38cf6377 Mon Sep 17 00:00:00 2001 -From: Juergen Gross -Date: Tue, 16 Mar 2021 14:00:33 +0100 -Subject: [PATCH 1/8] xen: when unplugging emulated devices skip virtio devices - -Virtio devices should never be unplugged at boot time, as they are -similar to pci passthrough devices. - -Signed-off-by: Juergen Gross -Acked-by: Stefano Stabellini ---- - hw/i386/xen/xen_platform.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c -index a64265cca0..39bbb12675 100644 ---- a/hw/i386/xen/xen_platform.c -+++ b/hw/i386/xen/xen_platform.c -@@ -30,6 +30,7 @@ - #include "hw/pci/pci.h" - #include "hw/xen/xen_common.h" - #include "migration/vmstate.h" -+#include "hw/virtio/virtio-bus.h" - #include "hw/xen/xen-legacy-backend.h" - #include "trace.h" - #include "sysemu/xen.h" -@@ -114,7 +115,8 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o) - /* We have to ignore passthrough devices */ - if (pci_get_word(d->config + PCI_CLASS_DEVICE) == - PCI_CLASS_NETWORK_ETHERNET -- && strcmp(d->name, "xen-pci-passthrough") != 0) { -+ && strcmp(d->name, "xen-pci-passthrough") != 0 -+ && !qdev_get_child_bus(&d->qdev, TYPE_VIRTIO_BUS)) { - object_unparent(OBJECT(d)); - } - } -@@ -191,6 +193,11 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *opaque) - return; - } - -+ /* Ignore virtio devices */ -+ if (qdev_get_child_bus(&d->qdev, TYPE_VIRTIO_BUS)) { -+ return; -+ } -+ - switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) { - case PCI_CLASS_STORAGE_IDE: - pci_xen_ide_unplug(DEVICE(d), aux); --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen_common-return-error-from-xen_create_ioreq_server.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen_common-return-error-from-xen_create_ioreq_server.patch deleted file mode 100644 index d4349b1d..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0001-xen_common-return-error-from-xen_create_ioreq_server.patch +++ /dev/null @@ -1,55 +0,0 @@ -From ef4d512aff004c62d550cdd64329c6c1acd0f217 Mon Sep 17 00:00:00 2001 -From: Stefano Stabellini -Date: Fri, 1 Jul 2022 18:48:03 -0700 -Subject: [PATCH 01/16] xen_common: return error from xen_create_ioreq_server - -Signed-off-by: Stefano Stabellini ---- - include/hw/xen/xen_common.h | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h -index 77ce17d8a4..c2d2f36bde 100644 ---- a/include/hw/xen/xen_common.h -+++ b/include/hw/xen/xen_common.h -@@ -467,8 +467,8 @@ static inline void xen_unmap_pcidev(domid_t dom, - { - } - --static inline void xen_create_ioreq_server(domid_t dom, -- ioservid_t *ioservid) -+static inline int xen_create_ioreq_server(domid_t dom, -+ ioservid_t *ioservid) - { - } - -@@ -600,8 +600,8 @@ static inline void xen_unmap_pcidev(domid_t dom, - PCI_FUNC(pci_dev->devfn)); - } - --static inline void xen_create_ioreq_server(domid_t dom, -- ioservid_t *ioservid) -+static inline int xen_create_ioreq_server(domid_t dom, -+ ioservid_t *ioservid) - { - int rc = xendevicemodel_create_ioreq_server(xen_dmod, dom, - HVM_IOREQSRV_BUFIOREQ_ATOMIC, -@@ -609,12 +609,14 @@ static inline void xen_create_ioreq_server(domid_t dom, - - if (rc == 0) { - trace_xen_ioreq_server_create(*ioservid); -- return; -+ return rc; - } - - *ioservid = 0; - use_default_ioreq_server = true; - trace_xen_default_ioreq_server(); -+ -+ return rc; - } - - static inline void xen_destroy_ioreq_server(domid_t dom, --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-add-pseudo-RAM-region-for-grant-mappings.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-add-pseudo-RAM-region-for-grant-mappings.patch deleted file mode 100644 index 8facb189..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-add-pseudo-RAM-region-for-grant-mappings.patch +++ /dev/null @@ -1,252 +0,0 @@ -From e18daac2f6d3f60c8217f44189a91cf8240a591f Mon Sep 17 00:00:00 2001 -From: Juergen Gross -Date: Thu, 20 May 2021 11:19:58 +0200 -Subject: [PATCH 2/8] xen: add pseudo RAM region for grant mappings - -Add a memory region which can be used to automatically map granted -memory. It is starting at 0x8000000000000000ULL in order to be able to -distinguish it from normal RAM. - -For this reason the xen.ram memory region is expanded, which has no -further impact as it is used just as a container of the real RAM -regions and now the grant region. - -Signed-off-by: Juergen Gross -Signed-off-by: Vikram Garhwal -Acked-by: Stefano Stabellini ---- - hw/i386/xen/xen-hvm.c | 3 ++ - hw/xen/xen-hvm-common.c | 4 +-- - hw/xen/xen-mapcache.c | 28 +++++++++++++++ - include/exec/ram_addr.h | 1 + - include/hw/xen/xen-hvm-common.h | 2 ++ - include/hw/xen/xen_pvdev.h | 3 ++ - include/sysemu/xen-mapcache.h | 3 ++ - softmmu/physmem.c | 61 ++++++++++++++++++++------------- - 8 files changed, 80 insertions(+), 25 deletions(-) - -diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c -index 36d87555a9..2dcc2e1179 100644 ---- a/hw/i386/xen/xen-hvm.c -+++ b/hw/i386/xen/xen-hvm.c -@@ -171,6 +171,9 @@ static void xen_ram_init(PCMachineState *pcms, - x86ms->above_4g_mem_size); - memory_region_add_subregion(sysmem, 0x100000000ULL, &ram_hi); - } -+ -+ /* Add grant mappings as a pseudo RAM region. */ -+ ram_grants = *xen_init_grant_ram(); - } - - static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size) -diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c -index 7e7d23397f..abd6e379d3 100644 ---- a/hw/xen/xen-hvm-common.c -+++ b/hw/xen/xen-hvm-common.c -@@ -10,7 +10,7 @@ - #include "hw/boards.h" - #include "hw/xen/arch_hvm.h" - --MemoryRegion ram_memory; -+MemoryRegion ram_memory, ram_grants; - - MemoryListener xen_io_listener = { - .name = "xen-io", -@@ -742,7 +742,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, - return; - } - -- if (mr == &ram_memory) { -+ if (mr == &ram_memory || mr == &ram_grants) { - return; - } - -diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c -index a2f93096e7..0b75f1633a 100644 ---- a/hw/xen/xen-mapcache.c -+++ b/hw/xen/xen-mapcache.c -@@ -14,7 +14,10 @@ - - #include - -+#include "hw/xen/xen-hvm-common.h" - #include "hw/xen/xen-legacy-backend.h" -+#include "hw/xen/xen_pvdev.h" -+ - #include "qemu/bitmap.h" - - #include "sysemu/runstate.h" -@@ -597,3 +600,28 @@ uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr, - mapcache_unlock(); - return p; - } -+ -+MemoryRegion *xen_init_grant_ram(void) -+{ -+ RAMBlock *block; -+ -+ memory_region_init(&ram_grants, NULL, "xen.grants", -+ XEN_MAX_VIRTIO_GRANTS * XC_PAGE_SIZE); -+ block = g_malloc0(sizeof(*block)); -+ block->mr = &ram_grants; -+ block->used_length = XEN_MAX_VIRTIO_GRANTS * XC_PAGE_SIZE; -+ block->max_length = XEN_MAX_VIRTIO_GRANTS * XC_PAGE_SIZE; -+ block->fd = -1; -+ block->page_size = XC_PAGE_SIZE; -+ block->host = (void *)XEN_GRANT_ADDR_OFF; -+ block->offset = XEN_GRANT_ADDR_OFF; -+ block->flags = RAM_PREALLOC; -+ ram_grants.ram_block = block; -+ ram_grants.ram = true; -+ ram_grants.terminates = true; -+ ram_block_add_list(block); -+ memory_region_add_subregion(get_system_memory(), XEN_GRANT_ADDR_OFF, -+ &ram_grants); -+ -+ return &ram_grants; -+} -diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h -index f3e0c78161..e60b055867 100644 ---- a/include/exec/ram_addr.h -+++ b/include/exec/ram_addr.h -@@ -137,6 +137,7 @@ void qemu_ram_free(RAMBlock *block); - int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp); - - void qemu_ram_msync(RAMBlock *block, ram_addr_t start, ram_addr_t length); -+void ram_block_add_list(RAMBlock *new_block); - - /* Clear whole block of mem */ - static inline void qemu_ram_block_writeback(RAMBlock *block) -diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-common.h -index 2979f84ee2..6f7cc05d38 100644 ---- a/include/hw/xen/xen-hvm-common.h -+++ b/include/hw/xen/xen-hvm-common.h -@@ -16,6 +16,8 @@ - #include - - extern MemoryRegion ram_memory; -+ -+extern MemoryRegion ram_grants; - extern MemoryListener xen_io_listener; - extern DeviceListener xen_device_listener; - -diff --git a/include/hw/xen/xen_pvdev.h b/include/hw/xen/xen_pvdev.h -index 7cd4bc2b82..36cd3ec1d4 100644 ---- a/include/hw/xen/xen_pvdev.h -+++ b/include/hw/xen/xen_pvdev.h -@@ -78,4 +78,7 @@ int xen_pv_send_notify(struct XenLegacyDevice *xendev); - void xen_pv_printf(struct XenLegacyDevice *xendev, int msg_level, - const char *fmt, ...) G_GNUC_PRINTF(3, 4); - -+#define XEN_GRANT_ADDR_OFF 0x8000000000000000ULL -+#define XEN_MAX_VIRTIO_GRANTS 65536 -+ - #endif /* QEMU_HW_XEN_PVDEV_H */ -diff --git a/include/sysemu/xen-mapcache.h b/include/sysemu/xen-mapcache.h -index c8e7c2f6cf..f4bedb1c11 100644 ---- a/include/sysemu/xen-mapcache.h -+++ b/include/sysemu/xen-mapcache.h -@@ -10,6 +10,7 @@ - #define XEN_MAPCACHE_H - - #include "exec/cpu-common.h" -+#include "exec/ram_addr.h" - - typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr phys_offset, - ram_addr_t size); -@@ -25,6 +26,8 @@ void xen_invalidate_map_cache(void); - uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr, - hwaddr new_phys_addr, - hwaddr size); -+MemoryRegion *xen_init_grant_ram(void); -+ - #else - - static inline void xen_map_cache_init(phys_offset_to_gaddr_t f, -diff --git a/softmmu/physmem.c b/softmmu/physmem.c -index dc3c3e5f2e..63ba5f7495 100644 ---- a/softmmu/physmem.c -+++ b/softmmu/physmem.c -@@ -1971,12 +1971,46 @@ static void dirty_memory_extend(ram_addr_t old_ram_size, - } - } - -+static void ram_block_add_list_locked(RAMBlock *new_block) -+ { -+ RAMBlock *block; -+ RAMBlock *last_block = NULL; -+ -+ /* Keep the list sorted from biggest to smallest block. Unlike QTAILQ, -+ * QLIST (which has an RCU-friendly variant) does not have insertion at -+ * tail, so save the last element in last_block. -+ */ -+ RAMBLOCK_FOREACH(block) { -+ last_block = block; -+ if (block->max_length < new_block->max_length) { -+ break; -+ } -+ } -+ if (block) { -+ QLIST_INSERT_BEFORE_RCU(block, new_block, next); -+ } else if (last_block) { -+ QLIST_INSERT_AFTER_RCU(last_block, new_block, next); -+ } else { /* list is empty */ -+ QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next); -+ } -+ ram_list.mru_block = NULL; -+ -+ /* Write list before version */ -+ smp_wmb(); -+ ram_list.version++; -+} -+ -+void ram_block_add_list(RAMBlock *new_block) -+{ -+ qemu_mutex_lock_ramlist(); -+ ram_block_add_list_locked(new_block); -+ qemu_mutex_unlock_ramlist(); -+} -+ - static void ram_block_add(RAMBlock *new_block, Error **errp) - { - const bool noreserve = qemu_ram_is_noreserve(new_block); - const bool shared = qemu_ram_is_shared(new_block); -- RAMBlock *block; -- RAMBlock *last_block = NULL; - ram_addr_t old_ram_size, new_ram_size; - Error *err = NULL; - -@@ -2014,28 +2048,9 @@ static void ram_block_add(RAMBlock *new_block, Error **errp) - if (new_ram_size > old_ram_size) { - dirty_memory_extend(old_ram_size, new_ram_size); - } -- /* Keep the list sorted from biggest to smallest block. Unlike QTAILQ, -- * QLIST (which has an RCU-friendly variant) does not have insertion at -- * tail, so save the last element in last_block. -- */ -- RAMBLOCK_FOREACH(block) { -- last_block = block; -- if (block->max_length < new_block->max_length) { -- break; -- } -- } -- if (block) { -- QLIST_INSERT_BEFORE_RCU(block, new_block, next); -- } else if (last_block) { -- QLIST_INSERT_AFTER_RCU(last_block, new_block, next); -- } else { /* list is empty */ -- QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next); -- } -- ram_list.mru_block = NULL; - -- /* Write list before version */ -- smp_wmb(); -- ram_list.version++; -+ ram_block_add_list_locked(new_block); -+ - qemu_mutex_unlock_ramlist(); - - cpu_physical_memory_set_dirty_range(new_block->offset, --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-mapcache-move-xen-mapcache.c-to-hw-xen.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-mapcache-move-xen-mapcache.c-to-hw-xen.patch deleted file mode 100644 index 35ca6df4..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0002-xen-mapcache-move-xen-mapcache.c-to-hw-xen.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 423468bdb3728154e95af18ef755bc75c5d59a3a Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Thu, 30 Jun 2022 18:19:50 -0700 -Subject: [PATCH 02/16] xen-mapcache: move xen-mapcache.c to hw/xen - -xen-mapcache.c contains common functions which are useful for Xen on ARM -IOREQ handling. Moving it out of i386 to hw/xen for commong access. - -Signed-off-by: Vikram Garhwal -Reviewed-by: Stefano Stabellini -Signed-off-by: Stefano Stabellini ---- - hw/i386/meson.build | 1 + - hw/i386/xen/meson.build | 1 - - hw/i386/xen/trace-events | 5 ----- - hw/xen/meson.build | 4 ++++ - hw/xen/trace-events | 5 +++++ - hw/{i386 => }/xen/xen-mapcache.c | 0 - 6 files changed, 10 insertions(+), 6 deletions(-) - rename hw/{i386 => }/xen/xen-mapcache.c (100%) - -diff --git a/hw/i386/meson.build b/hw/i386/meson.build -index 213e2e82b3..cfdbfdcbcb 100644 ---- a/hw/i386/meson.build -+++ b/hw/i386/meson.build -@@ -33,5 +33,6 @@ subdir('kvm') - subdir('xen') - - i386_ss.add_all(xenpv_ss) -+i386_ss.add_all(xen_ss) - - hw_arch += {'i386': i386_ss} -diff --git a/hw/i386/xen/meson.build b/hw/i386/xen/meson.build -index be84130300..2fcc46e6ca 100644 ---- a/hw/i386/xen/meson.build -+++ b/hw/i386/xen/meson.build -@@ -1,6 +1,5 @@ - i386_ss.add(when: 'CONFIG_XEN', if_true: files( - 'xen-hvm.c', -- 'xen-mapcache.c', - 'xen_apic.c', - 'xen_platform.c', - 'xen_pvdevice.c', -diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events -index 5d6be61090..a0c89d91c4 100644 ---- a/hw/i386/xen/trace-events -+++ b/hw/i386/xen/trace-events -@@ -21,8 +21,3 @@ xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" - cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" - cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" - --# xen-mapcache.c --xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 --xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 --xen_map_cache_return(void* ptr) "%p" -- -diff --git a/hw/xen/meson.build b/hw/xen/meson.build -index ae0ace3046..19d0637c46 100644 ---- a/hw/xen/meson.build -+++ b/hw/xen/meson.build -@@ -22,3 +22,7 @@ else - endif - - specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) -+ -+xen_ss = ss.source_set() -+ -+xen_ss.add(when: 'CONFIG_XEN', if_true: files('xen-mapcache.c')) -diff --git a/hw/xen/trace-events b/hw/xen/trace-events -index 3da3fd8348..2c8f238f42 100644 ---- a/hw/xen/trace-events -+++ b/hw/xen/trace-events -@@ -41,3 +41,8 @@ xs_node_vprintf(char *path, char *value) "%s %s" - xs_node_vscanf(char *path, char *value) "%s %s" - xs_node_watch(char *path) "%s" - xs_node_unwatch(char *path) "%s" -+ -+# xen-mapcache.c -+xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 -+xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 -+xen_map_cache_return(void* ptr) "%p" -diff --git a/hw/i386/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c -similarity index 100% -rename from hw/i386/xen/xen-mapcache.c -rename to hw/xen/xen-mapcache.c --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-hw-i386-xen-rearrange-xen_hvm_init_pc.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-hw-i386-xen-rearrange-xen_hvm_init_pc.patch deleted file mode 100644 index 1113cf39..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-hw-i386-xen-rearrange-xen_hvm_init_pc.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 4472924c800e9dbf46e4c2432565d3e406b35d27 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Fri, 1 Jul 2022 16:32:33 -0700 -Subject: [PATCH 03/16] hw/i386/xen: rearrange xen_hvm_init_pc - -Move references to: -- xen_get_vmport_regs_pfn -- xen_suspend_notifier -- xen_wakeup_notifier -- xen_ram_init - -towards the end of the function. This is done to keep the the common -ioreq functions in one place which will be moved to new function in next -patch in order to make it useful to ARM machines also. - -Signed-off-by: Vikram Garhwal -Signed-off-by: Stefano Stabellini -Reviewed-by: Stefano Stabellini ---- - hw/i386/xen/xen-hvm.c | 49 ++++++++++++++++++++++--------------------- - 1 file changed, 25 insertions(+), 24 deletions(-) - -diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c -index e4293d6d66..b27484ad22 100644 ---- a/hw/i386/xen/xen-hvm.c -+++ b/hw/i386/xen/xen-hvm.c -@@ -1416,12 +1416,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - state->exit.notify = xen_exit_notifier; - qemu_add_exit_notifier(&state->exit); - -- state->suspend.notify = xen_suspend_notifier; -- qemu_register_suspend_notifier(&state->suspend); -- -- state->wakeup.notify = xen_wakeup_notifier; -- qemu_register_wakeup_notifier(&state->wakeup); -- - /* - * Register wake-up support in QMP query-current-machine API - */ -@@ -1432,23 +1426,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - goto err; - } - -- rc = xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn); -- if (!rc) { -- DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn); -- state->shared_vmport_page = -- xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE, -- 1, &ioreq_pfn, NULL); -- if (state->shared_vmport_page == NULL) { -- error_report("map shared vmport IO page returned error %d handle=%p", -- errno, xen_xc); -- goto err; -- } -- } else if (rc != -ENOSYS) { -- error_report("get vmport regs pfn returned error %d, rc=%d", -- errno, rc); -- goto err; -- } -- - /* Note: cpus is empty at this point in init */ - state->cpu_by_vcpu_id = g_new0(CPUState *, max_cpus); - -@@ -1486,7 +1463,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - #else - xen_map_cache_init(NULL, state); - #endif -- xen_ram_init(pcms, ms->ram_size, ram_memory); - - qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); - -@@ -1513,6 +1489,31 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - QLIST_INIT(&xen_physmap); - xen_read_physmap(state); - -+ state->suspend.notify = xen_suspend_notifier; -+ qemu_register_suspend_notifier(&state->suspend); -+ -+ state->wakeup.notify = xen_wakeup_notifier; -+ qemu_register_wakeup_notifier(&state->wakeup); -+ -+ rc = xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn); -+ if (!rc) { -+ DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn); -+ state->shared_vmport_page = -+ xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE, -+ 1, &ioreq_pfn, NULL); -+ if (state->shared_vmport_page == NULL) { -+ error_report("map shared vmport IO page returned error %d handle=%p", -+ errno, xen_xc); -+ goto err; -+ } -+ } else if (rc != -ENOSYS) { -+ error_report("get vmport regs pfn returned error %d, rc=%d", -+ errno, rc); -+ goto err; -+ } -+ -+ xen_ram_init(pcms, ms->ram_size, ram_memory); -+ - /* Disable ACPI build because Xen handles it */ - pcms->acpi_build_enabled = false; - --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-softmmu-let-qemu_map_ram_ptr-use-qemu_ram_ptr_length.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-softmmu-let-qemu_map_ram_ptr-use-qemu_ram_ptr_length.patch deleted file mode 100644 index bff815bc..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0003-softmmu-let-qemu_map_ram_ptr-use-qemu_ram_ptr_length.patch +++ /dev/null @@ -1,113 +0,0 @@ -From cb4be1f7185c5974523c764f3f6efe3af6633d71 Mon Sep 17 00:00:00 2001 -From: Juergen Gross -Date: Thu, 20 May 2021 11:54:48 +0200 -Subject: [PATCH 3/8] softmmu: let qemu_map_ram_ptr() use qemu_ram_ptr_length() - -qemu_map_ram_ptr() and qemu_ram_ptr_length() share quite some code, so -modify qemu_ram_ptr_length() a little bit and use it for -qemu_map_ram_ptr(), too. - -Signed-off-by: Juergen Gross -Acked-by: Stefano Stabellini ---- - softmmu/physmem.c | 56 ++++++++++++++++++----------------------------- - 1 file changed, 21 insertions(+), 35 deletions(-) - -diff --git a/softmmu/physmem.c b/softmmu/physmem.c -index 63ba5f7495..439a53a1be 100644 ---- a/softmmu/physmem.c -+++ b/softmmu/physmem.c -@@ -2306,38 +2306,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) - } - #endif /* !_WIN32 */ - --/* Return a host pointer to ram allocated with qemu_ram_alloc. -- * This should not be used for general purpose DMA. Use address_space_map -- * or address_space_rw instead. For local memory (e.g. video ram) that the -- * device owns, use memory_region_get_ram_ptr. -- * -- * Called within RCU critical section. -- */ --void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr) --{ -- RAMBlock *block = ram_block; -- -- if (block == NULL) { -- block = qemu_get_ram_block(addr); -- addr -= block->offset; -- } -- -- if (xen_enabled() && block->host == NULL) { -- /* We need to check if the requested address is in the RAM -- * because we don't want to map the entire memory in QEMU. -- * In that case just map until the end of the page. -- */ -- if (block->offset == 0) { -- return xen_map_cache(addr, 0, 0, false); -- } -- -- block->host = xen_map_cache(block->offset, block->max_length, 1, false); -- } -- return ramblock_ptr(block, addr); --} -- --/* Return a host pointer to guest's ram. Similar to qemu_map_ram_ptr -- * but takes a size argument. -+/* Return a host pointer to guest's ram. - * - * Called within RCU critical section. - */ -@@ -2345,7 +2314,9 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr, - hwaddr *size, bool lock) - { - RAMBlock *block = ram_block; -- if (*size == 0) { -+ hwaddr len = 0; -+ -+ if (size && *size == 0) { - return NULL; - } - -@@ -2353,7 +2324,10 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr, - block = qemu_get_ram_block(addr); - addr -= block->offset; - } -- *size = MIN(*size, block->max_length - addr); -+ if (size) { -+ *size = MIN(*size, block->max_length - addr); -+ len = *size; -+ } - - if (xen_enabled() && block->host == NULL) { - /* We need to check if the requested address is in the RAM -@@ -2361,7 +2335,7 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr, - * In that case just map the requested area. - */ - if (block->offset == 0) { -- return xen_map_cache(addr, *size, lock, lock); -+ return xen_map_cache(addr, len, lock, lock); - } - - block->host = xen_map_cache(block->offset, block->max_length, 1, lock); -@@ -2370,6 +2344,18 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr, - return ramblock_ptr(block, addr); - } - -+/* Return a host pointer to ram allocated with qemu_ram_alloc. -+ * This should not be used for general purpose DMA. Use address_space_map -+ * or address_space_rw instead. For local memory (e.g. video ram) that the -+ * device owns, use memory_region_get_ram_ptr. -+ * -+ * Called within RCU critical section. -+ */ -+void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr) -+{ -+ return qemu_ram_ptr_length(ram_block, addr, NULL, false); -+} -+ - /* Return the offset of a hostpointer within a ramblock */ - ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host) - { --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-hvm-move-x86-specific-fields-out-of-XenIOState.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-hvm-move-x86-specific-fields-out-of-XenIOState.patch deleted file mode 100644 index 4337e0c8..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-hvm-move-x86-specific-fields-out-of-XenIOState.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 2a01fa06d267f68148d3a6df50675edfe090601a Mon Sep 17 00:00:00 2001 -From: Stefano Stabellini -Date: Fri, 1 Jul 2022 18:16:52 -0700 -Subject: [PATCH 04/16] xen-hvm: move x86-specific fields out of XenIOState - -Move: -- shared_vmport_page -- log_for_dirtybit -- dirty_bitmap -- suspend -- wakeup - -out of XenIOState as they are only used on x86, especially the ones -related to dirty logging. - -Remove free_phys_offset that was unused. - -Signed-off-by: Stefano Stabellini ---- - hw/i386/xen/xen-hvm.c | 58 ++++++++++++++++++++----------------------- - 1 file changed, 27 insertions(+), 31 deletions(-) - -diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c -index b27484ad22..225cfdf8b7 100644 ---- a/hw/i386/xen/xen-hvm.c -+++ b/hw/i386/xen/xen-hvm.c -@@ -73,6 +73,7 @@ struct shared_vmport_iopage { - }; - typedef struct shared_vmport_iopage shared_vmport_iopage_t; - #endif -+static shared_vmport_iopage_t *shared_vmport_page; - - static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i) - { -@@ -95,6 +96,11 @@ typedef struct XenPhysmap { - } XenPhysmap; - - static QLIST_HEAD(, XenPhysmap) xen_physmap; -+static const XenPhysmap *log_for_dirtybit = NULL; -+/* Buffer used by xen_sync_dirty_bitmap */ -+static unsigned long *dirty_bitmap = NULL; -+static Notifier suspend; -+static Notifier wakeup; - - typedef struct XenPciDevice { - PCIDevice *pci_dev; -@@ -105,7 +111,6 @@ typedef struct XenPciDevice { - typedef struct XenIOState { - ioservid_t ioservid; - shared_iopage_t *shared_page; -- shared_vmport_iopage_t *shared_vmport_page; - buffered_iopage_t *buffered_io_page; - xenforeignmemory_resource_handle *fres; - QEMUTimer *buffered_io_timer; -@@ -125,14 +130,8 @@ typedef struct XenIOState { - MemoryListener io_listener; - QLIST_HEAD(, XenPciDevice) dev_list; - DeviceListener device_listener; -- hwaddr free_phys_offset; -- const XenPhysmap *log_for_dirtybit; -- /* Buffer used by xen_sync_dirty_bitmap */ -- unsigned long *dirty_bitmap; - - Notifier exit; -- Notifier suspend; -- Notifier wakeup; - } XenIOState; - - /* Xen specific function for piix pci */ -@@ -462,10 +461,10 @@ static int xen_remove_from_physmap(XenIOState *state, - } - - QLIST_REMOVE(physmap, list); -- if (state->log_for_dirtybit == physmap) { -- state->log_for_dirtybit = NULL; -- g_free(state->dirty_bitmap); -- state->dirty_bitmap = NULL; -+ if (log_for_dirtybit == physmap) { -+ log_for_dirtybit = NULL; -+ g_free(dirty_bitmap); -+ dirty_bitmap = NULL; - } - g_free(physmap); - -@@ -626,16 +625,16 @@ static void xen_sync_dirty_bitmap(XenIOState *state, - return; - } - -- if (state->log_for_dirtybit == NULL) { -- state->log_for_dirtybit = physmap; -- state->dirty_bitmap = g_new(unsigned long, bitmap_size); -- } else if (state->log_for_dirtybit != physmap) { -+ if (log_for_dirtybit == NULL) { -+ log_for_dirtybit = physmap; -+ dirty_bitmap = g_new(unsigned long, bitmap_size); -+ } else if (log_for_dirtybit != physmap) { - /* Only one range for dirty bitmap can be tracked. */ - return; - } - - rc = xen_track_dirty_vram(xen_domid, start_addr >> TARGET_PAGE_BITS, -- npages, state->dirty_bitmap); -+ npages, dirty_bitmap); - if (rc < 0) { - #ifndef ENODATA - #define ENODATA ENOENT -@@ -650,7 +649,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state, - } - - for (i = 0; i < bitmap_size; i++) { -- unsigned long map = state->dirty_bitmap[i]; -+ unsigned long map = dirty_bitmap[i]; - while (map != 0) { - j = ctzl(map); - map &= ~(1ul << j); -@@ -676,12 +675,10 @@ static void xen_log_start(MemoryListener *listener, - static void xen_log_stop(MemoryListener *listener, MemoryRegionSection *section, - int old, int new) - { -- XenIOState *state = container_of(listener, XenIOState, memory_listener); -- - if (old & ~new & (1 << DIRTY_MEMORY_VGA)) { -- state->log_for_dirtybit = NULL; -- g_free(state->dirty_bitmap); -- state->dirty_bitmap = NULL; -+ log_for_dirtybit = NULL; -+ g_free(dirty_bitmap); -+ dirty_bitmap = NULL; - /* Disable dirty bit tracking */ - xen_track_dirty_vram(xen_domid, 0, 0, NULL); - } -@@ -1021,9 +1018,9 @@ static void handle_vmport_ioreq(XenIOState *state, ioreq_t *req) - { - vmware_regs_t *vmport_regs; - -- assert(state->shared_vmport_page); -+ assert(shared_vmport_page); - vmport_regs = -- &state->shared_vmport_page->vcpu_vmport_regs[state->send_vcpu]; -+ &shared_vmport_page->vcpu_vmport_regs[state->send_vcpu]; - QEMU_BUILD_BUG_ON(sizeof(*req) < sizeof(*vmport_regs)); - - current_cpu = state->cpu_by_vcpu_id[state->send_vcpu]; -@@ -1468,7 +1465,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - - state->memory_listener = xen_memory_listener; - memory_listener_register(&state->memory_listener, &address_space_memory); -- state->log_for_dirtybit = NULL; - - state->io_listener = xen_io_listener; - memory_listener_register(&state->io_listener, &address_space_io); -@@ -1489,19 +1485,19 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - QLIST_INIT(&xen_physmap); - xen_read_physmap(state); - -- state->suspend.notify = xen_suspend_notifier; -- qemu_register_suspend_notifier(&state->suspend); -+ suspend.notify = xen_suspend_notifier; -+ qemu_register_suspend_notifier(&suspend); - -- state->wakeup.notify = xen_wakeup_notifier; -- qemu_register_wakeup_notifier(&state->wakeup); -+ wakeup.notify = xen_wakeup_notifier; -+ qemu_register_wakeup_notifier(&wakeup); - - rc = xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn); - if (!rc) { - DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn); -- state->shared_vmport_page = -+ shared_vmport_page = - xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE, - 1, &ioreq_pfn, NULL); -- if (state->shared_vmport_page == NULL) { -+ if (shared_vmport_page == NULL) { - error_report("map shared vmport IO page returned error %d handle=%p", - errno, xen_xc); - goto err; --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-let-xen_ram_addr_from_mapcache-return-1-in-case-.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-let-xen_ram_addr_from_mapcache-return-1-in-case-.patch deleted file mode 100644 index 25dc0ae0..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0004-xen-let-xen_ram_addr_from_mapcache-return-1-in-case-.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 7dfa8828bd2e61fc5bf2bf6294aad16b2bf4ff8a Mon Sep 17 00:00:00 2001 -From: Juergen Gross -Date: Thu, 20 May 2021 13:31:32 +0200 -Subject: [PATCH 4/8] xen: let xen_ram_addr_from_mapcache() return -1 in case - of not found entry - -Today xen_ram_addr_from_mapcache() will either abort() or return 0 in -case it can't find a matching entry for a pointer value. Both cases -are bad, so change that to return an invalid address instead. - -Signed-off-by: Juergen Gross -Acked-by: Stefano Stabellini ---- - hw/xen/xen-mapcache.c | 12 +++--------- - 1 file changed, 3 insertions(+), 9 deletions(-) - -diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c -index 0b75f1633a..e53e7221f1 100644 ---- a/hw/xen/xen-mapcache.c -+++ b/hw/xen/xen-mapcache.c -@@ -405,13 +405,8 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) - } - } - if (!found) { -- fprintf(stderr, "%s, could not find %p\n", __func__, ptr); -- QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) { -- DPRINTF(" "TARGET_FMT_plx" -> %p is present\n", reventry->paddr_index, -- reventry->vaddr_req); -- } -- abort(); -- return 0; -+ mapcache_unlock(); -+ return RAM_ADDR_INVALID; - } - - entry = &mapcache->entry[paddr_index % mapcache->nr_buckets]; -@@ -419,8 +414,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) - entry = entry->next; - } - if (!entry) { -- DPRINTF("Trying to find address %p that is not in the mapcache!\n", ptr); -- raddr = 0; -+ raddr = RAM_ADDR_INVALID; - } else { - raddr = (reventry->paddr_index << MCACHE_BUCKET_SHIFT) + - ((unsigned long) ptr - (unsigned long) entry->vaddr_base); --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-memory-add-MemoryRegion-map-and-unmap-callbacks.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-memory-add-MemoryRegion-map-and-unmap-callbacks.patch deleted file mode 100644 index db6d8fe5..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-memory-add-MemoryRegion-map-and-unmap-callbacks.patch +++ /dev/null @@ -1,150 +0,0 @@ -From bd32a130ca633eae7cf0f4ff0fa856004d413df0 Mon Sep 17 00:00:00 2001 -From: Juergen Gross -Date: Thu, 27 May 2021 15:27:55 +0200 -Subject: [PATCH 5/8] memory: add MemoryRegion map and unmap callbacks - -In order to support mapping and unmapping guest memory dynamically to -and from qemu during address_space_[un]map() operations add the map() -and unmap() callbacks to MemoryRegionOps. - -Those will be used e.g. for Xen grant mappings when performing guest -I/Os. - -Signed-off-by: Juergen Gross -Signed-off-by: Vikram Garhwal -Acked-by: Stefano Stabellini ---- - include/exec/memory.h | 19 +++++++++++++++++ - softmmu/physmem.c | 47 +++++++++++++++++++++++++++++++++---------- - 2 files changed, 55 insertions(+), 11 deletions(-) - -diff --git a/include/exec/memory.h b/include/exec/memory.h -index bfb1de8eea..19e2aac694 100644 ---- a/include/exec/memory.h -+++ b/include/exec/memory.h -@@ -245,6 +245,25 @@ struct MemoryRegionOps { - unsigned size, - MemTxAttrs attrs); - -+ /* Dynamically create mapping. @addr is the guest address to map; @plen -+ * is the pointer to the usable length of the buffer. -+ * @mr contents can be changed in case a new memory region is created for -+ * the mapping. -+ * Returns the buffer address for accessing the data. */ -+ void *(*map)(MemoryRegion **mr, -+ hwaddr addr, -+ hwaddr *plen, -+ bool is_write, -+ MemTxAttrs attrs); -+ -+ /* Unmap an area obtained via map() before. */ -+ void (*unmap)(MemoryRegion *mr, -+ void *buffer, -+ ram_addr_t addr, -+ hwaddr len, -+ bool is_write, -+ hwaddr access_len); -+ - enum device_endian endianness; - /* Guest-visible constraints: */ - struct { -diff --git a/softmmu/physmem.c b/softmmu/physmem.c -index 439a53a1be..2038240311 100644 ---- a/softmmu/physmem.c -+++ b/softmmu/physmem.c -@@ -3237,7 +3237,7 @@ void *address_space_map(AddressSpace *as, - hwaddr len = *plen; - hwaddr l, xlat; - MemoryRegion *mr; -- void *ptr; -+ void *ptr = NULL; - FlatView *fv; - - if (len == 0) { -@@ -3273,10 +3273,17 @@ void *address_space_map(AddressSpace *as, - - - memory_region_ref(mr); -+ -+ if (mr->ops && mr->ops->map) { -+ ptr = mr->ops->map(&mr, addr, plen, is_write, attrs); -+ } -+ - *plen = flatview_extend_translation(fv, addr, len, mr, xlat, - l, is_write, attrs); - fuzz_dma_read_cb(addr, *plen, mr); -- ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true); -+ if (ptr == NULL) { -+ ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true); -+ } - - return ptr; - } -@@ -3294,11 +3301,16 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, - - mr = memory_region_from_host(buffer, &addr1); - assert(mr != NULL); -- if (is_write) { -- invalidate_and_set_dirty(mr, addr1, access_len); -- } -- if (xen_enabled()) { -- xen_invalidate_map_cache_entry(buffer); -+ -+ if (mr->ops && mr->ops->unmap) { -+ mr->ops->unmap(mr, buffer, addr1, len, is_write, access_len); -+ } else { -+ if (is_write) { -+ invalidate_and_set_dirty(mr, addr1, access_len); -+ } -+ if (xen_enabled()) { -+ xen_invalidate_map_cache_entry(buffer); -+ } - } - memory_region_unref(mr); - return; -@@ -3370,10 +3382,17 @@ int64_t address_space_cache_init(MemoryRegionCache *cache, - * doing this if we found actual RAM, which behaves the same - * regardless of attributes; so UNSPECIFIED is fine. - */ -+ if (mr->ops && mr->ops->map) { -+ cache->ptr = mr->ops->map(&mr, addr, &l, is_write, -+ MEMTXATTRS_UNSPECIFIED); -+ } -+ - l = flatview_extend_translation(cache->fv, addr, len, mr, - cache->xlat, l, is_write, - MEMTXATTRS_UNSPECIFIED); -- cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true); -+ if (!cache->ptr) { -+ cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true); -+ } - } else { - cache->ptr = NULL; - } -@@ -3395,14 +3414,20 @@ void address_space_cache_invalidate(MemoryRegionCache *cache, - - void address_space_cache_destroy(MemoryRegionCache *cache) - { -- if (!cache->mrs.mr) { -+ MemoryRegion *mr = cache->mrs.mr; -+ -+ if (!mr) { - return; - } - -- if (xen_enabled()) { -+ if (mr->ops && mr->ops->unmap) { -+ mr->ops->unmap(mr, cache->ptr, cache->xlat, cache->len, -+ cache->is_write, cache->len); -+ } else if (xen_enabled()) { - xen_invalidate_map_cache_entry(cache->ptr); - } -- memory_region_unref(cache->mrs.mr); -+ -+ memory_region_unref(mr); - flatview_unref(cache->fv); - cache->mrs.mr = NULL; - cache->fv = NULL; --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-xen-hvm-create-arch_handle_ioreq-and-arch_xen_set_me.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-xen-hvm-create-arch_handle_ioreq-and-arch_xen_set_me.patch deleted file mode 100644 index 6b56a39e..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0005-xen-hvm-create-arch_handle_ioreq-and-arch_xen_set_me.patch +++ /dev/null @@ -1,192 +0,0 @@ -From c38436434fc888ba8844d99eab451f9b734e5e5b Mon Sep 17 00:00:00 2001 -From: Stefano Stabellini -Date: Fri, 1 Jul 2022 19:34:39 -0700 -Subject: [PATCH 05/16] xen-hvm: create arch_handle_ioreq and - arch_xen_set_memory - -In preparation to moving most of xen-hvm code to an arch-neutral -location, move the x86-specific portion of xen_set_memory to -arch_xen_set_memory. - -Also move handle_vmport_ioreq to arch_handle_ioreq. - -Signed-off-by: Stefano Stabellini -Signed-off-by: Vikram Garhwal -Reviewed-by: Stefano Stabellini ---- - hw/i386/xen/xen-hvm.c | 98 ++++++++++++++++++++-------------- - include/hw/i386/xen_arch_hvm.h | 10 ++++ - include/hw/xen/arch_hvm.h | 3 ++ - 3 files changed, 71 insertions(+), 40 deletions(-) - create mode 100644 include/hw/i386/xen_arch_hvm.h - create mode 100644 include/hw/xen/arch_hvm.h - -diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c -index 225cfdf8b7..178f0c68fc 100644 ---- a/hw/i386/xen/xen-hvm.c -+++ b/hw/i386/xen/xen-hvm.c -@@ -134,6 +134,8 @@ typedef struct XenIOState { - Notifier exit; - } XenIOState; - -+#include "hw/xen/arch_hvm.h" -+ - /* Xen specific function for piix pci */ - - int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) -@@ -476,10 +478,6 @@ static void xen_set_memory(struct MemoryListener *listener, - bool add) - { - XenIOState *state = container_of(listener, XenIOState, memory_listener); -- hwaddr start_addr = section->offset_within_address_space; -- ram_addr_t size = int128_get64(section->size); -- bool log_dirty = memory_region_is_logging(section->mr, DIRTY_MEMORY_VGA); -- hvmmem_type_t mem_type; - - if (section->mr == &ram_memory) { - return; -@@ -492,38 +490,7 @@ static void xen_set_memory(struct MemoryListener *listener, - section); - } - } -- -- if (!memory_region_is_ram(section->mr)) { -- return; -- } -- -- if (log_dirty != add) { -- return; -- } -- -- trace_xen_client_set_memory(start_addr, size, log_dirty); -- -- start_addr &= TARGET_PAGE_MASK; -- size = TARGET_PAGE_ALIGN(size); -- -- if (add) { -- if (!memory_region_is_rom(section->mr)) { -- xen_add_to_physmap(state, start_addr, size, -- section->mr, section->offset_within_region); -- } else { -- mem_type = HVMMEM_ram_ro; -- if (xen_set_mem_type(xen_domid, mem_type, -- start_addr >> TARGET_PAGE_BITS, -- size >> TARGET_PAGE_BITS)) { -- DPRINTF("xen_set_mem_type error, addr: "TARGET_FMT_plx"\n", -- start_addr); -- } -- } -- } else { -- if (xen_remove_from_physmap(state, start_addr, size) < 0) { -- DPRINTF("physmapping does not exist at "TARGET_FMT_plx"\n", start_addr); -- } -- } -+ arch_xen_set_memory(state, section, add); - } - - static void xen_region_add(MemoryListener *listener, -@@ -1051,9 +1018,6 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req) - case IOREQ_TYPE_COPY: - cpu_ioreq_move(req); - break; -- case IOREQ_TYPE_VMWARE_PORT: -- handle_vmport_ioreq(state, req); -- break; - case IOREQ_TYPE_TIMEOFFSET: - break; - case IOREQ_TYPE_INVALIDATE: -@@ -1063,7 +1027,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req) - cpu_ioreq_config(state, req); - break; - default: -- hw_error("Invalid ioreq type 0x%x\n", req->type); -+ arch_handle_ioreq(state, req); - } - if (req->dir == IOREQ_READ) { - trace_handle_ioreq_read(req, req->type, req->df, req->data_is_ptr, -@@ -1604,3 +1568,57 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp) - memory_global_dirty_log_stop(GLOBAL_DIRTY_MIGRATION); - } - } -+ -+void arch_xen_set_memory(XenIOState *state,MemoryRegionSection *section, -+ bool add) -+{ -+ hwaddr start_addr = section->offset_within_address_space; -+ ram_addr_t size = int128_get64(section->size); -+ bool log_dirty = memory_region_is_logging(section->mr, DIRTY_MEMORY_VGA); -+ hvmmem_type_t mem_type; -+ -+ if (!memory_region_is_ram(section->mr)) { -+ return; -+ } -+ -+ if (log_dirty != add) { -+ return; -+ } -+ -+ trace_xen_client_set_memory(start_addr, size, log_dirty); -+ -+ start_addr &= TARGET_PAGE_MASK; -+ size = TARGET_PAGE_ALIGN(size); -+ -+ if (add) { -+ if (!memory_region_is_rom(section->mr)) { -+ xen_add_to_physmap(state, start_addr, size, -+ section->mr, section->offset_within_region); -+ } else { -+ mem_type = HVMMEM_ram_ro; -+ if (xen_set_mem_type(xen_domid, mem_type, -+ start_addr >> TARGET_PAGE_BITS, -+ size >> TARGET_PAGE_BITS)) { -+ DPRINTF("xen_set_mem_type error, addr: "TARGET_FMT_plx"\n", -+ start_addr); -+ } -+ } -+ } else { -+ if (xen_remove_from_physmap(state, start_addr, size) < 0) { -+ DPRINTF("physmapping does not exist at "TARGET_FMT_plx"\n", start_addr); -+ } -+ } -+} -+ -+void arch_handle_ioreq(XenIOState *state, ioreq_t *req) -+{ -+ switch (req->type) { -+ case IOREQ_TYPE_VMWARE_PORT: -+ handle_vmport_ioreq(state, req); -+ break; -+ default: -+ hw_error("Invalid ioreq type 0x%x\n", req->type); -+ } -+ -+ return; -+} -diff --git a/include/hw/i386/xen_arch_hvm.h b/include/hw/i386/xen_arch_hvm.h -new file mode 100644 -index 0000000000..1b2c71ba4f ---- /dev/null -+++ b/include/hw/i386/xen_arch_hvm.h -@@ -0,0 +1,10 @@ -+#ifndef HW_XEN_ARCH_I386_HVM_H -+#define HW_XEN_ARCH_I386_HVM_H -+ -+#include -+ -+void arch_handle_ioreq(XenIOState *state, ioreq_t *req); -+void arch_xen_set_memory(XenIOState *state, -+ MemoryRegionSection *section, -+ bool add); -+#endif -diff --git a/include/hw/xen/arch_hvm.h b/include/hw/xen/arch_hvm.h -new file mode 100644 -index 0000000000..26674648d8 ---- /dev/null -+++ b/include/hw/xen/arch_hvm.h -@@ -0,0 +1,3 @@ -+#if defined(TARGET_I386) || defined(TARGET_X86_64) -+#include "hw/i386/xen_arch_hvm.h" -+#endif --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-add-map-and-unmap-callbacks-for-grant-region.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-add-map-and-unmap-callbacks-for-grant-region.patch deleted file mode 100644 index 87bbc3c6..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-add-map-and-unmap-callbacks-for-grant-region.patch +++ /dev/null @@ -1,255 +0,0 @@ -From ef94d70d4a22c5282d6955a7ed066ef502e99829 Mon Sep 17 00:00:00 2001 -From: Juergen Gross -Date: Fri, 26 Aug 2022 13:57:06 +0200 -Subject: [PATCH 6/8] xen: add map and unmap callbacks for grant region - -Add the callbacks for mapping/unmapping guest memory via grants to the -special grant memory region. - -Signed-off-by: Juergen Gross -Signed-off-by: Vikram Garhwal -Signed-off-by: Stefano Stabellini -Acked-by: Stefano Stabellini ---- - hw/xen/xen-mapcache.c | 167 +++++++++++++++++++++++++++++++++++++++++- - softmmu/physmem.c | 11 ++- - 2 files changed, 173 insertions(+), 5 deletions(-) - -diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c -index e53e7221f1..f81b75d216 100644 ---- a/hw/xen/xen-mapcache.c -+++ b/hw/xen/xen-mapcache.c -@@ -9,6 +9,8 @@ - */ - - #include "qemu/osdep.h" -+#include "qemu/queue.h" -+#include "qemu/thread.h" - #include "qemu/units.h" - #include "qemu/error-report.h" - -@@ -24,6 +26,8 @@ - #include "sysemu/xen-mapcache.h" - #include "trace.h" - -+#include -+#include - - //#define MAPCACHE_DEBUG - -@@ -386,7 +390,7 @@ uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size, - return p; - } - --ram_addr_t xen_ram_addr_from_mapcache(void *ptr) -+static ram_addr_t xen_ram_addr_from_mapcache_try(void *ptr) - { - MapCacheEntry *entry = NULL; - MapCacheRev *reventry; -@@ -595,10 +599,170 @@ uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr, - return p; - } - -+struct XENMappedGrantRegion { -+ void *addr; -+ unsigned int pages; -+ unsigned int refs; -+ unsigned int prot; -+ uint32_t idx; -+ QLIST_ENTRY(XENMappedGrantRegion) list; -+}; -+ -+static xengnttab_handle *xen_region_gnttabdev; -+static QLIST_HEAD(GrantRegionList, XENMappedGrantRegion) xen_grant_mappings = -+ QLIST_HEAD_INITIALIZER(xen_grant_mappings); -+static QemuMutex xen_map_mutex; -+ -+static void *xen_map_grant_dyn(MemoryRegion **mr, hwaddr addr, hwaddr *plen, -+ bool is_write, MemTxAttrs attrs) -+{ -+ unsigned int page_off = addr & (XC_PAGE_SIZE - 1); -+ unsigned int i; -+ unsigned int nrefs = (page_off + *plen + XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT; -+ uint32_t ref = (addr - XEN_GRANT_ADDR_OFF) >> XC_PAGE_SHIFT; -+ uint32_t *refs; -+ unsigned int prot = PROT_READ; -+ struct XENMappedGrantRegion *mgr = NULL; -+ -+ if (is_write) { -+ prot |= PROT_WRITE; -+ } -+ -+ qemu_mutex_lock(&xen_map_mutex); -+ -+ QLIST_FOREACH(mgr, &xen_grant_mappings, list) { -+ if (mgr->idx == ref && -+ mgr->pages == nrefs && -+ (mgr->prot & prot) == prot) { -+ break; -+ } -+ } -+ if (!mgr) { -+ mgr = g_new(struct XENMappedGrantRegion, 1); -+ -+ if (nrefs == 1) { -+ refs = &ref; -+ } else { -+ refs = g_new(uint32_t, nrefs); -+ for (i = 0; i < nrefs; i++) { -+ refs[i] = ref + i; -+ } -+ } -+ mgr->addr = xengnttab_map_domain_grant_refs(xen_region_gnttabdev, nrefs, -+ xen_domid, refs, prot); -+ if (mgr->addr) { -+ mgr->pages = nrefs; -+ mgr->refs = 1; -+ mgr->prot = prot; -+ mgr->idx = ref; -+ -+ QLIST_INSERT_HEAD(&xen_grant_mappings, mgr, list); -+ } else { -+ g_free(mgr); -+ mgr = NULL; -+ } -+ } else { -+ mgr->refs++; -+ } -+ -+ qemu_mutex_unlock(&xen_map_mutex); -+ -+ if (nrefs > 1) { -+ g_free(refs); -+ } -+ -+ return mgr ? mgr->addr + page_off : NULL; -+} -+ -+static void xen_unmap_grant_dyn(MemoryRegion *mr, void *buffer, ram_addr_t addr, -+ hwaddr len, bool is_write, hwaddr access_len) -+{ -+ unsigned int page_off = (unsigned long)buffer & (XC_PAGE_SIZE - 1); -+ unsigned int nrefs = (page_off + len + XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT; -+ unsigned int prot = PROT_READ; -+ struct XENMappedGrantRegion *mgr = NULL; -+ -+ if (is_write) { -+ prot |= PROT_WRITE; -+ } -+ -+ qemu_mutex_lock(&xen_map_mutex); -+ -+ QLIST_FOREACH(mgr, &xen_grant_mappings, list) { -+ if (mgr->addr == buffer - page_off && -+ mgr->pages == nrefs && -+ (mgr->prot & prot) == prot) { -+ break; -+ } -+ } -+ if (mgr) { -+ mgr->refs--; -+ if (!mgr->refs) { -+ xengnttab_unmap(xen_region_gnttabdev, mgr->addr, nrefs); -+ -+ QLIST_REMOVE(mgr, list); -+ g_free(mgr); -+ } -+ } else { -+ error_report("xen_unmap_grant_dyn() trying to unmap unknown buffer"); -+ } -+ -+ qemu_mutex_unlock(&xen_map_mutex); -+} -+ -+static ram_addr_t xen_ram_addr_from_grant_cache(void *ptr) -+{ -+ unsigned int page_off = (unsigned long)ptr & (XC_PAGE_SIZE - 1); -+ struct XENMappedGrantRegion *mgr = NULL; -+ ram_addr_t raddr = RAM_ADDR_INVALID; -+ -+ qemu_mutex_lock(&xen_map_mutex); -+ -+ QLIST_FOREACH(mgr, &xen_grant_mappings, list) { -+ if (mgr->addr == ptr - page_off) { -+ break; -+ } -+ } -+ -+ if (mgr) { -+ raddr = (mgr->idx << XC_PAGE_SHIFT) + page_off + XEN_GRANT_ADDR_OFF; -+ } -+ -+ qemu_mutex_unlock(&xen_map_mutex); -+ -+ return raddr; -+} -+ -+ram_addr_t xen_ram_addr_from_mapcache(void *ptr) -+{ -+ ram_addr_t raddr; -+ -+ raddr = xen_ram_addr_from_mapcache_try(ptr); -+ if (raddr == RAM_ADDR_INVALID) { -+ raddr = xen_ram_addr_from_grant_cache(ptr); -+ } -+ -+ return raddr; -+} -+ -+static const struct MemoryRegionOps xen_grant_mr_ops = { -+ .map = xen_map_grant_dyn, -+ .unmap = xen_unmap_grant_dyn, -+ .endianness = DEVICE_LITTLE_ENDIAN, -+}; -+ - MemoryRegion *xen_init_grant_ram(void) - { - RAMBlock *block; - -+ qemu_mutex_init(&xen_map_mutex); -+ -+ xen_region_gnttabdev = xengnttab_open(NULL, 0); -+ if (xen_region_gnttabdev == NULL) { -+ fprintf(stderr, "can't open gnttab device\n"); -+ return NULL; -+ } -+ - memory_region_init(&ram_grants, NULL, "xen.grants", - XEN_MAX_VIRTIO_GRANTS * XC_PAGE_SIZE); - block = g_malloc0(sizeof(*block)); -@@ -613,6 +777,7 @@ MemoryRegion *xen_init_grant_ram(void) - ram_grants.ram_block = block; - ram_grants.ram = true; - ram_grants.terminates = true; -+ ram_grants.ops = &xen_grant_mr_ops; - ram_block_add_list(block); - memory_region_add_subregion(get_system_memory(), XEN_GRANT_ADDR_OFF, - &ram_grants); -diff --git a/softmmu/physmem.c b/softmmu/physmem.c -index 2038240311..6b2a02fc87 100644 ---- a/softmmu/physmem.c -+++ b/softmmu/physmem.c -@@ -2391,13 +2391,16 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, - - if (xen_enabled()) { - ram_addr_t ram_addr; -+ - RCU_READ_LOCK_GUARD(); - ram_addr = xen_ram_addr_from_mapcache(ptr); -- block = qemu_get_ram_block(ram_addr); -- if (block) { -- *offset = ram_addr - block->offset; -+ if (ram_addr != RAM_ADDR_INVALID) { -+ block = qemu_get_ram_block(ram_addr); -+ if (block) { -+ *offset = ram_addr - block->offset; -+ } -+ return block; - } -- return block; - } - - RCU_READ_LOCK_GUARD(); --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-hvm-move-common-functions-to-hw-xen-xen-hvm-comm.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-hvm-move-common-functions-to-hw-xen-xen-hvm-comm.patch deleted file mode 100644 index 7df302a2..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0006-xen-hvm-move-common-functions-to-hw-xen-xen-hvm-comm.patch +++ /dev/null @@ -1,2094 +0,0 @@ -From 87d362e72e65b604da7554657204344a6540d88c Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Fri, 1 Jul 2022 15:59:47 -0700 -Subject: [PATCH 06/16] xen-hvm: move common functions to - hw/xen/xen-hvm-common.c - -Extract common functionalities from xen-hvm.c and move them to -hw/xen/xen-hvm-common.c. These common functions are useful for creating -an IOREQ server. - -Moved the common usable IOREQ creation part to a new function -xen_register_ioreq() which can be used by both x86 and ARM machines. - -NOTE: This patch will break the build as the patch only involves moving -of functions. Build fixes will be in the next patch. - -Signed-off-by: Vikram Garhwal -Signed-off-by: Stefano Stabellini -Reviewed-by: Stefano Stabellini ---- - hw/i386/xen/trace-events | 14 - - hw/i386/xen/xen-hvm.c | 927 +------------------------------- - hw/xen/meson.build | 5 +- - hw/xen/trace-events | 14 + - hw/xen/xen-hvm-common.c | 861 +++++++++++++++++++++++++++++ - include/hw/i386/xen_arch_hvm.h | 1 + - include/hw/xen/xen-hvm-common.h | 98 ++++ - 7 files changed, 986 insertions(+), 934 deletions(-) - create mode 100644 hw/xen/xen-hvm-common.c - create mode 100644 include/hw/xen/xen-hvm-common.h - -diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events -index a0c89d91c4..5d0a8d6dcf 100644 ---- a/hw/i386/xen/trace-events -+++ b/hw/i386/xen/trace-events -@@ -7,17 +7,3 @@ xen_platform_log(char *s) "xen platform: %s" - xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address 0x%"PRIx64")" - xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address 0x%"PRIx64")" - --# xen-hvm.c --xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx" --xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "0x%"PRIx64" size 0x%lx, log_dirty %i" --handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p type=%d dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" --handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p read type=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" --handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p write type=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" --cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p pio dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" --cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=0x%"PRIx64" port=0x%"PRIx64" size=%d" --cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=0x%"PRIx64" port=0x%"PRIx64" size=%d" --cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" --xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" --cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" --cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" -- -diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c -index 178f0c68fc..36d87555a9 100644 ---- a/hw/i386/xen/xen-hvm.c -+++ b/hw/i386/xen/xen-hvm.c -@@ -10,43 +10,21 @@ - - #include "qemu/osdep.h" - #include "qemu/units.h" -+#include "qapi/error.h" -+#include "qapi/qapi-commands-migration.h" -+#include "trace.h" - --#include "cpu.h" --#include "hw/pci/pci.h" --#include "hw/pci/pci_host.h" - #include "hw/i386/pc.h" - #include "hw/irq.h" --#include "hw/hw.h" - #include "hw/i386/apic-msidef.h" --#include "hw/xen/xen_common.h" --#include "hw/xen/xen-legacy-backend.h" --#include "hw/xen/xen-bus.h" - #include "hw/xen/xen-x86.h" --#include "qapi/error.h" --#include "qapi/qapi-commands-migration.h" --#include "qemu/error-report.h" --#include "qemu/main-loop.h" - #include "qemu/range.h" --#include "sysemu/runstate.h" --#include "sysemu/sysemu.h" --#include "sysemu/xen.h" --#include "sysemu/xen-mapcache.h" --#include "trace.h" - --#include -+#include "hw/xen/xen-hvm-common.h" -+#include "hw/xen/arch_hvm.h" - #include - --//#define DEBUG_XEN_HVM -- --#ifdef DEBUG_XEN_HVM --#define DPRINTF(fmt, ...) \ -- do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) --#else --#define DPRINTF(fmt, ...) \ -- do { } while (0) --#endif -- --static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi; -+static MemoryRegion ram_640k, ram_lo, ram_hi; - static MemoryRegion *framebuffer; - static bool xen_in_migration; - -@@ -75,25 +53,6 @@ typedef struct shared_vmport_iopage shared_vmport_iopage_t; - #endif - static shared_vmport_iopage_t *shared_vmport_page; - --static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i) --{ -- return shared_page->vcpu_ioreq[i].vp_eport; --} --static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu) --{ -- return &shared_page->vcpu_ioreq[vcpu]; --} -- --#define BUFFER_IO_MAX_DELAY 100 -- --typedef struct XenPhysmap { -- hwaddr start_addr; -- ram_addr_t size; -- const char *name; -- hwaddr phys_offset; -- -- QLIST_ENTRY(XenPhysmap) list; --} XenPhysmap; - - static QLIST_HEAD(, XenPhysmap) xen_physmap; - static const XenPhysmap *log_for_dirtybit = NULL; -@@ -102,40 +61,6 @@ static unsigned long *dirty_bitmap = NULL; - static Notifier suspend; - static Notifier wakeup; - --typedef struct XenPciDevice { -- PCIDevice *pci_dev; -- uint32_t sbdf; -- QLIST_ENTRY(XenPciDevice) entry; --} XenPciDevice; -- --typedef struct XenIOState { -- ioservid_t ioservid; -- shared_iopage_t *shared_page; -- buffered_iopage_t *buffered_io_page; -- xenforeignmemory_resource_handle *fres; -- QEMUTimer *buffered_io_timer; -- CPUState **cpu_by_vcpu_id; -- /* the evtchn port for polling the notification, */ -- evtchn_port_t *ioreq_local_port; -- /* evtchn remote and local ports for buffered io */ -- evtchn_port_t bufioreq_remote_port; -- evtchn_port_t bufioreq_local_port; -- /* the evtchn fd for polling */ -- xenevtchn_handle *xce_handle; -- /* which vcpu we are serving */ -- int send_vcpu; -- -- struct xs_handle *xenstore; -- MemoryListener memory_listener; -- MemoryListener io_listener; -- QLIST_HEAD(, XenPciDevice) dev_list; -- DeviceListener device_listener; -- -- Notifier exit; --} XenIOState; -- --#include "hw/xen/arch_hvm.h" -- - /* Xen specific function for piix pci */ - - int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) -@@ -248,42 +173,6 @@ static void xen_ram_init(PCMachineState *pcms, - } - } - --void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, -- Error **errp) --{ -- unsigned long nr_pfn; -- xen_pfn_t *pfn_list; -- int i; -- -- if (runstate_check(RUN_STATE_INMIGRATE)) { -- /* RAM already populated in Xen */ -- fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT -- " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE\n", -- __func__, size, ram_addr); -- return; -- } -- -- if (mr == &ram_memory) { -- return; -- } -- -- trace_xen_ram_alloc(ram_addr, size); -- -- nr_pfn = size >> TARGET_PAGE_BITS; -- pfn_list = g_malloc(sizeof (*pfn_list) * nr_pfn); -- -- for (i = 0; i < nr_pfn; i++) { -- pfn_list[i] = (ram_addr >> TARGET_PAGE_BITS) + i; -- } -- -- if (xc_domain_populate_physmap_exact(xen_xc, xen_domid, nr_pfn, 0, 0, pfn_list)) { -- error_setg(errp, "xen: failed to populate ram at " RAM_ADDR_FMT, -- ram_addr); -- } -- -- g_free(pfn_list); --} -- - static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size) - { - XenPhysmap *physmap = NULL; -@@ -473,109 +362,6 @@ static int xen_remove_from_physmap(XenIOState *state, - return 0; - } - --static void xen_set_memory(struct MemoryListener *listener, -- MemoryRegionSection *section, -- bool add) --{ -- XenIOState *state = container_of(listener, XenIOState, memory_listener); -- -- if (section->mr == &ram_memory) { -- return; -- } else { -- if (add) { -- xen_map_memory_section(xen_domid, state->ioservid, -- section); -- } else { -- xen_unmap_memory_section(xen_domid, state->ioservid, -- section); -- } -- } -- arch_xen_set_memory(state, section, add); --} -- --static void xen_region_add(MemoryListener *listener, -- MemoryRegionSection *section) --{ -- memory_region_ref(section->mr); -- xen_set_memory(listener, section, true); --} -- --static void xen_region_del(MemoryListener *listener, -- MemoryRegionSection *section) --{ -- xen_set_memory(listener, section, false); -- memory_region_unref(section->mr); --} -- --static void xen_io_add(MemoryListener *listener, -- MemoryRegionSection *section) --{ -- XenIOState *state = container_of(listener, XenIOState, io_listener); -- MemoryRegion *mr = section->mr; -- -- if (mr->ops == &unassigned_io_ops) { -- return; -- } -- -- memory_region_ref(mr); -- -- xen_map_io_section(xen_domid, state->ioservid, section); --} -- --static void xen_io_del(MemoryListener *listener, -- MemoryRegionSection *section) --{ -- XenIOState *state = container_of(listener, XenIOState, io_listener); -- MemoryRegion *mr = section->mr; -- -- if (mr->ops == &unassigned_io_ops) { -- return; -- } -- -- xen_unmap_io_section(xen_domid, state->ioservid, section); -- -- memory_region_unref(mr); --} -- --static void xen_device_realize(DeviceListener *listener, -- DeviceState *dev) --{ -- XenIOState *state = container_of(listener, XenIOState, device_listener); -- -- if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { -- PCIDevice *pci_dev = PCI_DEVICE(dev); -- XenPciDevice *xendev = g_new(XenPciDevice, 1); -- -- xendev->pci_dev = pci_dev; -- xendev->sbdf = PCI_BUILD_BDF(pci_dev_bus_num(pci_dev), -- pci_dev->devfn); -- QLIST_INSERT_HEAD(&state->dev_list, xendev, entry); -- -- xen_map_pcidev(xen_domid, state->ioservid, pci_dev); -- } --} -- --static void xen_device_unrealize(DeviceListener *listener, -- DeviceState *dev) --{ -- XenIOState *state = container_of(listener, XenIOState, device_listener); -- -- if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { -- PCIDevice *pci_dev = PCI_DEVICE(dev); -- XenPciDevice *xendev, *next; -- -- xen_unmap_pcidev(xen_domid, state->ioservid, pci_dev); -- -- QLIST_FOREACH_SAFE(xendev, &state->dev_list, entry, next) { -- if (xendev->pci_dev == pci_dev) { -- QLIST_REMOVE(xendev, entry); -- g_free(xendev); -- break; -- } -- } -- } --} -- - static void xen_sync_dirty_bitmap(XenIOState *state, - hwaddr start_addr, - ram_addr_t size) -@@ -683,277 +469,6 @@ static MemoryListener xen_memory_listener = { - .priority = 10, - }; - --static MemoryListener xen_io_listener = { -- .name = "xen-io", -- .region_add = xen_io_add, -- .region_del = xen_io_del, -- .priority = 10, --}; -- --static DeviceListener xen_device_listener = { -- .realize = xen_device_realize, -- .unrealize = xen_device_unrealize, --}; -- --/* get the ioreq packets from share mem */ --static ioreq_t *cpu_get_ioreq_from_shared_memory(XenIOState *state, int vcpu) --{ -- ioreq_t *req = xen_vcpu_ioreq(state->shared_page, vcpu); -- -- if (req->state != STATE_IOREQ_READY) { -- DPRINTF("I/O request not ready: " -- "%x, ptr: %x, port: %"PRIx64", " -- "data: %"PRIx64", count: %u, size: %u\n", -- req->state, req->data_is_ptr, req->addr, -- req->data, req->count, req->size); -- return NULL; -- } -- -- xen_rmb(); /* see IOREQ_READY /then/ read contents of ioreq */ -- -- req->state = STATE_IOREQ_INPROCESS; -- return req; --} -- --/* use poll to get the port notification */ --/* ioreq_vec--out,the */ --/* retval--the number of ioreq packet */ --static ioreq_t *cpu_get_ioreq(XenIOState *state) --{ -- MachineState *ms = MACHINE(qdev_get_machine()); -- unsigned int max_cpus = ms->smp.max_cpus; -- int i; -- evtchn_port_t port; -- -- port = xenevtchn_pending(state->xce_handle); -- if (port == state->bufioreq_local_port) { -- timer_mod(state->buffered_io_timer, -- BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); -- return NULL; -- } -- -- if (port != -1) { -- for (i = 0; i < max_cpus; i++) { -- if (state->ioreq_local_port[i] == port) { -- break; -- } -- } -- -- if (i == max_cpus) { -- hw_error("Fatal error while trying to get io event!\n"); -- } -- -- /* unmask the wanted port again */ -- xenevtchn_unmask(state->xce_handle, port); -- -- /* get the io packet from shared memory */ -- state->send_vcpu = i; -- return cpu_get_ioreq_from_shared_memory(state, i); -- } -- -- /* read error or read nothing */ -- return NULL; --} -- --static uint32_t do_inp(uint32_t addr, unsigned long size) --{ -- switch (size) { -- case 1: -- return cpu_inb(addr); -- case 2: -- return cpu_inw(addr); -- case 4: -- return cpu_inl(addr); -- default: -- hw_error("inp: bad size: %04x %lx", addr, size); -- } --} -- --static void do_outp(uint32_t addr, -- unsigned long size, uint32_t val) --{ -- switch (size) { -- case 1: -- return cpu_outb(addr, val); -- case 2: -- return cpu_outw(addr, val); -- case 4: -- return cpu_outl(addr, val); -- default: -- hw_error("outp: bad size: %04x %lx", addr, size); -- } --} -- --/* -- * Helper functions which read/write an object from/to physical guest -- * memory, as part of the implementation of an ioreq. -- * -- * Equivalent to -- * cpu_physical_memory_rw(addr + (req->df ? -1 : +1) * req->size * i, -- * val, req->size, 0/1) -- * except without the integer overflow problems. -- */ --static void rw_phys_req_item(hwaddr addr, -- ioreq_t *req, uint32_t i, void *val, int rw) --{ -- /* Do everything unsigned so overflow just results in a truncated result -- * and accesses to undesired parts of guest memory, which is up -- * to the guest */ -- hwaddr offset = (hwaddr)req->size * i; -- if (req->df) { -- addr -= offset; -- } else { -- addr += offset; -- } -- cpu_physical_memory_rw(addr, val, req->size, rw); --} -- --static inline void read_phys_req_item(hwaddr addr, -- ioreq_t *req, uint32_t i, void *val) --{ -- rw_phys_req_item(addr, req, i, val, 0); --} --static inline void write_phys_req_item(hwaddr addr, -- ioreq_t *req, uint32_t i, void *val) --{ -- rw_phys_req_item(addr, req, i, val, 1); --} -- -- --static void cpu_ioreq_pio(ioreq_t *req) --{ -- uint32_t i; -- -- trace_cpu_ioreq_pio(req, req->dir, req->df, req->data_is_ptr, req->addr, -- req->data, req->count, req->size); -- -- if (req->size > sizeof(uint32_t)) { -- hw_error("PIO: bad size (%u)", req->size); -- } -- -- if (req->dir == IOREQ_READ) { -- if (!req->data_is_ptr) { -- req->data = do_inp(req->addr, req->size); -- trace_cpu_ioreq_pio_read_reg(req, req->data, req->addr, -- req->size); -- } else { -- uint32_t tmp; -- -- for (i = 0; i < req->count; i++) { -- tmp = do_inp(req->addr, req->size); -- write_phys_req_item(req->data, req, i, &tmp); -- } -- } -- } else if (req->dir == IOREQ_WRITE) { -- if (!req->data_is_ptr) { -- trace_cpu_ioreq_pio_write_reg(req, req->data, req->addr, -- req->size); -- do_outp(req->addr, req->size, req->data); -- } else { -- for (i = 0; i < req->count; i++) { -- uint32_t tmp = 0; -- -- read_phys_req_item(req->data, req, i, &tmp); -- do_outp(req->addr, req->size, tmp); -- } -- } -- } --} -- --static void cpu_ioreq_move(ioreq_t *req) --{ -- uint32_t i; -- -- trace_cpu_ioreq_move(req, req->dir, req->df, req->data_is_ptr, req->addr, -- req->data, req->count, req->size); -- -- if (req->size > sizeof(req->data)) { -- hw_error("MMIO: bad size (%u)", req->size); -- } -- -- if (!req->data_is_ptr) { -- if (req->dir == IOREQ_READ) { -- for (i = 0; i < req->count; i++) { -- read_phys_req_item(req->addr, req, i, &req->data); -- } -- } else if (req->dir == IOREQ_WRITE) { -- for (i = 0; i < req->count; i++) { -- write_phys_req_item(req->addr, req, i, &req->data); -- } -- } -- } else { -- uint64_t tmp; -- -- if (req->dir == IOREQ_READ) { -- for (i = 0; i < req->count; i++) { -- read_phys_req_item(req->addr, req, i, &tmp); -- write_phys_req_item(req->data, req, i, &tmp); -- } -- } else if (req->dir == IOREQ_WRITE) { -- for (i = 0; i < req->count; i++) { -- read_phys_req_item(req->data, req, i, &tmp); -- write_phys_req_item(req->addr, req, i, &tmp); -- } -- } -- } --} -- --static void cpu_ioreq_config(XenIOState *state, ioreq_t *req) --{ -- uint32_t sbdf = req->addr >> 32; -- uint32_t reg = req->addr; -- XenPciDevice *xendev; -- -- if (req->size != sizeof(uint8_t) && req->size != sizeof(uint16_t) && -- req->size != sizeof(uint32_t)) { -- hw_error("PCI config access: bad size (%u)", req->size); -- } -- -- if (req->count != 1) { -- hw_error("PCI config access: bad count (%u)", req->count); -- } -- -- QLIST_FOREACH(xendev, &state->dev_list, entry) { -- if (xendev->sbdf != sbdf) { -- continue; -- } -- -- if (!req->data_is_ptr) { -- if (req->dir == IOREQ_READ) { -- req->data = pci_host_config_read_common( -- xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -- req->size); -- trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, -- req->size, req->data); -- } else if (req->dir == IOREQ_WRITE) { -- trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, -- req->size, req->data); -- pci_host_config_write_common( -- xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -- req->data, req->size); -- } -- } else { -- uint32_t tmp; -- -- if (req->dir == IOREQ_READ) { -- tmp = pci_host_config_read_common( -- xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -- req->size); -- trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, -- req->size, tmp); -- write_phys_req_item(req->data, req, 0, &tmp); -- } else if (req->dir == IOREQ_WRITE) { -- read_phys_req_item(req->data, req, 0, &tmp); -- trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, -- req->size, tmp); -- pci_host_config_write_common( -- xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -- tmp, req->size); -- } -- } -- } --} -- - static void regs_to_cpu(vmware_regs_t *vmport_regs, ioreq_t *req) - { - X86CPU *cpu; -@@ -997,223 +512,6 @@ static void handle_vmport_ioreq(XenIOState *state, ioreq_t *req) - current_cpu = NULL; - } - --static void handle_ioreq(XenIOState *state, ioreq_t *req) --{ -- trace_handle_ioreq(req, req->type, req->dir, req->df, req->data_is_ptr, -- req->addr, req->data, req->count, req->size); -- -- if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && -- (req->size < sizeof (target_ulong))) { -- req->data &= ((target_ulong) 1 << (8 * req->size)) - 1; -- } -- -- if (req->dir == IOREQ_WRITE) -- trace_handle_ioreq_write(req, req->type, req->df, req->data_is_ptr, -- req->addr, req->data, req->count, req->size); -- -- switch (req->type) { -- case IOREQ_TYPE_PIO: -- cpu_ioreq_pio(req); -- break; -- case IOREQ_TYPE_COPY: -- cpu_ioreq_move(req); -- break; -- case IOREQ_TYPE_TIMEOFFSET: -- break; -- case IOREQ_TYPE_INVALIDATE: -- xen_invalidate_map_cache(); -- break; -- case IOREQ_TYPE_PCI_CONFIG: -- cpu_ioreq_config(state, req); -- break; -- default: -- arch_handle_ioreq(state, req); -- } -- if (req->dir == IOREQ_READ) { -- trace_handle_ioreq_read(req, req->type, req->df, req->data_is_ptr, -- req->addr, req->data, req->count, req->size); -- } --} -- --static bool handle_buffered_iopage(XenIOState *state) --{ -- buffered_iopage_t *buf_page = state->buffered_io_page; -- buf_ioreq_t *buf_req = NULL; -- bool handled_ioreq = false; -- ioreq_t req; -- int qw; -- -- if (!buf_page) { -- return 0; -- } -- -- memset(&req, 0x00, sizeof(req)); -- req.state = STATE_IOREQ_READY; -- req.count = 1; -- req.dir = IOREQ_WRITE; -- -- for (;;) { -- uint32_t rdptr = buf_page->read_pointer, wrptr; -- -- xen_rmb(); -- wrptr = buf_page->write_pointer; -- xen_rmb(); -- if (rdptr != buf_page->read_pointer) { -- continue; -- } -- if (rdptr == wrptr) { -- break; -- } -- buf_req = &buf_page->buf_ioreq[rdptr % IOREQ_BUFFER_SLOT_NUM]; -- req.size = 1U << buf_req->size; -- req.addr = buf_req->addr; -- req.data = buf_req->data; -- req.type = buf_req->type; -- xen_rmb(); -- qw = (req.size == 8); -- if (qw) { -- if (rdptr + 1 == wrptr) { -- hw_error("Incomplete quad word buffered ioreq"); -- } -- buf_req = &buf_page->buf_ioreq[(rdptr + 1) % -- IOREQ_BUFFER_SLOT_NUM]; -- req.data |= ((uint64_t)buf_req->data) << 32; -- xen_rmb(); -- } -- -- handle_ioreq(state, &req); -- -- /* Only req.data may get updated by handle_ioreq(), albeit even that -- * should not happen as such data would never make it to the guest (we -- * can only usefully see writes here after all). -- */ -- assert(req.state == STATE_IOREQ_READY); -- assert(req.count == 1); -- assert(req.dir == IOREQ_WRITE); -- assert(!req.data_is_ptr); -- -- qatomic_add(&buf_page->read_pointer, qw + 1); -- handled_ioreq = true; -- } -- -- return handled_ioreq; --} -- --static void handle_buffered_io(void *opaque) --{ -- XenIOState *state = opaque; -- -- if (handle_buffered_iopage(state)) { -- timer_mod(state->buffered_io_timer, -- BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); -- } else { -- timer_del(state->buffered_io_timer); -- xenevtchn_unmask(state->xce_handle, state->bufioreq_local_port); -- } --} -- --static void cpu_handle_ioreq(void *opaque) --{ -- XenIOState *state = opaque; -- ioreq_t *req = cpu_get_ioreq(state); -- -- handle_buffered_iopage(state); -- if (req) { -- ioreq_t copy = *req; -- -- xen_rmb(); -- handle_ioreq(state, ©); -- req->data = copy.data; -- -- if (req->state != STATE_IOREQ_INPROCESS) { -- fprintf(stderr, "Badness in I/O request ... not in service?!: " -- "%x, ptr: %x, port: %"PRIx64", " -- "data: %"PRIx64", count: %u, size: %u, type: %u\n", -- req->state, req->data_is_ptr, req->addr, -- req->data, req->count, req->size, req->type); -- destroy_hvm_domain(false); -- return; -- } -- -- xen_wmb(); /* Update ioreq contents /then/ update state. */ -- -- /* -- * We do this before we send the response so that the tools -- * have the opportunity to pick up on the reset before the -- * guest resumes and does a hlt with interrupts disabled which -- * causes Xen to powerdown the domain. -- */ -- if (runstate_is_running()) { -- ShutdownCause request; -- -- if (qemu_shutdown_requested_get()) { -- destroy_hvm_domain(false); -- } -- request = qemu_reset_requested_get(); -- if (request) { -- qemu_system_reset(request); -- destroy_hvm_domain(true); -- } -- } -- -- req->state = STATE_IORESP_READY; -- xenevtchn_notify(state->xce_handle, -- state->ioreq_local_port[state->send_vcpu]); -- } --} -- --static void xen_main_loop_prepare(XenIOState *state) --{ -- int evtchn_fd = -1; -- -- if (state->xce_handle != NULL) { -- evtchn_fd = xenevtchn_fd(state->xce_handle); -- } -- -- state->buffered_io_timer = timer_new_ms(QEMU_CLOCK_REALTIME, handle_buffered_io, -- state); -- -- if (evtchn_fd != -1) { -- CPUState *cpu_state; -- -- DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); -- CPU_FOREACH(cpu_state) { -- DPRINTF("%s: cpu_by_vcpu_id[%d]=%p\n", -- __func__, cpu_state->cpu_index, cpu_state); -- state->cpu_by_vcpu_id[cpu_state->cpu_index] = cpu_state; -- } -- qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); -- } --} -- -- --static void xen_hvm_change_state_handler(void *opaque, bool running, -- RunState rstate) --{ -- XenIOState *state = opaque; -- -- if (running) { -- xen_main_loop_prepare(state); -- } -- -- xen_set_ioreq_server_state(xen_domid, -- state->ioservid, -- (rstate == RUN_STATE_RUNNING)); --} -- --static void xen_exit_notifier(Notifier *n, void *data) --{ -- XenIOState *state = container_of(n, XenIOState, exit); -- -- xen_destroy_ioreq_server(xen_domid, state->ioservid); -- if (state->fres != NULL) { -- xenforeignmemory_unmap_resource(xen_fmem, state->fres); -- } -- -- xenevtchn_close(state->xce_handle); -- xs_daemon_close(state->xenstore); --} -- - #ifdef XEN_COMPAT_PHYSMAP - static void xen_read_physmap(XenIOState *state) - { -@@ -1273,178 +571,17 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data) - xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); - } - --static int xen_map_ioreq_server(XenIOState *state) --{ -- void *addr = NULL; -- xen_pfn_t ioreq_pfn; -- xen_pfn_t bufioreq_pfn; -- evtchn_port_t bufioreq_evtchn; -- int rc; -- -- /* -- * Attempt to map using the resource API and fall back to normal -- * foreign mapping if this is not supported. -- */ -- QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq != 0); -- QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) != 1); -- state->fres = xenforeignmemory_map_resource(xen_fmem, xen_domid, -- XENMEM_resource_ioreq_server, -- state->ioservid, 0, 2, -- &addr, -- PROT_READ | PROT_WRITE, 0); -- if (state->fres != NULL) { -- trace_xen_map_resource_ioreq(state->ioservid, addr); -- state->buffered_io_page = addr; -- state->shared_page = addr + TARGET_PAGE_SIZE; -- } else if (errno != EOPNOTSUPP) { -- error_report("failed to map ioreq server resources: error %d handle=%p", -- errno, xen_xc); -- return -1; -- } -- -- rc = xen_get_ioreq_server_info(xen_domid, state->ioservid, -- (state->shared_page == NULL) ? -- &ioreq_pfn : NULL, -- (state->buffered_io_page == NULL) ? -- &bufioreq_pfn : NULL, -- &bufioreq_evtchn); -- if (rc < 0) { -- error_report("failed to get ioreq server info: error %d handle=%p", -- errno, xen_xc); -- return rc; -- } -- -- if (state->shared_page == NULL) { -- DPRINTF("shared page at pfn %lx\n", ioreq_pfn); -- -- state->shared_page = xenforeignmemory_map(xen_fmem, xen_domid, -- PROT_READ | PROT_WRITE, -- 1, &ioreq_pfn, NULL); -- if (state->shared_page == NULL) { -- error_report("map shared IO page returned error %d handle=%p", -- errno, xen_xc); -- } -- } -- -- if (state->buffered_io_page == NULL) { -- DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); -- -- state->buffered_io_page = xenforeignmemory_map(xen_fmem, xen_domid, -- PROT_READ | PROT_WRITE, -- 1, &bufioreq_pfn, -- NULL); -- if (state->buffered_io_page == NULL) { -- error_report("map buffered IO page returned error %d", errno); -- return -1; -- } -- } -- -- if (state->shared_page == NULL || state->buffered_io_page == NULL) { -- return -1; -- } -- -- DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); -- -- state->bufioreq_remote_port = bufioreq_evtchn; -- -- return 0; --} -- - void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) - { - MachineState *ms = MACHINE(pcms); - unsigned int max_cpus = ms->smp.max_cpus; -- int i, rc; -+ int rc; - xen_pfn_t ioreq_pfn; - XenIOState *state; - - state = g_new0(XenIOState, 1); - -- state->xce_handle = xenevtchn_open(NULL, 0); -- if (state->xce_handle == NULL) { -- perror("xen: event channel open"); -- goto err; -- } -- -- state->xenstore = xs_daemon_open(); -- if (state->xenstore == NULL) { -- perror("xen: xenstore open"); -- goto err; -- } -- -- xen_create_ioreq_server(xen_domid, &state->ioservid); -- -- state->exit.notify = xen_exit_notifier; -- qemu_add_exit_notifier(&state->exit); -- -- /* -- * Register wake-up support in QMP query-current-machine API -- */ -- qemu_register_wakeup_support(); -- -- rc = xen_map_ioreq_server(state); -- if (rc < 0) { -- goto err; -- } -- -- /* Note: cpus is empty at this point in init */ -- state->cpu_by_vcpu_id = g_new0(CPUState *, max_cpus); -- -- rc = xen_set_ioreq_server_state(xen_domid, state->ioservid, true); -- if (rc < 0) { -- error_report("failed to enable ioreq server info: error %d handle=%p", -- errno, xen_xc); -- goto err; -- } -- -- state->ioreq_local_port = g_new0(evtchn_port_t, max_cpus); -- -- /* FIXME: how about if we overflow the page here? */ -- for (i = 0; i < max_cpus; i++) { -- rc = xenevtchn_bind_interdomain(state->xce_handle, xen_domid, -- xen_vcpu_eport(state->shared_page, i)); -- if (rc == -1) { -- error_report("shared evtchn %d bind error %d", i, errno); -- goto err; -- } -- state->ioreq_local_port[i] = rc; -- } -- -- rc = xenevtchn_bind_interdomain(state->xce_handle, xen_domid, -- state->bufioreq_remote_port); -- if (rc == -1) { -- error_report("buffered evtchn bind error %d", errno); -- goto err; -- } -- state->bufioreq_local_port = rc; -- -- /* Init RAM management */ --#ifdef XEN_COMPAT_PHYSMAP -- xen_map_cache_init(xen_phys_offset_to_gaddr, state); --#else -- xen_map_cache_init(NULL, state); --#endif -- -- qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); -- -- state->memory_listener = xen_memory_listener; -- memory_listener_register(&state->memory_listener, &address_space_memory); -- -- state->io_listener = xen_io_listener; -- memory_listener_register(&state->io_listener, &address_space_io); -- -- state->device_listener = xen_device_listener; -- QLIST_INIT(&state->dev_list); -- device_listener_register(&state->device_listener); -- -- xen_bus_init(); -- -- /* Initialize backend core & drivers */ -- if (xen_be_init() != 0) { -- error_report("xen backend core setup failed"); -- goto err; -- } -- xen_be_register_common(); -+ xen_register_ioreq(state, max_cpus, xen_memory_listener); - - QLIST_INIT(&xen_physmap); - xen_read_physmap(state); -@@ -1484,59 +621,11 @@ err: - exit(1); - } - --void destroy_hvm_domain(bool reboot) --{ -- xc_interface *xc_handle; -- int sts; -- int rc; -- -- unsigned int reason = reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff; -- -- if (xen_dmod) { -- rc = xendevicemodel_shutdown(xen_dmod, xen_domid, reason); -- if (!rc) { -- return; -- } -- if (errno != ENOTTY /* old Xen */) { -- perror("xendevicemodel_shutdown failed"); -- } -- /* well, try the old thing then */ -- } -- -- xc_handle = xc_interface_open(0, 0, 0); -- if (xc_handle == NULL) { -- fprintf(stderr, "Cannot acquire xenctrl handle\n"); -- } else { -- sts = xc_domain_shutdown(xc_handle, xen_domid, reason); -- if (sts != 0) { -- fprintf(stderr, "xc_domain_shutdown failed to issue %s, " -- "sts %d, %s\n", reboot ? "reboot" : "poweroff", -- sts, strerror(errno)); -- } else { -- fprintf(stderr, "Issued domain %d %s\n", xen_domid, -- reboot ? "reboot" : "poweroff"); -- } -- xc_interface_close(xc_handle); -- } --} -- - void xen_register_framebuffer(MemoryRegion *mr) - { - framebuffer = mr; - } - --void xen_shutdown_fatal_error(const char *fmt, ...) --{ -- va_list ap; -- -- va_start(ap, fmt); -- vfprintf(stderr, fmt, ap); -- va_end(ap); -- fprintf(stderr, "Will destroy the domain.\n"); -- /* destroy the domain */ -- qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); --} -- - void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) - { - if (unlikely(xen_in_migration)) { -diff --git a/hw/xen/meson.build b/hw/xen/meson.build -index 19d0637c46..008e036d63 100644 ---- a/hw/xen/meson.build -+++ b/hw/xen/meson.build -@@ -25,4 +25,7 @@ specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) - - xen_ss = ss.source_set() - --xen_ss.add(when: 'CONFIG_XEN', if_true: files('xen-mapcache.c')) -+xen_ss.add(when: 'CONFIG_XEN', if_true: files( -+ 'xen-mapcache.c', -+ 'xen-hvm-common.c', -+)) -diff --git a/hw/xen/trace-events b/hw/xen/trace-events -index 2c8f238f42..02ca1183da 100644 ---- a/hw/xen/trace-events -+++ b/hw/xen/trace-events -@@ -42,6 +42,20 @@ xs_node_vscanf(char *path, char *value) "%s %s" - xs_node_watch(char *path) "%s" - xs_node_unwatch(char *path) "%s" - -+# xen-hvm.c -+xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx" -+xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "0x%"PRIx64" size 0x%lx, log_dirty %i" -+handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p type=%d dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" -+handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p read type=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" -+handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p write type=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" -+cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p pio dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" -+cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=0x%"PRIx64" port=0x%"PRIx64" size=%d" -+cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=0x%"PRIx64" port=0x%"PRIx64" size=%d" -+cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" -+xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" -+cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" -+cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" -+ - # xen-mapcache.c - xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 - xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 -diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c -new file mode 100644 -index 0000000000..67f76f6010 ---- /dev/null -+++ b/hw/xen/xen-hvm-common.c -@@ -0,0 +1,861 @@ -+#include "qemu/osdep.h" -+#include "qemu/units.h" -+#include "qapi/error.h" -+#include "trace.h" -+ -+#include "hw/pci/pci_host.h" -+#include "hw/xen/xen-hvm-common.h" -+#include "hw/xen/xen-legacy-backend.h" -+#include "hw/xen/xen-bus.h" -+#include "hw/boards.h" -+#include "hw/xen/arch_hvm.h" -+ -+MemoryRegion ram_memory; -+ -+MemoryListener xen_io_listener = { -+ .name = "xen-io", -+ .region_add = xen_io_add, -+ .region_del = xen_io_del, -+ .priority = 10, -+}; -+ -+DeviceListener xen_device_listener = { -+ .realize = xen_device_realize, -+ .unrealize = xen_device_unrealize, -+}; -+ -+static void xen_set_memory(struct MemoryListener *listener, -+ MemoryRegionSection *section, -+ bool add) -+{ -+ XenIOState *state = container_of(listener, XenIOState, memory_listener); -+ -+ if (section->mr == &ram_memory) { -+ return; -+ } else { -+ if (add) { -+ xen_map_memory_section(xen_domid, state->ioservid, -+ section); -+ } else { -+ xen_unmap_memory_section(xen_domid, state->ioservid, -+ section); -+ } -+ } -+ arch_xen_set_memory(state, section, add); -+} -+ -+void xen_region_add(MemoryListener *listener, -+ MemoryRegionSection *section) -+{ -+ memory_region_ref(section->mr); -+ xen_set_memory(listener, section, true); -+} -+ -+void xen_region_del(MemoryListener *listener, -+ MemoryRegionSection *section) -+{ -+ xen_set_memory(listener, section, false); -+ memory_region_unref(section->mr); -+} -+ -+void xen_io_add(MemoryListener *listener, -+ MemoryRegionSection *section) -+{ -+ XenIOState *state = container_of(listener, XenIOState, io_listener); -+ MemoryRegion *mr = section->mr; -+ -+ if (mr->ops == &unassigned_io_ops) { -+ return; -+ } -+ -+ memory_region_ref(mr); -+ -+ xen_map_io_section(xen_domid, state->ioservid, section); -+} -+ -+void xen_io_del(MemoryListener *listener, -+ MemoryRegionSection *section) -+{ -+ XenIOState *state = container_of(listener, XenIOState, io_listener); -+ MemoryRegion *mr = section->mr; -+ -+ if (mr->ops == &unassigned_io_ops) { -+ return; -+ } -+ -+ xen_unmap_io_section(xen_domid, state->ioservid, section); -+ -+ memory_region_unref(mr); -+} -+ -+void xen_device_realize(DeviceListener *listener, -+ DeviceState *dev) -+{ -+ XenIOState *state = container_of(listener, XenIOState, device_listener); -+ -+ if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { -+ PCIDevice *pci_dev = PCI_DEVICE(dev); -+ XenPciDevice *xendev = g_new(XenPciDevice, 1); -+ -+ xendev->pci_dev = pci_dev; -+ xendev->sbdf = PCI_BUILD_BDF(pci_dev_bus_num(pci_dev), -+ pci_dev->devfn); -+ QLIST_INSERT_HEAD(&state->dev_list, xendev, entry); -+ -+ xen_map_pcidev(xen_domid, state->ioservid, pci_dev); -+ } -+} -+ -+void xen_device_unrealize(DeviceListener *listener, -+ DeviceState *dev) -+{ -+ XenIOState *state = container_of(listener, XenIOState, device_listener); -+ -+ if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { -+ PCIDevice *pci_dev = PCI_DEVICE(dev); -+ XenPciDevice *xendev, *next; -+ -+ xen_unmap_pcidev(xen_domid, state->ioservid, pci_dev); -+ -+ QLIST_FOREACH_SAFE(xendev, &state->dev_list, entry, next) { -+ if (xendev->pci_dev == pci_dev) { -+ QLIST_REMOVE(xendev, entry); -+ g_free(xendev); -+ break; -+ } -+ } -+ } -+} -+ -+/* get the ioreq packets from share mem */ -+static ioreq_t *cpu_get_ioreq_from_shared_memory(XenIOState *state, int vcpu) -+{ -+ ioreq_t *req = xen_vcpu_ioreq(state->shared_page, vcpu); -+ -+ if (req->state != STATE_IOREQ_READY) { -+ DPRINTF("I/O request not ready: " -+ "%x, ptr: %x, port: %"PRIx64", " -+ "data: %"PRIx64", count: %u, size: %u\n", -+ req->state, req->data_is_ptr, req->addr, -+ req->data, req->count, req->size); -+ return NULL; -+ } -+ -+ xen_rmb(); /* see IOREQ_READY /then/ read contents of ioreq */ -+ -+ req->state = STATE_IOREQ_INPROCESS; -+ return req; -+} -+ -+/* use poll to get the port notification */ -+/* ioreq_vec--out,the */ -+/* retval--the number of ioreq packet */ -+static ioreq_t *cpu_get_ioreq(XenIOState *state) -+{ -+ MachineState *ms = MACHINE(qdev_get_machine()); -+ unsigned int max_cpus = ms->smp.max_cpus; -+ int i; -+ evtchn_port_t port; -+ -+ port = xenevtchn_pending(state->xce_handle); -+ if (port == state->bufioreq_local_port) { -+ timer_mod(state->buffered_io_timer, -+ BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); -+ return NULL; -+ } -+ -+ if (port != -1) { -+ for (i = 0; i < max_cpus; i++) { -+ if (state->ioreq_local_port[i] == port) { -+ break; -+ } -+ } -+ -+ if (i == max_cpus) { -+ hw_error("Fatal error while trying to get io event!\n"); -+ } -+ -+ /* unmask the wanted port again */ -+ xenevtchn_unmask(state->xce_handle, port); -+ -+ /* get the io packet from shared memory */ -+ state->send_vcpu = i; -+ return cpu_get_ioreq_from_shared_memory(state, i); -+ } -+ -+ /* read error or read nothing */ -+ return NULL; -+} -+ -+static uint32_t do_inp(uint32_t addr, unsigned long size) -+{ -+ switch (size) { -+ case 1: -+ return cpu_inb(addr); -+ case 2: -+ return cpu_inw(addr); -+ case 4: -+ return cpu_inl(addr); -+ default: -+ hw_error("inp: bad size: %04x %lx", addr, size); -+ } -+} -+ -+static void do_outp(uint32_t addr, -+ unsigned long size, uint32_t val) -+{ -+ switch (size) { -+ case 1: -+ return cpu_outb(addr, val); -+ case 2: -+ return cpu_outw(addr, val); -+ case 4: -+ return cpu_outl(addr, val); -+ default: -+ hw_error("outp: bad size: %04x %lx", addr, size); -+ } -+} -+ -+/* -+ * Helper functions which read/write an object from/to physical guest -+ * memory, as part of the implementation of an ioreq. -+ * -+ * Equivalent to -+ * cpu_physical_memory_rw(addr + (req->df ? -1 : +1) * req->size * i, -+ * val, req->size, 0/1) -+ * except without the integer overflow problems. -+ */ -+static void rw_phys_req_item(hwaddr addr, -+ ioreq_t *req, uint32_t i, void *val, int rw) -+{ -+ /* Do everything unsigned so overflow just results in a truncated result -+ * and accesses to undesired parts of guest memory, which is up -+ * to the guest */ -+ hwaddr offset = (hwaddr)req->size * i; -+ if (req->df) { -+ addr -= offset; -+ } else { -+ addr += offset; -+ } -+ cpu_physical_memory_rw(addr, val, req->size, rw); -+} -+ -+static inline void read_phys_req_item(hwaddr addr, -+ ioreq_t *req, uint32_t i, void *val) -+{ -+ rw_phys_req_item(addr, req, i, val, 0); -+} -+static inline void write_phys_req_item(hwaddr addr, -+ ioreq_t *req, uint32_t i, void *val) -+{ -+ rw_phys_req_item(addr, req, i, val, 1); -+} -+ -+ -+void cpu_ioreq_pio(ioreq_t *req) -+{ -+ uint32_t i; -+ -+ trace_cpu_ioreq_pio(req, req->dir, req->df, req->data_is_ptr, req->addr, -+ req->data, req->count, req->size); -+ -+ if (req->size > sizeof(uint32_t)) { -+ hw_error("PIO: bad size (%u)", req->size); -+ } -+ -+ if (req->dir == IOREQ_READ) { -+ if (!req->data_is_ptr) { -+ req->data = do_inp(req->addr, req->size); -+ trace_cpu_ioreq_pio_read_reg(req, req->data, req->addr, -+ req->size); -+ } else { -+ uint32_t tmp; -+ -+ for (i = 0; i < req->count; i++) { -+ tmp = do_inp(req->addr, req->size); -+ write_phys_req_item(req->data, req, i, &tmp); -+ } -+ } -+ } else if (req->dir == IOREQ_WRITE) { -+ if (!req->data_is_ptr) { -+ trace_cpu_ioreq_pio_write_reg(req, req->data, req->addr, -+ req->size); -+ do_outp(req->addr, req->size, req->data); -+ } else { -+ for (i = 0; i < req->count; i++) { -+ uint32_t tmp = 0; -+ -+ read_phys_req_item(req->data, req, i, &tmp); -+ do_outp(req->addr, req->size, tmp); -+ } -+ } -+ } -+} -+ -+static void cpu_ioreq_move(ioreq_t *req) -+{ -+ uint32_t i; -+ -+ trace_cpu_ioreq_move(req, req->dir, req->df, req->data_is_ptr, req->addr, -+ req->data, req->count, req->size); -+ -+ if (req->size > sizeof(req->data)) { -+ hw_error("MMIO: bad size (%u)", req->size); -+ } -+ -+ if (!req->data_is_ptr) { -+ if (req->dir == IOREQ_READ) { -+ for (i = 0; i < req->count; i++) { -+ read_phys_req_item(req->addr, req, i, &req->data); -+ } -+ } else if (req->dir == IOREQ_WRITE) { -+ for (i = 0; i < req->count; i++) { -+ write_phys_req_item(req->addr, req, i, &req->data); -+ } -+ } -+ } else { -+ uint64_t tmp; -+ -+ if (req->dir == IOREQ_READ) { -+ for (i = 0; i < req->count; i++) { -+ read_phys_req_item(req->addr, req, i, &tmp); -+ write_phys_req_item(req->data, req, i, &tmp); -+ } -+ } else if (req->dir == IOREQ_WRITE) { -+ for (i = 0; i < req->count; i++) { -+ read_phys_req_item(req->data, req, i, &tmp); -+ write_phys_req_item(req->addr, req, i, &tmp); -+ } -+ } -+ } -+} -+ -+static void cpu_ioreq_config(XenIOState *state, ioreq_t *req) -+{ -+ uint32_t sbdf = req->addr >> 32; -+ uint32_t reg = req->addr; -+ XenPciDevice *xendev; -+ -+ if (req->size != sizeof(uint8_t) && req->size != sizeof(uint16_t) && -+ req->size != sizeof(uint32_t)) { -+ hw_error("PCI config access: bad size (%u)", req->size); -+ } -+ -+ if (req->count != 1) { -+ hw_error("PCI config access: bad count (%u)", req->count); -+ } -+ -+ QLIST_FOREACH(xendev, &state->dev_list, entry) { -+ if (xendev->sbdf != sbdf) { -+ continue; -+ } -+ -+ if (!req->data_is_ptr) { -+ if (req->dir == IOREQ_READ) { -+ req->data = pci_host_config_read_common( -+ xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -+ req->size); -+ trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, -+ req->size, req->data); -+ } else if (req->dir == IOREQ_WRITE) { -+ trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, -+ req->size, req->data); -+ pci_host_config_write_common( -+ xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -+ req->data, req->size); -+ } -+ } else { -+ uint32_t tmp; -+ -+ if (req->dir == IOREQ_READ) { -+ tmp = pci_host_config_read_common( -+ xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -+ req->size); -+ trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, -+ req->size, tmp); -+ write_phys_req_item(req->data, req, 0, &tmp); -+ } else if (req->dir == IOREQ_WRITE) { -+ read_phys_req_item(req->data, req, 0, &tmp); -+ trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, -+ req->size, tmp); -+ pci_host_config_write_common( -+ xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, -+ tmp, req->size); -+ } -+ } -+ } -+} -+ -+static void handle_ioreq(XenIOState *state, ioreq_t *req) -+{ -+ trace_handle_ioreq(req, req->type, req->dir, req->df, req->data_is_ptr, -+ req->addr, req->data, req->count, req->size); -+ -+ if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && -+ (req->size < sizeof (target_ulong))) { -+ req->data &= ((target_ulong) 1 << (8 * req->size)) - 1; -+ } -+ -+ if (req->dir == IOREQ_WRITE) -+ trace_handle_ioreq_write(req, req->type, req->df, req->data_is_ptr, -+ req->addr, req->data, req->count, req->size); -+ -+ switch (req->type) { -+ case IOREQ_TYPE_PIO: -+ cpu_ioreq_pio(req); -+ break; -+ case IOREQ_TYPE_COPY: -+ cpu_ioreq_move(req); -+ break; -+ case IOREQ_TYPE_TIMEOFFSET: -+ break; -+ case IOREQ_TYPE_INVALIDATE: -+ xen_invalidate_map_cache(); -+ break; -+ case IOREQ_TYPE_PCI_CONFIG: -+ cpu_ioreq_config(state, req); -+ break; -+ default: -+ arch_handle_ioreq(state, req); -+ } -+ if (req->dir == IOREQ_READ) { -+ trace_handle_ioreq_read(req, req->type, req->df, req->data_is_ptr, -+ req->addr, req->data, req->count, req->size); -+ } -+} -+ -+static bool handle_buffered_iopage(XenIOState *state) -+{ -+ buffered_iopage_t *buf_page = state->buffered_io_page; -+ buf_ioreq_t *buf_req = NULL; -+ bool handled_ioreq = false; -+ ioreq_t req; -+ int qw; -+ -+ if (!buf_page) { -+ return 0; -+ } -+ -+ memset(&req, 0x00, sizeof(req)); -+ req.state = STATE_IOREQ_READY; -+ req.count = 1; -+ req.dir = IOREQ_WRITE; -+ -+ for (;;) { -+ uint32_t rdptr = buf_page->read_pointer, wrptr; -+ -+ xen_rmb(); -+ wrptr = buf_page->write_pointer; -+ xen_rmb(); -+ if (rdptr != buf_page->read_pointer) { -+ continue; -+ } -+ if (rdptr == wrptr) { -+ break; -+ } -+ buf_req = &buf_page->buf_ioreq[rdptr % IOREQ_BUFFER_SLOT_NUM]; -+ req.size = 1U << buf_req->size; -+ req.addr = buf_req->addr; -+ req.data = buf_req->data; -+ req.type = buf_req->type; -+ xen_rmb(); -+ qw = (req.size == 8); -+ if (qw) { -+ if (rdptr + 1 == wrptr) { -+ hw_error("Incomplete quad word buffered ioreq"); -+ } -+ buf_req = &buf_page->buf_ioreq[(rdptr + 1) % -+ IOREQ_BUFFER_SLOT_NUM]; -+ req.data |= ((uint64_t)buf_req->data) << 32; -+ xen_rmb(); -+ } -+ -+ handle_ioreq(state, &req); -+ -+ /* Only req.data may get updated by handle_ioreq(), albeit even that -+ * should not happen as such data would never make it to the guest (we -+ * can only usefully see writes here after all). -+ */ -+ assert(req.state == STATE_IOREQ_READY); -+ assert(req.count == 1); -+ assert(req.dir == IOREQ_WRITE); -+ assert(!req.data_is_ptr); -+ -+ qatomic_add(&buf_page->read_pointer, qw + 1); -+ } -+ -+ return handled_ioreq; -+} -+ -+static void handle_buffered_io(void *opaque) -+{ -+ XenIOState *state = opaque; -+ -+ if (handle_buffered_iopage(state)) { -+ timer_mod(state->buffered_io_timer, -+ BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); -+ } else { -+ timer_del(state->buffered_io_timer); -+ xenevtchn_unmask(state->xce_handle, state->bufioreq_local_port); -+ } -+} -+ -+static void cpu_handle_ioreq(void *opaque) -+{ -+ XenIOState *state = opaque; -+ ioreq_t *req = cpu_get_ioreq(state); -+ -+ handle_buffered_iopage(state); -+ if (req) { -+ ioreq_t copy = *req; -+ -+ xen_rmb(); -+ handle_ioreq(state, ©); -+ req->data = copy.data; -+ -+ if (req->state != STATE_IOREQ_INPROCESS) { -+ fprintf(stderr, "Badness in I/O request ... not in service?!: " -+ "%x, ptr: %x, port: %"PRIx64", " -+ "data: %"PRIx64", count: %u, size: %u, type: %u\n", -+ req->state, req->data_is_ptr, req->addr, -+ req->data, req->count, req->size, req->type); -+ destroy_hvm_domain(false); -+ return; -+ } -+ -+ xen_wmb(); /* Update ioreq contents /then/ update state. */ -+ -+ /* -+ * We do this before we send the response so that the tools -+ * have the opportunity to pick up on the reset before the -+ * guest resumes and does a hlt with interrupts disabled which -+ * causes Xen to powerdown the domain. -+ */ -+ if (runstate_is_running()) { -+ ShutdownCause request; -+ -+ if (qemu_shutdown_requested_get()) { -+ destroy_hvm_domain(false); -+ } -+ request = qemu_reset_requested_get(); -+ if (request) { -+ qemu_system_reset(request); -+ destroy_hvm_domain(true); -+ } -+ } -+ -+ req->state = STATE_IORESP_READY; -+ xenevtchn_notify(state->xce_handle, -+ state->ioreq_local_port[state->send_vcpu]); -+ } -+} -+ -+static void xen_main_loop_prepare(XenIOState *state) -+{ -+ int evtchn_fd = -1; -+ -+ if (state->xce_handle != NULL) { -+ evtchn_fd = xenevtchn_fd(state->xce_handle); -+ } -+ -+ state->buffered_io_timer = timer_new_ms(QEMU_CLOCK_REALTIME, handle_buffered_io, -+ state); -+ -+ if (evtchn_fd != -1) { -+ CPUState *cpu_state; -+ -+ DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); -+ CPU_FOREACH(cpu_state) { -+ DPRINTF("%s: cpu_by_vcpu_id[%d]=%p\n", -+ __func__, cpu_state->cpu_index, cpu_state); -+ state->cpu_by_vcpu_id[cpu_state->cpu_index] = cpu_state; -+ } -+ qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); -+ } -+} -+ -+ -+void xen_hvm_change_state_handler(void *opaque, bool running, -+ RunState rstate) -+{ -+ XenIOState *state = opaque; -+ -+ if (running) { -+ xen_main_loop_prepare(state); -+ } -+ -+ xen_set_ioreq_server_state(xen_domid, -+ state->ioservid, -+ (rstate == RUN_STATE_RUNNING)); -+} -+ -+void xen_exit_notifier(Notifier *n, void *data) -+{ -+ XenIOState *state = container_of(n, XenIOState, exit); -+ -+ xen_destroy_ioreq_server(xen_domid, state->ioservid); -+ if (state->fres != NULL) { -+ xenforeignmemory_unmap_resource(xen_fmem, state->fres); -+ } -+ -+ xenevtchn_close(state->xce_handle); -+ xs_daemon_close(state->xenstore); -+} -+ -+static int xen_map_ioreq_server(XenIOState *state) -+{ -+ void *addr = NULL; -+ xen_pfn_t ioreq_pfn; -+ xen_pfn_t bufioreq_pfn; -+ evtchn_port_t bufioreq_evtchn; -+ int rc; -+ -+ /* -+ * Attempt to map using the resource API and fall back to normal -+ * foreign mapping if this is not supported. -+ */ -+ QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq != 0); -+ QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) != 1); -+ state->fres = xenforeignmemory_map_resource(xen_fmem, xen_domid, -+ XENMEM_resource_ioreq_server, -+ state->ioservid, 0, 2, -+ &addr, -+ PROT_READ | PROT_WRITE, 0); -+ if (state->fres != NULL) { -+ trace_xen_map_resource_ioreq(state->ioservid, addr); -+ state->buffered_io_page = addr; -+ state->shared_page = addr + TARGET_PAGE_SIZE; -+ } else if (errno != EOPNOTSUPP) { -+ error_report("failed to map ioreq server resources: error %d handle=%p", -+ errno, xen_xc); -+ return -1; -+ } -+ -+ rc = xen_get_ioreq_server_info(xen_domid, state->ioservid, -+ (state->shared_page == NULL) ? -+ &ioreq_pfn : NULL, -+ (state->buffered_io_page == NULL) ? -+ &bufioreq_pfn : NULL, -+ &bufioreq_evtchn); -+ if (rc < 0) { -+ error_report("failed to get ioreq server info: error %d handle=%p", -+ errno, xen_xc); -+ return rc; -+ } -+ -+ if (state->shared_page == NULL) { -+ DPRINTF("shared page at pfn %lx\n", ioreq_pfn); -+ -+ state->shared_page = xenforeignmemory_map(xen_fmem, xen_domid, -+ PROT_READ | PROT_WRITE, -+ 1, &ioreq_pfn, NULL); -+ if (state->shared_page == NULL) { -+ error_report("map shared IO page returned error %d handle=%p", -+ errno, xen_xc); -+ } -+ } -+ -+ if (state->buffered_io_page == NULL) { -+ DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); -+ -+ state->buffered_io_page = xenforeignmemory_map(xen_fmem, xen_domid, -+ PROT_READ | PROT_WRITE, -+ 1, &bufioreq_pfn, -+ NULL); -+ if (state->buffered_io_page == NULL) { -+ error_report("map buffered IO page returned error %d", errno); -+ return -1; -+ } -+ } -+ -+ if (state->shared_page == NULL || state->buffered_io_page == NULL) { -+ return -1; -+ } -+ -+ DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); -+ -+ state->bufioreq_remote_port = bufioreq_evtchn; -+ -+ return 0; -+} -+ -+void xen_shutdown_fatal_error(const char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vfprintf(stderr, fmt, ap); -+ va_end(ap); -+ fprintf(stderr, "Will destroy the domain.\n"); -+ /* destroy the domain */ -+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); -+} -+ -+void destroy_hvm_domain(bool reboot) -+{ -+ xc_interface *xc_handle; -+ int sts; -+ int rc; -+ -+ unsigned int reason = reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff; -+ -+ if (xen_dmod) { -+ rc = xendevicemodel_shutdown(xen_dmod, xen_domid, reason); -+ if (!rc) { -+ return; -+ } -+ if (errno != ENOTTY /* old Xen */) { -+ perror("xendevicemodel_shutdown failed"); -+ } -+ /* well, try the old thing then */ -+ } -+ -+ xc_handle = xc_interface_open(0, 0, 0); -+ if (xc_handle == NULL) { -+ fprintf(stderr, "Cannot acquire xenctrl handle\n"); -+ } else { -+ sts = xc_domain_shutdown(xc_handle, xen_domid, reason); -+ if (sts != 0) { -+ fprintf(stderr, "xc_domain_shutdown failed to issue %s, " -+ "sts %d, %s\n", reboot ? "reboot" : "poweroff", -+ sts, strerror(errno)); -+ } else { -+ fprintf(stderr, "Issued domain %d %s\n", xen_domid, -+ reboot ? "reboot" : "poweroff"); -+ } -+ xc_interface_close(xc_handle); -+ } -+} -+ -+void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, -+ Error **errp) -+{ -+ unsigned long nr_pfn; -+ xen_pfn_t *pfn_list; -+ int i; -+ -+ if (runstate_check(RUN_STATE_INMIGRATE)) { -+ /* RAM already populated in Xen */ -+ fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT -+ " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE\n", -+ __func__, size, ram_addr); -+ return; -+ } -+ -+ if (mr == &ram_memory) { -+ return; -+ } -+ -+ trace_xen_ram_alloc(ram_addr, size); -+ -+ nr_pfn = size >> TARGET_PAGE_BITS; -+ pfn_list = g_malloc(sizeof (*pfn_list) * nr_pfn); -+ -+ for (i = 0; i < nr_pfn; i++) { -+ pfn_list[i] = (ram_addr >> TARGET_PAGE_BITS) + i; -+ } -+ -+ if (xc_domain_populate_physmap_exact(xen_xc, xen_domid, nr_pfn, 0, 0, pfn_list)) { -+ error_setg(errp, "xen: failed to populate ram at " RAM_ADDR_FMT, -+ ram_addr); -+ } -+ -+ g_free(pfn_list); -+} -+ -+void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, -+ MemoryListener xen_memory_listener) -+{ -+ int i, rc; -+ -+ state->xce_handle = xenevtchn_open(NULL, 0); -+ if (state->xce_handle == NULL) { -+ perror("xen: event channel open"); -+ goto err; -+ } -+ -+ state->xenstore = xs_daemon_open(); -+ if (state->xenstore == NULL) { -+ perror("xen: xenstore open"); -+ goto err; -+ } -+ -+ xen_create_ioreq_server(xen_domid, &state->ioservid); -+ -+ state->exit.notify = xen_exit_notifier; -+ qemu_add_exit_notifier(&state->exit); -+ -+ /* -+ * Register wake-up support in QMP query-current-machine API -+ */ -+ qemu_register_wakeup_support(); -+ -+ rc = xen_map_ioreq_server(state); -+ if (rc < 0) { -+ goto err; -+ } -+ -+ /* Note: cpus is empty at this point in init */ -+ state->cpu_by_vcpu_id = g_new0(CPUState *, max_cpus); -+ -+ rc = xen_set_ioreq_server_state(xen_domid, state->ioservid, true); -+ if (rc < 0) { -+ error_report("failed to enable ioreq server info: error %d handle=%p", -+ errno, xen_xc); -+ goto err; -+ } -+ -+ state->ioreq_local_port = g_new0(evtchn_port_t, max_cpus); -+ -+ /* FIXME: how about if we overflow the page here? */ -+ for (i = 0; i < max_cpus; i++) { -+ rc = xenevtchn_bind_interdomain(state->xce_handle, xen_domid, -+ xen_vcpu_eport(state->shared_page, i)); -+ if (rc == -1) { -+ error_report("shared evtchn %d bind error %d", i, errno); -+ goto err; -+ } -+ state->ioreq_local_port[i] = rc; -+ } -+ -+ rc = xenevtchn_bind_interdomain(state->xce_handle, xen_domid, -+ state->bufioreq_remote_port); -+ if (rc == -1) { -+ error_report("buffered evtchn bind error %d", errno); -+ goto err; -+ } -+ state->bufioreq_local_port = rc; -+ -+ /* Init RAM management */ -+#ifdef XEN_COMPAT_PHYSMAP -+ xen_map_cache_init(xen_phys_offset_to_gaddr, state); -+#else -+ xen_map_cache_init(NULL, state); -+#endif -+ -+ qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); -+ -+ state->memory_listener = xen_memory_listener; -+ memory_listener_register(&state->memory_listener, &address_space_memory); -+ -+ state->io_listener = xen_io_listener; -+ memory_listener_register(&state->io_listener, &address_space_io); -+ -+ state->device_listener = xen_device_listener; -+ QLIST_INIT(&state->dev_list); -+ device_listener_register(&state->device_listener); -+ -+ xen_bus_init(); -+ -+ /* Initialize backend core & drivers */ -+ if (xen_be_init() != 0) { -+ error_report("xen backend core setup failed"); -+ goto err; -+ } -+ xen_be_register_common(); -+ -+ return; -+err: -+ error_report("xen hardware virtual machine initialisation failed"); -+ exit(1); -+} -diff --git a/include/hw/i386/xen_arch_hvm.h b/include/hw/i386/xen_arch_hvm.h -index 1b2c71ba4f..1000f8f543 100644 ---- a/include/hw/i386/xen_arch_hvm.h -+++ b/include/hw/i386/xen_arch_hvm.h -@@ -2,6 +2,7 @@ - #define HW_XEN_ARCH_I386_HVM_H - - #include -+#include "hw/xen/xen-hvm-common.h" - - void arch_handle_ioreq(XenIOState *state, ioreq_t *req); - void arch_xen_set_memory(XenIOState *state, -diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-common.h -new file mode 100644 -index 0000000000..2979f84ee2 ---- /dev/null -+++ b/include/hw/xen/xen-hvm-common.h -@@ -0,0 +1,98 @@ -+#ifndef HW_XEN_HVM_COMMON_H -+#define HW_XEN_HVM_COMMON_H -+ -+#include "qemu/osdep.h" -+#include "qemu/units.h" -+ -+#include "cpu.h" -+#include "hw/pci/pci.h" -+#include "hw/hw.h" -+#include "hw/xen/xen_common.h" -+#include "sysemu/runstate.h" -+#include "sysemu/sysemu.h" -+#include "sysemu/xen.h" -+#include "sysemu/xen-mapcache.h" -+ -+#include -+ -+extern MemoryRegion ram_memory; -+extern MemoryListener xen_io_listener; -+extern DeviceListener xen_device_listener; -+ -+//#define DEBUG_XEN_HVM -+ -+#ifdef DEBUG_XEN_HVM -+#define DPRINTF(fmt, ...) \ -+ do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) -+#else -+#define DPRINTF(fmt, ...) \ -+ do { } while (0) -+#endif -+ -+static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i) -+{ -+ return shared_page->vcpu_ioreq[i].vp_eport; -+} -+static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu) -+{ -+ return &shared_page->vcpu_ioreq[vcpu]; -+} -+ -+#define BUFFER_IO_MAX_DELAY 100 -+ -+typedef struct XenPhysmap { -+ hwaddr start_addr; -+ ram_addr_t size; -+ const char *name; -+ hwaddr phys_offset; -+ -+ QLIST_ENTRY(XenPhysmap) list; -+} XenPhysmap; -+ -+typedef struct XenPciDevice { -+ PCIDevice *pci_dev; -+ uint32_t sbdf; -+ QLIST_ENTRY(XenPciDevice) entry; -+} XenPciDevice; -+ -+typedef struct XenIOState { -+ ioservid_t ioservid; -+ shared_iopage_t *shared_page; -+ buffered_iopage_t *buffered_io_page; -+ xenforeignmemory_resource_handle *fres; -+ QEMUTimer *buffered_io_timer; -+ CPUState **cpu_by_vcpu_id; -+ /* the evtchn port for polling the notification, */ -+ evtchn_port_t *ioreq_local_port; -+ /* evtchn remote and local ports for buffered io */ -+ evtchn_port_t bufioreq_remote_port; -+ evtchn_port_t bufioreq_local_port; -+ /* the evtchn fd for polling */ -+ xenevtchn_handle *xce_handle; -+ /* which vcpu we are serving */ -+ int send_vcpu; -+ -+ struct xs_handle *xenstore; -+ MemoryListener memory_listener; -+ MemoryListener io_listener; -+ QLIST_HEAD(, XenPciDevice) dev_list; -+ DeviceListener device_listener; -+ -+ Notifier exit; -+} XenIOState; -+ -+void xen_exit_notifier(Notifier *n, void *data); -+ -+void xen_region_add(MemoryListener *listener, MemoryRegionSection *section); -+void xen_region_del(MemoryListener *listener, MemoryRegionSection *section); -+void xen_io_add(MemoryListener *listener, MemoryRegionSection *section); -+void xen_io_del(MemoryListener *listener, MemoryRegionSection *section); -+void xen_device_realize(DeviceListener *listener, DeviceState *dev); -+void xen_device_unrealize(DeviceListener *listener, DeviceState *dev); -+ -+void xen_hvm_change_state_handler(void *opaque, bool running, RunState rstate); -+void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, -+ MemoryListener xen_memory_listener); -+ -+void cpu_ioreq_pio(ioreq_t *req); -+#endif /* HW_XEN_HVM_COMMON_H */ --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-mapcache-Fix-build-on-Arm.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-mapcache-Fix-build-on-Arm.patch deleted file mode 100644 index 7ff202ff..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-mapcache-Fix-build-on-Arm.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 2aca3ff63a5d5897cd32e0030569623f0c454f2c Mon Sep 17 00:00:00 2001 -From: Oleksandr Tyshchenko -Date: Mon, 19 Sep 2022 21:59:55 +0300 -Subject: [PATCH 7/8] xen-mapcache: Fix build on Arm -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -../hw/xen/xen-mapcache.c: In function ‘xen_map_grant_dyn’: -../hw/xen/xen-mapcache.c:668:9: error: ‘refs’ may be used uninitialized - in this function [-Werror=maybe-uninitialized] - 668 | g_free(refs); - | ^~~~~~~~~~~~ -cc1: all warnings being treated as errors - -Signed-off-by: Oleksandr Tyshchenko -Acked-by: Stefano Stabellini ---- - hw/xen/xen-mapcache.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c -index f81b75d216..6544e331e0 100644 ---- a/hw/xen/xen-mapcache.c -+++ b/hw/xen/xen-mapcache.c -@@ -620,7 +620,7 @@ static void *xen_map_grant_dyn(MemoryRegion **mr, hwaddr addr, hwaddr *plen, - unsigned int i; - unsigned int nrefs = (page_off + *plen + XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT; - uint32_t ref = (addr - XEN_GRANT_ADDR_OFF) >> XC_PAGE_SHIFT; -- uint32_t *refs; -+ uint32_t *refs = NULL; - unsigned int prot = PROT_READ; - struct XENMappedGrantRegion *mgr = NULL; - --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-skip-ioreq-creation-on-ioreq-registration-failur.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-skip-ioreq-creation-on-ioreq-registration-failur.patch deleted file mode 100644 index 83a18c08..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0007-xen-skip-ioreq-creation-on-ioreq-registration-failur.patch +++ /dev/null @@ -1,42 +0,0 @@ -From fa475ec44fc78ff246e6536c8b9d408abadbb4a4 Mon Sep 17 00:00:00 2001 -From: Stefano Stabellini -Date: Fri, 1 Jul 2022 18:50:59 -0700 -Subject: [PATCH 07/16] xen: skip ioreq creation on ioreq registration failure - -On ARM it is possible to have a functioning xenpv machine with only the -PV backends and no IOREQ server. If the IOREQ server creation fails -continue to the PV backends initialization. - -Signed-off-by: Stefano Stabellini ---- - hw/xen/xen-hvm-common.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c -index 67f76f6010..7e7d23397f 100644 ---- a/hw/xen/xen-hvm-common.c -+++ b/hw/xen/xen-hvm-common.c -@@ -780,7 +780,11 @@ void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, - goto err; - } - -- xen_create_ioreq_server(xen_domid, &state->ioservid); -+ rc = xen_create_ioreq_server(xen_domid, &state->ioservid); -+ if (rc) { -+ DPRINTF("xen: failed to create ioreq server\n"); -+ goto no_ioreq; -+ } - - state->exit.notify = xen_exit_notifier; - qemu_add_exit_notifier(&state->exit); -@@ -845,6 +849,7 @@ void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, - QLIST_INIT(&state->dev_list); - device_listener_register(&state->device_listener); - -+no_ioreq: - xen_bus_init(); - - /* Initialize backend core & drivers */ --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-accel-xen-xen-all-export-xenstore_record_dm_state.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-accel-xen-xen-all-export-xenstore_record_dm_state.patch deleted file mode 100644 index 881076fb..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-accel-xen-xen-all-export-xenstore_record_dm_state.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 13443fe86bb100849c55b41873f48e0b121c7bc0 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Fri, 1 Jul 2022 17:28:14 -0700 -Subject: [PATCH 08/16] accel/xen/xen-all: export xenstore_record_dm_state - -Signed-off-by: Vikram Garhwal -Signed-off-by: Stefano Stabellini -Reviewed-by: Stefano Stabellini ---- - accel/xen/xen-all.c | 2 +- - include/hw/xen/xen.h | 2 ++ - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c -index 69aa7d018b..276625b78b 100644 ---- a/accel/xen/xen-all.c -+++ b/accel/xen/xen-all.c -@@ -100,7 +100,7 @@ void xenstore_store_pv_console_info(int i, Chardev *chr) - } - - --static void xenstore_record_dm_state(struct xs_handle *xs, const char *state) -+void xenstore_record_dm_state(struct xs_handle *xs, const char *state) - { - char path[50]; - -diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h -index afdf9c436a..31e9538a5c 100644 ---- a/include/hw/xen/xen.h -+++ b/include/hw/xen/xen.h -@@ -9,6 +9,7 @@ - */ - - #include "exec/cpu-common.h" -+#include - - /* xen-machine.c */ - enum xen_mode { -@@ -31,5 +32,6 @@ qemu_irq *xen_interrupt_controller_init(void); - void xenstore_store_pv_console_info(int i, Chardev *chr); - - void xen_register_framebuffer(struct MemoryRegion *mr); -+void xenstore_record_dm_state(struct xs_handle *xs, const char *state); - - #endif /* QEMU_HW_XEN_H */ --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-hw-arm-Add-grant-mapping.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-hw-arm-Add-grant-mapping.patch deleted file mode 100644 index 3b83d229..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0008-hw-arm-Add-grant-mapping.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b5e5f60de37bb6f71bc34ecb989c31ef5c834272 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Tue, 31 Jan 2023 21:46:43 +0000 -Subject: [PATCH 8/8] hw: arm: Add grant mapping. - -Add support for grant mapping and change qemu machine name to xenpvh. - -Signed-off-by: Vikram Garhwal -Acked-by: Stefano Stabellini ---- - hw/arm/xen_arm.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -index 4ac425a3c5..392bed7367 100644 ---- a/hw/arm/xen_arm.c -+++ b/hw/arm/xen_arm.c -@@ -35,7 +35,7 @@ - #include "sysemu/tpm.h" - #include "hw/xen/arch_hvm.h" - --#define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpv") -+#define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") - OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) - - static MemoryListener xen_memory_listener = { -@@ -115,6 +115,9 @@ static void xen_init_ram(MachineState *machine) - DPRINTF("Initialized region xen.ram.hi: base 0x%llx size 0x%lx\n", - GUEST_RAM1_BASE, ram_size[1]); - } -+ -+ DPRINTF("init grant ram mapping for XEN\n"); -+ ram_grants = *xen_init_grant_ram(); - } - - void arch_handle_ioreq(XenIOState *state, ioreq_t *req) --- -2.25.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0009-xen-hvm-enable-xen-hvm-common-build-for-ARM.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0009-xen-hvm-enable-xen-hvm-common-build-for-ARM.patch deleted file mode 100644 index 1b1aea76..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0009-xen-hvm-enable-xen-hvm-common-build-for-ARM.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 2e6a9f464fd1f247c41ce3666ff3e3f66920d0b7 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Fri, 1 Jul 2022 17:28:15 -0700 -Subject: [PATCH 09/16] xen-hvm: enable xen-hvm-common build for ARM - -Add CONFIG_XEN for aarch64 device and change xen-hvm-common.c to -support build for ARM targets. - -Signed-off-by: Vikram Garhwal -Acked-by: Stefano Stabellini -Signed-off-by: Stefano Stabellini ---- - hw/arm/meson.build | 1 + - meson.build | 2 +- - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/hw/arm/meson.build b/hw/arm/meson.build -index 92f9f6e000..3aac913bfd 100644 ---- a/hw/arm/meson.build -+++ b/hw/arm/meson.build -@@ -62,5 +62,6 @@ arm_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d-sabre. - arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c', 'smmuv3.c')) - arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c')) - arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c')) -+arm_ss.add_all(xen_ss) - - hw_arch += {'arm': arm_ss} -diff --git a/meson.build b/meson.build -index 5c6b5a1c75..b94f0cd76e 100644 ---- a/meson.build -+++ b/meson.build -@@ -125,7 +125,7 @@ endif - if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] - # i386 emulator provides xenpv machine type for multiple architectures - accelerator_targets += { -- 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], -+ 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu', 'aarch64-softmmu'], - } - endif - if cpu in ['x86', 'x86_64'] --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0010-hw-arm-introduce-xenpv-machine.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0010-hw-arm-introduce-xenpv-machine.patch deleted file mode 100644 index fc979b52..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0010-hw-arm-introduce-xenpv-machine.patch +++ /dev/null @@ -1,230 +0,0 @@ -From 5618a18b1f12d567a8ef85240d55b841e18ef472 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Fri, 1 Jul 2022 17:28:16 -0700 -Subject: [PATCH 10/16] hw/arm: introduce xenpv machine - -Create a new machine xenpv which creates a IOREQ server to connect -with Xen. It also creates a tpm-tis-device which connects to swtpm to -support TPM functionalities. - -Xen IOREQ connection expect the TARGET_PAGE_SIZE to 4096, and the xenpv -machine on ARM will have no CPU definitions. We need to define -TARGET_PAGE_SIZE appropriately ourselves. - -Signed-off-by: Vikram Garhwal -Signed-off-by: Stefano Stabellini -Reviewed-by: Stefano Stabellini ---- - hw/arm/meson.build | 1 + - hw/arm/xen_arm.c | 156 ++++++++++++++++++++++++++++++++++ - include/hw/arm/xen_arch_hvm.h | 12 +++ - include/hw/xen/arch_hvm.h | 2 + - 4 files changed, 171 insertions(+) - create mode 100644 hw/arm/xen_arm.c - create mode 100644 include/hw/arm/xen_arch_hvm.h - -diff --git a/hw/arm/meson.build b/hw/arm/meson.build -index 3aac913bfd..0cae024374 100644 ---- a/hw/arm/meson.build -+++ b/hw/arm/meson.build -@@ -62,6 +62,7 @@ arm_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d-sabre. - arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c', 'smmuv3.c')) - arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c')) - arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c')) -+arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c')) - arm_ss.add_all(xen_ss) - - hw_arch += {'arm': arm_ss} -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -new file mode 100644 -index 0000000000..0922e3db84 ---- /dev/null -+++ b/hw/arm/xen_arm.c -@@ -0,0 +1,156 @@ -+/* -+ * QEMU ARM Xen PV Machine -+ * -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this software and associated documentation files (the "Software"), to deal -+ * in the Software without restriction, including without limitation the rights -+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+ * copies of the Software, and to permit persons to whom the Software is -+ * furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -+ * THE SOFTWARE. -+ */ -+ -+#include "qemu/osdep.h" -+#include "qemu/error-report.h" -+#include "qapi/qapi-commands-migration.h" -+#include "hw/boards.h" -+#include "hw/sysbus.h" -+#include "sysemu/block-backend.h" -+#include "sysemu/tpm_backend.h" -+#include "sysemu/sysemu.h" -+#include "hw/xen/xen-legacy-backend.h" -+#include "hw/xen/xen-hvm-common.h" -+#include "sysemu/tpm.h" -+#include "hw/xen/arch_hvm.h" -+ -+#define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpv") -+OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) -+ -+static MemoryListener xen_memory_listener = { -+ .region_add = xen_region_add, -+ .region_del = xen_region_del, -+ .log_start = NULL, -+ .log_stop = NULL, -+ .log_sync = NULL, -+ .log_global_start = NULL, -+ .log_global_stop = NULL, -+ .priority = 10, -+}; -+ -+struct XenArmState { -+ /*< private >*/ -+ MachineState parent; -+ -+ XenIOState *state; -+}; -+ -+void arch_handle_ioreq(XenIOState *state, ioreq_t *req) -+{ -+ hw_error("Invalid ioreq type 0x%x\n", req->type); -+ -+ return; -+} -+ -+void arch_xen_set_memory(XenIOState *state,MemoryRegionSection *section, -+ bool add) -+{ -+} -+ -+void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) -+{ -+} -+ -+void qmp_xen_set_global_dirty_log(bool enable, Error **errp) -+{ -+} -+ -+static int xen_init_ioreq(XenIOState *state, unsigned int max_cpus) -+{ -+ xen_dmod = xendevicemodel_open(0, 0); -+ xen_xc = xc_interface_open(0, 0, 0); -+ -+ if (xen_xc == NULL) { -+ perror("xen: can't open xen interface\n"); -+ return -1; -+ } -+ -+ xen_fmem = xenforeignmemory_open(0, 0); -+ if (xen_fmem == NULL) { -+ perror("xen: can't open xen fmem interface\n"); -+ xc_interface_close(xen_xc); -+ return -1; -+ } -+ -+ xen_register_ioreq(state, max_cpus, xen_memory_listener); -+ -+ xenstore_record_dm_state(xenstore, "running"); -+ -+ return 0; -+} -+ -+ -+static void xen_arm_init(MachineState *machine) -+{ -+ DeviceState *dev; -+ SysBusDevice *busdev; -+ Error *errp = NULL; -+ XenArmState *xam = XEN_ARM(machine); -+ -+ xam->state = g_new0(XenIOState, 1); -+ -+ if (xen_init_ioreq(xam->state, machine->smp.cpus)) { -+ return; -+ } -+ -+ TPMBackend *be = qemu_find_tpm_be("tpm0"); -+ if (be == NULL) { -+ DPRINTF("Couldn't fine the backend for tpm0\n"); -+ return; -+ } -+ -+ dev = qdev_new(TYPE_TPM_TIS_SYSBUS); -+ object_property_set_link(OBJECT(dev), "tpmdev", OBJECT(be), &errp); -+ object_property_set_str(OBJECT(dev), "tpmdev", be->id, &errp); -+ busdev = SYS_BUS_DEVICE(dev); -+ sysbus_realize_and_unref(busdev, &error_fatal); -+ sysbus_mmio_map(busdev, 0, GUEST_TPM_BASE); -+ -+ DPRINTF("Connected tpmdev at address 0x%lx\n", GUEST_TPM_BASE); -+ -+ return; -+} -+ -+static void xen_arm_machine_class_init(ObjectClass *oc, void *data) -+{ -+ -+ MachineClass *mc = MACHINE_CLASS(oc); -+ mc->desc = "Xen Para-virtualized PC"; -+ mc->init = xen_arm_init; -+ mc->max_cpus = 1; -+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); -+} -+ -+static const TypeInfo xen_arm_machine_type = { -+ .name = TYPE_XEN_ARM, -+ .parent = TYPE_MACHINE, -+ .class_init = xen_arm_machine_class_init, -+ .instance_size = sizeof(XenArmState), -+}; -+ -+static void xen_arm_machine_register_types(void) -+{ -+ type_register_static(&xen_arm_machine_type); -+} -+ -+type_init(xen_arm_machine_register_types) -diff --git a/include/hw/arm/xen_arch_hvm.h b/include/hw/arm/xen_arch_hvm.h -new file mode 100644 -index 0000000000..f645dfec28 ---- /dev/null -+++ b/include/hw/arm/xen_arch_hvm.h -@@ -0,0 +1,12 @@ -+#ifndef HW_XEN_ARCH_ARM_HVM_H -+#define HW_XEN_ARCH_ARM_HVM_H -+ -+#include -+void arch_handle_ioreq(XenIOState *state, ioreq_t *req); -+void arch_xen_set_memory(XenIOState *state, -+ MemoryRegionSection *section, -+ bool add); -+ -+#undef TARGET_PAGE_SIZE -+#define TARGET_PAGE_SIZE 4096 -+#endif -diff --git a/include/hw/xen/arch_hvm.h b/include/hw/xen/arch_hvm.h -index 26674648d8..c7c515220d 100644 ---- a/include/hw/xen/arch_hvm.h -+++ b/include/hw/xen/arch_hvm.h -@@ -1,3 +1,5 @@ - #if defined(TARGET_I386) || defined(TARGET_X86_64) - #include "hw/i386/xen_arch_hvm.h" -+#elif defined(TARGET_ARM) || defined(TARGET_ARM_64) -+#include "hw/arm/xen_arch_hvm.h" - #endif --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0011-meson.build-do-not-set-have_xen_pci_passthrough-for-.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0011-meson.build-do-not-set-have_xen_pci_passthrough-for-.patch deleted file mode 100644 index dad3029f..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0011-meson.build-do-not-set-have_xen_pci_passthrough-for-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f4ff3490639dea08fb70ec69d60fe73ef479073b Mon Sep 17 00:00:00 2001 -From: Stefano Stabellini -Date: Thu, 7 Jul 2022 14:03:41 -0700 -Subject: [PATCH 11/16] meson.build: do not set have_xen_pci_passthrough for - aarch64 targets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -have_xen_pci_passthrough is only used for Xen x86 VMs. - -Signed-off-by: Stefano Stabellini -Reviewed-by: Alex Bennée ---- - meson.build | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/meson.build b/meson.build -index b94f0cd76e..a4965251ab 100644 ---- a/meson.build -+++ b/meson.build -@@ -1469,6 +1469,8 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ - error_message: 'Xen PCI passthrough requested but Xen not enabled') \ - .require(targetos == 'linux', - error_message: 'Xen PCI passthrough not available on this platform') \ -+ .require(cpu == 'x86' or cpu == 'x86_64', -+ error_message: 'Xen PCI passthrough not available on this platform') \ - .allowed() - - --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0012-xen-arm-call-qemu_find_tpm_be-if-CONFIG_TPM.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0012-xen-arm-call-qemu_find_tpm_be-if-CONFIG_TPM.patch deleted file mode 100644 index f80a0873..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0012-xen-arm-call-qemu_find_tpm_be-if-CONFIG_TPM.patch +++ /dev/null @@ -1,72 +0,0 @@ -From a26982a55fa5f47116b344ca5d411f00c3a2b422 Mon Sep 17 00:00:00 2001 -From: Stefano Stabellini -Date: Thu, 7 Jul 2022 14:35:33 -0700 -Subject: [PATCH 12/16] xen-arm: call qemu_find_tpm_be if CONFIG_TPM - -qemu_find_tpm_be is only availablen when CONFIG_TPM is enabled. -So #ifdef the call to make sure the code builds correctly even when -CONFIG_TPM is not enabled. - -Signed-off-by: Stefano Stabellini ---- - hw/arm/xen_arm.c | 28 +++++++++++++++++----------- - 1 file changed, 17 insertions(+), 11 deletions(-) - -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -index 0922e3db84..f248b5744a 100644 ---- a/hw/arm/xen_arm.c -+++ b/hw/arm/xen_arm.c -@@ -99,26 +99,18 @@ static int xen_init_ioreq(XenIOState *state, unsigned int max_cpus) - return 0; - } - -- --static void xen_arm_init(MachineState *machine) -+static void xen_enable_tpm(void) - { -+#ifdef CONFIG_TPM -+ Error *errp = NULL; - DeviceState *dev; - SysBusDevice *busdev; -- Error *errp = NULL; -- XenArmState *xam = XEN_ARM(machine); -- -- xam->state = g_new0(XenIOState, 1); -- -- if (xen_init_ioreq(xam->state, machine->smp.cpus)) { -- return; -- } - - TPMBackend *be = qemu_find_tpm_be("tpm0"); - if (be == NULL) { - DPRINTF("Couldn't fine the backend for tpm0\n"); - return; - } -- - dev = qdev_new(TYPE_TPM_TIS_SYSBUS); - object_property_set_link(OBJECT(dev), "tpmdev", OBJECT(be), &errp); - object_property_set_str(OBJECT(dev), "tpmdev", be->id, &errp); -@@ -127,6 +119,20 @@ static void xen_arm_init(MachineState *machine) - sysbus_mmio_map(busdev, 0, GUEST_TPM_BASE); - - DPRINTF("Connected tpmdev at address 0x%lx\n", GUEST_TPM_BASE); -+#endif -+} -+ -+static void xen_arm_init(MachineState *machine) -+{ -+ XenArmState *xam = XEN_ARM(machine); -+ -+ xam->state = g_new0(XenIOState, 1); -+ -+ if (xen_init_ioreq(xam->state, machine->smp.cpus)) { -+ return; -+ } -+ -+ xen_enable_tpm(); - - return; - } --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0013-arm-xenpv-fix-TPM-address-print-warning.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0013-arm-xenpv-fix-TPM-address-print-warning.patch deleted file mode 100644 index 1aa09efb..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0013-arm-xenpv-fix-TPM-address-print-warning.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c5b128668d9cd1e1cb4da80d5bc8aaebc6ff2e19 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Fri, 23 Dec 2022 00:06:29 +0000 -Subject: [PATCH 13/16] arm: xenpv: fix TPM address print warning - -Signed-off-by: Vikram Garhwal -Acked-by: Stefano Stabellini ---- - hw/arm/xen_arm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -index f248b5744a..153cedfeb4 100644 ---- a/hw/arm/xen_arm.c -+++ b/hw/arm/xen_arm.c -@@ -118,7 +118,7 @@ static void xen_enable_tpm(void) - sysbus_realize_and_unref(busdev, &error_fatal); - sysbus_mmio_map(busdev, 0, GUEST_TPM_BASE); - -- DPRINTF("Connected tpmdev at address 0x%lx\n", GUEST_TPM_BASE); -+ DPRINTF("Connected tpmdev at address 0x%llx\n", GUEST_TPM_BASE); - #endif - } - --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0014-xen_arm-Create-virtio-mmio-devices-during-initializa.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0014-xen_arm-Create-virtio-mmio-devices-during-initializa.patch deleted file mode 100644 index a6925acf..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0014-xen_arm-Create-virtio-mmio-devices-during-initializa.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 3dc39d71c3652bea37dc955d5dbf8cd391d2aed0 Mon Sep 17 00:00:00 2001 -From: Oleksandr Tyshchenko -Date: Sat, 30 Jul 2022 17:51:19 +0300 -Subject: [PATCH 14/16] xen_arm: Create virtio-mmio devices during - initialization - -In order to use virtio backends we need to allocate virtio-mmio -parameters (irq and base) and register corresponding buses. - -Use the constants defined in public header arch-arm.h to be -aligned with the toolstack. So the number of current supported -virtio-mmio devices is 10. - -For the interrupts triggering use already existing on Arm -device-model hypercall. - -The toolstack should then insert the same amount of device nodes -into guest device-tree. - -Signed-off-by: Oleksandr Tyshchenko -Signed-off-by: Vikram Garhwal -Reviewed-by: Stefano Stabellini ---- - hw/arm/xen_arm.c | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -index 153cedfeb4..2012ee7aff 100644 ---- a/hw/arm/xen_arm.c -+++ b/hw/arm/xen_arm.c -@@ -25,6 +25,7 @@ - #include "qemu/error-report.h" - #include "qapi/qapi-commands-migration.h" - #include "hw/boards.h" -+#include "hw/irq.h" - #include "hw/sysbus.h" - #include "sysemu/block-backend.h" - #include "sysemu/tpm_backend.h" -@@ -55,6 +56,32 @@ struct XenArmState { - XenIOState *state; - }; - -+#define VIRTIO_MMIO_DEV_SIZE 0x200 -+ -+#define NR_VIRTIO_MMIO_DEVICES \ -+ (GUEST_VIRTIO_MMIO_SPI_LAST - GUEST_VIRTIO_MMIO_SPI_FIRST) -+ -+static void xen_set_irq(void *opaque, int irq, int level) -+{ -+ xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level); -+} -+ -+static void xen_create_virtio_mmio_devices(XenArmState *xam) -+{ -+ int i; -+ -+ for (i = 0; i < NR_VIRTIO_MMIO_DEVICES; i++) { -+ hwaddr base = GUEST_VIRTIO_MMIO_BASE + i * VIRTIO_MMIO_DEV_SIZE; -+ qemu_irq irq = qemu_allocate_irq(xen_set_irq, NULL, -+ GUEST_VIRTIO_MMIO_SPI_FIRST + i); -+ -+ sysbus_create_simple("virtio-mmio", base, irq); -+ -+ DPRINTF("Created virtio-mmio device %d: irq %d base 0x%lx\n", -+ i, GUEST_VIRTIO_MMIO_SPI_FIRST + i, base); -+ } -+} -+ - void arch_handle_ioreq(XenIOState *state, ioreq_t *req) - { - hw_error("Invalid ioreq type 0x%x\n", req->type); -@@ -132,6 +159,8 @@ static void xen_arm_init(MachineState *machine) - return; - } - -+ xen_create_virtio_mmio_devices(xam); -+ - xen_enable_tpm(); - - return; --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0015-xen_arm-Initialize-RAM-and-add-hi-low-memory-regions.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0015-xen_arm-Initialize-RAM-and-add-hi-low-memory-regions.patch deleted file mode 100644 index 7c2b272d..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0015-xen_arm-Initialize-RAM-and-add-hi-low-memory-regions.patch +++ /dev/null @@ -1,105 +0,0 @@ -From a284a53c5374e19ac37b884f2dd50293e7c8070e Mon Sep 17 00:00:00 2001 -From: Oleksandr Tyshchenko -Date: Sat, 30 Jul 2022 17:18:06 +0300 -Subject: [PATCH 15/16] xen_arm: Initialize RAM and add hi/low memory regions - -In order to use virtio backends we need to initialize RAM for the -xen-mapcache (which is responsible for mapping guest memory using foreign -mapping) to work. Calculate and add hi/low memory regions based on -machine->ram_size. - -Use the constants defined in public header arch-arm.h to be aligned with the -toolstack. - -The toolstack should then pass real ram_size using "-m" arg. -If "-m" is not given, create a QEMU machine without IOREQ, TPM and VIRTIO to -keep it usable for /etc/init.d/xencommons. - -Signed-off-by: Oleksandr Tyshchenko -Signed-off-by: Vikram Garhwal -Reviewed-by: Stefano Stabellini ---- - hw/arm/xen_arm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 46 insertions(+) - -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -index 2012ee7aff..fde919df29 100644 ---- a/hw/arm/xen_arm.c -+++ b/hw/arm/xen_arm.c -@@ -56,6 +56,8 @@ struct XenArmState { - XenIOState *state; - }; - -+static MemoryRegion ram_lo, ram_hi; -+ - #define VIRTIO_MMIO_DEV_SIZE 0x200 - - #define NR_VIRTIO_MMIO_DEVICES \ -@@ -82,6 +84,39 @@ static void xen_create_virtio_mmio_devices(XenArmState *xam) - } - } - -+static void xen_init_ram(MachineState *machine) -+{ -+ MemoryRegion *sysmem = get_system_memory(); -+ ram_addr_t block_len, ram_size[GUEST_RAM_BANKS]; -+ -+ if (machine->ram_size <= GUEST_RAM0_SIZE) { -+ ram_size[0] = machine->ram_size; -+ ram_size[1] = 0; -+ block_len = GUEST_RAM0_BASE + ram_size[0]; -+ } else { -+ ram_size[0] = GUEST_RAM0_SIZE; -+ ram_size[1] = machine->ram_size - GUEST_RAM0_SIZE; -+ block_len = GUEST_RAM1_BASE + ram_size[1]; -+ } -+ -+ memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len, -+ &error_fatal); -+ -+ memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", &ram_memory, -+ GUEST_RAM0_BASE, ram_size[0]); -+ memory_region_add_subregion(sysmem, GUEST_RAM0_BASE, &ram_lo); -+ DPRINTF("Initialized region xen.ram.lo: base 0x%llx size 0x%lx\n", -+ GUEST_RAM0_BASE, ram_size[0]); -+ -+ if (ram_size[1] > 0) { -+ memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", &ram_memory, -+ GUEST_RAM1_BASE, ram_size[1]); -+ memory_region_add_subregion(sysmem, GUEST_RAM1_BASE, &ram_hi); -+ DPRINTF("Initialized region xen.ram.hi: base 0x%llx size 0x%lx\n", -+ GUEST_RAM1_BASE, ram_size[1]); -+ } -+} -+ - void arch_handle_ioreq(XenIOState *state, ioreq_t *req) - { - hw_error("Invalid ioreq type 0x%x\n", req->type); -@@ -155,6 +190,14 @@ static void xen_arm_init(MachineState *machine) - - xam->state = g_new0(XenIOState, 1); - -+ if (machine->ram_size == 0) { -+ DPRINTF("ram_size not specified. QEMU machine will be started without" -+ " TPM, IOREQ and Virtio-MMIO backends\n"); -+ return; -+ } -+ -+ xen_init_ram(machine); -+ - if (xen_init_ioreq(xam->state, machine->smp.cpus)) { - return; - } -@@ -173,6 +216,9 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) - mc->desc = "Xen Para-virtualized PC"; - mc->init = xen_arm_init; - mc->max_cpus = 1; -+ /* Set explicitly here to make sure that real ram_size is passed */ -+ mc->default_ram_size = 0; -+ - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); - } - --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0016-xen_arm-Add-accel-xen-and-drop-extra-interface-openi.patch b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0016-xen_arm-Add-accel-xen-and-drop-extra-interface-openi.patch deleted file mode 100644 index 14f2e240..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx-7.1/0016-xen_arm-Add-accel-xen-and-drop-extra-interface-openi.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a730d5ea4a0445a8c694b56583dd06bd000fae74 Mon Sep 17 00:00:00 2001 -From: Vikram Garhwal -Date: Wed, 4 Jan 2023 23:05:25 +0000 -Subject: [PATCH 16/16] xen_arm: Add "accel = xen" and drop extra interface - openings - -In order to use virtio backends we need to make sure that Xen accelerator -is enabled (xen_enabled() returns true) as the memory/cache systems -check for xen_enabled() to perform specific actions. Without that -the xen-mapcache (which is needed for mapping guest memory) is not in use. - -Also drop extra interface opening as this is already done in xen-all.c -(so drop xen_init_ioreq() completely) and skip virtio/tpm initialization -if device emulation is not available. - -Signed-off-by: Oleksandr Tyshchenko -Signed-off-by: Vikram Garhwal -Reviewed-by: Stefano Stabellini ---- - hw/arm/xen_arm.c | 29 ++--------------------------- - 1 file changed, 2 insertions(+), 27 deletions(-) - -diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c -index fde919df29..4ac425a3c5 100644 ---- a/hw/arm/xen_arm.c -+++ b/hw/arm/xen_arm.c -@@ -137,30 +137,6 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp) - { - } - --static int xen_init_ioreq(XenIOState *state, unsigned int max_cpus) --{ -- xen_dmod = xendevicemodel_open(0, 0); -- xen_xc = xc_interface_open(0, 0, 0); -- -- if (xen_xc == NULL) { -- perror("xen: can't open xen interface\n"); -- return -1; -- } -- -- xen_fmem = xenforeignmemory_open(0, 0); -- if (xen_fmem == NULL) { -- perror("xen: can't open xen fmem interface\n"); -- xc_interface_close(xen_xc); -- return -1; -- } -- -- xen_register_ioreq(state, max_cpus, xen_memory_listener); -- -- xenstore_record_dm_state(xenstore, "running"); -- -- return 0; --} -- - static void xen_enable_tpm(void) - { - #ifdef CONFIG_TPM -@@ -198,9 +174,7 @@ static void xen_arm_init(MachineState *machine) - - xen_init_ram(machine); - -- if (xen_init_ioreq(xam->state, machine->smp.cpus)) { -- return; -- } -+ xen_register_ioreq(xam->state, machine->smp.cpus, xen_memory_listener); - - xen_create_virtio_mmio_devices(xam); - -@@ -218,6 +192,7 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) - mc->max_cpus = 1; - /* Set explicitly here to make sure that real ram_size is passed */ - mc->default_ram_size = 0; -+ mc->default_machine_opts = "accel=xen"; - - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); - } --- -2.17.1 - diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend deleted file mode 100644 index 5cb9f0d0..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu-xilinx_2023%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -require qemu-tpm.inc -require qemu-xen_7.1.inc - -# We do not want QEMU, on the target to be configured with OpenGL -PACKAGECONFIG:remove:class-target = "virglrenderer epoxy gtk+" diff --git a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu_7.1%.bbappend b/meta-xilinx-virtualization/recipes-devtools/qemu/qemu_7.1%.bbappend deleted file mode 100644 index 5cb9f0d0..00000000 --- a/meta-xilinx-virtualization/recipes-devtools/qemu/qemu_7.1%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -require qemu-tpm.inc -require qemu-xen_7.1.inc - -# We do not want QEMU, on the target to be configured with OpenGL -PACKAGECONFIG:remove:class-target = "virglrenderer epoxy gtk+" -- cgit v1.2.3-54-g00ecf