Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754538AbdGCN1J (ORCPT ); Mon, 3 Jul 2017 09:27:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:58126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753447AbdGCN1G (ORCPT ); Mon, 3 Jul 2017 09:27:06 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0FD322BCC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Mon, 3 Jul 2017 08:27:04 -0500 From: Bjorn Helgaas To: Ard Biesheuvel Cc: Marc Gonzalez , Mason , Marc Zyngier , linux-pci , Thibaud Cornic , LKML , Thomas Gleixner , Linux ARM , Jingoo Han , Joao Pinto Subject: Re: [PATCH v9 2/3] PCI: Add tango PCIe host bridge support Message-ID: <20170703132704.GF13824@bhelgaas-glaptop.roam.corp.google.com> References: <987fac41-80dc-f1d0-ec0b-91ae57b91bfd@sigmadesigns.com> <20170702231811.GJ18324@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2375 Lines: 55 [+cc Jingoo, Joao] On Mon, Jul 03, 2017 at 10:35:50AM +0100, Ard Biesheuvel wrote: > On 3 July 2017 at 00:18, Bjorn Helgaas wrote: > > On Tue, Jun 20, 2017 at 10:17:40AM +0200, Marc Gonzalez wrote: > >> This driver is required to work around several hardware bugs > >> in the PCIe controller. > >> > >> NB: Revision 1 does not support legacy interrupts, or IO space. > > > > I had to apply these manually because of conflicts in Kconfig and > > Makefile. What are these based on? Easiest for me is if you base > > them on the current -rc1 tag. > > > >> Signed-off-by: Marc Gonzalez > >> --- > >> drivers/pci/host/Kconfig | 8 +++ > >> drivers/pci/host/Makefile | 1 + > >> drivers/pci/host/pcie-tango.c | 164 ++++++++++++++++++++++++++++++++++++++++++ > >> include/linux/pci_ids.h | 2 + > >> 4 files changed, 175 insertions(+) > >> create mode 100644 drivers/pci/host/pcie-tango.c > >> > [..] > >> + /* > >> + * QUIRK #2 > >> + * Unfortunately, config and mem spaces are muxed. > >> + * Linux does not support such a setting, since drivers are free > >> + * to access mem space directly, at any time. > >> + * Therefore, we can only PRAY that config and mem space accesses > >> + * NEVER occur concurrently. > >> + */ > >> + writel_relaxed(1, pcie->mux); > >> + ret = pci_generic_config_read(bus, devfn, where, size, val); > >> + writel_relaxed(0, pcie->mux); > > > > I'm very hesitant about this. When people stress this, we're going to > > get reports of data corruption. Even with the disclaimer below, I > > don't feel good about this. Adding the driver is an implicit claim > > that we support the device, but we know it can't be made reliable. > > I noticed that the Synopsys driver suffers from a similar issue: in > dw_pcie_rd_other_conf(), it happily reprograms the outbound I/O window > to perform a config space access, and switches it back to I/O space > afterwards (unless it has more than 2 viewports, in which case it uses > dedicated windows for I/O space and config space) That doesn't sound good. Jingoo, Joao? I remember some discussion about this, but not the details. I/O accesses use wrappers (inb(), etc), so there's at least the possibility of a mutex to serialize them with respect to config accesses. Bjorn