Enable automated removal of deprecated versioned machine types

* Remove test relying on 4.1 machine type that is about to
   be disabled
 * Fix off-by-1 in deprecation/removal logic for versioned
   machine types to cope with dev/rc versions
 * Enable logic for disabling registration of versioned machine
   types which have exceeded the 6 year lifetime policy.
 * Add automated version information to documentation about which
   versioned machine types are deprecated and removed
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE2vOm/bJrYpEtDo4/vobrtBUQT98FAmgc2GwACgkQvobrtBUQ
 T9+gpA/+K08Np6taoY3XNYPc6CPxEVXJziR/4JT8wzVHKlz5aNjfWW4LewluRpNg
 E+fnUaBWfdwvi2utRG/O+QvVFR5cHATpCBhGzJlAyKymQ7d4jyEjOqgW/euahmrb
 A1KuLMmSNOUG5DiDKXnYpJxnfG/Vq36F4JRXlD+wbTtHImZnwkTGpOcaGcbnNQpn
 CGC0ih1u1JWVlEWNzgR3pgJNoF5qd++aW6p2Nhl9shRRXs+ocIibkPVI733WwJCM
 F11aRuwEAnCxxsS7BU6iSpToTByUQBvWihBJrisg+NvjkTzOG8uu1TBDUCabAU7v
 TfjC6prVZPlt1U7tXZLFrw9bk6ldkA7ZiYp5xqCYXSX1pL1USLzwzfjsCglKTAmn
 FV0Hn4Dk+TpiQ3KGEZsuRJ/PeRpYQTPlJAjUoC7xNmP1kSGo9yrZtMfOFUwf0MFe
 N91N8XyhKiKhxr+CnAoVRiDAvZOts6Se8ELE4mGVXZevP7qd19pMyTQ0V/n6vPHB
 GT84bJIcwoBBLjyM2ySOZsMnYTgRuYs1SdrjUaGrwfUnyBE0Sk1j/gTy02s3PdIM
 Xcbbt2q4uuCfPF/Iu6ExROMooie8P13J0K13+njYDP6DSr+eG1YESN+qsQefNJYG
 Vcf8Nct2LW1KNxt0NV2HkbCnTQu34JT4aw4yyFVTLPDlOFl0++E=
 =fKhx
 -----END PGP SIGNATURE-----

Merge tag 'docs-dep-pull-request' of https://gitlab.com/berrange/qemu into staging

Enable automated removal of deprecated versioned machine types

* Remove test relying on 4.1 machine type that is about to
  be disabled
* Fix off-by-1 in deprecation/removal logic for versioned
  machine types to cope with dev/rc versions
* Enable logic for disabling registration of versioned machine
  types which have exceeded the 6 year lifetime policy.
* Add automated version information to documentation about which
  versioned machine types are deprecated and removed

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE2vOm/bJrYpEtDo4/vobrtBUQT98FAmgc2GwACgkQvobrtBUQ
# T9+gpA/+K08Np6taoY3XNYPc6CPxEVXJziR/4JT8wzVHKlz5aNjfWW4LewluRpNg
# E+fnUaBWfdwvi2utRG/O+QvVFR5cHATpCBhGzJlAyKymQ7d4jyEjOqgW/euahmrb
# A1KuLMmSNOUG5DiDKXnYpJxnfG/Vq36F4JRXlD+wbTtHImZnwkTGpOcaGcbnNQpn
# CGC0ih1u1JWVlEWNzgR3pgJNoF5qd++aW6p2Nhl9shRRXs+ocIibkPVI733WwJCM
# F11aRuwEAnCxxsS7BU6iSpToTByUQBvWihBJrisg+NvjkTzOG8uu1TBDUCabAU7v
# TfjC6prVZPlt1U7tXZLFrw9bk6ldkA7ZiYp5xqCYXSX1pL1USLzwzfjsCglKTAmn
# FV0Hn4Dk+TpiQ3KGEZsuRJ/PeRpYQTPlJAjUoC7xNmP1kSGo9yrZtMfOFUwf0MFe
# N91N8XyhKiKhxr+CnAoVRiDAvZOts6Se8ELE4mGVXZevP7qd19pMyTQ0V/n6vPHB
# GT84bJIcwoBBLjyM2ySOZsMnYTgRuYs1SdrjUaGrwfUnyBE0Sk1j/gTy02s3PdIM
# Xcbbt2q4uuCfPF/Iu6ExROMooie8P13J0K13+njYDP6DSr+eG1YESN+qsQefNJYG
# Vcf8Nct2LW1KNxt0NV2HkbCnTQu34JT4aw4yyFVTLPDlOFl0++E=
# =fKhx
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 08 May 2025 12:14:36 EDT
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* tag 'docs-dep-pull-request' of https://gitlab.com/berrange/qemu:
  include/hw/boards: add warning about changing deprecation logic
  docs/about/removed-features: auto-generate a note for versioned machine types
  docs/about/deprecated: auto-generate a note for versioned machine types
  include/hw/boards: cope with dev/rc versions in deprecation checks
  Revert "include/hw: temporarily disable deletion of versioned machine types"
  tests/qtest/q35-test: Remove the obsolete test_without_smram_base test

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2025-05-09 12:04:27 -04:00
commit 2008924653
5 changed files with 90 additions and 61 deletions

View file

@ -278,6 +278,13 @@ CPU implementation for a while before removing all support.
System emulator machines
------------------------
Versioned machine types (aarch64, arm, i386, m68k, ppc64, s390x, x86_64)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
In accordance with our versioned machine type deprecation policy, all machine
types with version |VER_MACHINE_DEPRECATION_VERSION|, or older, have been
deprecated.
Arm ``virt`` machine ``dtb-kaslr-seed`` property (since 7.1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

View file

@ -981,10 +981,12 @@ from Linux in 2021, and is not supported anymore by QEMU either.
System emulator machines
------------------------
Note: Versioned machine types that have been introduced in a QEMU version
that has initially been released more than 6 years before are considered
obsolete and will be removed without further notice in this document.
Please use newer machine types instead.
Versioned machine types (aarch64, arm, i386, m68k, ppc64, s390x, x86_64)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
In accordance with our versioned machine type deprecation policy, all machine
types with version |VER_MACHINE_DELETION_VERSION|, or older, have been
removed.
``s390-virtio`` (removed in 2.6)
''''''''''''''''''''''''''''''''

View file

@ -117,6 +117,32 @@ finally:
else:
version = release = "unknown version"
bits = version.split(".")
major = int(bits[0])
minor = int(bits[1])
micro = int(bits[2])
# Check for a dev snapshot, so we can adjust to next
# predicted release version.
#
# This assumes we do 3 releases per year, so must bump
# major if minor == 2
if micro >= 50:
micro = 0
if minor == 2:
major += 1
minor = 0
else:
minor += 1
# These thresholds must match the constants
# MACHINE_VER_DELETION_MAJOR & MACHINE_VER_DEPRECATION_MAJOR
# defined in include/hw/boards.h and the introductory text in
# docs/about/deprecated.rst
ver_machine_deprecation_version = "%d.%d.0" % (major - 3, minor)
ver_machine_deletion_version = "%d.%d.0" % (major - 6, minor)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
@ -145,7 +171,18 @@ suppress_warnings = ["ref.option"]
# environment variable is not set is for the benefit of readthedocs
# style document building; our Makefile always sets the variable.
confdir = os.getenv('CONFDIR', "/etc/qemu")
rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n"
vars = {
"CONFDIR": confdir,
"VER_MACHINE_DEPRECATION_VERSION": ver_machine_deprecation_version,
"VER_MACHINE_DELETION_VERSION": ver_machine_deletion_version,
}
rst_epilog = "".join([
".. |" + key + "| replace:: ``" + vars[key] + "``\n"
for key in vars.keys()
])
# We slurp in the defs.rst.inc and literally include it into rst_epilog,
# because Sphinx's include:: directive doesn't work with absolute paths
# and there isn't any one single relative path that will work for all

View file

@ -636,7 +636,11 @@ struct MachineState {
/*
* How many years/major releases for each phase
* of the life cycle. Assumes use of versioning
* scheme where major is bumped each year
* scheme where major is bumped each year.
*
* These values must match the ver_machine_deprecation_version
* and ver_machine_deletion_version logic in docs/conf.py and
* the text in docs/about/deprecated.rst
*/
#define MACHINE_VER_DELETION_MAJOR 6
#define MACHINE_VER_DEPRECATION_MAJOR 3
@ -650,11 +654,42 @@ struct MachineState {
" years old are subject to deletion after " \
stringify(MACHINE_VER_DELETION_MAJOR) " years"
#define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \
#define _MACHINE_VER_IS_CURRENT_EXPIRED(cutoff, major, minor) \
(((QEMU_VERSION_MAJOR - major) > cutoff) || \
(((QEMU_VERSION_MAJOR - major) == cutoff) && \
(QEMU_VERSION_MINOR - minor) >= 0))
#define _MACHINE_VER_IS_NEXT_MINOR_EXPIRED(cutoff, major, minor) \
(((QEMU_VERSION_MAJOR - major) > cutoff) || \
(((QEMU_VERSION_MAJOR - major) == cutoff) && \
((QEMU_VERSION_MINOR + 1) - minor) >= 0))
#define _MACHINE_VER_IS_NEXT_MAJOR_EXPIRED(cutoff, major, minor) \
((((QEMU_VERSION_MAJOR + 1) - major) > cutoff) || \
((((QEMU_VERSION_MAJOR + 1) - major) == cutoff) && \
(0 - minor) >= 0))
/*
* - The first check applies to formal releases
* - The second check applies to dev snapshots / release candidates
* where the next major version is the same.
* e.g. 9.0.50, 9.1.50, 9.0.90, 9.1.90
* - The third check applies to dev snapshots / release candidates
* where the next major version will change.
* e.g. 9.2.50, 9.2.90
*
* NB: this assumes we do 3 minor releases per year, before bumping major,
* and dev snapshots / release candidates are numbered with micro >= 50
* If this ever changes the logic below will need modifying....
*/
#define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \
((QEMU_VERSION_MICRO < 50 && \
_MACHINE_VER_IS_CURRENT_EXPIRED(cutoff, major, minor)) || \
(QEMU_VERSION_MICRO >= 50 && QEMU_VERSION_MINOR < 2 && \
_MACHINE_VER_IS_NEXT_MINOR_EXPIRED(cutoff, major, minor)) || \
(QEMU_VERSION_MICRO >= 50 && QEMU_VERSION_MINOR == 2 && \
_MACHINE_VER_IS_NEXT_MAJOR_EXPIRED(cutoff, major, minor)))
#define _MACHINE_VER_IS_EXPIRED2(cutoff, major, minor) \
_MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor)
#define _MACHINE_VER_IS_EXPIRED3(cutoff, major, minor, micro) \
@ -719,28 +754,11 @@ struct MachineState {
* suitable period of time has passed, it will cause
* execution of the method to return, avoiding registration
* of the machine
*
* The new deprecation and deletion policy for versioned
* machine types was introduced in QEMU 9.1.0.
*
* Under the new policy a number of old machine types (any
* prior to 2.12) would be liable for immediate deletion
* which would be a violation of our historical deprecation
* and removal policy
*
* Thus deletions are temporarily gated on existance of
* the env variable "QEMU_DELETE_MACHINES" / QEMU version
* number >= 10.1.0. This gate can be deleted in the 10.1.0
* dev cycle
*/
#define MACHINE_VER_DELETION(...) \
do { \
if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \
if (getenv("QEMU_DELETE_MACHINES") || \
QEMU_VERSION_MAJOR > 10 || (QEMU_VERSION_MAJOR == 10 && \
QEMU_VERSION_MINOR >= 1)) { \
return; \
} \
return; \
} \
} while (0)

View file

@ -246,41 +246,6 @@ static void test_smram_smbase_lock(void)
qtest_quit(qts);
}
static void test_without_smram_base(void)
{
QPCIBus *pcibus;
QPCIDevice *pcidev;
QTestState *qts;
int i;
qts = qtest_init("-M pc-q35-4.1");
pcibus = qpci_new_pc(qts, NULL);
g_assert(pcibus != NULL);
pcidev = qpci_device_find(pcibus, 0);
g_assert(pcidev != NULL);
/* check that RAM is accessible */
qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN);
g_assert_cmpint(qtest_readb(qts, SMBASE), ==, SMRAM_TEST_PATTERN);
/* check that writing to 0x9c succeeds */
for (i = 0; i <= 0xff; i++) {
qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, i);
g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) == i);
}
/* check that RAM is still accessible */
qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN + 1);
g_assert_cmpint(qtest_readb(qts, SMBASE), ==, (SMRAM_TEST_PATTERN + 1));
g_free(pcidev);
qpci_free_pc(pcibus);
qtest_quit(qts);
}
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@ -293,6 +258,6 @@ int main(int argc, char **argv)
qtest_add_data_func("/q35/tseg-size/ext/16mb", &tseg_ext_16mb,
test_tseg_size);
qtest_add_func("/q35/smram/smbase_lock", test_smram_smbase_lock);
qtest_add_func("/q35/smram/legacy_smbase", test_without_smram_base);
return g_test_run();
}