diff mbox series

[v3,5/6] bus: mhi: pci_generic: Set register access length for MHI driver

Message ID 1620234501-30461-6-git-send-email-bbhatt@codeaurora.org
State Superseded
Headers show
Series [v3,1/6] bus: mhi: core: Set BHI/BHIe offsets on power up preparation | expand

Commit Message

Bhaumik Bhatt May 5, 2021, 5:08 p.m. UTC
MHI driver requires register space length to add range checks and
prevent memory region accesses outside of that for MMIO space.
Set it from the PCI generic controller driver before registering
the MHI controller.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
---
 drivers/bus/mhi/pci_generic.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Hemant Kumar May 6, 2021, 12:14 a.m. UTC | #1
On 5/5/21 10:08 AM, Bhaumik Bhatt wrote:
> MHI driver requires register space length to add range checks and
> prevent memory region accesses outside of that for MMIO space.
> Set it from the PCI generic controller driver before registering
> the MHI controller.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
Loic Poulain May 6, 2021, 8:03 a.m. UTC | #2
On Wed, 5 May 2021 at 19:08, Bhaumik Bhatt <bbhatt@codeaurora.org> wrote:
>

> MHI driver requires register space length to add range checks and

> prevent memory region accesses outside of that for MMIO space.

> Set it from the PCI generic controller driver before registering

> the MHI controller.

>

> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>


Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
diff mbox series

Patch

diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c
index 7c810f0..fb7889f 100644
--- a/drivers/bus/mhi/pci_generic.c
+++ b/drivers/bus/mhi/pci_generic.c
@@ -463,6 +463,7 @@  static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
 		return err;
 	}
 	mhi_cntrl->regs = pcim_iomap_table(pdev)[bar_num];
+	mhi_cntrl->reg_len = pci_resource_len(pdev, bar_num);
 
 	err = pci_set_dma_mask(pdev, dma_mask);
 	if (err) {