Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5775841ybv; Tue, 11 Feb 2020 23:40:19 -0800 (PST) X-Google-Smtp-Source: APXvYqwI2fnKX8N1r/61Oy7KvDjrJ9vhcvur1vL4sWPK7DVHoFtPYQiUrr95a0uNI58Z14qwT05Q X-Received: by 2002:a9d:d0b:: with SMTP id 11mr8597720oti.287.1581493218946; Tue, 11 Feb 2020 23:40:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581493218; cv=none; d=google.com; s=arc-20160816; b=A3wy+hQ1DWcxbldesAZw4zrS5fAoMjfOytcuJaw8/FvCwUVCCklDu9ACEiQTJbhQ56 b3HNC6UHmwO5lEVYD5Cl1zKjMPdFdda8I5vvGf1tAEVCfn1Z2U+Mr799mJxqpvoj7H4C 1mvFiVFu5fDIAT9fQ9inHXF/gZWuPnlC02oxJuYScp9lEE6UO63Dc6XbODp2ILfib/dH uEg95wiBBVk2Ljip1xT4pDfAPD/EK9sBC0VyJblFi7sWsiQ/l3b3qpPx5lUxFzdLFWlY zDazln63sgoWUa+syi6vDVTCGXXvLtwQU8ouf8FLQTdpsqZ0XH/5Zcw5MrROaWcmm3iQ iyWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XWghytwp0n8q64ohIAtcpx40VHgmilMQUtH3KTGYx7s=; b=Ee9RHQI9s5Y0/KyTHoAdmaUvrxeZj6O2/ltZa0qr+MYzojLMumlsetgC501D4D5g0a F/OZABcINDHqfkh5yCc71X2aHOU3QCkSo8mJvFAuSHFVP9SmxfTddVpsniaUlMnRVH4D uT+9ZMbHMcM0nQ3J8/YSt2aW0KkDwscKkZCxhuwYlbw+a2+Okv2eFYqBF2nDcfNrBR0m ET8+jhxtBQ0W4ypxIFgHL0Z4aKoujPrugtwdRp2Ma7ZalcMyV4a8NWvFEfDOOgM9oGPR ZMSzlGZ2mKbcRyFY4SHM6rOf04SXgNbM/8uFKKIkigAzrYrUNgpBBqkpikuaTlZchUF6 8yTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TC9l1keL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h64si2869069oif.215.2020.02.11.23.40.05; Tue, 11 Feb 2020 23:40:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TC9l1keL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbgBLHjA (ORCPT + 99 others); Wed, 12 Feb 2020 02:39:00 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:45175 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbgBLHi7 (ORCPT ); Wed, 12 Feb 2020 02:38:59 -0500 Received: by mail-oi1-f194.google.com with SMTP id v19so1106615oic.12; Tue, 11 Feb 2020 23:38:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XWghytwp0n8q64ohIAtcpx40VHgmilMQUtH3KTGYx7s=; b=TC9l1keL4Hd58ZG6CwkLWbCSXi5tO6plnzWPUvdQr3NN3ngxbK8wuGWtKxo3V2o0IF 35uTR//ax4ujBc5PoSxF448KRz+e2JRA/9tboijhEqO4xvGUdJ3w3qu0cgB7JLy3KCvN ZV9RPjikYG5lPOx/BpbwfcbWOa4ta+57T3E/8GZT72GEbeDiyk4YbifmxU2gA7bX7stq Yyay/i9ESUd6i51aqEw9scXiXaPLZR7cl2dA/XS4X1b1DvLceTqs36YW0fBJe0TNWdQN dR8NlBMscQr7A7gjx+20IohWRh97Il+wzZJKrowF0vOxTG4AORg/XckkIfwTFN+Hrxlw xKow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XWghytwp0n8q64ohIAtcpx40VHgmilMQUtH3KTGYx7s=; b=mUQewgiLB/6OoUXDNnHqecB446cqr6T9X3hFtg5SF+AnYBEu+wPsm9GxYy3sXKFTCx qT6rVzbcrnqs621UygT95Icve37fKhfmlkKC+TfIOCcBVowR83pUmU2lra7LWqfbeWej BZmPiDuFFhFpDGF6AvNJ2XzNEhMtmHW/TqpKKm4jM6b0p+VEjyhLc1vodzCCgDJxgTr8 IV75fyucmXcDuEbTNTw8Trt+8tIdp+CdJJsbcLBYwsnztpSTBFCMJHe8nPJId4lxaVHC vdepExLj/9YTJV5LbqBwcA8CqL+FYaYVQeXUJtopiRTV8Zlwj25B7k7hH+e+SDLE4ir1 EJ1A== X-Gm-Message-State: APjAAAXwhQ5Q0NvcH+08Gr0VxE/QV0kEsCiR4zpka7OHwGL+EvTAgnEw r+fUYqYTQKkfDiEcIMhEl5YRTeubFOwYezKLjW0= X-Received: by 2002:aca:5a04:: with SMTP id o4mr5370457oib.71.1581493138499; Tue, 11 Feb 2020 23:38:58 -0800 (PST) MIME-Version: 1.0 References: <20200208183641.6674-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200208183641.6674-6-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200212034239.GA38314@ubuntu-m2-xlarge-x86> In-Reply-To: <20200212034239.GA38314@ubuntu-m2-xlarge-x86> From: "Lad, Prabhakar" Date: Wed, 12 Feb 2020 07:38:32 +0000 Message-ID: Subject: Re: [PATCH v4 5/6] PCI: rcar: Add support for rcar PCIe controller in endpoint mode To: Nathan Chancellor 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 , LAK , Linux-Renesas , "open list:ARM/Rockchip SoC..." , LKML , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Lad Prabhakar , clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nathan, On Wed, Feb 12, 2020 at 3:42 AM Nathan Chancellor wrote: > > 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? > Sure ill fix that. Cheers, --Prabhakar Lad > You can view the full report here: > > https://groups.google.com/d/msg/clang-built-linux/KHUKw5L8yxw/Mb7KRMG7BQAJ > > Cheers, > Nathan