Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4115297pxj; Tue, 15 Jun 2021 16:00:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzevQaxgufqzvB8Gko8gXx09F5/eXDSWKW8NsUVVOSDDjS5HcvvZurz2izPNK+cfMtV+xTA X-Received: by 2002:a02:666d:: with SMTP id l45mr1395630jaf.0.1623798001878; Tue, 15 Jun 2021 16:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623798001; cv=none; d=google.com; s=arc-20160816; b=RNxL0E3BlmIaaZ7NfD+dbtfsIIDsMT696psxvAgfvenyd2t7YjZdXRK7woO0Op5M1i g/M0TBOoWR4HHGP+5xhF1qexx0KWV7phnVfEF57trFlHgcC88cjg1fQeLL4z36wyLqDR su9GjvoTbyQe66HKDJyZKoP+WvQYZ6dERZH7WBUY+kuXW6FiKVJKcxw+MiP0AV6rtyYf n9/z6ifwv4GkTFAeX8syxBgemedNnKwQYshSNOWtneYPPnYT4IU+4GQDJTLq9F+8KzxU 6PGOh31uzcVKi8kDEvYMOmSbroRseSpKQOaoLuF5WxgBvkbt3CyPdR6/lkh6NYL0FmVR 3mPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qlTKAUDpgW/aVWFcl6ZYQV6zmV889oxnPc1k40CzH84=; b=nJ9RkNsz0gCEjg/wj0+XdBPgkMgOIInBQ0L11CJ9sIPBZRVMFOD2ZcZk0O+c9Y0Y+x lM5wLjkaB8dLEwwZMKZZr1s3E4s/3x4Gvj5ti1glbOOmFW21siwFFjoFfSRvpxF4lmfH o/TvpFHsbKULXjsEJaVS+LOq81CwqSSFb78kSxxzzA3t3Tnmp1XQU3D9k87n7w7onoXe crpQVWMf4J0vdBZ5IREkvikyfOEe7RalSwxuj5BqtwXwzRGZ27qObY8CwtcnjZJO7WXK Ks3GnF/Yk633x4fCZhyGKUMdLhneHmxUv6gt0AEqPEYrFIsvSrqeagackupTE1PMB1Xn WMXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6j48dWS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x14si207337ill.134.2021.06.15.15.59.45; Tue, 15 Jun 2021 16:00:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6j48dWS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230438AbhFOXAf (ORCPT + 99 others); Tue, 15 Jun 2021 19:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbhFOXAf (ORCPT ); Tue, 15 Jun 2021 19:00:35 -0400 Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DB77C061767 for ; Tue, 15 Jun 2021 15:58:29 -0700 (PDT) Received: by mail-oo1-xc2b.google.com with SMTP id d27-20020a4a3c1b0000b029024983ef66dbso202043ooa.3 for ; Tue, 15 Jun 2021 15:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qlTKAUDpgW/aVWFcl6ZYQV6zmV889oxnPc1k40CzH84=; b=Y6j48dWS8Zjp45eyuaVvc0GXsT4HSvTzjnwjt2i2u6VxfEW89ci8iej3A0gCIHnJWT FCsZOhR/ES6yKJf5EMZJsf2KTVi4Iq+nXutr8yjIvmB6WcfmM6ySC5eVLBvvSVVuGsXo ttNdErqUXVU5XjNR5m/d7Qx0y23KmQ0sup2dOe1pDcSMoOUVLdJMCHXoH38wl7QHiP8q aD8ntmJVizuLBlzapNXiuv6WNamAClcJSop5/H5p6vL4YtOFuO+CrVAl627kglXjUT7d o6q+sw/pG1gF78eT2INat9qTwBIU4GXNDMbykJOOOf1a0/yDzsbCzYZGNQMyaRZrYJcs QbbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qlTKAUDpgW/aVWFcl6ZYQV6zmV889oxnPc1k40CzH84=; b=p8JOJIEG2QSb00+yiP5DiYDQFgyUrAS2BftzxpQYhsiSyS55wZIHShffqW+QYNBPGq kva6Aato9oixkGQhTQI9wNxu4+omwAC07kE2n61aiwbh7iuTFFzgvndq59TQnvXiNvxd A3MQT/XidS0iE8+pduYM0GPtES4VyMrjoJnYVNkEfQYh5XHYWr+7BTKNR8ZPOxgSveI/ xIRMZy8GqHNfunnkeFD+lWG6+3haIErYKsiO01m6mopM9yp7Xnt5W1b6opB54FNM686m GNkYRCtXtgC+LxvZ07S+DNTGJqrIXIr/RwysEH3tmofLwCDOne8HA6JoElZfHdfr12tK ZIkQ== X-Gm-Message-State: AOAM533V2K51sNPWxK9Wj4kSFRgl4syFsF3wTe0n+a6oGzaFadnCBKOq 7BCLuU2fl3jw0pzPFVK7CO57Kg== X-Received: by 2002:a4a:b1c2:: with SMTP id j2mr1249731ooo.78.1623797908009; Tue, 15 Jun 2021 15:58:28 -0700 (PDT) Received: from yoga (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id f63sm95341otb.36.2021.06.15.15.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 15:58:27 -0700 (PDT) Date: Tue, 15 Jun 2021 17:58:25 -0500 From: Bjorn Andersson To: Rob Herring Cc: Manivannan Sadhasivam , Lorenzo Pieralisi , Bjorn Helgaas , linux-arm-msm , PCI , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Siddartha Mohanadoss Subject: Re: [PATCH v2 2/3] PCI: dwc: Add Qualcomm PCIe Endpoint controller driver Message-ID: References: <20210603103814.95177-1-manivannan.sadhasivam@linaro.org> <20210603103814.95177-3-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 15 Jun 17:20 CDT 2021, Rob Herring wrote: > On Tue, Jun 15, 2021 at 3:57 PM Bjorn Andersson > wrote: > > > > On Tue 15 Jun 16:40 CDT 2021, Rob Herring wrote: > > > > > On Sat, Jun 5, 2021 at 9:07 PM Bjorn Andersson > > > wrote: > > > > > > > > On Thu 03 Jun 05:38 CDT 2021, Manivannan Sadhasivam wrote: > > > > > > > > > Add driver support for Qualcomm PCIe Endpoint controller driver based on > > > > > the Designware core with added Qualcomm specific wrapper around the > > > > > core. The driver support is very basic such that it supports only > > > > > enumeration, PCIe read/write, and MSI. There is no ASPM and PM support > > > > > for now but these will be added later. > > > > > > > > > > The driver is capable of using the PERST# and WAKE# side-band GPIOs for > > > > > operation and written on top of the DWC PCI framework. > > > > > > > > > > Co-developed-by: Siddartha Mohanadoss > > > > > Signed-off-by: Siddartha Mohanadoss > > > > > [mani: restructured the driver and fixed several bugs for upstream] > > > > > Signed-off-by: Manivannan Sadhasivam > > > > > > > > Really nice to see this working! > > > > > > [...] > > > > > > > > +static void qcom_pcie_ep_configure_tcsr(struct qcom_pcie_ep *pcie_ep) > > > > > +{ > > > > > + writel_relaxed(0x0, pcie_ep->tcsr + TCSR_PCIE_PERST_EN); > > > > > > > > Please avoid _relaxed accessor unless there's a strong reason, and if so > > > > document it. > > > > > > Uhhh, what!? That's the wrong way around from what I've ever seen > > > anyone say. Have you ever looked at the resulting code on arm32 with > > > OMAP enabled? It's just a memory barrier and an indirect function call > > > on every access. > > > > > > Use readl/writel if you have an ordering requirement WRT DMA, > > > otherwise use relaxed variants. > > > > > > > That does make sense. Unfortunately I don't know where this started, but > > I would guess it might have been a reaction to the fact that people > > where just sprinkling wmb() all over the place to be on the safe side... > > I think you could write a book on it. In the beginning, there was x86 > and it was strongly ordered... > I guess it would allow me to ask people to RTFM (RTFB) instead then :) Jokes aside, I think we came to the conclusion that writel() was better than incorrect use of writel_relaxed() followed by wmb(). And in this particular case it's definitely not happening in a hot code path... > > > > > > > + writel_relaxed(0x0, pcie_ep->tcsr + TCSR_PERST_SEPARATION_ENABLE); > > > > > +} > > > > > + > > > > > > [...] > > > > > > > > +static struct platform_driver qcom_pcie_ep_driver = { > > > > > + .probe = qcom_pcie_ep_probe, > > > > > + .driver = { > > > > > + .name = "qcom-pcie-ep", > > > > > > > > Skip the indentation of the '='. > > > > > > > > > + .suppress_bind_attrs = true, > > > > > > > > Why do we suppress_bind_attrs? > > > > > > Because remove is not handled. > > > > > > > Not handled in Mani's driver, or is this a PCI thing? > > Only a PCI thing in the sense all the drivers happen to copy-n-paste > it and are mostly built-in. The Android modules thing doesn't seem to > have quite hit PCI yet. On the flipside, I'm sure there's lots of > drivers we can unbind and fun will ensue. > > There is some work needed as the remove() implementations that we do > have are all unique (such as do we need a lock or not). I keep nudging > people to look into it. > Thanks, that confirms that my expectation. I would prefer to see this tackled in a separate step then :) Regards, Bjorn