Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752022AbbKWQFm (ORCPT ); Mon, 23 Nov 2015 11:05:42 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38281 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751684AbbKWQFg (ORCPT ); Mon, 23 Nov 2015 11:05:36 -0500 Subject: Re: [PATCH v3 2/6] PCI: designware: add memory barrier after enabling region To: Russell King - ARM Linux , Stanimir Varbanov References: <20151123112744.GL8644@n2100.arm.linux.org.uk> Cc: 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 , Mark Rutland , Arnd Bergmann , Pawel Moll , Ian Campbell , Jingoo Han , Pratyush Anand , Rob Herring , Srinivas Kandagatla , Bjorn Andersson From: Stanimir Varbanov Message-ID: <56533947.4040206@linaro.org> Date: Mon, 23 Nov 2015 18:05:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151123112744.GL8644@n2100.arm.linux.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2118 Lines: 51 On 11/23/2015 01:27 PM, Russell King - ARM Linux wrote: > On Mon, Nov 23, 2015 at 11:28:59AM +0200, Stanimir Varbanov wrote: >> Add 'write memory' barrier after enable region in PCIE_ATU_CR2 >> register. The barrier is needed to ensure that the region enable >> request has been reached it's destination at time when we >> read/write to PCI configuration space. >> >> Without this barrier PCI device enumeration during kernel boot >> is not reliable, and reading configuration space for particular >> PCI device on the bus returns zero aka no device. >> >> 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..e15a2ae1583f 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]. >> + */ >> + smp_wmb(); > > So, why is this a SMP barrier? > I wrongly assumed that smp_wmb will come down to wmb(), I have no excuse. But despite my ignorant, as I noted in cover letter I want this patch to be treated as an RFC (maybe I had to add it in the subject). Do we really need a memory barrier after enabling ATU in PCI_ATU_CR2 register and before first access to pci configuration space using read[lwb] (see dw_pcie_rd_other_conf)? Or I have made totally wrong assumption. -- regards, Stan -- 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/