bus: mhi: host: fix endianness of BHI vector table
Subsystems (2)
PATCH v3 1/1 bus: mhi: host: fix endianness of BHI vector table
On big endian platform like PowerPC the MHI bus does not start properly. The following example shows the error messages by using qcn9274 wireless radio module with ath12k driver:
ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit]
ath12k_pci 0001:01:00.0: MSI vectors: 1
ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0
ath12k_pci 0001:01:00.0: failed to set mhi state: POWER_ON(2)
ath12k_pci 0001:01:00.0: failed to start mhi: -110
ath12k_pci 0001:01:00.0: failed to power up :-110
ath12k_pci 0001:01:00.0: failed to create soc core: -110
ath12k_pci 0001:01:00.0: failed to init core: -110
ath12k_pci: probe of 0001:01:00.0 failed with error -110Fix it by swapping DMA address and size of the BHI vector table.
---
Changes in v2:
- Set __le64 type for dma_addr and size.
Changes in v3:
- Improve the clarity of the commit message.
drivers/bus/mhi/host/boot.c | 8 ++++---- drivers/bus/mhi/host/internal.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/bus/mhi/host/boot.c +4 -4
@@ -31,8 +31,8 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,int ret;for (i =0 ; i < img_info->entries -1 ; i++, mhi_buf++, bhi_vec++) { - bhi_vec->dma_addr = mhi_buf->dma_addr; - bhi_vec->size = mhi_buf->len; + bhi_vec->dma_addr =cpu_to_le64 (mhi_buf->dma_addr); + bhi_vec->size =cpu_to_le64 (mhi_buf->len); }dev_dbg (dev,"BHIe programming for RDDM\n" );
@@ -431,8 +431,8 @@ static void mhi_firmware_copy_bhie(struct mhi_controller *mhi_cntrl,while (remainder) { to_cpy =min (remainder, mhi_buf->len);memcpy (mhi_buf->buf, buf, to_cpy); - bhi_vec->dma_addr = mhi_buf->dma_addr; - bhi_vec->size = to_cpy; + bhi_vec->dma_addr =cpu_to_le64 (mhi_buf->dma_addr); + bhi_vec->size =cpu_to_le64 (to_cpy); buf += to_cpy; remainder -= to_cpy;
drivers/bus/mhi/host/internal.h +2 -2
@@ -25,8 +25,8 @@ struct mhi_ctxt { };struct bhi_vec_entry { -u64 dma_addr; -u64 size; +__le64 dma_addr; +__le64 size; };enum mhi_fw_load_type {
Signature · 1 line
2.34.1
Jeff Hugo
reviewerQuoted 14 lines · Alexander Wilhelm
On big endian platform like PowerPC the MHI bus does not start properly. The following example shows the error messages by using qcn9274 wireless radio module with ath12k driver:
ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit] ath12k_pci 0001:01:00.0: MSI vectors: 1 ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0 ath12k_pci 0001:01:00.0: failed to set mhi state: POWER_ON(2) ath12k_pci 0001:01:00.0: failed to start mhi: -110 ath12k_pci 0001:01:00.0: failed to power up :-110 ath12k_pci 0001:01:00.0: failed to create soc core: -110 ath12k_pci 0001:01:00.0: failed to init core: -110 ath12k_pci: probe of 0001:01:00.0 failed with error -110
Quoted 4 lines
Fix it by swapping DMA address and size of the BHI vector table.
Signed-off-by Alexander Wilhelm <[email protected]>Reviewed-by Jeff Hugo <[email protected]>
Shouldn't there be a fixes tag? Probably pointing to one of the original MHI commits given what this change is touching.
-Jeff
Am Mon, May 19, 2025 at 08:13:00AM -0600 schrieb Jeff Hugo:
Quoted 17 lines · Alexander Wilhelm
Quoted 16 lines
On big endian platform like PowerPC the MHI bus does not start properly. The following example shows the error messages by using qcn9274 wireless radio module with ath12k driver:
ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit] ath12k_pci 0001:01:00.0: MSI vectors: 1 ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0 ath12k_pci 0001:01:00.0: failed to set mhi state: POWER_ON(2) ath12k_pci 0001:01:00.0: failed to start mhi: -110 ath12k_pci 0001:01:00.0: failed to power up :-110 ath12k_pci 0001:01:00.0: failed to create soc core: -110 ath12k_pci 0001:01:00.0: failed to init core: -110 ath12k_pci: probe of 0001:01:00.0 failed with error -110Fix it by swapping DMA address and size of the BHI vector table.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Alexander Wilhelm <[email protected]>Reviewed-by Jeff Hugo <[email protected]>Shouldn't there be a fixes tag? Probably pointing to one of the original MHI commits given what this change is touching.
-Jeff
Thank you for supporting me. I will add that in the next patch version. This patch fixes 3 different origin commits. I would take the first one, where bhi_vec_entry was first introducted. The following 2 commits are only follow up errors.
Best regards
Alexander Wilhelm