Skip to content

Commit 54c6774

Browse files
Vivek PernamittaManivannan Sadhasivam
authored andcommitted
bus: mhi: host: pci_generic: Set DMA mask for VFs
VFs in devices like QDU100 are capable of accessing host memory up to 40 bits, compared to 32 bits used by PFs and other non-SR-IOV capable MHI devices. To support this, configure `dma_mask` independently for PFs and VFs, by introducing a new 'vf_dma_data_width' member in 'mhi_pci_dev_info' struct and set it to 40 for QDU100. Signed-off-by: Vivek Pernamitta <[email protected]> [mani: reworded subject and description] Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent aa1a0e9 commit 54c6774

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/bus/mhi/host/pci_generic.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* @edl_trigger: capable of triggering EDL mode in the device (if supported)
4242
* @bar_num: PCI base address register to use for MHI MMIO register space
4343
* @dma_data_width: DMA transfer word size (32 or 64 bits)
44+
* @vf_dma_data_width: DMA transfer word size for VF's (optional)
4445
* @mru_default: default MRU size for MBIM network packets
4546
* @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
4647
* of inband wake support (such as sdx24)
@@ -56,6 +57,7 @@ struct mhi_pci_dev_info {
5657
bool edl_trigger;
5758
unsigned int bar_num;
5859
unsigned int dma_data_width;
60+
unsigned int vf_dma_data_width;
5961
unsigned int mru_default;
6062
bool sideband_wake;
6163
bool no_m3;
@@ -300,6 +302,7 @@ static const struct mhi_pci_dev_info mhi_qcom_qdu100_info = {
300302
.config = &mhi_qcom_qdu100_config,
301303
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
302304
.dma_data_width = 32,
305+
.vf_dma_data_width = 40,
303306
.sideband_wake = false,
304307
.no_m3 = true,
305308
.reset_on_remove = true,
@@ -1300,6 +1303,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13001303
const struct mhi_controller_config *mhi_cntrl_config;
13011304
struct mhi_pci_device *mhi_pdev;
13021305
struct mhi_controller *mhi_cntrl;
1306+
unsigned int dma_data_width;
13031307
int err;
13041308

13051309
dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
@@ -1322,9 +1326,12 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13221326

13231327
mhi_cntrl = &mhi_pdev->mhi_cntrl;
13241328

1329+
dma_data_width = (pdev->is_virtfn && info->vf_dma_data_width) ?
1330+
info->vf_dma_data_width : info->dma_data_width;
1331+
13251332
mhi_cntrl->cntrl_dev = &pdev->dev;
13261333
mhi_cntrl->iova_start = 0;
1327-
mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(info->dma_data_width);
1334+
mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(dma_data_width);
13281335
mhi_cntrl->fw_image = info->fw;
13291336
mhi_cntrl->edl_image = info->edl;
13301337

@@ -1348,7 +1355,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13481355
mhi_cntrl->wake_toggle = mhi_pci_wake_toggle_nop;
13491356
}
13501357

1351-
err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_data_width));
1358+
err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(dma_data_width));
13521359
if (err)
13531360
return err;
13541361

0 commit comments

Comments
 (0)