Skip to content

Add systemd unit to mount persist partition#1484

Merged
vkraleti merged 1 commit intoqualcomm-linux:masterfrom
vkraleti:mnt-persist
Feb 12, 2026
Merged

Add systemd unit to mount persist partition#1484
vkraleti merged 1 commit intoqualcomm-linux:masterfrom
vkraleti:mnt-persist

Conversation

@vkraleti
Copy link
Contributor

@vkraleti vkraleti commented Feb 4, 2026

Add a systemd .mount unit to mount persist partition at /var/lib/tee.
This directory is used by QTEE to store encrypted data.

[Mount]
DirectoryMode=0755
What=/dev/disk/by-partlabel/persist
Where=/var/lib/tee
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it the only dir which we need to persist? TQFTP engineers also want to have some persistent data.

Copy link
Contributor

Choose a reason for hiding this comment

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

At least this partition was created with the QTEE justification, but this is a good question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If both QTEE & TQFTP both need this partition, is the path /var/lib/tee still valid?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, but AFAIK we only had QTEE requesting this type of persistent data (as it can be related with security keys and credentials).

Copy link
Contributor

Choose a reason for hiding this comment

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

#1445 (comment)
I don't know if it requires the separate partition or if something under /var would be sufficient

Copy link
Contributor

Choose a reason for hiding this comment

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

@ricardosalveti we had a whole other subthread here: qualcomm-linux/qcom-ptool#66

I'm not sure the precious data that we're trying to save is provisioned at factory time. IIUC, there is device-specific licenses that are precious and end up in an app-specific section of the QTEE persistent storage. There are backups in the HLOS' rootfs, and persist is kept separate to avoid paying a fee if one reprovisions the device except for persist.

I agree with the high-level need to have ways to protect precious data. Things I'm personally unclear about:

  • we're special casing the "precious data" situation with the QTEE storage here; what if I have precious data elsewhere?
  • what's the lifecycle around the persist partition and I guess this specific QTEE situation: if we were to support this particular integration, what are the situations we'd want to support? e.g. 1) factory flash with persist as a zeroed partition, HLOS has to mkfs.ext4 it? 2) reflash while preserving persist partition?

I wonder if we should flip this whole design around: provide a generic partition for backups of things that are potential precious and can be used as a recovery point from HLOS. This could look like:

  1. provision an empty "backups" partitions at factory time
  2. have two HLOS first-boot modes: a) restoring files from backup (or one of the backups), b) ignoring backups

I wish this was something somewhat standard that we're not the only ones doing. Would FDO have a story for this?

Choose a reason for hiding this comment

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

Hi @lool ,

Allow me to clarify a few things further.

  1. The precious data we are trying to save consists of both one-time factory provisioned data, such as HDCP keys (provisioned via a Trusted Application in OPTEE/QTEE since only TEE writes to this partition) along with data generated by running use-cases (such as licenses acquired over a network and stored here via a Trusted Application) which is only really accessible to TEE (it is encrypted and is only visible to TEE) which is where the whole Global Platform Persistent Object comes into the picture.
  2. The backups are not in HLOS rootfs, they are also in the persist partition, they are used to preserve 'atomicity' of operations on the persist partition. If an operation on a file in the persist partition fails, the backup is used to go back to the last known good state before the operation began. The backup is also used in-case due to a power-cycle a file being written to gets corrupted.
  3. I am not familiar with any use-case running on Qualcomm chipsets where you store security assets (licenses, keys) in some other location apart from RPMB. But like @ricardosalveti , RPMB is not viable for all use-cases.
  4. A re-flash does not need to preserve the contents of the persist partition. We only care about preserving the contents of persist once it is out there in the field. No operation, once the device has been deployed should mess up the contents of this partition. If we decide to re-flash the device, then the partition is supposed to be zeroed out again. This is in-line with the thought process that if the partition has been corrupted, the device anyways needs to be brought back to the factory and reprovisioned (using run-time on-device tools), so wiping it off clean is fine.
  5. A design with a separate 'backups' partition doesn't fit into the TEE Core API specification for GP Persist Objects, where both the files and their backups reside side by side in the same partition. So Qualcomm Linux might provide such a partition, but the specification does not provide a design based around this. Also, we haven't implemented our Secure File System based on separate 'backup' partitions.

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @harshaldev27 and BTW thanks for the time you're taking in educating me (and I hope others) on some of these topics

  1. The backups are not in HLOS rootfs, they are also in the persist partition, they are used to preserve 'atomicity' of operations on the persist partition. If an operation on a file in the persist partition fails, the backup is used to go back to the last known good state before the operation began. The backup is also used in-case due to a power-cycle a file being written to gets corrupted.

So you're making specific use of the persist filesystem; what happens if that filesystem gets corrupted?

  1. I am not familiar with any use-case running on Qualcomm chipsets where you store security assets (licenses, keys) in some other location apart from RPMB. But like @ricardosalveti , RPMB is not viable for all use-cases.

Personally (on other SoCs) I saw cases of higher level device management certificates (e.g greengrass), device encryption keys for the HLOS, and app level passwords. In an ideal design, these are stored / accessed through TZ, but not always feasible (no TZ, hard to integrate etc.).

  1. A re-flash does not need to preserve the contents of the persist partition. We only care about preserving the contents of persist once it is out there in the field. No operation, once the device has been deployed should mess up the contents of this partition. If we decide to re-flash the device, then the partition is supposed to be zeroed out again. This is in-line with the thought process that if the partition has been corrupted, the device anyways needs to be brought back to the factory and reprovisioned (using run-time on-device tools), so wiping it off clean is fine.

We might need the right terminology, how would you call "I want to fix the system after a broken OTA, but keep the precious data"? Reprovision the HLOS?

  1. A design with a separate 'backups' partition doesn't fit into the TEE Core API specification for GP Persist Objects, where both the files and their backups reside side by side in the same partition. So Qualcomm Linux might provide such a partition, but the specification does not provide a design based around this. Also, we haven't implemented our Secure File System based on separate 'backup' partitions.

I guess this is due to the atomic thingy you mentioned earlier; it sounds like some A/B mechanism within the persist partition.

Overall, it feels like this TEE space is solving its problem in its bubble for itself, but its lifecycle requirements require some HLOS integration (provisioning, boot, recovery). I'm trying to see if this can be generalized so that we don't do a TEE-specific or – worse – a QTEE-specific HLOS integration.

Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment I would say that this TEE-specific, and compatible with both QTEE and OP-TEE (we had similar needs in foundries, using a separated partition for OP-TEE).

Copy link
Member

Choose a reason for hiding this comment

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

@lool

Overall, it feels like this TEE space is solving its problem in its bubble for itself

I can understand your comments from standard Linux distros point of view especially Debian where the TEE based use-cases for IoT/Mobile/Edge systems are less known or implemented. Although hardware TPM based use-cases are more prevalent there. Many of the TPM related use-cases can be supported with TEE especially with the support of TEE based firmware TPMs. The TEE based use-cases are mostly prevalent in Yocto and Android environments. But for sure standard distros gaining momentum in the IoT/Mobile/Edge systems, we surely would need to get at-least Debian support for TEE based security use-cases.

I wish this was something somewhat standard that we're not the only ones doing. Would FDO have a story for this?

Yeah, IIRC from my Linaro days folks already started exploring standard FDO provisioning using Fedora with OP-TEE as well. Not sure the current status of that work. Anyhow, we are not alone here as all other silicon vendors in the IoT space offer TEE solutions but I feel the standard distros integration is still missing.

but its lifecycle requirements require some HLOS integration (provisioning, boot, recovery).

That's right since TEE environments (whether QTEE/OP-TEE) is pretty constrained due to small footprint design goals. For that reason, it depends on HLOS for all the file-system services for secure storage. And yes there is use of RPMB for secure storage as well but it's pretty limited in terms of storage space.

Regarding usage of separate partition for secure storage, it usually becomes handy when you have to deal with A/B firmware and OS updates with the rollback counters stored in that secure storage based on the separate partition. That's additional use-case to what has been mentioned earlier related to secrets (key/data) provisioning.

@ricardosalveti ricardosalveti requested a review from lool February 4, 2026 22:47
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Test run workflow

Test jobs for commit 955cbe8

Test dragonboard-410c dragonboard-820c qcs6490 qcs8300 qcs9100 qcs9100-rb8 qrb2210-rb1
AudioRecord 🚫 🚫 pass pass pass 🚫 pass
BT_FW_KMD_Service 🚫 🚫 fail pass pass fail pass
BT_ON_OFF 🚫 🚫 pass pass pass 🚫 pass
BT_SCAN 🚫 🚫 pass pass pass pass ⚠️ skip
CPUFreq_Validation 🚫 🚫 pass pass pass 🚫 pass
Interrupts 🚫 🚫 pass pass pass 🚫 pass
OpenCV 🚫 🚫 pass pass pass 🚫 pass
WiFi_Firmware_Driver 🚫 🚫 pass pass pass 🚫 pass
WiFi_OnOff 🚫 🚫 pass pass pass 🚫 pass
adsp_remoteproc 🚫 🚫 pass pass pass 🚫 pass
boot pass pass pass pass pass pass pass
cdsp_remoteproc 🚫 🚫 pass 🚫 pass 🚫 ⚠️ skip
hotplug 🚫 🚫 pass pass pass 🚫 pass
irq 🚫 🚫 pass pass pass 🚫 pass

All jobs summary

Job ID Device State Health
138357 qcs6490 Finished Complete
138348 qcs6490 Finished Complete
138359 qcs8300 Finished Complete
138355 qcs8300 Finished Complete
138339 qcs6490 Finished Complete
138345 qrb2210-rb1 Finished Complete
138342 qcs9100-rb8 Finished Complete
138346 qrb2210-rb1 Finished Complete
138340 dragonboard-820c Finished Complete
138336 dragonboard-820c Finished Complete
138337 qcs9100 Finished Complete
138343 dragonboard-410c Finished Complete
138353 qrb2210-rb1 Finished Complete
138356 qrb2210-rb1 Finished Complete
138347 dragonboard-410c Finished Complete
138361 qcs9100 Finished Complete
138349 qcs8300 Finished Complete
138352 qcs9100-rb8 Running Unknown
138354 qcs9100 Finished Complete
138358 qcs6490 Finished Complete
138360 qcs9100-rb8 Submitted Unknown
138341 qcs9100-rb8 Finished Complete
138338 qcs8300 Finished Complete
138344 qcs9100 Finished Complete

@vkraleti vkraleti marked this pull request as ready for review February 6, 2026 15:50
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Test run workflow

Test jobs for commit 0263a8b

Test dragonboard-410c dragonboard-820c qcs6490 qcs8300 qcs9100 qcs9100-rb8 qrb2210-rb1
boot pass pass pass pass pass pass pass

All jobs summary

Job ID Device State Health
138949 qcs9100-rb8 Finished Complete
138955 qrb2210-rb1 Finished Complete
138950 dragonboard-410c Finished Complete
138959 qcs8300 Finished Complete
138958 qcs6490 Finished Complete
138957 qrb2210-rb1 Finished Complete
138952 qcs6490 Finished Complete
138947 qcs9100-rb8 Finished Complete
138948 dragonboard-820c Finished Complete
138956 qcs9100 Finished Complete
138954 qcs9100 Finished Incomplete
138951 dragonboard-820c Finished Complete
138946 qcs8300 Finished Complete
138953 dragonboard-410c Finished Complete

@test-reporting-app
Copy link

test-reporting-app bot commented Feb 6, 2026

Test Results

   46 files  +   19    151 suites  +124   2h 50m 28s ⏱️ + 1h 51m 47s
   43 tests +   32     39 ✅ +   28  0 💤 ±0  4 ❌ +4 
1 446 runs  +1 209  1 440 ✅ +1 203  2 💤 +2  4 ❌ +4 

For more details on these failures, see this check.

Results for commit a918d93. ± Comparison against base commit a8424ba.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Test run workflow

Test jobs for commit 0263a8b

Test dragonboard-410c dragonboard-820c qcs6490 qcs8300 qcs9100 qcs9100-rb8 qrb2210-rb1
AudioRecord 🚫 🚫 🚫 pass pass pass pass
BT_FW_KMD_Service 🚫 🚫 🚫 pass pass 🚫 pass
BT_ON_OFF 🚫 🚫 🚫 pass pass pass pass
BT_SCAN 🚫 🚫 🚫 pass pass 🚫 pass
CPUFreq_Validation 🚫 🚫 🚫 pass pass pass pass
Interrupts 🚫 🚫 🚫 pass pass pass pass
OpenCV 🚫 🚫 🚫 pass pass pass pass
WiFi_Firmware_Driver 🚫 🚫 🚫 pass pass pass pass
WiFi_OnOff 🚫 🚫 🚫 pass pass pass pass
adsp_remoteproc 🚫 🚫 🚫 pass pass pass pass
boot pass pass pass pass pass pass pass
cdsp_remoteproc 🚫 🚫 🚫 🚫 pass 🚫 ⚠️ skip
hotplug 🚫 🚫 🚫 pass pass pass pass
irq 🚫 🚫 🚫 pass pass pass pass

All jobs summary

Job ID Device State Health
138949 qcs9100-rb8 Finished Complete
139018 qcs9100 Finished Complete
138955 qrb2210-rb1 Finished Complete
139016 qcs9100-rb8 Finished Incomplete
138950 dragonboard-410c Finished Complete
139014 qcs8300 Finished Complete
138959 qcs8300 Finished Complete
138958 qcs6490 Finished Complete
138957 qrb2210-rb1 Finished Complete
139013 qrb2210-rb1 Finished Complete
139011 qcs8300 Finished Complete
139020 qcs9100-rb8 Running Unknown
138952 qcs6490 Finished Complete
139012 qcs6490 Finished Incomplete
138947 qcs9100-rb8 Finished Complete
138948 dragonboard-820c Finished Complete
139017 qcs9100 Finished Complete
138956 qcs9100 Finished Complete
138954 qcs9100 Finished Incomplete
139019 qrb2210-rb1 Finished Complete
138951 dragonboard-820c Finished Complete
139015 qcs6490 Finished Incomplete
138946 qcs8300 Finished Complete
139010 qcs9100 Finished Complete
138953 dragonboard-410c Finished Complete

Add a systemd .mount unit to ensure the `persist` partition is mounted at
/var/lib/tee. This directory is used by QTEE to store encrypted data, and
mounting it early in the boot process ensures the required filesystem is
available before services that depend on it start.

Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
Copy link
Contributor

@lool lool left a comment

Choose a reason for hiding this comment

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

Ricardo asked for my review, I see other approval coming in, so soon auto-merge will kick-in... I don't want to stand blocking this (I'm not a meta-qcom maintainer anyway).

I don't particularly mind this or that implementation, this seems to be a copy-paste of what was done in the past. I do find this overall integration would benefit from having at the very least a spec that we could refer to and would explain the big picture, and then the implementation would follow.

I personally didn't quite conclude in understanding the line of thinking and tradeoffs that led to this implementation, I feel a more general purpose implementation could be delivered, but again, not a meta-qcom maintainer. 🤷‍♂️

@ricardosalveti
Copy link
Contributor

I don't particularly mind this or that implementation, this seems to be a copy-paste of what was done in the past. I do find this overall integration would benefit from having at the very least a spec that we could refer to and would explain the big picture, and then the implementation would follow.

I believe it is a valid scenario and that we should try proposing the idea for a TEE-based persistent partition (e.g. https://uapi-group.org/specifications/specs/discoverable_partitions_specification/), then we can update the implementation based on the upstream feedback.

The actual problem is that secure storage is not something commonly used by distros, so this needs more discussion.

@github-actions
Copy link

Test run workflow

Test jobs for commit a918d93

Test dragonboard-410c dragonboard-820c qcs6490 qcs8300 qcs9100 qcs9100-rb8 qrb2210-rb1
AudioRecord 🚫 🚫 pass pass pass pass pass
BT_FW_KMD_Service 🚫 🚫 pass pass pass pass pass
BT_ON_OFF 🚫 🚫 pass pass pass pass pass
BT_SCAN 🚫 🚫 pass pass pass pass pass
CPUFreq_Validation 🚫 🚫 pass pass pass pass pass
Interrupts 🚫 🚫 pass pass pass pass pass
OpenCV 🚫 🚫 pass pass pass pass pass
WiFi_Firmware_Driver 🚫 🚫 pass pass pass pass pass
WiFi_OnOff 🚫 🚫 pass pass pass pass pass
adsp_remoteproc 🚫 🚫 pass pass pass pass pass
boot pass pass pass pass pass pass pass
cdsp_remoteproc 🚫 🚫 pass pass pass ⚠️ skip ⚠️ skip
hotplug 🚫 🚫 pass pass pass pass pass
irq 🚫 🚫 pass pass pass pass pass

All jobs summary

Job ID Device State Health
139977 qcs8300 Finished Complete
139969 qrb2210-rb1 Finished Complete
139974 qcs9100 Finished Complete
139981 qcs6490 Finished Incomplete
141676 qcs9100-rb8 Running Unknown
139941 qcs6490 Finished Complete
139940 qrb2210-rb1 Finished Complete
139939 qrb2210-rb1 Finished Complete
139948 qcs9100-rb8 Finished Complete
139943 qcs9100 Finished Complete
139980 qcs6490 Finished Complete
139944 qcs6490 Finished Complete
139982 qrb2210-rb1 Finished Complete
139934 qcs9100 Finished Complete
139965 qcs9100-rb8 Finished Incomplete
141677 qcs6490 Finished Complete
139973 qcs8300 Finished Complete
139929 dragonboard-410c Finished Complete
139950 qcs9100-rb8 Finished Complete
139963 qcs8300 Finished Complete
139949 qcs8300 Finished Complete
139931 qcs8300 Finished Complete
139938 qcs6490 Finished Complete
139968 qcs9100 Finished Complete
139964 qcs9100-rb8 Finished Incomplete
141673 qcs8300 Finished Complete
139967 qrb2210-rb1 Finished Incomplete
139951 qcs6490 Finished Complete
141672 qcs9100-rb8 Running Unknown
139945 dragonboard-820c Finished Complete
139930 dragonboard-410c Finished Complete
139978 qcs9100-rb8 Finished Complete
139955 qcs9100-rb8 Finished Complete
139954 qcs9100-rb8 Finished Complete
139942 dragonboard-820c Finished Complete
139972 qcs6490 Finished Complete
139976 qcs6490 Finished Complete
139933 dragonboard-820c Finished Complete
139956 dragonboard-820c Finished Complete
139936 qrb2210-rb1 Finished Complete
139935 qcs8300 Finished Complete
139947 qcs8300 Finished Complete
139937 dragonboard-410c Finished Complete
139966 qcs8300 Finished Incomplete
139932 qcs9100 Finished Complete
139971 qcs9100 Finished Complete
139953 qcs9100 Finished Complete
139979 qrb2210-rb1 Finished Complete
139970 qcs9100-rb8 Finished Incomplete
141675 qrb2210-rb1 Finished Complete
139975 qcs9100 Finished Complete
139946 dragonboard-410c Finished Complete
141674 qcs9100-rb8 Finished Incomplete
139952 qrb2210-rb1 Finished Complete

@vkraleti vkraleti merged commit 445d533 into qualcomm-linux:master Feb 12, 2026
111 of 113 checks passed
@vkraleti vkraleti deleted the mnt-persist branch February 12, 2026 04:18
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.

8 participants

Comments