qemu-e2k/tests
Ani Sinha cf0386509e hw/i386/pc: improve physical address space bound check for 32-bit x86 systems
32-bit x86 systems do not have a reserved memory for hole64. On those 32-bit
systems without PSE36 or PAE CPU features, hotplugging memory devices are not
supported by QEMU as QEMU always places hotplugged memory above 4 GiB boundary
which is beyond the physical address space of the processor. Linux guests also
does not support memory hotplug on those systems. Please see Linux
kernel commit b59d02ed08690 ("mm/memory_hotplug: disable the functionality
for 32b") for more details.

Therefore, the maximum limit of the guest physical address in the absence of
additional memory devices effectively coincides with the end of
"above 4G memory space" region for 32-bit x86 without PAE/PSE36. When users
configure additional memory devices, after properly accounting for the
additional device memory region to find the maximum value of the guest
physical address, the address will be outside the range of the processor's
physical address space.

This change adds improvements to take above into consideration.

For example, previously this was allowed:

$ ./qemu-system-x86_64 -cpu pentium -m size=10G

With this change now it is no longer allowed:

$ ./qemu-system-x86_64 -cpu pentium -m size=10G
qemu-system-x86_64: Address space limit 0xffffffff < 0x2bfffffff phys-bits too low (32)

However, the following are allowed since on both cases physical address
space of the processor is 36 bits:

$ ./qemu-system-x86_64 -cpu pentium2 -m size=10G
$ ./qemu-system-x86_64 -cpu pentium,pse36=on -m size=10G

For 32-bit, without PAE/PSE36, hotplugging additional memory is no longer allowed.

$ ./qemu-system-i386 -m size=1G,maxmem=3G,slots=2
qemu-system-i386: Address space limit 0xffffffff < 0x1ffffffff phys-bits too low (32)
$ ./qemu-system-i386 -machine q35 -m size=1G,maxmem=3G,slots=2
qemu-system-i386: Address space limit 0xffffffff < 0x1ffffffff phys-bits too low (32)

A new compatibility flag is introduced to make sure pc_max_used_gpa() keeps
returning the old value for machines 8.1 and older.
Therefore, the above is still allowed for older machine types in order to support
compatibility. Hence, the following still works:

$ ./qemu-system-i386 -machine pc-i440fx-8.1 -m size=1G,maxmem=3G,slots=2
$ ./qemu-system-i386 -machine pc-q35-8.1 -m size=1G,maxmem=3G,slots=2

Further, following is also allowed as with PSE36, the processor has 36-bit
address space:

$ ./qemu-system-i386 -cpu 486,pse36=on -m size=1G,maxmem=3G,slots=2

After calling CPUID with EAX=0x80000001, all AMD64 compliant processors
have the longmode-capable-bit turned on in the extended feature flags (bit 29)
in EDX. The absence of CPUID longmode can be used to differentiate between
32-bit and 64-bit processors and is the recommended approach. QEMU takes this
approach elsewhere (for example, please see x86_cpu_realizefn()), With
this change, pc_max_used_gpa() also uses the same method to detect 32-bit
processors.

Unit tests are modified to not run 32-bit x86 tests that use memory hotplug.

Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230922160413.165702-1-anisinha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-10-04 18:15:06 -04:00
..
avocado tests/avocado: fix waiting for vm shutdown in replay_linux 2023-09-25 08:02:23 +02:00
bench
data tests/acpi: update virt/SSDT.memhp 2023-09-18 15:27:27 +02:00
decode tests/: spelling fixes 2023-09-08 13:08:52 +03:00
docker tests/docker: Update docker-loongarch-cross toolchain 2023-09-20 15:06:33 +01:00
fp
guest-debug tests/tcg: clean-up gdb confirm/pagination settings 2023-08-30 14:57:50 +01:00
image-fuzzer
include
keys
lcitool tests: update most Debian images to Bookworm 2023-09-20 15:06:26 +01:00
migration tests/: spelling fixes 2023-09-08 13:08:52 +03:00
multiboot
perf/block/qcow2
plugin tests/: spelling fixes 2023-09-08 13:08:52 +03:00
qapi-schema tests/: spelling fixes 2023-09-08 13:08:52 +03:00
qemu-iotests Parallels format driver: 2023-09-21 09:32:07 -04:00
qtest hw/i386/pc: improve physical address space bound check for 32-bit x86 systems 2023-10-04 18:15:06 -04:00
rocker
tcg target-arm queue: 2023-09-25 10:09:04 -04:00
tsan tests/: spelling fixes 2023-09-08 13:08:52 +03:00
uefi-test-tools tests/: spelling fixes 2023-09-08 13:08:52 +03:00
unit Block layer patches 2023-09-21 09:31:28 -04:00
vm tests/: spelling fixes 2023-09-08 13:08:52 +03:00
vmstate-static-checker-data
dbus-vmstate-daemon.sh
Makefile.include configure, meson: move --enable-plugins to meson 2023-09-07 13:32:37 +02:00
meson.build configure, meson: remove target OS symbols from config-host.mak 2023-09-07 13:32:37 +02:00
test-qht-par.c
vhost-user-bridge.c