[RFC] sim: implement proper Firehose protocol state machine#192
Open
igoropaniuk wants to merge 1 commit intolinux-msm:masterfrom
Open
[RFC] sim: implement proper Firehose protocol state machine#192igoropaniuk wants to merge 1 commit intolinux-msm:masterfrom
igoropaniuk wants to merge 1 commit intolinux-msm:masterfrom
Conversation
Replace the stub sim_read()/sim_write() with a simulator that parses incoming XML commands and enqueues matching XML responses, mirroring the real Firehose device protocol. This decreases divergence in behavior between the real HW and the dry-run mode, giving better validation of the flashing process in dry-run mode. sim_write() now dispatches based on the command tag: - configure: enqueue log + ACK echoing the same max payload size so firehose_try_configure() does not trigger a redundant exchange - program/read: enqueue log + rawmode=true ACK and transition to SIM_STATE_RAW_IN/RAW_OUT to track the raw binary transfer - erase/patch/setbootablestoragedrive/ufs: enqueue log + ACK - power: enqueue log + ACK and mark the simulator as closed sim_read() first drains the XML response queue (ensuring protocol responses are delivered before any raw data), then serves zero-filled sector data in SIM_STATE_RAW_OUT, and returns -EIO once closed so the trailing drain in firehose_reset() completes immediately. Since the simulator now produces correct protocol responses, remove the QDL_DEVICE_SIM early-return guards in firehose_read() and firehose_try_configure() that previously bypassed response parsing. Pre-initialize qdl->sector_size = 4096 in sim_init() and only probe sector size in firehose_try_configure() if unset. Previously, the probe <read> commands were executed during --createdigest dry-runs and included in the VIP digest table, but not issued during real VIP flashing (where probing is gated on VIP_DISABLED). This caused all subsequent digest entries to shift, resulting in hash mismatches on the device. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
igoropaniuk
commented
Feb 26, 2026
Contributor
Author
|
Friendly ping 🙂 Please let me know if there are any additional concerns or comments. If everything looks good, this might be ready to land. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the stub sim_read()/sim_write() with a simulator that parses incoming XML commands and enqueues matching XML responses, mirroring the real Firehose device protocol. This decreases divergence in behavior between the real HW and the dry-run mode, giving better validation of the flashing process in dry-run mode.
sim_write() now dispatches based on the command tag:
sim_read() first drains the XML response queue (ensuring protocol responses are delivered before any raw data), then serves zero-filled sector data in SIM_STATE_RAW_OUT, and returns -EIO once closed so the trailing drain in firehose_reset() completes immediately.
Since the simulator now produces correct protocol responses, remove the QDL_DEVICE_SIM early-return guards in firehose_read() and firehose_try_configure() that previously bypassed response parsing.
Pre-initialize qdl->sector_size = 4096 in sim_init() and only probe sector size in firehose_try_configure() if unset. Previously, the probe commands were executed during --createdigest dry-runs and included in the VIP digest table, but not issued during real VIP flashing (where probing is gated on VIP_DISABLED). This caused all subsequent digest entries to shift, resulting in hash mismatches on the device.