Skip to content

Commit

Permalink
PCI: rockchip-ep: Improve rockchip_pcie_ep_map_addr()
Browse files Browse the repository at this point in the history
Add a check to verify that the outbound region to be used for mapping an
address is not already in use.

Link: https://lore.kernel.org/r/20241017015849.190271-5-dlemoal@kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
  • Loading branch information
Damien Le Moal authored and Bjorn Helgaas committed Nov 25, 2024
1 parent 57ed93f commit d8dbd21
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/pci/controller/pcie-rockchip-ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ static int rockchip_pcie_ep_map_addr(struct pci_epc *epc, u8 fn, u8 vfn,
struct rockchip_pcie *pcie = &ep->rockchip;
u32 r = rockchip_ob_region(addr);

if (test_bit(r, &ep->ob_region_map))
return -EBUSY;

rockchip_pcie_prog_ep_ob_atu(pcie, fn, r, addr, pci_addr, size);

set_bit(r, &ep->ob_region_map);
Expand Down

0 comments on commit d8dbd21

Please sign in to comment.