qdl icon indicating copy to clipboard operation
qdl copied to clipboard

Target filesystem corruption when flashing from arm64 host

Open EmbeddedAndroid opened this issue 1 year ago • 1 comments

I recently purchased a Lenovo T14s Gen6 and am running the Ubuntu concept image found here: https://discourse.ubuntu.com/t/ubuntu-24-10-concept-snapdragon-x-elite/48800

I was able to build qdl at b068cc5 without issues.

I attempted to flash an RB3G2 using the following command.

sudo ./qdl --debug prog_firehose_ddr.elf rawprogram*.xml patch*.xml

The output from this command can be found below:

qdl-flash-output.txt

On the device side, I see the following error:

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.MXF.1.0.c1-00193.1-KODIAKLA-1
S - IMAGE_VARIANT_STRING=SocKodiakLAA
S - OEM_IMAGE_VERSION_STRING=ip-10-195-202-183
S - Boot Interface: USB
S - Secure Boot: Off
S - Boot Config @ 0x00786070 = 0x000000c1
S - JTAG ID @ 0x00786130 = 0x001980e1
S - OEM ID @ 0x00786138 = 0x00000000
S - Serial Number @ 0x00786134 = 0x0e0e0411
S - OEM Config Row 0 @ 0x007841c0 = 0x0000000000000000
S - OEM Config Row 1 @ 0x007841c8 = 0x0000000000000000
S - Feature Config Row 0 @ 0x00784148 = 0x0000000000000000
S - Feature Config Row 1 @ 0x00784150 = 0x0000000000000000
S - Core 0 Frequency, 1516 MHz
S - PBL Patch Ver: 1
D -      6624 - pbl_apps_init_timestamp
D -    309968 - bootable_media_detect_timestamp
D -    192020 - bl_elf_metadata_loading_timestamp
D -       701 - bl_hash_seg_auth_timestamp
D -    216698 - bl_elf_loadable_segment_loading_timestamp
D -      5960 - bl_elf_segs_hash_verify_timestamp
D -     17623 - bl_sec_hash_seg_auth_timestamp
D -       812 - bl_sec_segs_hash_verify_timestamp
D -        28 - pbl_populate_shared_data_and_exit_timestamp
S -    750434 - PBL, End
B -    765123 - SBL1, Start
B -    895266 - SBL1 BUILD @ 18:21:13 on Sep 23 2024
D -    898987 - sbl1_hw_init
B -    903928 - DTB  Found: [pre-ddr][7601f201000000][0]
B -    905453 - Entering DeviceProg DDR
B -    910669 - CDT not found in any storage media
B -    921313 - pm_device_programmer_init, Start
D -      6283 - pm_device_programmer_init, Delta
B -    927657 - Pre_DDR_clock_init, Start
D -        30 - Pre_DDR_clock_init, Delta
B -    936075 - sbl1_ddr_init, Start
B -    939918 - LP4 DDR detected
B -    953704 - eCDT MRR - Data Starting Address: 0x09066D00

D -     14365 - sbl1_ddr_init, Delta
B -    959408 - DSF version = 262.0.46
B -    962824 - Manufacturer ID = 1, Device Type = 7
B -    966423 - Rank 0 size = 2048 MB, Rank 1 size = 4096 MB
B -    971272 - Row Hamming DDR
B -    976854 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH0 & CS0
B -    985607 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH0 & CS1
B -    996374 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH1 & CS0
B -   1007171 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH1 & CS1
B -   1018334 - usb: init start
B -   1023000 - usb: qusb_dci_platform , 0x8
B -   1025989 - usb: enum_carried_from_pbl
B -   1030137 - usb: SUPER , 0x900e
B -   1034194 - usb: timer_start , 0x4c4b40
B -   1037396 - usb: ENUM success
B -   1041575 - usb: VBUS High!
B -   5825957 - usb: host sends ZLP
B -   5827787 - UFS Device Tree Settings
B -   5829312 - UFS Init Speed: HS Enabled 1, Gear 4 2 Lane Rate 2
B -   5838828 - UFS Perf Speed: HS Enabled 1, Gear 4 2 Lane Rate 2
B -   5844959 - UFS Timeouts(us): fDeviceInit 2500000, UTRD Poll 30000000
B -   5914407 - UFS INQUIRY ID: SAMSUNG KM2L9001CM-B518 0700
B -   5915963 - UFS Boot LUN: 1
B -   5926150 - UFS GEAR: 3
B - 171802474 - usb: bulk_shutdown
B - 171832821 - usb: endxfer EP0 OUT
Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.MXF.1.0.c1-00193.1-KODIAKLA-1
S - IMAGE_VARIANT_STRING=SocKodiakLAA
S - OEM_IMAGE_VERSION_STRING=ip-10-195-202-183
S - Boot Interface: UFS
S - Secure Boot: Off
S - Boot Config @ 0x00786070 = 0x000000c1
S - JTAG ID @ 0x00786130 = 0x001980e1
S - OEM ID @ 0x00786138 = 0x00000000
S - Serial Number @ 0x00786134 = 0x0e0e0411
S - OEM Config Row 0 @ 0x007841c0 = 0x0000000000000000
S - OEM Config Row 1 @ 0x007841c8 = 0x0000000000000000
S - Feature Config Row 0 @ 0x00784148 = 0x0000000000000000
S - Feature Config Row 1 @ 0x00784150 = 0x0000000000000000
S - Core 0 Frequency, 1516 MHz
S - PBL Patch Ver: 1
D -      6618 - pbl_apps_init_timestamp
D -     31512 - bootable_media_detect_timestamp
D -       838 - bl_elf_metadata_loading_timestamp
D -       705 - bl_hash_seg_auth_timestamp
D -      6898 - bl_elf_loadable_segment_loading_timestamp
D -      4820 - bl_elf_segs_hash_verify_timestamp
D -     17638 - bl_sec_hash_seg_auth_timestamp
D -       812 - bl_sec_segs_hash_verify_timestamp
D -        28 - pbl_populate_shared_data_and_exit_timestamp
S -     69869 - PBL, End
B -     79422 - SBL1, Start
B -    208681 - SBL1 BUILD @ 18:18:23 on Sep 23 2024
B -    212768 - usb: usb_shared_xbl_dtb_node_init dtb status , 0x3
B -    221918 - usb: HS: device tree Not available , 0x3
B -    222314 - usb: eud_serial_upd , 0xe0e0411
D -    227530 - sbl1_hw_init
D -       549 - media_init:1
D -         0 - smss_load_cancel
D -         0 - boot_sail_pbl_edl_check
D -         0 - sail_execute_bist_sequence
B -    244091 - SMSS -  Image Load, Start
D -      3965 - SMSS -  Image Loaded, Delta - (0 Bytes)
D -      1037 - Auth Metadata
D -      5765 - sbl1_xblconfig_init
B -    259890 - XBL Config -  Image Load, Start
B -    263977 - DTB  Found: [pre-ddr][7601f201000000][0]
D -      4422 - boot_pre_ddr_dtb_load
B -    274286 - UFS Device Tree Settings
B -    276360 - UFS Init Speed: HS Enabled 1, Gear 4 2 Lane Rate 2
B -    285907 - UFS Perf Speed: HS Enabled 1, Gear 4 2 Lane Rate 2
B -    292037 - UFS Timeouts(us): fDeviceInit 2500000, UTRD Poll 30000000
D -     47458 - media_init:2
B -    464271 - UFS INQUIRY ID: SAMSUNG KM2L9001CM-B518 0700
B -    465826 - UFS Boot LUN: 1
B -    477233 - UFS GEAR: 3
D -    162534 - media_init:3
D -         0 - shrm_load_cancel
B -    485560 - SHRM -  Image Load, Start
D -       640 - Auth Metadata
D -      1311 - Segments hash check
D -     12017 - SHRM -  Image Loaded, Delta - (35752 Bytes)
D -       366 - boot_cdt_init
B -    506391 - CDT -  Image Load, Start
B -    509197 - CDT Version:3,Platform ID:32,Major ID:1,Minor ID:0,Subtype:1
D -     16684 - sbl1_hw_platform_pre_ddr
D -         0 - devcfg init
B -    535427 - PMIC A:2.0 B:1.0 C:2.2 I:1.0
B -    536952 - PM: PM_DT_PARSING_ERR: charger
B -    540795 - PM: Reset by PSHOLD
B -    543906 - PM: Reset Type: Hard Reset
B -    547231 - PM: PON by SYSOK
B -    800869 - PM: SET_VAL:Skip
B -    800899 - PM: Verifying PON-Trigger specific configurations & current PON-Trigger
B -    809622 - PM: All PON-Trigger specific configs verified. Proceeding to BOOT
B -    819413 - PM: PSI: b0x06_v0x3c
B -    821914 - PM: OEM_PSI Start
B -    823012 - PM: OEM_PSI Done
B -    825970 - PM: Device Init # SPMI Transn: 15437
D -    303109 - pm_device_init, Delta
B -    833839 - pm_driver_init, Start
B -    845246 - PM: Driver Init # SPMI Transn: 518
D -      7961 - pm_driver_init, Delta
B -    849974 - PM: CHG Type in CHG init : 0
B -    854366 - PM: Battery ID: 7548Ohm
B -    857538 - PM: debug board connected
B -    861198 - vsense_init, Start
D -         0 - vsense_init, Delta
D -    351757 - sbl1_hw_pre_ddr_init
D -         0 - boot_dload_handle_forced_dload_timeout
D -      2989 - sbl1_load_ddr_training_data
B -    886086 - Pre_DDR_clock_init, Start
D -        91 - Pre_DDR_clock_init, Delta
D -     12901 - sbl1_ddr_set_params
B -    897798 - sbl1_ddr_init, Start
B -    901214 - LP4 DDR detected
B -    915793 - eCDT MRR - Data Starting Address: 0x09066D00

D -     15220 - sbl1_ddr_init, Delta
B -    921466 - DSF version = 262.0.46
B -    924851 - Manufacturer ID = 1, Device Type = 7
B -    928420 - Rank 0 size = 2048 MB, Rank 1 size = 4096 MB
B -    933269 - Row Hamming DDR
B -    938790 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH0 & CS0
B -    947452 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH0 & CS1
B -    958157 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH1 & CS0
B -    968863 - Row Hammer Check : DRAM supports unlimited MAC Value : MR_RH[OP2:0 = 0] & MR_RH[OP3 = 1] for CH1 & CS1
D -     81892 - sbl1_ddr_init
D -        31 - boot_pre_ddi_entry
B -    987346 - do_ddr_training, Start
B -   1028551 - DDR: Start of DDR Training Restore
B -   1032089 - Current DDR Freq = 1709 MHz
B -   1033187 - Max enabled DDR Freq = 2092 MHz
B -   1037213 - DDR: End of DDR Training Restore
D -     51057 - do_ddr_training, Delta
D -     58865 - sbl1_do_ddr_training
D -       518 - boot_ddi_entry
B -   1053043 - Pimem init cmd, entry
D -      9211 - Pimem init cmd, exit
B -   1065670 - External heap init, Start
B -   1068567 - External heap init, End
D -     22295 - sbl1_post_ddr_init
D -       213 - sbl1_hw_init_secondary
B -   1079273 - DDR -  Image Load, Start
B -   1085495 - DTB  Found: [post-ddr][7601f201000000][2001010000000000]
D -      9486 - boot_post_ddr_dtb_load
D -      1555 - boot_fedl_check
B -   1096810 - APDP -  Image Load, Start
D -      3142 - APDP -  Image Loaded, Delta - (64 Bytes)
D -         0 - boot_dload_dump_security_regions
D -         0 - ramdump_load_cancel
B -   1113250 - RamDump -  Image Load, Start
D -      3324 - RamDump -  Image Loaded, Delta - (0 Bytes)
D -         0 - boot_update_abnormal_reset_status
D -         0 - boot_cache_set_memory_barrier
D -         0 - boot_smem_debug_init
D -       518 - boot_smem_init
D -         0 - boot_smem_alloc_for_minidump
D -        61 - boot_smem_store_pon_status
D -        31 - sbl1_hw_platform_smem
D -        92 - boot_ddr_share_data_to_aop
D -       518 - boot_clock_init_rpm
D -         0 - boot_vsense_copy_to_smem
D -         0 - boot_populate_ram_partition_table
D -        31 - boot_populate_ddr_details_shared_table
D -       244 - sbl1_tlmm_init
D -         0 - sbl1_efs_handle_cookies
B -   1176019 - OEM_MISC -  Image Load, Start
D -       641 - Auth Metadata
D -       396 - Segments hash check
D -     10675 - OEM_MISC -  Image Loaded, Delta - (5048 Bytes)
B -   1189988 - QTI_MISC -  Image Load, Start
D -      5703 - QTI_MISC -  Image Loaded, Delta - (0 Bytes)
D -         0 - boot_sail_wait_for_bist
B -   1212497 - PM: PM Total Mem Allocated: 8876 
D -      7198 - sbl1_pm_aop_pre_init_wrapper
B -   1217072 - AOP -  Image Load, Start
D -       793 - Auth Metadata
D -      1769 - Segments hash check
D -     13694 - AOP -  Image Loaded, Delta - (197074 Bytes)
B -   1234091 - QSEE Dev Config -  Image Load, Start
D -       732 - Auth Metadata
D -       640 - Segments hash check
D -     13054 - QSEE Dev Config -  Image Loaded, Delta - (45056 Bytes)
B -   1256142 - QSEE -  Image Load, Start
D -     17873 - Auth Metadata
D -     23302 - Segments hash check
D -     58926 - QSEE -  Image Loaded, Delta - (4175488 Bytes)
B -   1319857 - DTB: Vibration Enabled
D -      7198 - sbl1_hw_play_vibr
B -   1327573 - SEC -  Image Load, Start
D -      3294 - SEC -  Image Loaded, Delta - (64 Bytes)
B -   1334466 - CPUCPFW -  Image Load, Start
D -     17782 - Auth Metadata
D -     17416 - Segments hash check
D -     49837 - CPUCPFW -  Image Loaded, Delta - (171260 Bytes)
B -   1393331 - QHEE -  Image Load, Start
D -     17660 - Auth Metadata
D -      7076 - Segments hash check
D -     29555 - QHEE -  Image Loaded, Delta - (1511504 Bytes)
B -   1426180 - APPSBL -  Image Load, Start
D -       763 - Auth Metadata
D -     16927 - Segments hash check
D -     31628 - APPSBL -  Image Loaded, Delta - (4001744 Bytes)
D -         0 - sbl1_save_appsbl_index
B -   1467050 - SBL1, End
D -   1391074 - SBL1, Delta
S - Flash Throughput, 247762 KB/s  (10406012 Bytes,  42184 us)
S - DDR Frequency, 1555 MHz
0       1.551427 Hypervisor cold boot, version: gunyah-bdded74bb prod (2024-09-17 17:01:45 UTC)
0       1.592699 Failed to register KP

[RM]Resource Manager version: 037df6cc (Tue Aug 20 05:21:39 2024 UTC)
[RM]HLOS is RAS handler
[RM]Init completed, disabling UART
0       1.627686 Hypervisor UART is disabled!



UEFI Start     [ 1633]
 - 0x09FC01000 [ 1636] Sec.efi
ASLR        : ON
DEP         : ON (RTB)
Timer Delta : +6 mS
RAM Entry 0 : Base 0x0080000000  Size 0x003A800000
RAM Entry 1 : Base 0x00C0000000  Size 0x0001800000
RAM Entry 2 : Base 0x00C3400000  Size 0x003CC00000
RAM Entry 3 : Base 0x0100000000  Size 0x0100000000
Total Available RAM : 6028 MB (0x0178C00000)
Total Installed RAM : 6144 MB (0x0180000000)
Init CPU core 1
  > Scheduler up on Core 1
UEFI Ver    : 6.0.240923.BOOT.MXF.1.0.c1-00193.1-KODIAKLA-1
Build Info  : 64b Sep 23 2024 18:19:42
Boot Device : UFS
PROD Mode   : TRUE
Retail      : TRUE
After Create Event Status (0x0)
PM0: 47, PM1: 63, PM2: 49, PM8: 46, 
Module cannot re-initialize DAL module environment
UFS INQUIRY ID: SAMSUNG KM2L9001CM-B518 0700
UFS Boot LUN: 1
tz_armv8_smc_call failed, TzStatus = 0xFFFFFFFF,  SmcId = 0x32000105  
Status = 0x3
APP_REGION_NOTIFICATION_CMD: Syscall Not Supported, status 3
HW Wdog Setting from PCD : Disabled
QseeResponse->result = 0xE
Status = 0x7
QseeResponse->result = 0xE
Status = 0x7
QseeResponse->result = 0xE
Status = 0x7
QseeResponse->result = 0xE
Status = 0x7
LoadImageFromPartitionUsingGuid Failed: 14
Failed to start featenabler_a TA, status = 14
DisplayDxe: Resolution 1920x1080 (1 intf)
smem_alloc_ex: SMEM alloc_ex failed with err=-3! smem_type=478, remote=3, size=32, flags=0x40000000.smem_alloc_ex: SMEM alloc_ex failed with err=-3! smem_type=478, remote=12, size=32, flags=0x40000000.smem_alloc_ex: SMEM alloc_ex failed with err=-3! smem_type=478, remote=17, size=32, flags=0x40000000.smem_alloc_ex: SMEM alloc_ex failed with err=-3! smem_type=478, remote=18, size=32, flags=0x40000000.fast_core_num val: 0
UsbConfigLibOpenProtocols: PMI version (0x0)
UsbConfigLibOpenProtocols: gPmicNpaClientHS2 cannot be created
UsbConfigInit: after setting role
UsbConfigInit: UsbConfigInit, not start on port: 0, mode 0
UsbConfigInit: after setting role
UsbConfigInit: UsbConfigInit, not start on port: 1, mode 0
UsbConfigPortsQueryConnectionChange: usbport->connectstate: ATT
ButtonsDxeTest: Keypress SDAM data payload 0 
HypDtFixupEntryPoint : Reading of OsConfigTableSelection failed,checking DT setting 
SoftSKUDxeInitialize: SoftSKU not supported for this chip
MinidumpTADxe: Minidump TA loading not enabled.
Disp init wait [ 2012] 
-----------------------------
Platform Init  [ 2075] BDS
UEFI Ver   : 6.0.240923.BOOT.MXF.1.0.c1-00193.1-KODIAKLA-1
Platform           : IOT
Subtype            : 1
Boot Device        : UFS
Chip Name          : QCS6490
Chip Ver           : 1.0
Chip Serial Number : 0xE0E0411
-----------------------------
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
Locate pMorPpiProtocol failed 0xE 00000010
Platform Init End : 2211
-----------------------------
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
[QcomBds] Removable boot path
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter
FatDiskIo: error Invalid Parameter

This error continues forever.

I then compiled the at b068cc5 on my Mac M3, and flashed the same image without the corruption.

I attempted to bisect qdl on the Lenovo to find a commit where there was no corruption but was not able to find one.

Any thoughts on what might be causing this?

EmbeddedAndroid avatar Nov 01 '24 15:11 EmbeddedAndroid

For the record; Arm64 has been the main host system where I've been developing, testing and using QDL, and I've not seen such corruption issues yet. I've not tested on X1E-based devices though, will give this a go.

That said, it doesn't look like you're running b068cc5, as the log entries removed by b7619632728a ("firehose: Remove unwanted timeout warning") is still present... (But no changes come to mind where this would matter)

quic-bjorande avatar Nov 13 '24 23:11 quic-bjorande

I was able to use qdl in WSL, which worked fine. I still need to test this futher on a native x1e and see if I can reproduce. I'm going to close this, and if I'm stilling having issues I'll reopen.

EmbeddedAndroid avatar Mar 01 '25 04:03 EmbeddedAndroid