hw/mem: add sp-mem device for Specific Purpose Memory
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v14 Latest10 patches 6 repliesIn review
- v1310 patches 11 repliesSuperseded
- v124 patches 5 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v11 | 4 patches | 2 replies | Superseded | |
| v10 | 4 patches | 14 replies | Superseded | |
| v9 | 4 patches | 11 replies | Superseded | |
| v8 | 1 patch | 2 replies | Superseded |
Changes in v14 from the cover letter
-----------------
- qapi: note that SpMemDeviceInfo's @size is in bytes.
- pc: fix the indentation of the pc_sp_mem_plug() continuation line.
- Collected the Reviewed-by / Acked-by tags from the v13 review.
Patches in v14 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | hw/mem: add sp-mem device for Specific Purpose Memoryhw/ hw/ hw/ +1 more | +147 | 1 reply | |
| 2/10 | qapi, hmp: introspection for the sp-mem devicehw/ hw/ qapi/ | +71 | 1 reply | |
| 3/10 | i386/acpi-build: partition device_memory SRAT umbrella for sp-memhw/ | +92 | 0 replies | |
| 4/10 | hw/i386: hook sp-mem into the pc machine plug pathhw/ hw/ hw/ | +44 | 1 reply | |
| 5/10 | MAINTAINERS: cover sp-mem under Memory devices, add R: tagMAINTAINERS | +3 | 0 replies | |
| 6/10 | tests/acpi: add empty expected blobs for sp-mem SRAT testtests/ tests/ tests/ | +2 | 0 replies | |
| 7/10 | tests/acpi: add bios-tables-test case for sp-memtests/ | +21 | 0 replies | |
| 8/10 | tests/acpi: generate expected blobs for sp-mem SRAT testtests/ tests/ tests/ | +0 | 0 replies | |
| 9/10 | tests/qtest: add e820 fw_cfg testtests/ tests/ | +96 | 0 replies | |
| 10/10 | tests/qtest: cover sp-mem SOFT_RESERVED e820 entrytests/ | +34 | 0 replies |
Reviews trailers per patch
All 10 patches have a Reviewed-by or Acked-by.
| Patch | Igor Mammedov | David Hildenbrand |
|---|---|---|
| 1/10 | R-b | R-b |
| 2/10 | R-b | R-b |
| 3/10 | R-b | |
| 4/10 | R-b | R-b |
| 5/10 | A-b | A-b |
| 6/10 | A-b | |
| 7/10 | R-b | |
| 8/10 | A-b | |
| 9/10 | A-b | |
| 10/10 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v14 00/10] hw/mem: add sp-mem device for Specific Purpose Memory
This series adds a TYPE_MEMORY_DEVICE subclass sp-mem for boot-time SOFT_RESERVED guest memory, following the direction from the v7 thread [1] and the v8 / v9 / v10 / v11 / v12 / v13 reviews [2][3][4][5][6][7].
Background
----------
This series targets coherent CPU + accelerator shared-address-space systems, where the accelerator's HBM is not a device-private framebuffer behind a PCIe BAR but a tier of host system memory:
visible to the CPU in the platform physical address space, shared coherently with the accelerator over the platform fabric, and bound to a NUMA proximity domain set by platform firmware at boot fabric training.
For such a region to function correctly in the guest, two things must hold simultaneously: the CPU memory subsystem has to see it in the system memory map (so the CPU side can address it), and it has to be reserved exclusively for the accelerator's driver (so the kernel's general allocator does not hand SPM pages to unrelated workloads). The SOFT_RESERVED memory type in E820 plus a matching SRAT memory-affinity entry is the mechanism that delivers both: a firmware-produced topology that the CPU memory subsystem honors and the accelerator's driver consumes for its own range.
Approach
--------
The series introduces a new TYPE_MEMORY_DEVICE subclass sp-mem. Each instance binds one host memory backend to a single NUMA proximity domain and is boot-time only; placement, mapped-state enforcement, and QMP introspection come from the existing memory-device framework.
Testing
-------
Verified end-to-end on q35 + KVM, with both SeaBIOS and OVMF, for:
- single sp-mem instance
- two sp-mem instances on different NUMA nodes
Guest observations: /proc/iomem shows one SOFT_RESERVED entry per sp-mem device, dmesg SRAT parsing reports the matching memory_affinity entries with correct PXM, and the umbrella HOTPLUGGABLE entry covers the remaining hotplug-memory window without overlapping the sp-mem ranges.
In-tree coverage: a bios-tables-test case validates the SRAT partition for two sp-mem devices on distinct nodes, and an e820 fw_cfg test checks the SOFT_RESERVED range.
Changes since v13
-----------------
- qapi: note that SpMemDeviceInfo's @size is in bytes.
- pc: fix the indentation of the pc_sp_mem_plug() continuation line.
- Collected the Reviewed-by / Acked-by tags from the v13 review.
Previous versions
-----------------
v1: https://lore.kernel.org/qemu-devel/[email protected]/
v2: https://lore.kernel.org/qemu-devel/[email protected]/
v3: https://lore.kernel.org/qemu-devel/[email protected]/
v4: https://lore.kernel.org/qemu-devel/[email protected]/
v5: https://lore.kernel.org/qemu-devel/[email protected]/
v6: https://lore.kernel.org/qemu-devel/[email protected]/
v7: https://lore.kernel.org/qemu-devel/[email protected]/
v8: https://lore.kernel.org/qemu-devel/[email protected]/
v9: https://lore.kernel.org/qemu-devel/[email protected]/
v10: https://lore.kernel.org/qemu-devel/[email protected]/
v11: https://lore.kernel.org/qemu-devel/[email protected]/
v12: https://lore.kernel.org/qemu-devel/[email protected]/
v13: https://lore.kernel.org/qemu-devel/[email protected]/
[1] v7 thread closeout:
https://lore.kernel.org/qemu-devel/[email protected]/ [2] v8 review: https://lore.kernel.org/qemu-devel/20260601105057.2d764e55@imammedo/ [3] v9 review: https://lore.kernel.org/qemu-devel/[email protected]/T/ [4] v10 review: https://lore.kernel.org/qemu-devel/[email protected]/T/ [5] v11 review: https://lore.kernel.org/qemu-devel/[email protected]/T/ [6] v12 review: https://lore.kernel.org/qemu-devel/[email protected]/T/ [7] v13 review: https://lore.kernel.org/qemu-devel/[email protected]/T/
fanhuang (10):
hw/mem: add sp-mem device for Specific Purpose Memory qapi, hmp: introspection for the sp-mem device i386/acpi-build: partition device_memory SRAT umbrella for sp-mem hw/i386: hook sp-mem into the pc machine plug path
MAINTAINERS: cover sp-mem under Memory devices, add R: tag tests/acpi: add empty expected blobs for sp-mem SRAT test tests/acpi: add bios-tables-test case for sp-mem tests/acpi: generate expected blobs for sp-mem SRAT test tests/qtest: add e820 fw_cfg test
tests/qtest: cover sp-mem SOFT_RESERVED e820 entry
MAINTAINERS | 3 + qapi/machine.json | 43 +++++++++- hw/i386/e820_memory_layout.h | 11 +-- include/hw/mem/sp-mem.h | 33 ++++++++ hw/core/machine-hmp-cmds.c | 11 +++ hw/i386/acpi-build.c | 96 ++++++++++++++++++++- hw/i386/pc.c | 36 ++++++++ hw/mem/sp-mem.c | 128 ++++++++++++++++++++++++++++ tests/qtest/bios-tables-test.c | 21 +++++ tests/qtest/e820-test.c | 129 +++++++++++++++++++++++++++++ hw/i386/Kconfig | 2 + hw/mem/Kconfig | 4 + hw/mem/meson.build | 1 + tests/data/acpi/x86/q35/DSDT.spmem | Bin 0 -> 9910 bytes tests/data/acpi/x86/q35/SRAT.spmem | Bin 0 -> 384 bytes tests/qtest/meson.build | 1 + 16 files changed, 508 insertions(+), 11 deletions(-) create mode 100644 include/hw/mem/sp-mem.h create mode 100644 hw/mem/sp-mem.c create mode 100644 tests/qtest/e820-test.c create mode 100644 tests/data/acpi/x86/q35/DSDT.spmem create mode 100644 tests/data/acpi/x86/q35/SRAT.spmem
base-commit: b83371668192a705b878e909c5ae9c1233cbd5fb
Signature · 1 line
2.34.1