On a Friday in 2023, Michal Privoznik wrote:
There are PCI devices with pretty large non-prefetchable memory,
for instance:
Memory at 9d800000 (64-bit, non-prefetchable) [size=8M]
Memory at a6800000 (64-bit, non-prefetchable) [size=16K]
For cold plugged devices this is not a problem, because firmware
sets PCI controllers in a way that make devices behind them just
work. Problem arises if such PCI device is to be hot plugged.
Since the PCI device wasn't present at cold boot, firmware could
not take it into calculations and the amount of reserved memory
is not sufficient.
Introduce a know that allows users overriding value computed by
FW and thus allow hot plug of such PCI devices.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/formatdomain.rst | 6 ++++++
src/conf/domain_conf.c | 9 +++++++++
src/conf/domain_conf.h | 3 +++
src/conf/schemas/domaincommon.rng | 5 +++++
tests/qemuxml2argvdata/q35-usb2.xml | 2 +-
tests/qemuxml2xmloutdata/q35-usb2.x86_64-latest.xml | 2 +-
6 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 310d2bc427..0a19f97618 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -4103,6 +4103,12 @@ generated by libvirt. :since:`Since 1.2.19 (QEMU only).`
``index``
pci-root controllers for pSeries guests use this attribute to record the
order they will show up in the guest. :since:`Since 3.6.0`
+``memReserve``
+ Some PCI devices have non-prefetchable memory bar larger than 2MiB. Use this
As far as I understand, 2 MiB is the default in some firmwares and
configurations, but this should not be universally needed for devices
with larger memory requirements while using newer edk2:
https://bugzilla.redhat.com/show_bug.cgi?id=2055123#c32
+ attribute to override value computed by firmware and thus make
controller
+ reserve more memory (in KiB) so that such PCI device can be hot plugged.
+ For cold plugged PCI devices firmware recognizes this and computes correct
+ value. :since:`Since 10.0.0`
So is the value is for all the devices plugged (hot or cold) into the
controller?
also, "Since 10.1.0" now.
diff --git a/tests/qemuxml2argvdata/q35-usb2.xml
b/tests/qemuxml2argvdata/q35-usb2.xml
index 571782a17c..4f5a5580ac 100644
--- a/tests/qemuxml2argvdata/q35-usb2.xml
+++ b/tests/qemuxml2argvdata/q35-usb2.xml
@@ -25,7 +25,7 @@
</controller>
<controller type='pci' index='2' model='pci-bridge'>
<model name='pci-bridge'/>
- <target chassisNr='56'/>
+ <target chassisNr='56' memReserve='8196'/>
</controller>
<controller type='usb' index='0' model='ich9-ehci1'/>
<controller type='usb' index='0' model='ich9-uhci1'/>
Please rebase on top of Peter's test changes.
Jano