Commit Graph

306 Commits

Author SHA1 Message Date
Jonathon Jongsma
0ebb416d7e qemu: make vdpa connect function more generic
qemuInterfaceVDPAConnect() was a helper function for connecting to the
vdpa device file. But in order to support other vdpa devices besides
network interfaces (e.g. vdpa block devices) make this function a bit
more generic.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-09-12 11:06:41 -05:00
Peter Krempa
6d6a87f229 qemuDiskConfigBlkdeviotuneEnabled: Make 'disk' argument const
The function doesn't modify it. Fix the argument declaration so that the
function can be used in a context where we have a 'const' disk
definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-06-05 13:20:13 +02:00
Michal Privoznik
df2ef2e706 qemuBuildThreadContextProps: Prune .node-affinity wrt <emulatorpin/>
When a thread-context object is specified on the cmd line, then
QEMU spawns a thread and sets its affinity to the list of NUMA
nodes specified in .node-affinity attribute. And this works just
fine, until the main QEMU thread itself is not restricted.

Because of v5.3.0-rc1~18 we restrict the main emulator thread
even before QEMU is executed and thus then it tries to set
affinity of a thread-context thread, it inevitably fails with:

  Setting CPU affinity failed: Invalid argument

Now, we could lift the pinning temporarily, let QEMU spawn all
thread-context threads, and enforce pinning again, but that would
require some form of communication with QEMU (maybe -preconfig?).
But that would still be wrong, because it would circumvent
<emulatorpin/>.

Technically speaking, thread-context is an internal
implementation detail of QEMU, and if it weren't for it, the main
emulator thread would be doing the allocation. Therefore, we
should honor the pinning and prune the list of node so that
inaccessible ones are dropped.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2154750
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-03-15 12:46:55 +01:00
Michal Privoznik
45222a83b7 qemu: Add @nodemask argument to qemuBuildThreadContextProps()
When building a thread-context object (inside of
qemuBuildThreadContextProps()) we look at given memory-backend-*
object and look for .host-nodes attribute. This works, as long as
we need to just copy the attribute value into another
thread-context attribute. But soon we will need to adjust it.
That's the point where having the value in virBitmap comes handy.
Utilize the previous commit, which made
qemuBuildMemoryBackendProps() set the argument and pass it into
qemuBuildThreadContextProps().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-03-15 12:46:52 +01:00
Michal Privoznik
9f26f6cc4b qemu: Add @nodemaskRet argument to qemuBuildMemoryBackendProps()
While it's true that anybody who's interested in getting
.host-nodes attribute value can just use
virJSONValueObjectGetArray() (and that's exactly what
qemuBuildThreadContextProps() is doing, btw), if somebody is
interested in getting the actual virBitmap, they would have to
parse the JSON array.

Instead, introduce an argument to qemuBuildMemoryBackendProps()
which is set to corresponding value used when formatting the
attribute.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-03-15 12:46:49 +01:00
Laine Stump
a56f0168d5 qemu: hook up passt config to qemu domains
This consists of (1) adding the necessary args to the qemu commandline
netdev option, and (2) starting a passt process prior to starting
qemu, and making sure that it is terminated when it's no longer
needed. Under normal circumstances, passt will terminate itself as
soon as qemu closes its socket, but in case of some error where qemu
is never started, or fails to startup completely, we need to terminate
passt manually.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-01-10 01:19:25 -05:00
Michal Privoznik
b03386d148 qemu_command: Introduce qemuBuildThreadContextProps()
The aim of thread-context object is to set affinity on threads
that allocate memory for a memory-backend-* object. For instance:

-object '{"qom-type":"thread-context","id":"tc-ram-node0","node-affinity":[3]}' \
-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,\
          "hugetlbsize":2097152,"share":true,"prealloc":true,"prealloc-threads":8,\
          "size":15032385536,"host-nodes":[3],"policy":"preferred",\
          "prealloc-context":"tc-ram-node0"}' \

allocates 14GiB worth of memory, backed by 2MiB hugepages from
host NUMA node 3, using 8 threads. If it weren't for
thread-context these threads wouldn't have any affinity and thus
theoretically could be scheduled to run on CPUs of different NUMA
node (which is what I saw occasionally).

Therefore, whenever we are pinning memory (IOW setting host-nodes
attribute), we can generate thread-context object with the same
affinity.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-11-15 11:47:08 +01:00
Peter Krempa
fcc231dc79 qemu: command: Remove unused qemuGetDriveSourceString
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:23:57 +02:00
Michal Privoznik
9e8601c464 lib: Use G_NO_INLINE instead of G_GNUC_NO_INLINE
The G_GNUC_NO_INLINE macro will eventually be marked as
deprecated [1] and we are recommended to use G_NO_INLINE instead.
Do the switch now, rather than waiting for compile time warning
to occur.

1: 15cd0f0461
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-07-18 17:23:15 +02:00
Peng Liang
bc16c1bcf6 qemu: Remove unused includes
Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-16 06:43:57 +02:00
Peter Krempa
fcd7741c48 qemuBuildCommandLine: Remove 'flags' argument
The flags are not used for anything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-05-17 19:31:07 +02:00
Peter Krempa
bab089d379 qemuBuildCommandLine: Don't avoid '-S' flag for 'domxml-to-native' conversion
The commandline generated from our XML->native convertor is the majority
of cases not usable without libvirt anyways and the situation will not
improve any more.

As of such there's no much utility of avoiding the use of stopped CPUs
flag in such case.

Remove the QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING flag and the associated
logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-05-17 19:31:07 +02:00
Peter Krempa
2afaa6894e qemuBuildCommandLine: Inline qemuCheckFips
Now that we store the state of the host FIPS mode setting in the qemu
driver object, we don't need to outsource the logic into
'qemuCheckFips'.

Additionally since we no longer support very old qemu's which would not
yet have --enable-fips we can drop the part of the comment about very
old qemus.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-05-17 19:31:07 +02:00
Peter Krempa
9b765882cd qemuBuildCommandLine: Remove 'driver' argument
We pass 'vm' which already contains it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-05-17 19:31:07 +02:00
Peter Krempa
552790edf2 qemuBuildCommandLine: Convert 'standalone' flag to use 'flags'
Introduce 'qemuBuildCommandLineFlags' and use it instead of specific
flag booleans.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-05-17 19:31:07 +02:00
Peter Krempa
0b64b75a09 qemu: command: Don't hide 'vhost' fds from 'standalone' command line
We already format a commandline using FD passing for the tap devices so
formatting the 'vhost' file descriptors won't make it any less usable
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-05-17 19:31:07 +02:00
Peter Krempa
c8633d35ca qemu: slirp: Pass FDs to qemu via qemuFDPass in the network private data
Populate the 'slirpfd' qemuFDPass structure inside the private data for
passing the fd to qemu rather than using out-of-band variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
c0d25738b2 qemuBuildNicDevProps: Remove unused 'tapfd' infrastructure
All callers pass NULL/0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
7a38d3946b qemu: Move opening of tap file descriptors for net devices into qemuBuildInterfaceConnect
Use the new infrastructure which stores the fds inside 'qemuFDPass'
objects in the private data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
4b3e730c77 qemuBuildHostNetProps: Remove 'vhostfd' machinery
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
7c43765513 qemuBuildNicDevProps: Don't pass 'vhostfdSize'
All callers effectively pass 'net->driver.virtio.queues'. In case of the
code in 'qemu_hotplug.c' this value was set to '1' if it was 0 before.

Since 'qemuBuildNicDevProps' only uses it if it's greater than 1 we can
remove all the extra complexity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
96d6fec8dc qemuBuildInterfaceConnect: Connect to 'vdpa' netdev
Move the setup of the 'vdpa' netdev into the new helper shared between
commandline and hotplug code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
29d022b1eb qemu: command: Introduce 'qemuBuildInterfaceConnect' helper
The helper will aggregate code that is used to connect the network
backend to the corresponding host portion.

This will be used to refactor the duplicated code between the cold-start
and hotplug helper functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 09:15:46 +02:00
Peter Krempa
d3f7b6fe2f qemu: Always assume QEMU_CAPS_STORAGE_WERROR
All supported QEMUs now accept werror/rerror as argument for the
frontend disk device, so we can remove the old code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
4225de7c73 qemuBuildTPMOpenBackendFDs: Construct 'cancel_path' internally
Since 'cancel_path' is constructed from the 'tpmdev' argument, we can
push it down into the function opening the FDs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Andrea Bolognani
cb81263c22 qemu: Drop qemuAudioDriver enumeration
This mostly overlaps with virDomainAudioType, but in a couple of
cases the string representations are different.

Right now we're doing that in a somewhat sketchy way, in that we
store values of one enumeration and then convert them to strings
using TypeToString() implementation for the other enumeration;
when converting from string, we open-code the handling of the
special values mentioned above.

Drop the second enumeration and introduce two helpers to deal
with conversion. Most calling sites don't need to be changed, and
one can even be simplified significantly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:26:58 +01:00
Michal Privoznik
f9db6f3ab6 qemu: Allow prealloc for virtio-mem-pci
There are a some scenarios in which we want to prealloc guest
memory (e.g. when requested in domain XML, when using hugepages,
etc.). With 'regular' <memory/> models (like 'dimm', 'nvdimm' or
'virtio-pmem') or regular guest memory it is corresponding
memory-backend-* object that ends up with .prealloc attribute
set. And that's desired because neither of those devices can
change its size on the fly. However, with virtio-mem model things
are a bit different. While one can set .prealloc attribute on
corresponding memory-backend-* object it doesn't make much sense,
because virtio-mem can inflate/deflate on the fly, i.e. change
how big of a portion of the memory-backend-* object is exposed to
the guest. For instance, from a say 4GiB module only a half can
be exposed to the guest. Therefore, it doesn't make much sense to
preallocate whole 4GiB and keep them allocated. But we still want
the part exposed to the guest preallocated (when conditions
described at the beginning are met).

Having said that, with new enough QEMU the virtio-mem-pci device
gained new attribute ".prealloc" which instructs the device to
talk to the memory backend object and allocate only the requested
portion of memory.

Now, that our algorithm for setting .prealloc was isolated in a
single function, the function can be called when constructing cmd
line for virtio-mem-pci device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:27 +01:00
Michal Privoznik
bad883787f qemuBuildMemoryDeviceProps: Fix const correctness
The @mem agrument of qemuBuildMemoryDeviceProps() function is
only read from. Make this fact obvious from the function
declaration too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:26 +01:00
Peter Krempa
0eabefb2b8 qemuBuildChrChardevStr: Remove unused arguments and clean up callers
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-10 16:37:42 +01:00
Peter Krempa
5dc77b7d32 qemuBuildStorageSourceAttachPrepare(Drive|Chardev): Unexport
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-19 12:38:34 +01:00
Peter Krempa
a6577204d7 qemu: command: Rename qemuBuildHostNetStr -> qemuBuildHostNetProps
The function is already returning JSON properties, rename it
accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-19 12:38:34 +01:00
Peter Krempa
7ef62d7d57 qemuBuildVHostUserFsCommandLine: Generate via JSON
The 'vhost-user-fs-pci' has following properties we control:
  chardev=<str>          - ID of a chardev to use as a backend
  queue-size=<uint16>    -  (default: 128)
  tag=<str>
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
3b4cc1d5a6 qemuBuildVsockCommandLine: Generate via JSON
Build the properties of 'vhost-vsock' device via JSON. In comparison to
previous similar refactors this also modifies the hotplug code to attach
the vhost fd handle explicitly rather than using
'qemuMonitorAddDeviceWithFd'.

The properties of vhost-vsock have the following types according to
QEMU:

  guest-cid=<uint64>     -  (default: 0)
  vhostfd=<str>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
44b52c18e3 qemuBuildHostdevCommandLine: Generate via JSON
Build the properties of 'vhost-scsi' device via JSON. In comparison to
previous similar refactors this also modifies the hotplug code to attach
the vhost fd handle explicitly rather than using
'qemuMonitorAddDeviceWithFd'.

The 'vhost-scsi' device doesn't have any special (non-string) properties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
9ac91fcceb qemuBuildChrDeviceCommandLine: Generate via JSON
Build commandlines for character devices via JSON.

For devices using 'VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL' address
type 'qemuBuildDeviceAddressProps' will now generate the address. The
only special property is 'nr'. QEMU declares it as:

  nr=<uint32>            -  (default: 4294967295)

The test fallout is caused by formatting addresses as decimal numbers
instead of hex as described in the commit which added
'qemuBuildDeviceAddressProps'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
a0d70f96ca qemuBuildControllersByTypeCommandLine: Generate via JSON
The handlers for PCI, SCSI and USB controllers already use JSON
internally. This patch converts 'virtio-serial', 'ccid' and 'sata' to do
the same and passes out the JSON directly so that it can be used in
monitor code to avoid conversion.

From the controllers converted in this patch only 'virtio-serial' has
special properties. QEMU thinks they have the following types:

  max_ports=<uint32>     -  (default: 31)
  vectors=<uint32>       -  (default: 2)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:12 +02:00
Peter Krempa
ee996fbf7a qemuBuildInterfaceCommandLine: Generate via JSON
virtio-net-pci specific properties and their types according to QEMU:
  tx=<str>
  ioeventfd=<bool>       - on/off (default: true)
  event_idx=<bool>       - on/off (default: true)
  csum=<bool>            - on/off (default: true)
  gso=<bool>             - on/off (default: true)
  host_tso4=<bool>       - on/off (default: true)
  host_tso6=<bool>       - on/off (default: true)
  host_ecn=<bool>        - on/off (default: true)
  host_ufo=<bool>        - on/off (default: true)
  mrg_rxbuf=<bool>       - on/off (default: true)
  guest_csum=<bool>      - on/off (default: true)
  guest_tso4=<bool>      - on/off (default: true)
  guest_tso6=<bool>      - on/off (default: true)
  guest_ecn=<bool>       - on/off (default: true)
  guest_ufo=<bool>       - on/off (default: true)
  mq=<bool>              - on/off (default: false)
  vectors=<uint32>       -  (default: 4294967295)
  rx_queue_size=<uint16> -  (default: 256)
  tx_queue_size=<uint16> -  (default: 256)
  host_mtu=<uint16>      -  (default: 0)
  failover=<bool>        -  (default: false)

properties common for all network interfaces:
  netdev=<str>           - ID of a netdev to use as a backend
  mac=<str>              - Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
dc481f11a6 qemuBuildDiskCommandLine: Generate via JSON
The types for the special fields of the 'virtio-blk-pci' according to
QEMU are:
  iothread=<link<iothread>>
  ioeventfd=<bool>       - on/off (default: true)
  event_idx=<bool>       - on/off (default: true)
  scsi=<bool>            - on/off (default: false)
  num-queues=<uint16>    -  (default: 65535)
  queue-size=<uint16>    -  (default: 256)

For all disks we also use the following properties (based on 'scsi-hd'):
  device_id=<str>
  share-rw=<bool>        -  (default: false)
  drive=<str>            - Node name or ID of a block device to use as a backend
  chardev=<str>          - ID of a chardev to use as a backend  <-  vhost-user-blk-pci
  bootindex=<int32>
  logical_block_size=<size> - A power of two between 512 B and 2 MiB (default: 0)
  physical_block_size=<size> - A power of two between 512 B and 2 MiB (default: 0)
  wwn=<uint64>           -  (default: 0)
  rotation_rate=<uint16> -  (default: 0)
  vendor=<str>
  product=<str>
  removable=<bool>       - on/off (default: false)
  write-cache=<OnOffAuto> - on/off/auto (default: "auto")
  cyls=<uint32>          -  (default: 0)
  heads=<uint32>         -  (default: 0)
  secs=<uint32>          -  (default: 0)
  bios-chs-trans=<BiosAtaTranslation> - Logical CHS translation algorithm, auto/none/lba/large/rechs (default: "auto") <- ide-hd
  serial=<str>
  werror=<BlockdevOnError> - Error handling policy, report/ignore/enospc/stop/auto (default: "auto")
  rerror=<BlockdevOnError> - Error handling policy, report/ignore/enospc/stop/auto (default: "auto")

The 'wwn' field is changed from a hex string to a number since qemu
actually treats it as a number.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
82d499c6c0 qemuBuildHostdevSCSICommandLine: Generate via JSON
Since 'qemuBuildDeviceAddressProps' now also builds 'drive' addresses
the generator is way simpler and doesn't use any special fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
fcf96b11ba qemuBuildHostdevCommandLine: Format PCI host devices via JSON
For properties we use these are the QEMU types:
  host=<str>             - Address (bus/device/function) of the host device, example: 04:10.0
  bootindex=<int32>
  failover_pair_id=<str>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
c3b1bd723e qemuCommandAddExtDevice: Generate via JSON
Generate the 'zpci' device via JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
478725b7c3 qemuBuildInputCommandLine: Generate via JSON
For 'usb-mouse'/'usb-tablet'/'usb-kbd' we don't use any special
property.

For 'virtio-input-pci' we only use the 'evdev' argument which is a
string so this conversion doesn't impact anything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
31e509ad39 qemuBuildRedirdevCommandLine: Generate via JSON
The 'usb-redir' device has the following types according to QEMU for
properties we control:

  chardev=<str>          - ID of a chardev to use as a backend
  filter=<str>
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
1cbfe4385c qemuBuildHostdevMediatedDevProps: Format USB host devices via JSON
The 'usb-host' device has the following types according to QEMU for
properties we control:

  hostdevice=<str>
  hostbus=<uint32>       -  (default: 0)
  hostaddr=<uint32>      -  (default: 0)
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
73c352ab8c qemuBuildHostdevCommandLine: Build mediated device commandline via JSON
The 'vfio-pci-nohotplug' device has the following property types
according to QEMU:

  display=<OnOffAuto>    - on/off/auto (default: "off")
  sysfsdev=<str>
  ramfb=<bool>
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
172f64bb81 qemuBuildRNGCommandLine: Generate via JSON
The 'virtio-rng' has the following property types according to QEMU:
  rng=<link<rng-backend>>
  max-bytes=<uint64>     -  (default: 9223372036854775807)
  period=<uint32>        -  (default: 65536)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
82bf36e551 qemuBuildShmemCommandLine: Generate via JSON
Note that the legacy 'ivshmem' device was already removed upstream, but
it's converted so that the code is identical.

For the two modern devices QEMU considers the properties being of
following types:

'ivshmem-doorbell'
  chardev=<str>          - ID of a chardev to use as a backend
  ioeventfd=<bool>       - on/off (default: true)
  master=<OnOffAuto>     - on/off/auto (default: "off")
  vectors=<uint32>       -  (default: 1)

'ivshmem-plain'
  master=<OnOffAuto>     - on/off/auto (default: "off")
  memdev=<link<memory-backend>>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
04f007e7b3 qemuBuildMemoryDeviceCommandLine: Generate via JSON
This includes the 'pc-dimm', 'nvdimm', 'virtio-pmem-pci' and
'virtio-mem-pci' devices.

The value types according to QEMU are:

'pc-dimm'
  node=<uint32>          -  (default: 0)
  memdev=<link<memory-backend>>

'nvdimm'
  label-size=<int>
  memdev=<link<memory-backend>>
  node=<uint32>          -  (default: 0)
  unarmed=<bool>         -  (default: false)
  uuid=<QemuUUID>

'virtio-pmem-pci'
  memdev=<link<memory-backend>>

'virtio-mem-pci'
  block-size=<size>
  memdev=<link<memory-backend>>
  node=<uint32>          -  (default: 0)
  requested-size=<size>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
a4229c087e qemuBuildWatchdogCommandLine: Generate via JSON
The watchdog doesn't have any special properties.

Convert the command line generator and hotplug code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
9e9fc9ea10 qemu: Clean up after old-style passing of 'bootIndex' to network devices
Remove the now unused boot-index related attributes and the code which
is assigning it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00