On Mon, Aug 01, 2022 at 07:24:57PM +0530, Manivannan Sadhasivam wrote: > On Fri, Jun 24, 2022 at 05:39:46PM +0300, Serge Semin wrote: > > Let's make the DWC PCIe RC/EP safer and more verbose for the invalid or > > failed inbound and outbound iATU windows setups. Needless to say that > > silently ignoring iATU regions setup errors may cause unpredictable > > errors. For instance if for some reason a cfg or IO window fails to be > > activated, then any CFG/IO requested won't reach target PCIe devices and > > the corresponding accessors will return platform-specific random values. > > > > First of all we need to convert dw_pcie_ep_outbound_atu() method to check > > whether the specified outbound iATU range is successfully setup. That > > method is called by the pci_epc_ops.map_addr callback. Thus we'll make the > > EP-specific CPU->PCIe memory mappings saver. > > > > Secondly since the iATU outbound range programming method now returns the > > operation status, it will be handy to take that status into account in the > > pci_ops.{map_bus,read,write} methods. Thus any failed mapping will be > > immediately noticeable by the PCIe CFG operations requesters. > > > > Finally we need to convert the dw_pcie_setup_rc() method to returning the > > operation status, since the iATU outbound ranges setup procedure may now > > fail. It will be especially handy in case if the DW PCIe RC DT-node has > > invalid/unsupported (dma-)ranges property. Note since the suggested > > modification causes having too wide code indentation, it is reasonable > > from maintainability and readability points of view to move the outbound > > ranges setup procedure in the separate function. > > > > Signed-off-by: Serge Semin <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx> > > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> Thank you very much for all your reviews, Manivannan! I added your reviewed-by to the appropriate commits.