Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755033AbbLIJxL (ORCPT ); Wed, 9 Dec 2015 04:53:11 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:52621 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753487AbbLIJxG (ORCPT ); Wed, 9 Dec 2015 04:53:06 -0500 From: Arnd Bergmann To: Pratyush Anand Cc: Stanimir Varbanov , Russell King - ARM Linux , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-pci@vger.kernel.org" , Bjorn Helgaas , Jingoo Han , Srinivas Kandagatla , Rob Herring , Rob Herring , Mark Rutland , Pawel Moll , Ian Campbell , Bjorn Andersson Subject: Re: [PATCH v4 1/5] PCI: designware: add memory barrier after enabling region Date: Wed, 09 Dec 2015 10:52:27 +0100 Message-ID: <1975309.Hla8QhEqf4@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1449149725-27607-1-git-send-email-stanimir.varbanov@linaro.org> <56669C50.9060700@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:kBRPDS8gGFHrD6H3ard9GRHWKxxvAxEi/rG46gj3aUMgEjXdkFR 8zBALFON3QrqTYMeXlVUl5tAyLmGexFrfDgbdlx5QbXmbdMTAi34bzNY9u7b53aQD7e+/lt cLRqrVSn4Gk2lqG9272b3xBcPGsLJqpNPgEZCl0DZHyUQ5lHvFwXUpd3HqwalooEjDimjOM cwCoMrBfuJ3Tmb8R2cGuw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Zx+BSHNyPLs=:uRLInfPQDS6IyRY7ddJ5AU wvHM++ZMO37P4Irnbgg9w1NFNlfvLFv0eiUSy055WL5lxywtvRj9Bh9a3grVSI7yuNW0/901X OGugFm7MI5JMXAIDRxG/ZW9E6UsDsx2DzHhI9eVjRjkEO+UudFugkTC9C74ODpP2WWsqKC5u/ FysDEKb3o5CRk9lDxrtudxXhiYDC4QBTteYPMmi6s58YNAZFYLpnxY6j4xTaAQMtxAofT2f7F udhr8iUwAm7dAyYbfvw/J3GvOIuOupVPn8vGwTj5klx/SEHJrhFLrSKKRB4YWD/2HeOloEUaB WlJxt6Zdh+LKbcEGpqYVpkStSrxDq4QuJtL2VIo1RDdz1Ofvg1pr1jOgrpb/ggri2g60jZIa1 qvlqL3qjkP35d6TZkD3P2gE6jLZSvjQDtKgrUHPm4HnphvwfI9BYxqRzIOIBxcJTZahrwHB55 C9+uDe4D5aZlY3jY1ltfIivHNKUOsC6r6KgDNXGcXAmvHxP3ahOs/+hBVvpsX3gnqBJ7S7jZR yI+i+bBly4ZyFTG+NewNqmTjNEgirzT+FmTpHlpMjLVjMi/0X/SgcrU8RxAePXrOqKvWfOuvO 6yMzGwm0LhidApy7oRFj6X897KS85lyMQT8Myx3L59v73bDlyr6itBv+irQRvhgm85P/TGpKc nYd9NnBiRiRd97Zr/z4zhuxcy+2ysTK+9eONuUKJQdaK3ZUzLvDFgGJchYUWXz8EhVby4T2/W vKjPmY993GKfqtIy Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2145 Lines: 49 On Wednesday 09 December 2015 10:10:05 Pratyush Anand wrote: > On Tue, Dec 8, 2015 at 2:31 PM, Stanimir Varbanov > > > Signed-off-by: Stanimir Varbanov > > > --- > > > drivers/pci/host/pcie-designware.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c > > > index 02a7452bdf23..ed4dc2e2553b 100644 > > > --- a/drivers/pci/host/pcie-designware.c > > > +++ b/drivers/pci/host/pcie-designware.c > > > @@ -164,6 +164,11 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index, > > > dw_pcie_writel_rc(pp, upper_32_bits(pci_addr), PCIE_ATU_UPPER_TARGET); > > > dw_pcie_writel_rc(pp, type, PCIE_ATU_CR1); > > > dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); > > > + /* > > > + * ensure that the ATU enable has been happaned before accessing > > > + * pci configuration/io spaces through dw_pcie_cfg_[read|write]. > > > + */ > > > + wmb(); > > > } > > > > > > My understnading is that since writel() of dw_pcie_writel_rc() in > above code and readl(), writel() of dw_pcie_cfg_[read|write]() (which > will follow) goes through same device (ie PCIe host here). So, it is > guaranteed that 1st writel() will be executed before later > readl()/writel(). If that is true then we do not need any explicit > barrier here. > > Arnd, Russel: whats your opinion here. I think the ordering is only enforced if the two register accesses are on the same device as seen from the bus, and it's possible that the RC registers and the config space registers are not considered the same thing here. For config write, this is not a problem, because the config space write has a wmb() that enforces ordering, but it's possible that the config space read may hit the device in parallel with the PCIE_ATU_ENABLE write. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/