From 1bed78f307ef3c813d753d645de43f1337f566ce Mon Sep 17 00:00:00 2001 From: lanruo Date: Tue, 29 Aug 2023 14:49:55 +0800 Subject: [PATCH] remove arbitrary limit on socket and core id --- 9000-fix-sw_64-grub-so-slow.patch | 139 ++++++++++++++++++ 9001-set-sw_64-default-usb-to-usb3.0.patch | 29 ++++ ...rary-limit-on-socket-and-core-id-Rel.patch | 38 +++++ libvirt.spec | 39 ++++- 4 files changed, 241 insertions(+), 4 deletions(-) create mode 100644 9000-fix-sw_64-grub-so-slow.patch create mode 100644 9001-set-sw_64-default-usb-to-usb3.0.patch create mode 100644 fix-remove-arbitrary-limit-on-socket-and-core-id-Rel.patch diff --git a/9000-fix-sw_64-grub-so-slow.patch b/9000-fix-sw_64-grub-so-slow.patch new file mode 100644 index 0000000..4df99d0 --- /dev/null +++ b/9000-fix-sw_64-grub-so-slow.patch @@ -0,0 +1,139 @@ +From 8aac0239ee9b045cd2af6ff07f2090d231d80119 Mon Sep 17 00:00:00 2001 +From: panchenbo +Date: Tue, 15 Aug 2023 09:28:29 +0800 +Subject: [PATCH] fix sw_64 grub so slow + +--- + src/conf/domain_conf.c | 5 +++-- + src/conf/domain_conf.h | 1 + + src/qemu/qemu_capabilities.c | 2 ++ + src/qemu/qemu_command.c | 5 ++++- + src/qemu/qemu_domain.c | 4 +++- + src/qemu/qemu_domain_address.c | 2 ++ + 6 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index b8cf1ad..a50b01f 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -766,6 +766,7 @@ VIR_ENUM_IMPL(virDomainVideo, + "parallels", + "virtio", + "gop", ++ "virtio-gpu", + "none", + "bochs", + "ramfb", +@@ -15977,7 +15978,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def, + case VIR_DOMAIN_VIDEO_TYPE_XEN: + /* Original Xen PVFB hardcoded to 4 MB */ + return 4 * 1024; +- ++ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO://zwx + case VIR_DOMAIN_VIDEO_TYPE_QXL: + /* QEMU use 64M as the minimal video memory for qxl device */ + return 64 * 1024; +@@ -15985,8 +15986,8 @@ virDomainVideoDefaultRAM(const virDomainDef *def, + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: + case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: +- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_GOP: ++ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO_GPU: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: + case VIR_DOMAIN_VIDEO_TYPE_LAST: +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 98fa323..fe99faf 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1441,6 +1441,7 @@ typedef enum { + VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */ + VIR_DOMAIN_VIDEO_TYPE_VIRTIO, + VIR_DOMAIN_VIDEO_TYPE_GOP, ++ VIR_DOMAIN_VIDEO_TYPE_VIRTIO_GPU, + VIR_DOMAIN_VIDEO_TYPE_NONE, + VIR_DOMAIN_VIDEO_TYPE_BOCHS, + VIR_DOMAIN_VIDEO_TYPE_RAMFB, +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 21b477c..401a122 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -5879,6 +5879,8 @@ virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps, + dev->modelType.report = true; + + VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_NONE); ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) ++ VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType,VIR_DOMAIN_VIDEO_TYPE_VIRTIO_GPU); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) + VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VGA); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 5f7e847..e60a9d3 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -112,6 +112,7 @@ VIR_ENUM_IMPL(qemuVideo, + "", /* don't support parallels */ + "", /* no need for virtio */ + "" /* don't support gop */, ++ "",/* no need for virtio-gpu */ + "" /* 'none' doesn't make sense here */, + "bochs-display", + "", /* ramfb can't be used with -vga */ +@@ -131,6 +132,7 @@ VIR_ENUM_IMPL(qemuDeviceVideo, + "", /* don't support parallels */ + "virtio-vga", + "" /* don't support gop */, ++ "virtio-gpu", + "" /* 'none' doesn't make sense here */, + "bochs-display", + "ramfb", +@@ -148,8 +150,9 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, + "", /* don't support vbox */ + "qxl", + "", /* don't support parallels */ +- "virtio-gpu", ++ "virtio-vga", + "" /* don't support gop */, ++ "virtio-gpu", + "" /* 'none' doesn't make sense here */, + "" /* no secondary device for bochs */, + "" /* no secondary device for ramfb */, +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 152c861..ec033dd 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -9382,6 +9382,8 @@ static int + qemuDomainDefaultVideoDevice(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) + { ++ if (ARCH_IS_SW64(def->os.arch)) ++ return VIR_DOMAIN_VIDEO_TYPE_VIRTIO_GPU; + if (ARCH_IS_PPC64(def->os.arch)) + return VIR_DOMAIN_VIDEO_TYPE_VGA; + if (qemuDomainIsARMVirt(def) || +@@ -14397,7 +14399,7 @@ qemuDomainSupportsVideoVga(virDomainVideoDefPtr video, + if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_VGA)) + return false; +- } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA)) { ++ } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) { + return false; + } + } +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index 7f48773..a460e84 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -955,6 +955,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + return pcieFlags; + ++ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO_GPU: ++ return pcieFlags; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: +-- +2.27.0 + diff --git a/9001-set-sw_64-default-usb-to-usb3.0.patch b/9001-set-sw_64-default-usb-to-usb3.0.patch new file mode 100644 index 0000000..a17a387 --- /dev/null +++ b/9001-set-sw_64-default-usb-to-usb3.0.patch @@ -0,0 +1,29 @@ +From 31e94c1de31b37f1ed062d1e216fe0e3dd9bb6e1 Mon Sep 17 00:00:00 2001 +From: panchenbo +Date: Wed, 16 Aug 2023 10:02:12 +0800 +Subject: [PATCH] set sw_64 default usb to + VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI + +--- + src/qemu/qemu_domain.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index ec033dd..43b47bc 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -9094,6 +9094,11 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI; + else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; ++ } else if (ARCH_IS_SW64(def->os.arch)) { ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) ++ cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI; ++ else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) ++ cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; + } + } + /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr */ +-- +2.27.0 + diff --git a/fix-remove-arbitrary-limit-on-socket-and-core-id-Rel.patch b/fix-remove-arbitrary-limit-on-socket-and-core-id-Rel.patch new file mode 100644 index 0000000..6794b3c --- /dev/null +++ b/fix-remove-arbitrary-limit-on-socket-and-core-id-Rel.patch @@ -0,0 +1,38 @@ +From 442be4f5f8027ac4be97ec788f6af603e611b016 Mon Sep 17 00:00:00 2001 +From: yangchenguang +Date: Tue, 11 Apr 2023 17:15:35 +0800 +Subject: [PATCH] fix(*) remove arbitrary limit on socket and core + id(Related:#51233) + +Signed-off-by: yangchenguang +--- + src/util/virhostcpu.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c +index ce3da7e..921b5a7 100644 +--- a/src/util/virhostcpu.c ++++ b/src/util/virhostcpu.c +@@ -336,7 +336,8 @@ virHostCPUParseNode(const char *node, + goto cleanup; + + /* enumerate sockets in the node */ +- sockets_map = virBitmapNewEmpty(); ++ if(!(sockets_map = virBitmapNewEmpty())) ++ goto cleanup; + + while ((direrr = virDirRead(cpudir, &cpudirent, node)) > 0) { + if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1) +@@ -372,7 +373,8 @@ virHostCPUParseNode(const char *node, + goto cleanup; + + for (i = 0; i < sock_max; i++) +- cores_maps[i] = virBitmapNewEmpty(); ++ if(!(cores_maps[i] = virBitmapNewEmpty())) ++ goto cleanup; + + /* Iterate over all CPUs in the node, in ascending order */ + for (cpu = 0; cpu < npresent_cpus; cpu++) { +-- +2.33.0 + diff --git a/libvirt.spec b/libvirt.spec index b1493dc..f276425 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -13,7 +13,7 @@ %define with_qemu_tcg %{with_qemu} -%define qemu_kvm_arches %{ix86} x86_64 aarch64 loongarch64 +%define qemu_kvm_arches %{ix86} x86_64 aarch64 loongarch64 sw_64 %ifarch %{qemu_kvm_arches} %define with_qemu_kvm %{with_qemu} @@ -44,7 +44,7 @@ %endif %define with_storage_zfs 0%{!?_without_storage_zfs:1} -%ifarch aarch64 x86_64 loongarch64 +%ifarch aarch64 x86_64 loongarch64 sw_64 %define with_storage_zfs 0 %endif @@ -101,7 +101,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 59 +Release: 60 License: LGPLv2+ URL: https://libvirt.org/ @@ -490,6 +490,10 @@ Patch0377: Revert-selinux-adapt-to-libselinux.patch Patch0378: selinux-Reflect-context_str-type-change.patch Patch0379: virnetsshsession-Adapt-to-change-libssh2-API.patch Patch0380: qemu-command-Use-correct-tpm-device-for-all-non-x86.patch +Patch0381: fix-remove-arbitrary-limit-on-socket-and-core-id-Rel.patch + +Patch1000: 9000-fix-sw_64-grub-so-slow.patch +Patch1001: 9001-set-sw_64-default-usb-to-usb3.0.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -644,6 +648,10 @@ BuildRequires: gawk # For storage wiping with different algorithms BuildRequires: scrub +%ifarch sw_64 +BuildRequires: git +%endif + %if %{with_numad} BuildRequires: numad %endif @@ -1229,8 +1237,11 @@ Libvirt plugin for NSS for translating domain names into IP addresses. %prep - %autosetup -p1 +%ifarch sw_64 +patch -Rp1 < %{_sourcedir}/9000-fix-sw_64-grub-so-slow.patch +patch -Rp1 < %{_sourcedir}/9001-set-sw_64-default-usb-to-usb3.0.patch +%endif %build @@ -1388,6 +1399,13 @@ LOADERS="$LOADERS:/usr/share/qemu/loongarch_bios.bin:/usr/share/qemu/loongarch_v export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec) +%ifarch sw_64 +git init +mkdir %{_vpath_builddir} +cd %{_vpath_builddir} +../autogen.sh --system --with-runstatedir=%{_rundir} --with-network --disable-werror --without-vbox --without-vmware --without-uml --without-openvz --without-esx --without-lxc --without-bhyve --enable-seccomp + +%else %if 0%{?enable_autotools} autoreconf -if %endif @@ -1461,6 +1479,7 @@ cd %{_vpath_builddir} --with-init-script=systemd \ %{?arg_login_shell} make %{?_smp_mflags} V=1 +%endif %install rm -fr %{buildroot} @@ -1527,6 +1546,12 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu %if ! %{with_lxc} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc +%ifarch sw_64 +rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/virt-login-shell.conf +rm -rf $RPM_BUILD_ROOT%{_bindir}/virt-login-shell +rm -rf $RPM_BUILD_ROOT%{_libexecdir}/virt-login-shell-helper +rm -rf $RPM_BUILD_ROOT%{_mandir}/man1/virt-login-shell.* +%endif %endif %if ! %{with_libxl} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/libxl.conf @@ -2226,6 +2251,12 @@ exit 0 %changelog +* Wed Aug 16 2023 panchenbo - 6.2.0-60 +- set sw_64 default usb to usb3.0 +- fix sw_64 grub so slow +- fix sw_64 build error +- remove arbitrary limit on socket and core id + * Sat Aug 26 2023 lixianglai - 6.2.0-59 - Synchronize upstream patches "Use correct tpm device for all non-x86" -- Gitee