Skip to content

Commit a46f2f6

Browse files
paliLorenzo Pieralisi
authored andcommitted
PCI: aardvark: Disable bus mastering when unbinding driver
Ensure that after driver unbind PCIe cards are not able to forward memory and I/O requests in the upstream direction. Link: https://lore.kernel.org/r/20211130172913.9727-7-kabel@kernel.org Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
1 parent a4ca794 commit a46f2f6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/pci/controller/pci-aardvark.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,7 @@ static int advk_pcie_remove(struct platform_device *pdev)
16951695
{
16961696
struct advk_pcie *pcie = platform_get_drvdata(pdev);
16971697
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
1698+
u32 val;
16981699
int i;
16991700

17001701
/* Remove PCI bus with all devices */
@@ -1703,6 +1704,11 @@ static int advk_pcie_remove(struct platform_device *pdev)
17031704
pci_remove_root_bus(bridge->bus);
17041705
pci_unlock_rescan_remove();
17051706

1707+
/* Disable Root Bridge I/O space, memory space and bus mastering */
1708+
val = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG);
1709+
val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
1710+
advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG);
1711+
17061712
/* Remove IRQ domains */
17071713
advk_pcie_remove_msi_irq_domain(pcie);
17081714
advk_pcie_remove_irq_domain(pcie);

0 commit comments

Comments
 (0)