dm: Remove pre-schema tag support

Support for using "u-boot,dm-..." rather than "bootph-..." has been
deprecated since February 2023. Any platforms using this have had a
console message saying to migrate by 2023.07. Go and remove all support
here now, for the v2026.01 release.

The results of this change that aren't clear from the above are that we
still have a checkpatch.pl error message, and document in
doc/develop/spl.rst that they have been migrated since 2023. We also
change the key2dtsi.py tool to use the correct bootph phase rather than
the legacy phase.

Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini
2025-11-02 14:08:12 -06:00
parent d3b691c9d3
commit 6d04828b45
19 changed files with 4 additions and 183 deletions

View File

@@ -190,18 +190,6 @@ stages:
export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
make pylint_err
- job: check_for_pre_schema_tags
displayName: 'Check for pre-schema driver model tags'
pool:
vmImage: $(ubuntu_vm)
container:
image: $(ci_runner_image)
options: $(container_option)
steps:
# If grep succeeds and finds a match the test fails as we should
# have no matches.
- script: git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
- job: check_packing_of_python_tools
displayName: 'Check we can package the Python tools'
pool:

View File

@@ -249,15 +249,6 @@ Run pylint:
- export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
- make pylint_err
# Check for pre-schema driver model tags
Check for pre-schema tags:
extends: .testsuites
script:
- git config --global --add safe.directory "${CI_PROJECT_DIR}";
# If grep succeeds and finds a match the test fails as we should
# have no matches.
- git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
# Check we can package the Python tools
Check packing of Python tools:
extends: .testsuites

View File

@@ -572,13 +572,6 @@ static int dm_announce(void)
printf("Warning: Unexpected devicetree source (not from a prior stage)");
printf("Warning: U-Boot may not function properly\n");
}
if (IS_ENABLED(CONFIG_OF_TAG_MIGRATE) &&
(gd->flags & GD_FLG_OF_TAG_MIGRATE))
/*
* U-Boot will silently fail to work after 2023.07 if
* there are old tags present
*/
printf("Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!\n");
}
return 0;

View File

@@ -65,7 +65,6 @@ CONFIG_CMD_SYSBOOT=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_DEVICE_TREE_INCLUDES="ast2700-u-boot.dtsi"
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_SYS_RX_ETH_BUFFER=2
# CONFIG_DM_DEVICE_REMOVE is not set

View File

@@ -57,7 +57,6 @@ CONFIG_CMD_SQUASHFS=y
# CONFIG_SPL_DOS_PARTITION is not set
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_LIVE=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_MMC=y

View File

@@ -65,7 +65,6 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_MTDIDS_DEFAULT="nor0=nor0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro"
CONFIG_OF_CONTROL=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
CONFIG_ENV_RELOC_GD_ENV_ADDR=y

View File

@@ -65,7 +65,6 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_MTDIDS_DEFAULT="nor0=nor0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro"
CONFIG_OF_CONTROL=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_USE_HOSTNAME=y

View File

@@ -65,7 +65,6 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_MTDIDS_DEFAULT="nor0=nor0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro"
CONFIG_OF_CONTROL=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_USE_HOSTNAME=y

View File

@@ -68,7 +68,6 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_MTDIDS_DEFAULT="nand0=nand0,nor0=nor0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand0:256k(bootstrap-nand)ro,1M(u-boot-nand)ro,256k(env-nand)ro,512k(dtb-nand)ro,6M(kernel-nand)ro,-(rootfs-nand)ro;nor0:256k(bootstrap-nor)ro,1M(u-boot-nor)ro,256k(env-nor)ro,512k(dtb-nor)ro,6M(kernel-nor)ro"
CONFIG_OF_CONTROL=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
CONFIG_ENV_RELOC_GD_ENV_ADDR=y

View File

@@ -67,7 +67,6 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_MTDIDS_DEFAULT="nand0=nand0,nor0=nor0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand0:256k(bootstrap-nand)ro,1M(u-boot-nand)ro,256k(env-nand)ro,512k(dtb-nand)ro,6M(kernel-nand)ro,-(rootfs-nand)ro;nor0:256k(bootstrap-nor)ro,1M(u-boot-nor)ro,256k(env-nor)ro,512k(dtb-nor)ro,6M(kernel-nor)ro"
CONFIG_OF_CONTROL=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_IS_IN_NAND=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_USE_HOSTNAME=y

View File

@@ -68,7 +68,6 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_MTDIDS_DEFAULT="nand0=nand0,nor0=nor0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand0:256k(bootstrap-nand)ro,1M(u-boot-nand)ro,256k(env-nand)ro,512k(dtb-nand)ro,6M(kernel-nand)ro,-(rootfs-nand)ro;nor0:256k(bootstrap-nor)ro,1M(u-boot-nor)ro,256k(env-nor)ro,512k(dtb-nor)ro,6M(kernel-nor)ro"
CONFIG_OF_CONTROL=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_USE_HOSTNAME=y

View File

@@ -57,7 +57,6 @@ CONFIG_CMD_SQUASHFS=y
# CONFIG_SPL_DOS_PARTITION is not set
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_LIVE=y
# CONFIG_OF_TAG_MIGRATE is not set
CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_MMC=y

View File

@@ -1629,18 +1629,6 @@ bool ofnode_pre_reloc(ofnode node)
ofnode_read_bool(node, "bootph-pre-sram"))
return gd->flags & GD_FLG_RELOC;
if (IS_ENABLED(CONFIG_OF_TAG_MIGRATE)) {
/* detect and handle old tags */
if (ofnode_read_bool(node, "u-boot,dm-pre-reloc") ||
ofnode_read_bool(node, "u-boot,dm-pre-proper") ||
ofnode_read_bool(node, "u-boot,dm-spl") ||
ofnode_read_bool(node, "u-boot,dm-tpl") ||
ofnode_read_bool(node, "u-boot,dm-vpl")) {
gd->flags |= GD_FLG_OF_TAG_MIGRATE;
return true;
}
}
return false;
#endif
}

View File

@@ -408,16 +408,6 @@ config SPL_MULTI_DTB_FIT_USER_DEF_ADDR
at compilation time. This is the address of this area. It must be
aligned on 2-byte boundary.
config OF_TAG_MIGRATE
bool "Ease migration from old device trees with u-boot,dm- tags"
default y
help
U-Boot moved over to use new tags to mark device tree nodes which need
to be processed in SPL, before relocation, etc. Enable this option to
detect old tags and handle them.
Note: This option will be removed after the 2023.07 release.
config OF_SPL_REMOVE_PROPS
string "List of device tree properties to drop for SPL"
depends on SPL_OF_CONTROL

View File

@@ -671,10 +671,10 @@ enum gd_flags {
* @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
*/
GD_FLG_FDT_CHANGED = 0x100000,
/**
* @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
/*
* @GD_FLG_OF_TAG_MIGRATE: Previously had the value of 0x200000 but was
* freed when migration support was removed.
*/
GD_FLG_OF_TAG_MIGRATE = 0x200000,
/**
* @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when
* the memory used to holds its tables has been mapped out.

View File

@@ -671,15 +671,6 @@ cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
# pass removes various unused properties from the remaining nodes.
# The output is typically a much smaller device tree file.
ifdef CONFIG_OF_TAG_MIGRATE
# Support the old tags for a migration period
migrate_tpl := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
migrate_vpl := -b u-boot,dm-pre-reloc -b u-boot,dm-vpl
migrate_spl := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
migrate_all := -P u-boot,dm-pre-reloc \
-P u-boot,dm-spl -P u-boot,dm-tpl -P u-boot,dm-vpl
endif
ifeq ($(CONFIG_VPL_BUILD),y)
fdtgrep_props := -b bootph-all -b bootph-verify $(migrate_vpl)
else

View File

@@ -1,105 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright 2023 Google LLC
# Written by Simon Glass <sjg@chromium.org>
"""Test handling of unmigrated u-boot,dm- tags"""
import os
import pytest
import utils
# This is needed for Azure, since the default '..' directory is not writeable
TMPDIR1 = '/tmp/test_no_migrate'
TMPDIR2 = '/tmp/test_no_migrate_spl'
TMPDIR3 = '/tmp/test_migrate'
def build_for_migrate(ubman, replace_pair, board, tmpdir, disable_migrate=True):
"""Build an updated U-Boot with a slightly modified device tree
Args:
ubman (ConsoleBase): U-Boot console
replace_pair (tuple):
String to find
String to replace it with
board (str): Board to build
tmpdir (str): Temporary directory to use
disable_migrate (bool): True to disable CONFIG_OF_TAG_MIGRATE in build
"""
srcdir = ubman.config.source_dir
build_dir = ubman.config.build_dir
# Get the source for the existing dts
dt_dir = os.path.join(build_dir, 'arch', 'sandbox', 'dts')
orig_fname = os.path.join(dt_dir, 'sandbox.dtb')
out_dts = os.path.join(dt_dir, 'sandbox_out.dts')
utils.run_and_log(ubman, ['dtc', orig_fname, '-I', 'dtb', '-O', 'dts',
'-o', out_dts])
# Update it to use an old tag
with open(out_dts) as inf:
data = inf.read()
data = data.replace(*replace_pair)
dts_fname = os.path.join(dt_dir, 'sandbox_oldtag.dts')
with open(dts_fname, 'w') as outf:
print(data, file=outf)
dtb_fname = os.path.join(dt_dir, 'sandbox_oldtag.dtb')
utils.run_and_log(ubman, ['dtc', dts_fname, '-o', dtb_fname])
migrate = ['-a', '~CONFIG_OF_TAG_MIGRATE'] if disable_migrate else []
# Build sandbox with this new dtb, turning off OF_TAG_MIGRATE
env = dict(os.environ)
env['EXT_DTB'] = dtb_fname
env['DEVICE_TREE'] = 'sandbox_new'
env['NO_LTO'] = '1' # Speed up build
out = utils.run_and_log(
ubman, ['./tools/buildman/buildman', '-m', '--board', board,
*migrate, '-w', '-o', tmpdir], ignore_errors=True, env=env)
return out
@pytest.mark.slow
@pytest.mark.boardspec('sandbox')
def test_of_no_migrate(ubman):
"""Test sandbox with old boot phase tags like u-boot,dm-pre-proper"""
build_for_migrate(ubman, ['bootph-some-ram', 'u-boot,dm-pre-proper'],
'sandbox', TMPDIR1)
# It should fail to run, since the lcd device will not be bound before
# relocation. so won't get its frame-buffer memory
out = utils.run_and_log(
ubman, [os.path.join(TMPDIR1, 'u-boot'), '-D', '-c', 'help'],
ignore_errors=True)
assert "Video device 'lcd' cannot allocate frame buffer memory" in out
@pytest.mark.slow
@pytest.mark.boardspec('sandbox_spl')
@pytest.mark.boardspec('spl_of_platdata_inst')
@pytest.mark.boardspec('!sandbox_tpl')
def test_of_no_migrate_spl(ubman):
"""Test sandbox with old boot phase tags like u-boot,dm-spl"""
out = build_for_migrate(ubman, ['bootph-pre-ram', 'u-boot,dm-spl'],
'sandbox_spl', TMPDIR2)
# It should fail to build, since the SPL DT will not include 'spl-test'
# node, among others
assert "undefined type struct dtd_sandbox_spl_test" in out
@pytest.mark.slow
@pytest.mark.boardspec('sandbox')
def test_of_migrate(ubman):
"""Test sandbox shows a message when tags were migrated"""
build_for_migrate(ubman, ['bootph-some-ram', 'u-boot,dm-pre-proper'],
'sandbox', TMPDIR3, disable_migrate=False)
# It should show a migration message
out = utils.run_and_log(
ubman, [os.path.join(TMPDIR3, 'u-boot'), '-D', '-c', 'help'],
ignore_errors=True)
assert "Warning: Device tree includes old 'u-boot,dm-' tags" in out

View File

@@ -59,7 +59,7 @@ if args.required_conf:
elif args.required_image:
out.write('\t\t\trequired = "image";\n')
if args.spl:
out.write('\t\t\tu-boot,dm-spl;\n')
out.write('\t\t\tbootph-pre-ram;\n')
out.write('\t\t};\n')
out.write('\t};\n')
out.write('};\n')

View File

@@ -522,11 +522,5 @@ index 0000000..2234c87
self.check_strl("cat");
self.check_strl("cpy");
def test_schema(self):
"""Check for uses of strn(cat|cpy)"""
pm = PatchMaker()
pm.add_line('arch/sandbox/dts/sandbox.dtsi', '\tu-boot,dm-pre-proper;')
self.check_single_message(pm, 'PRE_SCHEMA', 'error')
if __name__ == "__main__":
unittest.main()