]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 weeks agotests: qemuxmlconfdata: provide device-pluggable smmuv3 sample XML and CLI args
Nathan Chen [Thu, 20 Nov 2025 01:42:43 +0000 (17:42 -0800)] 
tests: qemuxmlconfdata: provide device-pluggable smmuv3 sample XML and CLI args

Provide sample XML and CLI args for the device-pluggable smmuv3
XML schema for virt machine type.

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemu: Implement pluggable-device smmuv3
Nathan Chen [Thu, 20 Nov 2025 01:42:41 +0000 (17:42 -0800)] 
qemu: Implement pluggable-device smmuv3

Introduce support for "pciBus" driver attribute for
"smmuv3" IOMMU model. The "pciBus" attribute indicates
the index of the controller that a smmuv3 IOMMU device
is attached to, and differentiates the device-pluggable
arm-smmuv3 model from the virt-machine-associated smmuv3
model.

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoconf: Support multiple device-pluggable smmuv3 IOMMUs
Nathan Chen [Thu, 20 Nov 2025 01:42:40 +0000 (17:42 -0800)] 
conf: Support multiple device-pluggable smmuv3 IOMMUs

Add support for parsing multiple IOMMU devices from
the VM definition when "smmuv3" is the IOMMU model.

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemu: Format IOMMU devices after controllers
Nathan Chen [Thu, 20 Nov 2025 01:42:42 +0000 (17:42 -0800)] 
qemu: Format IOMMU devices after controllers

Format qemu arguments for IOMMU devices after
controllers as the multi-SMMUv3 model associates
SMMUv3 devices with hostdevs by plugging them
into the same controller upstream.

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemu: make qemuBuildDeviceAddressPCIGetBus more generic
Ján Tomko [Thu, 20 Nov 2025 14:15:38 +0000 (15:15 +0100)] 
qemu: make qemuBuildDeviceAddressPCIGetBus more generic

Operate on a virPCIDeviceAddress, not virDomainDeviceInfo
so that this can be reused to look for buses that are not
stored in the device info.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agobhyve: support VNC 'wait' attribute
Roman Bogorodskiy [Tue, 18 Nov 2025 18:01:52 +0000 (19:01 +0100)] 
bhyve: support VNC 'wait' attribute

Bhyve supports the 'wait' option for the VNC device configuration.
When enabled, VM boots only upon a VNC connection.

Sample device configuration looks like this:

 -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agoconf: introduce 'wait' attribute for VNC
Roman Bogorodskiy [Tue, 18 Nov 2025 17:58:17 +0000 (18:58 +0100)] 
conf: introduce 'wait' attribute for VNC

Introduce an optional 'wait' attribute for 'VNC'.
When set to 'yes', VM should only boot upon the initiation of a VNC
connection.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agotools: inform user which hardware virt was found during validation
Daniel P. Berrangé [Thu, 20 Nov 2025 09:50:29 +0000 (04:50 -0500)] 
tools: inform user which hardware virt was found during validation

On x86 we can indicate VMX or SVM, while s390x would be SIE, and
PowerPC would be LCPR (Logical Partitioning Control Register).

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 weeks agotools: be explicit about failure to find x86 secure virt
Daniel P. Berrangé [Thu, 20 Nov 2025 09:42:35 +0000 (04:42 -0500)] 
tools: be explicit about failure to find x86 secure virt

If we fail to find either SEV or TDX on x86, we can explicitly
say there is no secure guest support on the platform.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 weeks agotools: inform user which CVM is found during validation
Daniel P. Berrangé [Thu, 20 Nov 2025 09:36:58 +0000 (04:36 -0500)] 
tools: inform user which CVM is found during validation

For AMD, the virt-host-validate 'secure guest' check reports
support for SEV, and there are then further check results
printed for SEV-ES/SEV-SNP which are overly verbose and the
long lines break output alignment.

This uses the new ability to report details with PASS results
to concisely tell the user which out of SEV/SEV-ES/SEV-SNP
are found. Only a single answer is neede, as SEV-SNP implies
SEV & SEV-ES, and SEV-ES implies SEV.

The TDX s390x PROT-VIRT checks also identify themselves.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 weeks agotools: inform user which IOMMU was found during validation
Daniel P. Berrangé [Thu, 20 Nov 2025 09:32:38 +0000 (04:32 -0500)] 
tools: inform user which IOMMU was found during validation

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 weeks agotools: allow passing details for passed validation tests
Daniel P. Berrangé [Thu, 20 Nov 2025 09:30:31 +0000 (04:30 -0500)] 
tools: allow passing details for passed validation tests

In a number of virt-host-validte tests we are testing for
at least one out of multiple acceptable features. For
example the 'secure guest' test can be satisfied by
s390x protvirt, or x86 TDX, SEV, SEV-ES, SEV-SNP.

It would be useful to inform the user which one we detected
when the test passes. This introduces virValidatePassDetails
to enable that.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 weeks agovmx2xmltest: Add a test case for disks in subfolder
Michal Privoznik [Wed, 12 Nov 2025 14:55:54 +0000 (15:55 +0100)] 
vmx2xmltest: Add a test case for disks in subfolder

This test case demonstrates correctness of the previous fix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agoesx: Allow disk images in subdirectories
Michal Privoznik [Wed, 19 Nov 2025 13:28:11 +0000 (14:28 +0100)] 
esx: Allow disk images in subdirectories

The esxParseVMXFileName() function parses path to a disk image
trying to replace some "known" patterns (e.g. datastore paths).
A simple filename is treated as a path relative to .vmx file. But
disk images (and thus filenames) can be in a subdirectory,
relative to the .vmx file. For instance:

  subfolder/disk.vmdk

Adapt our parser to this fact.

Resolves: https://issues.redhat.com/browse/RHEL-122751
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agovmx2xmltest: Drop custom file name parse function
Michal Privoznik [Fri, 14 Nov 2025 09:35:14 +0000 (10:35 +0100)] 
vmx2xmltest: Drop custom file name parse function

Having a custom file name parsing function in vmx2xml that's
different to the one used in production (esxParseVMXFileName())
might have served us well, but it also defeats the point of
having a unit test. More specifically, if there's a bug in
esxParseVMXFileName() then our unit test would not catch it.

But now that we have vmx2xmlmock the custom parsing function can
be dropped and the test can use the real one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agotests: Introduce vmx2xmlmock
Michal Privoznik [Wed, 19 Nov 2025 11:50:49 +0000 (12:50 +0100)] 
tests: Introduce vmx2xmlmock

If we want vmx2xmltest to use actual file name parser that's used
in production (esxParseVMXFileName()) we need a mock to stop it
from doing any HTTP requests and also to return predictable data.

So far, the function can call three functions that do HTTP
requests: esxVI_LookupDatastoreList(),
esxVI_LookupDatastoreHostMount() and
esxVI_LookupDatastoreByName().

Mock all three of them. And since their implementation uses some
other symbols (like allocators or _AppendToList() helpers) we
need to expose these symbols too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agoesx: Make esxVI_LookupDatastoreByName() mockable
Michal Privoznik [Wed, 19 Nov 2025 11:57:46 +0000 (12:57 +0100)] 
esx: Make esxVI_LookupDatastoreByName() mockable

This function is going to be mocked soon. Annotate and export it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agoesx: Make esxVI_LookupDatastoreHostMount() mockable
Michal Privoznik [Wed, 19 Nov 2025 11:50:34 +0000 (12:50 +0100)] 
esx: Make esxVI_LookupDatastoreHostMount() mockable

This function is going to be mocked soon. Annotate and export it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agoesx: Make esxVI_LookupDatastoreList() mockable
Michal Privoznik [Fri, 14 Nov 2025 09:34:59 +0000 (10:34 +0100)] 
esx: Make esxVI_LookupDatastoreList() mockable

This function is going to be mocked soon. Annotate and export it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agoesx: Expose esxParseVMXFileName() for tests
Michal Privoznik [Thu, 13 Nov 2025 09:34:26 +0000 (10:34 +0100)] 
esx: Expose esxParseVMXFileName() for tests

So far, our vmx2xmltest uses a custom .parseFileName callback.
And it kind of makes sense because the one that's used in
production (esxParseVMXFileName()) does some HTTP requests which
we don't want to do in our test suite. But this creates other
sorts of problems and the idea is to have the test ditch custom
parse callback and stick with the production one. But for now,
just expose it. With it, the esxVMX_Data struct is exposed too as
it is passed into the function (via 'opaque' argument).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agolibvirt_esx.syms: Put proper header file name into comment
Michal Privoznik [Fri, 14 Nov 2025 13:07:56 +0000 (14:07 +0100)] 
libvirt_esx.syms: Put proper header file name into comment

The esxVI_DateTime_ConvertToCalendarTime() symbol is declared in
esx_vi_types.h header file. Reflect this in the corresponding
.syms file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 weeks agodocs: domain: add watchdog notification support
Massimiliano Minella [Fri, 3 Oct 2025 09:06:16 +0000 (11:06 +0200)] 
docs: domain: add watchdog notification support

Since v0.8.0 a watchdog notification is available under event ID
VIR_DOMAIN_EVENT_ID_WATCHDOG, update the documentation to remove the
previous limitation.

Signed-off-by: Massimiliano Minella <massimiliano.minella@se.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemuDomainPrepareDiskSourceData: Setup 'detect_zeroes' for all layers
Peter Krempa [Fri, 14 Nov 2025 15:05:06 +0000 (16:05 +0100)] 
qemuDomainPrepareDiskSourceData: Setup 'detect_zeroes' for all layers

While it may seem that zero detection is pointless for backing chain
layers other than the top one, which is usually the only one gettin
written to,  with block operations such as active-layer commit the
non-top layer may become active, in which case the VM wouldn't be
configured in accordance to the XML any more.

Similarly with snapshots a new image is introduced which would not get
zero detection enabled, but next start of the VM would enable it.

Fix this by propagating the zero detection setting for all layers.

This problem partially addresses one of the issues reported in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1120389

Fixes: 8a78f88a1a6 and a522c3044bd (effectively reverts them)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 weeks agoqemuxmlconftest: Improve coverage of 'disk-detect-zeroes' test case
Peter Krempa [Fri, 14 Nov 2025 15:13:55 +0000 (16:13 +0100)] 
qemuxmlconftest: Improve coverage of 'disk-detect-zeroes' test case

Add test cases for all three options 'off'/'on'/'unmap' as well as add
backing store for each image to show how the configuration behaves.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 weeks agoselinux: Mark anything using content_context as shared
Cole Robinson [Tue, 11 Nov 2025 16:52:00 +0000 (11:52 -0500)] 
selinux: Mark anything using content_context as shared

This marks kernel, initrd, dtb, and similar elements with is_shared,
meaning we skip label restore if xattr label remembering is not
enabled or supported (like on qemu:///session).

non-xattr based label restore is subject to race conditions if
multiple VMs are starting and stopping using shared media:
https://issues.redhat.com/browse/RHEL-126945

This converts every case that is using content_context (virt_content_t)
as SetFileLabel time, which is how we are marking content as
readonly. All the shareable cases (marked with file_context) are
already skipping remembering/label restore entirely.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
3 weeks agoselinux: Add is_shared plumbing to RestoreFileLabel
Cole Robinson [Tue, 11 Nov 2025 14:21:17 +0000 (09:21 -0500)] 
selinux: Add is_shared plumbing to RestoreFileLabel

If set, we will skip fallback label restore attempts, if label
remembering fails or isn't supported.

This is a no-op, as every caller passes in `false` which matches
existing behavior. Next patch will make use of it

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
3 weeks agoselinux: Don't remember labels for shareable SCSI devices
Cole Robinson [Tue, 11 Nov 2025 16:50:06 +0000 (11:50 -0500)] 
selinux: Don't remember labels for shareable SCSI devices

For shareable/readonly devices, label restore is skipped entirely in
virSecuritySELinuxRestoreSCSILabel. So requesting remember=true here
doesn't accomplish anything

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
3 weeks agoselinux: Match remember/recall arguments for SavedStateLabel
Cole Robinson [Tue, 11 Nov 2025 14:10:03 +0000 (09:10 -0500)] 
selinux: Match remember/recall arguments for SavedStateLabel

virSecuritySELinuxSetSavedStateLabel uses remember=false, but
virSecuritySELinuxRestoreSavedStateLabel uses recall=true.

This doesn't cause problems in practice, just some redundant xattr
calls. But Set and Restore calls should be matched here.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
3 weeks agobhyve: s/provconn/privcon/
Michal Privoznik [Thu, 13 Nov 2025 08:06:43 +0000 (09:06 +0100)] 
bhyve: s/provconn/privcon/

Due to a typo, the bhyve driver doesn't compile. Fix it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoqemu: snapshot: Set umask for 'qemu-img' when creating external inactive snapshots CVE-2025-13193
Peter Krempa [Wed, 12 Nov 2025 16:52:05 +0000 (17:52 +0100)] 
qemu: snapshot: Set umask for 'qemu-img' when creating external inactive snapshots

External inactive snapshots are created by invoking 'qemu-img' which
creates the file. Currently qemu-img creates image with mode 644 based
on default umask as libvirt doesn't set any.

Having a world-readable image is obviously wrong so set the umask to
077 to have the file readable only by the owner.

Resolves: https://bugs.debian.org/1120119
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agoqemu: Check ACLs before parsing the whole domain XML CVE-2025-12748
Martin Kletzander [Thu, 6 Nov 2025 13:33:41 +0000 (14:33 +0100)] 
qemu: Check ACLs before parsing the whole domain XML

Utilise the new virDomainDefIDsParseString() for that.

This is one of the more complex ones since there is also a function that
reads relevant metadata from a save image XML.  In order _not_ to extract
the parsing out of the function (and make the function basically trivial
and all callers more complex) add a callback to the function which will
be used to check the ACLs.

Fixes: CVE-2025-12748
Reported-by: Святослав Терешин <s.tereshin@fobos-nt.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoch: Check ACLs before parsing the whole domain XML
Martin Kletzander [Thu, 6 Nov 2025 15:23:30 +0000 (16:23 +0100)] 
ch: Check ACLs before parsing the whole domain XML

Utilise the new virDomainDefIDsParseString() for that.

This is one of the more complex ones since there is also a function that
reads relevant metadata from a save image XML.  In order not to extract
the parsing out of the function (and make the function basically trivial
and all callers more complex) add a callback to the function which will
be used to check the ACLs.  And since this function is called in APIs
that perform ACL checks both with and without flags, add two of them for
good measure.

Fixes: CVE-2025-12748
Reported-by: Святослав Терешин <s.tereshin@fobos-nt.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agovz: Check ACLs before parsing the whole domain XML
Martin Kletzander [Thu, 6 Nov 2025 15:03:26 +0000 (16:03 +0100)] 
vz: Check ACLs before parsing the whole domain XML

Utilise the new virDomainDefIDsParseString() for that.

Fixes: CVE-2025-12748
Reported-by: Святослав Терешин <s.tereshin@fobos-nt.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agolxc: Check ACLs before parsing the whole domain XML
Martin Kletzander [Thu, 6 Nov 2025 14:49:01 +0000 (15:49 +0100)] 
lxc: Check ACLs before parsing the whole domain XML

Utilise the new virDomainDefIDsParseString() for that.

Fixes: CVE-2025-12748
Reported-by: Святослав Терешин <s.tereshin@fobos-nt.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agolibxl: Check ACLs before parsing the whole domain XML
Martin Kletzander [Thu, 6 Nov 2025 14:43:57 +0000 (15:43 +0100)] 
libxl: Check ACLs before parsing the whole domain XML

Utilise the new virDomainDefIDsParseString() for that.

Fixes: CVE-2025-12748
Reported-by: Святослав Терешин <s.tereshin@fobos-nt.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agobhyve: Check ACLs before parsing the whole domain XML
Martin Kletzander [Thu, 6 Nov 2025 14:31:12 +0000 (15:31 +0100)] 
bhyve: Check ACLs before parsing the whole domain XML

Utilise the new virDomainDefIDsParseString() for that.

Fixes: CVE-2025-12748
Reported-by: Святослав Терешин <s.tereshin@fobos-nt.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoconf: Add virDomainDefIDsParseString
Martin Kletzander [Thu, 6 Nov 2025 13:33:31 +0000 (14:33 +0100)] 
conf: Add virDomainDefIDsParseString

This function performs only parsing with the underlying
virDomainDefParseIDs() function to get needed metadata for any ACL
checks, but nothing else to avoid extraneous allocations and any
parser-induced DoS over ACL-forbidden connections.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agovirXMLFormatMetadata: Don't modify deprecated 'xmlIndentTreeOutput'
Peter Krempa [Mon, 10 Nov 2025 15:52:45 +0000 (16:52 +0100)] 
virXMLFormatMetadata: Don't modify deprecated 'xmlIndentTreeOutput'

'libxml2' deprecated the 'xmlIndentTreeOutput' thread-local variable as
well as the 'xmlThrDefIndentTreeOutput' function for setting the global
default, which we use in our code for formatting the metadata sub-XML.

'libxml2' also for now doesn't provide a way to set target indentation
level in 'xmlSaveCtxt' which would allow us to use the modern output
APIs, we can't replace our use of 'xmlDumpNode'. (See
https://gitlab.gnome.org/GNOME/libxml2/-/issues/989 )

Since the indentation is enabled by default in libxml2 and our most
commonly used code which calls xmlDumpNode lives in a standalone
process, where we don't override the setting, just removing the override
will result in identical behaviour.

For the use cases which do live in a process we don't fully control and
thus the default could have been overriden, the result would be that the
<metadata> element would be un-indented, but that is still valid XML.

Thus to fix the deprecated use just stop setting 'xmlIndentTreeOutput'.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/816
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agovirVBoxSnapshotConfSaveVboxFile: Don't modify deprecated 'xmlIndentTreeOutput'
Peter Krempa [Mon, 10 Nov 2025 15:54:32 +0000 (16:54 +0100)] 
virVBoxSnapshotConfSaveVboxFile: Don't modify deprecated 'xmlIndentTreeOutput'

'xmlIndentTreeOutput' is now deprecated by libxml2.

The default value set by libxml2 is '1', and the vbox driver resides
only inside the standalone daemon where the value will not be changed by
us thus there's no observable change in behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agobhyve: domain: improve disks validation
Roman Bogorodskiy [Sun, 9 Nov 2025 10:10:54 +0000 (11:10 +0100)] 
bhyve: domain: improve disks validation

Do not allow to configure queues and queue size for non-NVMe disks.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agobhyve: domain: refactor bhyveDomainDeviceDefValidate()
Roman Bogorodskiy [Sun, 9 Nov 2025 09:47:51 +0000 (10:47 +0100)] 
bhyve: domain: refactor bhyveDomainDeviceDefValidate()

Refactor bhyveDomainDeviceDefValidate() to use switch/case instead of
series of ifs which makes it easier to follow.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agobhyve: support queue configuration for NVMe disks
Roman Bogorodskiy [Sat, 8 Nov 2025 08:12:50 +0000 (09:12 +0100)] 
bhyve: support queue configuration for NVMe disks

bhyve supports queue configuration for the NVMe disks:

  maxq        Max number of queues.
  qsz         Max elements in each queue.

Map that to the disk driver's "queues" and "queue_size" attributes
respectfully, so:

  <driver name='file' type='raw' queues='2' queue_size='256'/>

results in:

  -s N:0,nvme,/tmp/disk.img,maxq=2,qsz=256

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoconf: domain_validate: make disk queue configuration driver specific
Roman Bogorodskiy [Sun, 9 Nov 2025 09:10:54 +0000 (10:10 +0100)] 
conf: domain_validate: make disk queue configuration driver specific

Currently, virDomainDiskDefValidate() allows to configure disks' number
of queues and queue size for virtio disks only. However, the bhyve
driver allows to configure these for the NVMe disks, so make this
check driver-specific.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agodocs: drvbhyve: add guest-specific nodes section
Roman Bogorodskiy [Sat, 8 Nov 2025 14:22:48 +0000 (15:22 +0100)] 
docs: drvbhyve: add guest-specific nodes section

Add a section with guest-specific notes. Start with LPC slot address
information for the Windows guests.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agodocs: drvbhyve: improve the manpage link
Roman Bogorodskiy [Sat, 8 Nov 2025 13:46:26 +0000 (14:46 +0100)] 
docs: drvbhyve: improve the manpage link

When linking to the bhyve(8) manual page, do not set manpath
to a specific FreeBSD version so the latest actual version
is displayed.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agodocs: drvbhyve: document device passthrough
Roman Bogorodskiy [Sat, 8 Nov 2025 13:25:00 +0000 (14:25 +0100)] 
docs: drvbhyve: document device passthrough

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agomeson: default to system crypto policies where available
Daniel P. Berrangé [Tue, 1 Jul 2025 16:45:26 +0000 (17:45 +0100)] 
meson: default to system crypto policies where available

In RHEL and Fedora, the built-in GNUTLS default priority is changed
from "NORMAL" to "@SYSTEM", but because libvirt sets an explicit
policy with gnutls we don't honour that. Instead we force "NORMAL"
unless the 'tls_priority' meson option is changed.

In RPM builds, meanwhile, we ask for "@LIBVIRT,SYSTEM" to make it
look for a libvirt specific profile first, falling back to "@SYSTEM"

This changes the meson option to default to "@LIBVIRT,SYSTEM" if the
crypto-policies config is present on the local machine and the meson
option -Dsystem=true is given.

This gives developers more appropriate default behaviour, matching
that seen in package builds.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 weeks agoch: Sort driver sources and drop header files
Michal Privoznik [Fri, 24 Oct 2025 08:11:04 +0000 (10:11 +0200)] 
ch: Sort driver sources and drop header files

Firstly, there's no need to list header files in
ch_driver_sources (we don't do that anywhere else, and meson is
smart enough to figure them out). And secondly, the list of
source file is not sorted which means new source files are added
in random order.

Thus, drop header files from the list and sort it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 weeks agoch: Assign device alias early
Michal Privoznik [Thu, 23 Oct 2025 13:53:20 +0000 (15:53 +0200)] 
ch: Assign device alias early

Assigning device should happen from ch_hotplug.c (just like it's
done for disks currently) not in ch_process.c. Move alias
assignment out of chProcessAddNetworkDevice(). And while at it,
mimic what's done with disks and have net hotplug handling done
from a function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 weeks agoch: Set transient domain definition
Michal Privoznik [Fri, 24 Oct 2025 13:42:53 +0000 (15:42 +0200)] 
ch: Set transient domain definition

Libvirt's philosophy is that for a running domain there are two
(in general distinct) definitions: live definition (reflects the
running state) and inactive definition (used to seed the live
definition when domain is being created).  That's why we have
VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG flags to APIs
that modify domain definitions.

Well, the CH driver doesn't do this distinction. Fix this by
making the domain definition transient when it's being created.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 weeks agoch: Use correct domain definition in chDomainGetXMLDesc()
Michal Privoznik [Thu, 6 Nov 2025 14:01:26 +0000 (15:01 +0100)] 
ch: Use correct domain definition in chDomainGetXMLDesc()

The chDomainGetXMLDesc() function claims to support
VIR_DOMAIN_XML_INACTIVE to obtain the persistent definition of a
running domain (in its call to virCheckFlags()) but in fact, it's
always passing vm->def to virDomainDefFormat().

So far, there's no harm done because CH driver never sets domain
def as transient. But that'll change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 weeks agoch_process: Avoid memleak in chProcessAddNetworkDevice()
Michal Privoznik [Thu, 6 Nov 2025 14:03:42 +0000 (15:03 +0100)] 
ch_process: Avoid memleak in chProcessAddNetworkDevice()

The 'payload' variable inside of chProcessAddNetworkDevice() is
reused and thus the memory it points to just before its
repurpose is not freed. Avoid reusing g_autofree variables.

 128 bytes in 1 blocks are definitely lost in loss record 1,828 of 2,026
    at 0x491A120: realloc (vg_replace_malloc.c:1801)
    by 0x4FEC251: g_realloc (in /usr/lib64/libglib-2.0.so.0.8400.4)
    by 0x500BB7E: g_string_expand (in /usr/lib64/libglib-2.0.so.0.8400.4)
    by 0x500BBF0: g_string_sized_new (in /usr/lib64/libglib-2.0.so.0.8400.4)
    by 0x4A114C0: virBufferInitialize (virbuffer.c:121)
    by 0x4A11890: virBufferAdd (virbuffer.c:160)
    by 0x4A67344: virJSONValueToBuffer (virjson.c:1562)
    by 0x4A673DB: virJSONValueToString (virjson.c:1599)
    by 0xBC878AB: virCHMonitorBuildNetJson (ch_monitor.c:466)
    by 0xBC8D4A9: chProcessAddNetworkDevice (ch_process.c:688)
    by 0xBC8FCE2: chDomainAttachDeviceLive (ch_hotplug.c:78)
    by 0xBC900CA: chDomainAttachDeviceLiveAndUpdateConfig (ch_hotplug.c:174)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 weeks agodomain_capabilities: Use virXMLFormatElement() in FORMAT_PROLOGUE and FORMAT_EPILOGUE...
Michal Privoznik [Tue, 4 Nov 2025 10:03:18 +0000 (11:03 +0100)] 
domain_capabilities: Use virXMLFormatElement() in FORMAT_PROLOGUE and FORMAT_EPILOGUE macros

Domain capabilities XML is formatted (mostly) using
FORMAT_PROLOGUE and FORMAT_EPILOGUE macros. These format opening
and closing stanzas for given element. The FORMAT_PROLOGUE macro
even tries to be clever and format element onto one line (if the
element isn't supported), but that's not enough. Fortunately, we
have virXMLFormatElement() which formats elements properly, so
let's switch macros into using that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 weeks agodomain_capabilities: Check NULL in FORMAT_PROLOGUE
Michal Privoznik [Tue, 4 Nov 2025 12:35:30 +0000 (13:35 +0100)] 
domain_capabilities: Check NULL in FORMAT_PROLOGUE

In the virDomainCaps struct there are some pointers that might be
NULL (for instance 'sev', 'sgx', 'hyperv'). Teach FORMAT_PROLOGUE
macro to check for NULL argument so that format functions (like
virDomainCapsFeatureHypervFormat()) don't need to.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 weeks agodomain_capabilities: Rework virDomainCapsCPUFormat()
Michal Privoznik [Tue, 4 Nov 2025 11:23:58 +0000 (12:23 +0100)] 
domain_capabilities: Rework virDomainCapsCPUFormat()

Make the virDomainCapsCPUFormat() function use
virXMLFormatElement() family of functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 weeks agodomain_capabilities: Rework virDomainCapsCPUCustomFormat()
Michal Privoznik [Wed, 5 Nov 2025 09:43:09 +0000 (10:43 +0100)] 
domain_capabilities: Rework virDomainCapsCPUCustomFormat()

Make the virDomainCapsCPUCustomFormat() function use
virXMLFormatElement() family of functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 weeks agodomain_capabilities: Move indentation adjustment out of virDomainCapsCPUCustomFormat()
Michal Privoznik [Tue, 4 Nov 2025 11:25:20 +0000 (12:25 +0100)] 
domain_capabilities: Move indentation adjustment out of virDomainCapsCPUCustomFormat()

The aim of virDomainCapsCPUCustomFormat() is to format CPU models
into given buffer. But it starts by adjusting indentation. Move
this one level up into the caller so that another buffer can be
used. This also makes the pattern match in the caller
(virDomainCapsCPUFormat()) with the rest of CPU related domcaps
formatting.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 weeks agobhyve: auto-assign PCI addresses for hostdevs
Roman Bogorodskiy [Wed, 2 Apr 2025 11:20:11 +0000 (13:20 +0200)] 
bhyve: auto-assign PCI addresses for hostdevs

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agobhyve: Tie the 'passthru' option to the 'hostdev' XML config
Alexander Shursha [Mon, 10 Mar 2025 09:05:05 +0000 (12:05 +0300)] 
bhyve: Tie the 'passthru' option to the 'hostdev' XML config

Signed-off-by: Alexander Shursha <kekek2@ya.ru>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agobhyve: Advertise hostdev support
Alexander Shursha [Mon, 10 Mar 2025 09:05:03 +0000 (12:05 +0300)] 
bhyve: Advertise hostdev support

Signed-off-by: Alexander Shursha <kekek2@ya.ru>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agobhyve: Support passing the 'passthru' command line option
Alexander Shursha [Mon, 10 Mar 2025 09:05:04 +0000 (12:05 +0300)] 
bhyve: Support passing the 'passthru' command line option

Bhyve supports PCI device passthrough using the following syntax:

  bhyve ... -s 4:0,passthru,5/2/0 ...

Where 5/2/0 is PCI address of the device in the host, and "4:0" is the
address in the guest.

Currently, user is responsible for reserving the device for passthrough,
i.e. by configuring pptdevs in loader.conf(5), or using devctl(8) to
detach the device.

Co-authored-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Signed-off-by: Alexander Shursha <kekek2@ya.ru>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agobhyve: process: improve domain startup error handling
Roman Bogorodskiy [Tue, 28 Oct 2025 17:04:12 +0000 (18:04 +0100)] 
bhyve: process: improve domain startup error handling

After executing the bhyve binary, it might happen that it fails very
early due to configuration issues (missing/inaccessible files, incorrect
custom args), bugs, etc. In this case it'll look like the domain has
started normally, but quickly turned off.

Improve that by waiting for the domain's vmm entity to appear in
/dev/vmm.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add YongFeng-v3 CPU model
Jiri Denemark [Thu, 6 Nov 2025 09:57:47 +0000 (10:57 +0100)] 
cpu_map: Add YongFeng-v3 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add YongFeng-v2 CPU model
Jiri Denemark [Thu, 6 Nov 2025 09:57:25 +0000 (10:57 +0100)] 
cpu_map: Add YongFeng-v2 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add YongFeng CPU model
Jiri Denemark [Thu, 6 Nov 2025 09:56:27 +0000 (10:56 +0100)] 
cpu_map: Add YongFeng CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add features used by Zhaoxin YongFeng Processor
Jiri Denemark [Thu, 6 Nov 2025 09:06:53 +0000 (10:06 +0100)] 
cpu_map: Add features used by Zhaoxin YongFeng Processor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add Zhaoxin CentaurHauls CPU vendor
Jiri Denemark [Thu, 6 Nov 2025 09:49:19 +0000 (10:49 +0100)] 
cpu_map: Add Zhaoxin CentaurHauls CPU vendor

Zhaoxin uses two distinct vendor IDs. This patch is adding one of them
used by Zhaoxin YongFeng Processor.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add EPYC-Turin CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:33:16 +0000 (09:33 +0100)] 
cpu_map: Add EPYC-Turin CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add EPYC-Milan-v3 CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:32:40 +0000 (09:32 +0100)] 
cpu_map: Add EPYC-Milan-v3 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add EPYC-v5 CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:30:18 +0000 (09:30 +0100)] 
cpu_map: Add EPYC-v5 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add EPYC-Rome-v5 CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:31:30 +0000 (09:31 +0100)] 
cpu_map: Add EPYC-Rome-v5 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add EPYC-Genoa-v2 CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:27:39 +0000 (09:27 +0100)] 
cpu_map: Add EPYC-Genoa-v2 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add ClearwaterForest CPU model
Jiri Denemark [Wed, 5 Nov 2025 15:45:43 +0000 (16:45 +0100)] 
cpu_map: Add ClearwaterForest CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add GraniteRapids-v3 CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:41:19 +0000 (09:41 +0100)] 
cpu_map: Add GraniteRapids-v3 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add SapphireRapids-v4 CPU model
Jiri Denemark [Thu, 6 Nov 2025 08:40:38 +0000 (09:40 +0100)] 
cpu_map: Add SapphireRapids-v4 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add SierraForest-v3 CPU model
Jiri Denemark [Wed, 5 Nov 2025 15:18:12 +0000 (16:18 +0100)] 
cpu_map: Add SierraForest-v3 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add SierraForest-v2 CPU model
Jiri Denemark [Wed, 5 Nov 2025 15:16:35 +0000 (16:16 +0100)] 
cpu_map: Add SierraForest-v2 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocputest: Add data for AMD Ryzen 9 9950X 16-Core CPU
Jiri Denemark [Thu, 6 Nov 2025 13:13:34 +0000 (14:13 +0100)] 
cputest: Add data for AMD Ryzen 9 9950X 16-Core CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocputest: Add data for Intel(R) Xeon(R) 6788P CPU
Jiri Denemark [Thu, 6 Nov 2025 11:20:01 +0000 (12:20 +0100)] 
cputest: Add data for Intel(R) Xeon(R) 6788P CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocputest: Read more MSRs in cpu-data.py
Jiri Denemark [Thu, 6 Nov 2025 13:10:06 +0000 (14:10 +0100)] 
cputest: Read more MSRs in cpu-data.py

The features defined in our CPU map use quite a bit more than just the
two MSRs the script is currently trying to read. Let's read all of them
to get complete host CPU data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocputest: Ignore missing MSRs in cpu-data.py
Jiri Denemark [Thu, 6 Nov 2025 12:40:14 +0000 (13:40 +0100)] 
cputest: Ignore missing MSRs in cpu-data.py

The current code made sense when we were reading only one MSR, but since
we started reading more MSRs, the host CPU would have to support all of
them otherwise the function would just return an empty dict.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agosync_qemu_models_i386: Support adding models to an empty group
Jiri Denemark [Thu, 6 Nov 2025 09:55:10 +0000 (10:55 +0100)] 
sync_qemu_models_i386: Support adding models to an empty group

When adding a new CPU vendor, we create a new empty group in
src/cpu_map/index.xml and want to use the sync_qemu_models_i386.py
script to add models there.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agosync_qemu_models_i386: Handle unknown features in GraniteRapids-v2
Jiri Denemark [Wed, 5 Nov 2025 14:54:57 +0000 (15:54 +0100)] 
sync_qemu_models_i386: Handle unknown features in GraniteRapids-v2

The GraniteRapids-v2 uses quite a few CPU features unknown to this
script.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agosync_qemu_models_i386: Print current model for unknown features
Jiri Denemark [Wed, 5 Nov 2025 14:49:22 +0000 (15:49 +0100)] 
sync_qemu_models_i386: Print current model for unknown features

This way one can just grep for all warnings in the script output and
still be able to see for which CPU model is defined using features the
script doesn't know about.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agosync_qemu_models_i386: Fix typo in CPUID_8000_0021_EAX_No_NESTED_DATA_BP
Jiri Denemark [Wed, 5 Nov 2025 14:48:11 +0000 (15:48 +0100)] 
sync_qemu_models_i386: Fix typo in CPUID_8000_0021_EAX_No_NESTED_DATA_BP

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Fix ordering of CPU models in meson.build
Jiri Denemark [Wed, 5 Nov 2025 14:47:18 +0000 (15:47 +0100)] 
cpu_map: Fix ordering of CPU models in meson.build

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add feature for detecting Indirect Target Selection immunity
Jiri Denemark [Wed, 5 Nov 2025 14:23:00 +0000 (15:23 +0100)] 
cpu_map: Add feature for detecting Indirect Target Selection immunity

QEMU commit 74978391b2da0116b9109d52931f342118d5a122

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add feature for detecting Branch History Injection immunity
Jiri Denemark [Wed, 5 Nov 2025 14:18:36 +0000 (15:18 +0100)] 
cpu_map: Add feature for detecting Branch History Injection immunity

QEMU commit b611931d4f70b9a3e49e39c405c63b3b5e9c0df1

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add features for Transient Scheduler Attacks mitigation
Jiri Denemark [Wed, 5 Nov 2025 14:11:56 +0000 (15:11 +0100)] 
cpu_map: Add features for Transient Scheduler Attacks mitigation

QEMU commits d8ec0baf4a15082cdc4abe1de28face9a26f0dc9 and
c79a35acadee784610aed40134a12738381b4fba

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add a few missing features to 0x80000021 CPUID leaf
Jiri Denemark [Wed, 5 Nov 2025 14:07:17 +0000 (15:07 +0100)] 
cpu_map: Add a few missing features to 0x80000021 CPUID leaf

QEMU commit dfd5b456108a75588ab094358ba5754787146d3d

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agocpu_map: Add msr-imm CPU feature
Jiri Denemark [Wed, 5 Nov 2025 13:45:36 +0000 (14:45 +0100)] 
cpu_map: Add msr-imm CPU feature

QEMU commit 91084f3b44b1da4935eec85b79c1f97d1c140ada

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agoscripts: do not use uninitialized variable
Ján Tomko [Fri, 7 Nov 2025 14:44:09 +0000 (15:44 +0100)] 
scripts: do not use uninitialized variable

A previous commit removed the 'ret' variable when
switching to subprocess.run, but did not adjust
the exit code.

Fixes: 15c9ca383c2a814c61cc4ed16b4dad91221d8129
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 weeks agotools/nss: check for missing array element
Daniel P. Berrangé [Thu, 16 Oct 2025 10:09:18 +0000 (11:09 +0100)] 
tools/nss: check for missing array element

We've already checked the upper bound of the array, but we should
none the less sanity check that the requested array element is
not NULL before dereferencing it.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 weeks agosrc: check for invalid stream in virStreamInData
Daniel P. Berrangé [Thu, 16 Oct 2025 10:03:41 +0000 (11:03 +0100)] 
src: check for invalid stream in virStreamInData

All methods must use virCheckStreamReturn to validate their
'stream' parameter.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 weeks agoscripts: use subprocess.run instead of os.system
Daniel P. Berrangé [Thu, 16 Oct 2025 09:23:27 +0000 (10:23 +0100)] 
scripts: use subprocess.run instead of os.system

The subprocess.run command avoids using the shell and so is robust
should sys.argv contain any whitespace or unexpected shell meta
characters.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 weeks agoqemu: Use query-accelerators to query accelerators
Praveen K Paladugu [Thu, 6 Nov 2025 16:26:54 +0000 (10:26 -0600)] 
qemu: Use query-accelerators to query accelerators

Use the `query-accelerators` command to generically query the enabled
acclerator. Below is an example invocation in Qemu:

  { "execute": "query-accelerators"}
  "return": {"enabled": "kvm", "present": ["kvm", "mshv", "qtest", "tcg", "xen"]}}

"enabled" here indicates "kvm" is the enabled accelertor.

If query-accelerators command is not available, fallback to existing
mechnisms for querying kvm and hvf capabilities.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agoqemu: Introduce query-accelerators cap
Praveen K Paladugu [Thu, 6 Nov 2025 16:26:53 +0000 (10:26 -0600)] 
qemu: Introduce query-accelerators cap

Introduce query-accelerators capability which is a generic way to query
the accelerators supported by qemu.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 weeks agosrc: report error from failing to add timer/FD watches
Daniel P. Berrangé [Mon, 22 Jul 2024 14:56:03 +0000 (15:56 +0100)] 
src: report error from failing to add timer/FD watches

The virEventAddHandle/Timeout APIs are unusual in that they do not
report errors on failure, because they call through to function
callbacks which might be provided externally to libvirt and thus
won't be using libvirt's error reporting APIs.

This is a rather unfortunate design characteristic as we can see
most callers forgot about this special behaviour and so we are
lacking error reporting in many cases.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 weeks agoconf: Don't leak virDomainDiskDef's 'statistics' member
Peter Krempa [Wed, 5 Nov 2025 15:03:13 +0000 (16:03 +0100)] 
conf: Don't leak virDomainDiskDef's 'statistics' member

In commit 19fc614d531f I've added an option to configure statistics but
forgot to free it once the disk definition struct is freed.

Fixes: 19fc614d531fb75877abb59baaf33bc1add4d483
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
4 weeks agoqemu: Add support for enabling timed block device statistics collection
Peter Krempa [Tue, 7 Oct 2025 15:43:41 +0000 (17:43 +0200)] 
qemu: Add support for enabling timed block device statistics collection

Add validation that qemu supports the collection of statistics and
enable it on the block device commandline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>