On 3/18/25 13:00, Martin Kletzander via Devel wrote:
On Tue, Mar 18, 2025 at 09:53:22AM +0100, Boris Fiuczynski wrote:
> Since commit f23f8ff91a virtio-mem supports also CCW. When hotplugging a
> virtio-mem device with a CCW address results in a PCI device getting
> attached. The method qemuDomainAssignMemoryDeviceSlot is only
> considering PCI as address type and overwriting the CCW address. Adding
> support for address type CCW.
>
> Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
> ---
> src/qemu/qemu_domain_address.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/
> qemu_domain_address.c
> index d38983bf63..b0289c2337 100644
> --- a/src/qemu/qemu_domain_address.c
> +++ b/src/qemu/qemu_domain_address.c
> @@ -3067,6 +3067,7 @@ qemuDomainAssignMemoryDeviceSlot(virDomainObj *vm,
> virDomainMemoryDef *mem)
> {
> g_autoptr(virBitmap) slotmap = NULL;
> + virDomainCCWAddressSet *ccwaddrs = NULL;
> virDomainDeviceDef dev = {.type =
> VIR_DOMAIN_DEVICE_MEMORY, .data.memory = mem};
>
> switch (mem->model) {
> @@ -3080,7 +3081,20 @@ qemuDomainAssignMemoryDeviceSlot(virDomainObj *vm,
>
> case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
> case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
> - return qemuDomainEnsurePCIAddress(vm, &dev);
> + if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
> + if (qemuDomainIsS390CCW(vm->def))
> + mem->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
> + }
> +
> + if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
> + mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
> + return qemuDomainEnsurePCIAddress(vm, &dev);
> + } else if (mem->info.type ==
> VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
> + if (!(ccwaddrs =
> virDomainCCWAddressSetCreateFromDomain(vm->def)))
> + return -1;
> + return virDomainCCWAddressAssign(&mem->info, ccwaddrs,
> + !mem-
> >info.addr.ccw.assigned);
> + }
You leak ccwaddrs here, I'd suggest squashing something like this in:
Thanks for your feedback.
I am going to send a v2 shortly.
It will make reuse of qemuDomainEnsureVirtioAddress reducing changes to
a minimum.
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294