Skip to contentSkip to conversation

hw/arm/virt enable support for virtio-mem

PATCH Superseded Jonathan Cameron 2 participants 2 messages Nov 5, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/virt enable support for virtio-mem

Basically a cut and paste job from the x86 support with the exception of needing a larger block size as the Memory Block Size (MIN_SECTION_SIZE) on ARM64 in Linux is 1G.

Tested:
* In full emulation and with KVM on an arm64 server.
* cold and hotplug for the virtio-mem-pci device.
* Wide range of memory sizes, added at creation and later.
* Fairly basic memory usage of memory added. Seems to function as normal.
* NUMA setup with virtio-mem-pci devices on each node.
* Simple migration test.

Related kernel patch just enables the Kconfig item for ARM64 as an alternative to x86 in drivers/virtio/Kconfig

The original patches from David Hildenbrand stated that he thought it should work for ARM64 but it wasn't enabled in the kernel [1]
It appears he was correct and everything 'just works'.

The build system related stuff is intended to ensure virtio-mem support is not built for arm32 (build will fail due no defined block size). If there is a more elegant way to do this, please point me in the right direction.

[1] https://lore.kernel.org/linux-mm/[email protected]/

---
 default-configs/devices/aarch64-softmmu.mak |  1 +
 hw/arm/Kconfig                              |  1 +
 hw/arm/virt.c                               | 64 ++++++++++++++++++++-
 hw/virtio/Kconfig                           |  4 ++
 hw/virtio/virtio-mem.c                      |  2 +
 5 files changed, 71 insertions(+), 1 deletion(-)
default-configs/devices/aarch64-softmmu.mak +1 -0
index 958b1e08e4..31d6128a29 100644
@@ -6,3 +6,4 @@ include arm-softmmu.mak
 CONFIG_XLNX_ZYNQMP_ARM=y
 CONFIG_XLNX_VERSAL=y
 CONFIG_SBSA_REF=y
+CONFIG_ARCH_VIRTIO_MEM_SUPPORTED=y
hw/arm/Kconfig +1 -0
index fdf4464b94..eeae77eee9 100644
@@ -20,6 +20,7 @@ config ARM_VIRT
     select PLATFORM_BUS
     select SMBIOS
     select VIRTIO_MMIO
+    select VIRTIO_MEM_SUPPORTED if ARCH_VIRTIO_MEM_SUPPORTED
     select ACPI_PCI
     select MEM_DEVICE
     select DIMM
hw/arm/virt.c +63 -1

109 lines not on this page · raw message

hw/virtio/Kconfig +4 -0
index 0eda25c4e1..00dbf2939e 100644
@@ -48,6 +48,10 @@ config VIRTIO_PMEM
     depends on VIRTIO_PMEM_SUPPORTED
     select MEM_DEVICE
 
+config ARCH_VIRTIO_MEM_SUPPORTED
+    bool
+    default n
+
 config VIRTIO_MEM_SUPPORTED
     bool
 
hw/virtio/virtio-mem.c +2 -0
index 7c8ca9f28b..c28f12547a 100644
@@ -53,6 +53,8 @@
  */
 #if defined(TARGET_X86_64) || defined(TARGET_I386)
 #define VIRTIO_MEM_USABLE_EXTENT (2 * (128 * MiB))
+#elif defined (TARGET_AARCH64)
+#define VIRTIO_MEM_USABLE_EXTENT (2 * (1024 * MiB))
 #else
 #error VIRTIO_MEM_USABLE_EXTENT not defined
 #endif
Signature · 1 line
2.19.1
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH] hw/arm/virt enable support for virtio-mem

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
03ce0eb hw/arm/virt enable support for virtio-mem

=== OUTPUT BEGIN ===
WARNING: line over 80 characters
#89: FILE: hw/arm/virt.c:2289:
+ error_setg(errp, "hotplug of virtio-mem based memory devices not supported"

ERROR: trailing whitespace
#113: FILE: hw/arm/virt.c:2313:
+ virt_virtio_md_pci_pre_plug(hotplug_dev, dev, errp); $

ERROR: space required before the open brace '{'
#173: FILE: hw/arm/virt.c:2464:
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)){

ERROR: space prohibited between function name and open parenthesis '(' #200: FILE: hw/virtio/virtio-mem.c:56:
+#elif defined (TARGET_AARCH64)

total: 3 errors, 1 warnings, 138 lines checked

Commit 03ce0eb928fb (hw/arm/virt enable support for virtio-mem) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]