mbox series

[v6,0/6] PCI endpoint additional pci_epc_set_bar() checks

Message ID 20241213143301.4158431-8-cassel@kernel.org (mailing list archive)
Headers show
Series PCI endpoint additional pci_epc_set_bar() checks | expand

Message

Niklas Cassel Dec. 13, 2024, 2:33 p.m. UTC
Hello all,

This series adds some extra checks to ensure that it is not possible to
program the iATU with an address which we did not intend to use.

If these checks were in place when testing some of the earlier revisions
of Frank's doorbell patches (which did not handle fixed BARs properly),
we would gotten an error, rather than silently using an address which we
did not intend to use.

Having these checks in place will hopefully avoid similar debugging in the
future.


Kind regards,
Niklas


Changes since v5:
-Picked up tags.
-Add Cc: stable for patch 2/6.
-Improved commit messages in patch 1/6 and patch 2/6.
-Improved code comment in patch 2/6 to be more specific.

Niklas Cassel (6):
  PCI: dwc: ep: Write BAR_MASK before iATU registers in
    pci_epc_set_bar()
  PCI: dwc: ep: Prevent changing BAR size/flags in pci_epc_set_bar()
  PCI: dwc: ep: Add 'address' alignment to 'size' check in
    dw_pcie_prog_ep_inbound_atu()
  PCI: artpec6: Implement dw_pcie_ep operation get_features
  PCI: endpoint: Add size check for fixed size BARs in pci_epc_set_bar()
  PCI: endpoint: Verify that requested BAR size is a power of two

 drivers/pci/controller/dwc/pcie-artpec6.c     | 13 +++++
 .../pci/controller/dwc/pcie-designware-ep.c   | 52 ++++++++++++++-----
 drivers/pci/controller/dwc/pcie-designware.c  |  5 +-
 drivers/pci/controller/dwc/pcie-designware.h  |  2 +-
 drivers/pci/endpoint/pci-epc-core.c           | 14 ++++-
 5 files changed, 67 insertions(+), 19 deletions(-)

Comments

Krzysztof WilczyƄski Dec. 18, 2024, 11:55 p.m. UTC | #1
Hello,

> This series adds some extra checks to ensure that it is not possible to
> program the iATU with an address which we did not intend to use.
> 
> If these checks were in place when testing some of the earlier revisions
> of Frank's doorbell patches (which did not handle fixed BARs properly),
> we would gotten an error, rather than silently using an address which we
> did not intend to use.
> 
> Having these checks in place will hopefully avoid similar debugging in the
> future.

Applied to endpoint, thank you!

[01/06] PCI: dwc: ep: Write BAR_MASK before iATU registers in pci_epc_set_bar()
        https://git.kernel.org/pci/pci/c/33a6938e0c33

[02/06] PCI: dwc: ep: Prevent changing BAR size/flags in pci_epc_set_bar()
        https://git.kernel.org/pci/pci/c/3708acbd5f16

[03/06] PCI: dwc: ep: Add 'address' alignment to 'size' check in dw_pcie_prog_ep_inbound_atu()
        https://git.kernel.org/pci/pci/c/129f6af747b2

[04/06] PCI: artpec6: Implement dw_pcie_ep operation get_features
        https://git.kernel.org/pci/pci/c/b61fef0813cb

[05/06] PCI: endpoint: Add size check for fixed size BARs in pci_epc_set_bar()
        https://git.kernel.org/pci/pci/c/f015b53d634a

[06/06] PCI: endpoint: Verify that requested BAR size is a power of two
        https://git.kernel.org/pci/pci/c/0e7faea1880c

	Krzysztof