Revision 0259e96687fa9b01d87113693e076dfa83a649f0 authored by Laszlo Ersek on 27 September 2018, 21:24:36 UTC, committed by Michael S. Tsirkin on 05 November 2018, 18:24:02 UTC
In commit 9fa99d2519cb ("hw/pci-host: Fix x86 Host Bridges 64bit PCI
hole", 2017-11-16), we meant to expose such a 64-bit PCI MMIO aperture in
the ACPI DSDT that would be at least as large as the new "pci-hole64-size"
property (2GB on i440fx, 32GB on q35). The goal was to offer "enough"
64-bit MMIO aperture to the guest OS for hotplug purposes.

Previous patch fixed the issue that the aperture is extended relative to
a possibly incorrect base.  This may result in an aperture size that is
smaller than the intent of commit 9fa99d2519cb.

This patch adds a test to make sure it won't happen again.

In the test case being added:
- use 128 MB initial RAM size,
- ask for one DIMM hotplug slot,
- ask for 2 GB maximum RAM size,
- use a pci-testdev with a 64-bit BAR of 2 GB size.

Consequences:

(1) In pc_memory_init() [hw/i386/pc.c], the DIMM hotplug area size is
    initially set to 2048-128 = 1920 MB. (Maximum RAM size minus initial
    RAM size.)

(2) The DIMM area base is set to 4096 MB (because the initial RAM is only
    128 MB -- there is no initial "high RAM").

(3) Due to commit 085f8e88ba73 ("pc: count in 1Gb hugepage alignment when
    sizing hotplug-memory container", 2014-11-24), we add 1 GB for the one
    DIMM hotplug slot that was specified. This sets the DIMM area size to
    1920+1024 = 2944 MB.

(4) The reserved-memory-end address (exclusive) is set to 4096 + 2944 =
    7040 MB (DIMM area base plus DIMM area size).

(5) The reserved-memory-end address is rounded up to GB alignment,
    yielding 7 GB (7168 MB).

(6) Given the 2 GB BAR size of pci-testdev, SeaBIOS allocates said 64-bit
    BAR in 64-bit address space.

(7) Because reserved-memory-end is at 7 GB, it is unaligned for the 2 GB
    BAR. Therefore SeaBIOS allocates the BAR at 8 GB. QEMU then
    (correctly) assigns the root bridge aperture base this BAR address, to
    be exposed in \_SB.PCI0._CRS.

(8) The intent of commit 9fa99d2519cb dictates that QEMU extend the
    aperture size to 32 GB, implying a 40 GB end address. However, QEMU
    performs the extension relative to reserved-memory-end (7 GB), not
    relative to the bridge aperture base that was correctly deduced from
    SeaBIOS's BAR programming (8 GB). Therefore we see 39 GB as the
    aperture end address in \_SB.PCI0._CRS:

> QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
>     0x0000000000000000, // Granularity
>     0x0000000200000000, // Range Minimum
>     0x00000009BFFFFFFF, // Range Maximum
>     0x0000000000000000, // Translation Offset
>     0x00000007C0000000, // Length
>     ,, , AddressRangeMemory, TypeStatic)

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent f5f4002
History
File Mode Size
accel
audio
backends
block
bsd-user
capstone @ 22ead3e
chardev
contrib
crypto
default-configs
disas
docs
dtc @ 88f1890
fpu
fsdev
gdb-xml
hw
include
io
libdecnumber
linux-headers
linux-user
migration
nbd
net
pc-bios
po
qapi
qga
qobject
qom
replay
roms
scripts
scsi
slirp
stubs
target
tcg
tests
trace
ui
util
.dir-locals.el -rw-r--r-- 75 bytes
.editorconfig -rw-r--r-- 635 bytes
.exrc -rw-r--r-- 220 bytes
.gdbinit -rw-r--r-- 326 bytes
.gitignore -rw-r--r-- 4.6 KB
.gitmodules -rw-r--r-- 1.6 KB
.gitpublish -rw-r--r-- 1.6 KB
.mailmap -rw-r--r-- 2.4 KB
.shippable.yml -rw-r--r-- 1.2 KB
.travis.yml -rw-r--r-- 5.7 KB
CODING_STYLE -rw-r--r-- 6.3 KB
COPYING -rw-r--r-- 17.6 KB
COPYING.LIB -rw-r--r-- 25.8 KB
Changelog -rw-r--r-- 22.6 KB
HACKING -rw-r--r-- 10.2 KB
LICENSE -rw-r--r-- 840 bytes
MAINTAINERS -rw-r--r-- 46.7 KB
Makefile -rw-r--r-- 42.8 KB
Makefile.objs -rw-r--r-- 9.0 KB
Makefile.target -rw-r--r-- 6.6 KB
README -rw-r--r-- 4.7 KB
VERSION -rw-r--r-- 7 bytes
arch_init.c -rw-r--r-- 3.3 KB
balloon.c -rw-r--r-- 3.6 KB
block.c -rw-r--r-- 160.5 KB
blockdev-nbd.c -rw-r--r-- 6.0 KB
blockdev.c -rw-r--r-- 132.4 KB
blockjob.c -rw-r--r-- 14.9 KB
bootdevice.c -rw-r--r-- 9.3 KB
bt-host.c -rw-r--r-- 5.2 KB
bt-vhci.c -rw-r--r-- 4.5 KB
configure -rwxr-xr-x 193.5 KB
cpus-common.c -rw-r--r-- 10.1 KB
cpus.c -rw-r--r-- 66.7 KB
device-hotplug.c -rw-r--r-- 2.6 KB
device_tree.c -rw-r--r-- 14.4 KB
disas.c -rw-r--r-- 17.8 KB
dma-helpers.c -rw-r--r-- 7.9 KB
dump.c -rw-r--r-- 60.5 KB
exec.c -rw-r--r-- 121.5 KB
gdbstub.c -rw-r--r-- 54.7 KB
hmp-commands-info.hx -rw-r--r-- 19.5 KB
hmp-commands.hx -rw-r--r-- 54.3 KB
hmp.c -rw-r--r-- 93.8 KB
hmp.h -rw-r--r-- 8.0 KB
ioport.c -rw-r--r-- 9.0 KB
iothread.c -rw-r--r-- 10.6 KB
job-qmp.c -rw-r--r-- 4.6 KB
job.c -rw-r--r-- 23.7 KB
memory.c -rw-r--r-- 97.1 KB
memory_ldst.inc.c -rw-r--r-- 16.5 KB
memory_mapping.c -rw-r--r-- 10.5 KB
module-common.c -rw-r--r-- 113 bytes
monitor.c -rw-r--r-- 128.3 KB
numa.c -rw-r--r-- 21.0 KB
os-posix.c -rw-r--r-- 8.9 KB
os-win32.c -rw-r--r-- 3.0 KB
qdev-monitor.c -rw-r--r-- 26.6 KB
qdict-test-data.txt -rw-r--r-- 88.4 KB
qemu-bridge-helper.c -rw-r--r-- 11.0 KB
qemu-deprecated.texi -rw-r--r-- 6.0 KB
qemu-doc.texi -rw-r--r-- 91.0 KB
qemu-edid.c -rw-r--r-- 3.4 KB
qemu-ga.texi -rw-r--r-- 3.2 KB
qemu-img-cmds.hx -rw-r--r-- 5.3 KB
qemu-img.c -rw-r--r-- 144.6 KB
qemu-img.texi -rw-r--r-- 30.5 KB
qemu-io-cmds.c -rw-r--r-- 60.5 KB
qemu-io.c -rw-r--r-- 17.5 KB
qemu-keymap.c -rw-r--r-- 7.4 KB
qemu-nbd.c -rw-r--r-- 32.1 KB
qemu-nbd.texi -rw-r--r-- 4.3 KB
qemu-option-trace.texi -rw-r--r-- 932 bytes
qemu-options-wrapper.h -rw-r--r-- 1.0 KB
qemu-options.h -rw-r--r-- 1.4 KB
qemu-options.hx -rw-r--r-- 174.1 KB
qemu-seccomp.c -rw-r--r-- 10.5 KB
qemu-tech.texi -rw-r--r-- 14.0 KB
qemu.nsi -rw-r--r-- 7.1 KB
qemu.sasl -rw-r--r-- 1.8 KB
qmp.c -rw-r--r-- 20.1 KB
qtest.c -rw-r--r-- 21.1 KB
replication.c -rw-r--r-- 2.5 KB
replication.h -rw-r--r-- 5.2 KB
rules.mak -rw-r--r-- 14.3 KB
thunk.c -rw-r--r-- 9.1 KB
tpm.c -rw-r--r-- 5.4 KB
trace-events -rw-r--r-- 8.1 KB
version.rc -rw-r--r-- 790 bytes
vl.c -rw-r--r-- 136.8 KB
win_dump.c -rw-r--r-- 10.8 KB
win_dump.h -rw-r--r-- 365 bytes

README

back to top