From 444cc624ef13c28ec5016d6077e50e03818a67b3 Mon Sep 17 00:00:00 2001 From: jiazhongfeng Date: Thu, 17 Oct 2024 10:48:47 +0800 Subject: [PATCH] Add Support for numa being initialized with mem 0 and memory --- ...numa-being-initialized-with-mem-0-an.patch | 86 +++++++++++++++++++ qemu.spec | 6 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 Add-Support-for-numa-being-initialized-with-mem-0-an.patch diff --git a/Add-Support-for-numa-being-initialized-with-mem-0-an.patch b/Add-Support-for-numa-being-initialized-with-mem-0-an.patch new file mode 100644 index 0000000..886885f --- /dev/null +++ b/Add-Support-for-numa-being-initialized-with-mem-0-an.patch @@ -0,0 +1,86 @@ +From 5988b5ba063a2172a6c6990e7492a795e7e5a246 Mon Sep 17 00:00:00 2001 +From: jiazhongfeng <14889146+jiazhongfeng@user.noreply.gitee.com> +Date: Thu, 17 Oct 2024 09:25:30 +0800 +Subject: [PATCH] Add Support for numa being initialized with mem 0 and memory + hot plug + +--- + backends/hostmem-file.c | 1 - + backends/hostmem.c | 9 +++------ + hw/core/machine.c | 5 ++++- + hw/core/numa.c | 4 ++++ + 4 files changed, 11 insertions(+), 8 deletions(-) + +diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c +index cd038024fa..6be6d40541 100644 +--- a/backends/hostmem-file.c ++++ b/backends/hostmem-file.c +@@ -43,7 +43,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) + gchar *name; + + if (!backend->size) { +- error_setg(errp, "can't create backend with size 0"); + return; + } + if (!fb->mem_path) { +diff --git a/backends/hostmem.c b/backends/hostmem.c +index 4c05862ed5..46cf3855a9 100644 +--- a/backends/hostmem.c ++++ b/backends/hostmem.c +@@ -64,12 +64,6 @@ host_memory_backend_set_size(Object *obj, Visitor *v, const char *name, + if (!visit_type_size(v, name, &value, errp)) { + return; + } +- if (!value) { +- error_setg(errp, +- "property '%s' of %s doesn't take value '%" PRIu64 "'", +- name, object_get_typename(obj), value); +- return; +- } + backend->size = value; + } + +@@ -337,6 +331,9 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) + goto out; + } + ++ if (0 == backend->size) { ++ return; ++ } + ptr = memory_region_get_ram_ptr(&backend->mr); + sz = memory_region_size(&backend->mr); + +diff --git a/hw/core/machine.c b/hw/core/machine.c +index 53a99abc56..d27ee4b30e 100644 +--- a/hw/core/machine.c ++++ b/hw/core/machine.c +@@ -1084,7 +1084,10 @@ MemoryRegion *machine_consume_memdev(MachineState *machine, + HostMemoryBackend *backend) + { + MemoryRegion *ret = host_memory_backend_get_memory(backend); +- ++ if (NULL == ret) ++ { ++ return ret; ++ } + if (memory_region_is_mapped(ret)) { + error_report("memory backend %s can't be used multiple times.", + object_get_canonical_path_component(OBJECT(backend))); +diff --git a/hw/core/numa.c b/hw/core/numa.c +index e6050b2273..afe5644461 100644 +--- a/hw/core/numa.c ++++ b/hw/core/numa.c +@@ -629,6 +629,10 @@ static void numa_init_memdev_container(MachineState *ms, MemoryRegion *ram) + continue; + } + MemoryRegion *seg = machine_consume_memdev(ms, backend); ++ if (seg == NULL) ++ { ++ continue; ++ } + memory_region_add_subregion(ram, addr, seg); + addr += size; + } +-- +2.45.1.windows.1 + diff --git a/qemu.spec b/qemu.spec index 417538f..526bf69 100644 --- a/qemu.spec +++ b/qemu.spec @@ -3,7 +3,7 @@ Name: qemu Version: 6.2.0 -Release: 100 +Release: 101 Epoch: 10 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -1048,6 +1048,7 @@ Patch1033: system-physmem-Propagate-AddressSpace-to-MapClient-h.patch Patch1034: system-physmem-Per-AddressSpace-bounce-buffering.patch Patch1035: softmmu-Support-concurrent-bounce-buffers-CVE-2024-8.patch Patch1036: mac_dbdma-Remove-leftover-dma_memory_unmap-calls-CVE.patch +Patch1037: Add-Support-for-numa-being-initialized-with-mem-0-an.patch BuildRequires: flex @@ -1647,6 +1648,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Thu Oct 17 2024 - 10:6.2.0-101 +- Add Support for numa being initialized with mem 0 and memory + * Mon Oct 14 2024 - 10:6.2.0-100 - mac_dbdma: Remove leftover `dma_memory_unmap` calls(CVE-2024-8612) - softmmu: Support concurrent bounce buffers(CVE-2024-8612) -- Gitee