Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbdCNNz5 (ORCPT ); Tue, 14 Mar 2017 09:55:57 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:41932 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752229AbdCNNzz (ORCPT ); Tue, 14 Mar 2017 09:55:55 -0400 Date: Tue, 14 Mar 2017 14:55:30 +0100 (CET) From: Thomas Gleixner To: Andi Kleen cc: bhelgaas@google.com, x86@kernel.org, linux-pci@vger.kernel.org, eranian@google.com, Peter Zijlstra , LKML , Andi Kleen Subject: Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig In-Reply-To: <20170302232104.10136-3-andi@firstfloor.org> Message-ID: References: <20170302232104.10136-1-andi@firstfloor.org> <20170302232104.10136-3-andi@firstfloor.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 904 Lines: 35 On Thu, 2 Mar 2017, Andi Kleen wrote: > +struct pci_ops pci_mmconfig_ops = { > + .read = pci_mmconfig_read, > + .write = pci_mmconfig_write, > +}; > + > +/* Force all config accesses to go through mmconfig. */ > +int pci_bus_force_mmconfig(struct pci_bus *bus) > +{ > + if (!raw_pci_ext_ops) > + return -1; We have error defines. That aside, the weak version of this returns 0, i.e. success, but here you return fail. Consistency is overrated, right? > + bus->ops = &pci_mmconfig_ops; What guarantees that raw_pci_ext_ops == pci_mmcfg? Nothing as far as I can tell. So that function name is nonsensical. It does not force anything. And the way how this function is used is a horrible hack. It's called from a random driver at some random point in time. The proper solution is to identify the bus at the point where the bus is discovered and switch it to mmconfig if possible. Thanks, tglx