From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Chancellor Subject: Re: [PATCH v4 5/6] PCI: rcar: Add support for rcar PCIe controller in endpoint mode Date: Tue, 11 Feb 2020 20:42:39 -0700 Message-ID: <20200212034239.GA38314@ubuntu-m2-xlarge-x86> References: <20200208183641.6674-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200208183641.6674-6-prabhakar.mahadev-lad.rj@bp.renesas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20200208183641.6674-6-prabhakar.mahadev-lad.rj-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Lad Prabhakar Cc: Bjorn Helgaas , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Kishon Vijay Abraham I , Lorenzo Pieralisi , Arnd Bergmann , Greg Kroah-Hartman , Jingoo Han , Gustavo Pimentel , Marek Vasut , Yoshihiro Shimoda , Shawn Lin , Heiko Stuebner , Andrew Murray , linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-ro List-Id: linux-rockchip.vger.kernel.org Hi Lad, On Sat, Feb 08, 2020 at 06:36:40PM +0000, Lad Prabhakar wrote: > This patch adds support for rcar PCIe controller to work in endpoint mode. > > Signed-off-by: Lad Prabhakar > --- > drivers/pci/controller/Kconfig | 7 + > drivers/pci/controller/Makefile | 1 + > drivers/pci/controller/pcie-rcar-ep.c | 492 ++++++++++++++++++++++++++++++++++ > drivers/pci/controller/pcie-rcar.h | 6 + > 4 files changed, 506 insertions(+) > create mode 100644 drivers/pci/controller/pcie-rcar-ep.c > > diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c > new file mode 100644 > index 0000000..32a7fca > --- /dev/null > +++ b/drivers/pci/controller/pcie-rcar-ep.c > +static int rcar_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, > + struct pci_epf_bar *epf_bar) > +{ > + struct rcar_pcie *ep = epc_get_drvdata(epc); > + dma_addr_t cpu_addr = epf_bar->phys_addr; > + int flags = epf_bar->flags | LAR_ENABLE | LAM_64BIT; > + enum pci_barno bar = epf_bar->barno; > + u64 size = 1ULL << fls64(epf_bar->size - 1); > + u32 mask; > + int idx; > + int err; > + > + idx = find_first_zero_bit(ep->ib_window_map, ep->num_ib_windows); > + if (idx >= ep->num_ib_windows) { > + dev_err(ep->dev, "no free inbound window\n"); > + return -EINVAL; > + } > + > + if ((flags & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) > + flags |= IO_SPACE; > + > + ep->bar_to_atu[bar] = idx; > + /* use 64 bit bars */ > + set_bit(idx, ep->ib_window_map); > + set_bit(idx + 1, ep->ib_window_map); > + > + if (cpu_addr > 0) { > + unsigned long nr_zeros = __ffs64(cpu_addr); > + u64 alignment = 1ULL << nr_zeros; > + > + size = min(size, alignment); > + } else { > + size = size; > + } We received a report from the 0day bot that clang warns that this is unnecessary. Would you mind removing it if you have to spin up a new version? You can view the full report here: https://groups.google.com/d/msg/clang-built-linux/KHUKw5L8yxw/Mb7KRMG7BQAJ Cheers, Nathan