[PATCH v2 18/27] qemu_command: Move dimm into qemuBuildDeviceAddressStr()

Peter Krempa pkrempa at redhat.com
Fri Dec 4 08:49:36 UTC 2020


On Thu, Dec 03, 2020 at 13:36:21 +0100, Michal Privoznik wrote:
> So far our memory modules could go only into DIMM slots. But with
> virtio model this assumption is no longer true - virtio-pmem goes
> onto PCI bus. But for formatting PCI address onto command line we
> already have a function - qemuBuildDeviceAddressStr(). Therefore,
> mode DIMM address generation into it so that we don't have to
> special case address building later on.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_command.c | 17 +++++++++--------
>  src/qemu/qemu_command.h |  5 ++++-
>  src/qemu/qemu_hotplug.c |  2 +-
>  3 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 9c50778180..49241fc507 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -393,6 +393,10 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
>          virBufferAsprintf(buf, ",iobase=0x%x,irq=0x%x",
>                            info->addr.isa.iobase,
>                            info->addr.isa.irq);
> +    } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
> +        virBufferAsprintf(buf, ",slot=%d", info->addr.dimm.slot);
> +        if (info->addr.dimm.base)
> +            virBufferAsprintf(buf, ",addr=%llu", info->addr.dimm.base);
>      }

This function would really benefit from a refactor to a switch.

Reviewed-by: Peter Krempa <pkrempa at redhat.com>

This cleanup should be applicable even without the virtio-mem patches.




More information about the libvir-list mailing list