Skip to content

firmware-qcom-capsule: stop hamoa's dtb entry leaking to other machines - #3079

Open
Michael Scott (mike-scott) wants to merge 1 commit into
qualcomm-linux:masterfrom
mike-scott:qcom-capsule-fix-hamoa-leak
Open

Michael Scott (mike-scott) wants to merge 1 commit into
qualcomm-linux:masterfrom
mike-scott:qcom-capsule-fix-hamoa-leak

Conversation

@mike-scott

Copy link
Copy Markdown

CAPSULE_FLASH_TYPE and CAPSULE_ENTRIES next to these definitions are machine-qualified; the CAPSULE_ENTRY_dtb[...] flags beside them are not, and cannot be -- varflags take no part in override resolution, so CAPSULE_ENTRY_dtb[dest_disk]:iq-x7181-evk does not exist.

They therefore apply on every machine. Any other board that declares a "dtb" capsule entry inherits hamoa's SPINOR destinations, and nothing catches it: generate_fvupdate() only checks that an entry has a binary, a dest_disk and a dest_partition, all of which hamoa's values supply. The build succeeds and produces a capsule aimed at storage the machine may not even have.

Guarding on MACHINEOVERRIDES gives the flags the scope the neighbouring overrides already have. Renaming the entry would also work, but the class keys the kernel dependency on the literal name "dtb".

Fixes: a314263 ("firmware-qcom-capsule: add iq-x7181-evk capsule entry definitions")

@mike-scott

Copy link
Copy Markdown
Author

NOTE: this is a cherry-pick Igor Opaniuk (@igoropaniuk) fix for the Hamoa DTB entry leak fix from:
#3043

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Test run workflow

Test jobs for commit 0d6b766

qcom-distro
Pass: 302 | Fail: 19 | Total: 357
qcom-distro_linux-qcom-6.18
Pass: 239 | Fail: 0 | Total: 259
nodistro
Pass: 10 | Fail: 0 | Total: 10

@test-reporting-app

test-reporting-app Bot commented Sep 4, 2026

Copy link
Copy Markdown

Test Results

  117 files   -  2    709 suites   - 6   8h 21m 46s ⏱️ - 1h 5m 11s
  173 tests  -  2    150 ✅  -  4   1 💤 ± 0  22 ❌ +2 
4 550 runs   - 57  4 467 ✅  - 66  56 💤 +11  27 ❌  - 2 

For more details on these failures, see this check.

Results for commit 0d6b766. ± Comparison against base commit c672971.

This pull request removes 2 tests.
lava ‑ lava-test-retry
lava ‑ lava-test-shell

♻️ This comment has been updated with latest results.

@mike-scott

Copy link
Copy Markdown
Author

Milosz Wasilewski (@mwasilew) Dmitry Baryshkov (@lumag) I can see that 1 check is failing, but I'm not sure if there's an action item to fixing the 33 fails: https://github.com/qualcomm-linux/meta-qcom/pull/3079/checks?check_run_id=100894475989

What do you recommend?

@mwasilew

Copy link
Copy Markdown
Contributor

@mike-scott

Michael Scott (mike-scott) commented Sep 9, 2026

Copy link
Copy Markdown
Author

Michael Scott (Michael Scott (@mike-scott)) https://github.com/qualcomm-linux/meta-qcom/actions/runs/33826835894

I meant there are errors in the following tests, that I don't think my change had anything to do with

  • qcom-distro / pre-merge glymur-crd: Error: 1_BT_SCAN/BT_SCAN
  • qcom-distro / pre-merge iq-8275-evk: Error: 1_BT_SCAN/BT_SCAN
  • qcom-distro / pre-merge iq-9075-evk: Error: 1_BT_SCAN/BT_SCAN

NOTE: There are some failures on the hamoa device:

  • qcom-distro / pre-merge iq-x7181-evk:
    • premerge-qcom-distro-iq-x7181-evk-pre-merge-bt.yaml: minimal-boot failed: 1 of 1 attempts. 'auto-login-action timed out after 1795 seconds'
POST Time      [ 5596] OS Loader
spinor t=164ms r=163ms w=0ms e=0ms o=1ms
TZ SMC call t=319ms
<then nothing>
  • premerge-qcom-distro-iq-x7181-evk-pre-merge-display-gfx.yaml: lava-test-retry failed: 1 of 1 attempts. 'lava-test-shell timed out after 1800 seconds'
Received signal: <STARTRUN> 0_Weston_Runtime_Preflight 400763_1.1.2.1
Starting test lava.0_Weston_Runtime_Preflight (400763_1.1.2.1)
Skipping test definition patterns.
+ REPO_PATH=/lava-400763/0/tests/0_Weston_Runtime_Preflight
+ cd Runner/suites/Multimedia/Display/Weston_Runtime_Preflight
+ WAIT_SECS=10
+ VALIDATE_EGLINFO=1
+ ./run.sh
[INFO] 2026-07-23 17:07:18 - Weston log directory, /lava-400763/0/tests/0_Weston_Runtime_Preflight/Runner/suites/Multimedia/Display/Weston_Runtime_Preflight
[INFO] 2026-07-23 17:07:18 - --------------------------------------------------------------------------
[INFO] 2026-07-23 17:07:18 - ------------------- Starting Weston_Runtime_Preflight Testcase --------------------------
[INFO] 2026-07-23 17:07:18 - Detected OS, qcom-distro
[INFO] 2026-07-23 17:07:18 - Config, REQUESTED_GRAPHICS_MODE=auto WAIT_SECS=10 VALIDATE_EGLINFO=1 ALLOW_RELAUNCH=0
[PASS] 2026-07-23 17:07:18 - Weston testcase dependencies are ready, client=weston-simple-shm
[INFO] 2026-07-23 17:07:18 - Graphics package-stack and GPU boot-mode handling skipped for os=qcom-distro
[INFO] 2026-07-23 17:07:18 - ----- Display snapshot: pre-display-check -----
[INFO] 2026-07-23 17:07:18 - DRM nodes: /dev/dri/by-path /dev/dri/card0 /dev/dri/renderD128
[INFO] 2026-07-23 17:07:18 - DRM: card0-DP-1 status=unknown enabled=disabled type=DP modes=0 first=<none> cur=-
[INFO] 2026-07-23 17:07:18 - DRM: card0-DP-2 status=unknown enabled=disabled type=DP modes=0 first=<none> cur=-
[INFO] 2026-07-23 17:07:18 - DRM: card0-DP-3 status=unknown enabled=disabled type=DP modes=0 first=<none> cur=-
[INFO] 2026-07-23 17:07:18 - DRM: card0-Writeback-1 status=unknown enabled=disabled type=Other modes=0 first=<none> cur=-
[INFO] 2026-07-23 17:07:18 - DRM: card0-eDP-1 status=unknown enabled=disabled type=eDP modes=0 first=<none> cur=-
[INFO] 2026-07-23 17:07:18 - Connected summary (sysfs): none
[INFO] 2026-07-23 17:07:18 - ----- End display snapshot: pre-display-check -----
[INFO] 2026-07-23 17:07:18 - ----- modetest -M msm -ac, capped at 200 lines -----
[   37.860821] VBL9: disabling

But I'm not sure if I should be researching these?

There are 3 of the pre-merge jobs for iq-x7181-evk that did pass:

@ricardosalveti

Copy link
Copy Markdown
Contributor

We are having some issues with some of the tests, retrying them.

@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit 8580b36

  • qcomdistro: multimedia image
    Pass: 9 | Fail: 0 | Total: 9
  • qcomdistro: multimedia image-prop
    Pass: 41 | Fail: 0 | Total: 41

CAPSULE_FLASH_TYPE and CAPSULE_ENTRIES definitions are
machine-qualified. The CAPSULE_ENTRY_dtb[...] flags are not.
Varflags don't work with override resolution.
This: CAPSULE_ENTRY_dtb[dest_disk]:iq-x7181-evk does not exist.

Currently, the CAPSULE_ENTRY_dtb entries apply to every machine.
Any other board that declares a "dtb" capsule entry ends up inheriting
hamoa's SPINOR destinations without any warning to the user.

Nothing catches it: generate_fvupdate() checks that an entry has a
binary, a dest_disk and a dest_partition, all of which hamoa's values
supply. The build succeeds and produces a capsule aimed at storage the
machine may not have, or worse: may use for a different purpose and
will be overwritten during a rare capsule update event.

Instead of guards or other attempts to rename the "dtb" entry to
something more unique for the machine, let's relocate these settings
to iq-x7181-evk.conf where they won't affect anyone else.

Fixes: a314263 ("firmware-qcom-capsule: add iq-x7181-evk capsule entry definitions")
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Signed-off-by: Michael Scott <mike@foundries.io>
@mike-scott

Michael Scott (mike-scott) commented Sep 15, 2026

Copy link
Copy Markdown
Author

Change of direction: add the CAPSULE_ related variables to the machine.conf

I had to make a few changes to the meta-qcom repo in order to test this change:

  • iq-x7181-evk: add ci/meta-arm.yml to ci/iq-x7181-evk.yml: enables the firmware-qcom-capsule recipe (it's a dynamic-layers/meta-arm)
  • iq-9075-evk: add CAPSULE_* related entries to the machine conf and the same ci/meta-arm.yml addition to ci/iq-9075-evk.yml

Step 1: verify the CAPSULE_ENTRY_dtb entries are valid for iq-9075-evk:

QCOM_IMAGE=qcom-multimedia-proprietary-image
CAPSULE_FEATURE=":meta-qcom/ci/capsule.yml:meta-qcom/ci/capsule-test-keys.yml"
KAS_MACHINE_CONFIG=iq-9075-evk
KAS_TARGET=${QCOM_IMAGE} kas shell meta-qcom/ci/${KAS_MACHINE_CONFIG}.yml:meta-qcom/ci/qcom-distro-sota.yml:meta-qcom/ci/performance.yml${CAPSULE_FEATURE}

At the build prompt:
bitbake -e firmware-qcom-capsule > env-iq-9075-evk.txt
in env-iq-9075-evk.txt look for the # $CAPSULE_ENTRY_dtb section:

# $CAPSULE_ENTRY_dtb [4 operations]
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-9075-evk.conf:84
#     [binary] "dtb.bin"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-9075-evk.conf:85
#     [dest_disk] "UFS_LUN4"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-9075-evk.conf:86
#     [dest_partition] "dtb_a"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-9075-evk.conf:87
#     [dest_guid] "{2A1A52FC-AA0B-401C-A808-5EA0F91068F8}"
# pre-expansion value:
#   "None"

Step 2: verify the CAPSULE_ENTRY_dtb entries are valid for iq-x7181-evk:

QCOM_IMAGE=qcom-multimedia-proprietary-image
CAPSULE_FEATURE=":meta-qcom/ci/capsule.yml:meta-qcom/ci/capsule-test-keys.yml"
KAS_MACHINE_CONFIG=iq-x7181-evk
KAS_TARGET=${QCOM_IMAGE} kas shell meta-qcom/ci/${KAS_MACHINE_CONFIG}.yml:meta-qcom/ci/qcom-distro-sota.yml:meta-qcom/ci/performance.yml${CAPSULE_FEATURE}

At the build prompt:
bitbake -e firmware-qcom-capsule > env-iq-x7181-evk.txt
in env-iq-x7181-evk.txt look for the # $CAPSULE_ENTRY_dtb section:

# $CAPSULE_ENTRY_dtb [7 operations]
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:43
#     [binary] "dtb.bin"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:44
#     [dest_disk] "SPINOR"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:45
#     [dest_partition] "dtb"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:46
#     [dest_guid] "{2A1A52FC-AA0B-401C-A808-5EA0F91068F8}"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:47
#     [backup_disk] "SPINOR"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:48
#     [backup_partition] "dtb_BACKUP"
#   set /home/scottml/fio/ref-qcom-linux/build/../meta-qcom/conf/machine/iq-x7181-evk.conf:49
#     [backup_guid] "{A166F11A-2B39-4FAA-B7E7-F8AA080D0587}"
# pre-expansion value:
#   "None"


CAPSULE_GUID = "0F6D58FC-2258-4D27-9E23-D77219B0897C"
CAPSULE_FLASH_TYPE = "NORUFS"
CAPSULE_ENTRIES = "dtb"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ricardo Salveti (@ricardosalveti) I can make these ?= if we want to make it easier to change in product overlay layers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine, unless we expect this to be customized.

CAPSULE_ENTRY_dtb[dest_guid] = "{2A1A52FC-AA0B-401C-A808-5EA0F91068F8}"
CAPSULE_ENTRY_dtb[backup_disk] = "SPINOR"
CAPSULE_ENTRY_dtb[backup_partition] = "dtb_BACKUP"
CAPSULE_ENTRY_dtb[backup_guid] = "{A166F11A-2B39-4FAA-B7E7-F8AA080D0587}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other issue found is that CAPSULE_ENTRY_dtb is not in do_compile's hash, so changes here would not trigger a rebuild.

We would also need something like in qcom-capsule.bbclass:

generate_fvupdate[vardeps] += "${@' '.join('CAPSULE_ENTRY_' + e for e in d.getVar('CAPSULE_ENTRIES').split())}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. This can probably be a separate PR or an additional patch on Igor Opaniuk (@igoropaniuk) 's #3043.

Would it stop this PR from moving forward? I think Igor Opaniuk (@igoropaniuk) can take a look?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new commit with the suggested line, then we can merge, as it #3043 might take longer until it is ready to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants