From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932931AbcFJUxz (ORCPT ); Fri, 10 Jun 2016 16:53:55 -0400 Received: from foss.arm.com ([217.140.101.70]:41042 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932558AbcFJUxy (ORCPT ); Fri, 10 Jun 2016 16:53:54 -0400 Date: Fri, 10 Jun 2016 21:54:23 +0100 From: Lorenzo Pieralisi To: Tomasz Nowicki Cc: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, hanjun.guo@linaro.org, okaya@codeaurora.org, jchandra@broadcom.com, robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, andrea.gallo@linaro.org, dhdang@apm.com, jeremy.linton@arm.com, liudongdong3@huawei.com, cov@codeaurora.org Subject: Re: [PATCH V9 10/11] ARM64/PCI: Implement ACPI low-level calls to access PCI_Config region from AML Message-ID: <20160610205423.GC24178@red-moon> References: <1465588519-11334-1-git-send-email-tn@semihalf.com> <1465588519-11334-11-git-send-email-tn@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465588519-11334-11-git-send-email-tn@semihalf.com> 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 On Fri, Jun 10, 2016 at 09:55:18PM +0200, Tomasz Nowicki wrote: > ACPI spec6.1 - chapter: 5.5.2.4 defines OperationRegion (Declare Operation > Region). Following the spec: " [...] An Operation Region is a specific > region of operation within an address space that is declared as a subset > of the entire address space using a starting address (offset) and a length. > Control methods must have exclusive access to any address accessed via > fields declared in Operation Regions. [...]". > > OperationRegion allows to declare various of operation region address space s/of// > identifiers including PCI_Config. PCI_Config is meant to access PCI > configuration space from the ASL. So every time ASL opcode operates > on PCI_Config space region, ASL interpreter dispatches accesses to OS > low-level calls - raw_pci_write() and raw_pci_read() for Linux - so-called > ACPI RAW accessors. > > In order to support PCI_Config operation region, implement mentioned > raw_pci_write() and raw_pci_read() calls so they find associated bus > and call read/write ops. > > Waiting for clarification in the ACPI specifications in relation > to PCI_Config space handling before PCI bus enumeration is completed, > current code does not support PCI_Config region accesses before PCI bus > enumeration whilst providing full AML PCI_Config access availability > when the PCI bus enumeration is completed by the kernel so that > RAW accessors can look-up PCI operations through the struct pci_bus > associated with a PCI bus. > > Signed-off-by: Tomasz Nowicki > Signed-off-by: Jayachandran C Reviewed-by: Lorenzo Pieralisi > --- > arch/arm64/kernel/pci.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > index b3b8a2c..328f857 100644 > --- a/arch/arm64/kernel/pci.c > +++ b/arch/arm64/kernel/pci.c > @@ -71,13 +71,21 @@ int pcibios_alloc_irq(struct pci_dev *dev) > int raw_pci_read(unsigned int domain, unsigned int bus, > unsigned int devfn, int reg, int len, u32 *val) > { > - return -ENXIO; > + struct pci_bus *b = pci_find_bus(domain, bus); > + > + if (!b) > + return PCIBIOS_DEVICE_NOT_FOUND; > + return b->ops->read(b, devfn, reg, len, val); > } > > int raw_pci_write(unsigned int domain, unsigned int bus, > unsigned int devfn, int reg, int len, u32 val) > { > - return -ENXIO; > + struct pci_bus *b = pci_find_bus(domain, bus); > + > + if (!b) > + return PCIBIOS_DEVICE_NOT_FOUND; > + return b->ops->write(b, devfn, reg, len, val); > } > > #ifdef CONFIG_NUMA > -- > 1.9.1 >