Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1258573imm; Fri, 27 Jul 2018 14:02:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdXVR3TWddz6iBqBsuuC2XMMn0hlvKDtiEZnQPhvzFcqa50hDuf2bZAvYLjeSmYdhntwWKk X-Received: by 2002:a63:1844:: with SMTP id 4-v6mr7594570pgy.313.1532725374251; Fri, 27 Jul 2018 14:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532725374; cv=none; d=google.com; s=arc-20160816; b=obdatVsvek488LOExGGwXjorwvAOowhlxdqLkRwOvacLe/XLRKpOMhXO4VpPewMyoH NVcqGDQcoUt1mjDeM2dhLsCtLXCOFzv9AvfEe6SWLkFOhBMdJH5IhDebj3hlGLrj9wXQ e4dU6S1SE2kN0m+cvv0eJTfqe748nuTQvcXJYglgq+IYlthj1a2IPX5j2VXBJHsNHwuW +z1rPNH+6UHdRNmW80LUBzxxxVazlIfnasTVN/Nq+WnHa/BaVikUtUq+GBV2RZtrpObl YFrCvUVSaAtPqrlejX6DOsgp4eT663TmHOUqL2S/ERF9EK3LGtO6fzswCpoPi/n+kFBo D/5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=I4vZZcYWo5zvwGMMiUhIlKms/+vPwsaEKNVXyq4mfkM=; b=EXg1oFkvGEcvasXuQOHP6znCvzybqoqztGijSLJhbznMZ/+E/Sf9IS+g+j101sJhLC xJP81NKDgoW4mZuXVyqqQiliB6ttihl9eupRwoJPn2tE+mPR/Q2gbpIhOfxal6anFArp tjIY8cb+gt8rGWdq5vMO/XW9UoUgZSxfQ0QrM0XCykZAexujNvYGCxXnpigxs4FTq5+I nmxzxSetnL7LimV2Q/fUvEzv3KPvDPY6TIBk5h5+yvo0Ok/Og+lIogvbuKFmL1rl5hKB h7VyQIkFzZcCeymdZxtokHvi2nzaxrtgDllO4FsdSK3uDWRfHp22eDv3FicV1ucQZXtv h3sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u8dQ0DYG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11-v6si4515329plm.143.2018.07.27.14.02.39; Fri, 27 Jul 2018 14:02:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u8dQ0DYG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389633AbeG0WZ3 (ORCPT + 99 others); Fri, 27 Jul 2018 18:25:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:59502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389479AbeG0WZ3 (ORCPT ); Fri, 27 Jul 2018 18:25:29 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DCFB920647; Fri, 27 Jul 2018 21:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532725310; bh=YbVmsFV6zOuUFQY44XV4BhnndI5tSnGTCTTlt+E4RjI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u8dQ0DYGyhewLJSW+zrDEsJHfwEqHIPqln3jx3SS1uLrI9XfUJrngq2CsYc+2x2s8 fHbSHsPsxD2ss1PAo8RdKu8E7r3JU6jTFoJUhDV0bpnPqRnykTeAMKL1yQQSGwEMKZ FwnjeOXKYFVOFnY+pjvCqDf9Rg2oAVQCAYzTqmiI= Date: Fri, 27 Jul 2018 16:01:48 -0500 From: Bjorn Helgaas To: "Rafael J. Wysocki" Cc: Linux PCI , ACPI Devel Maling List , Linux Kernel Mailing List Subject: Re: [PATCH v1 2/2] PCI: Document ACPI description of PCI host bridges Message-ID: <20180727210147.GE173328@bhelgaas-glaptop.roam.corp.google.com> References: <153030390808.57832.2200774416664543563.stgit@bhelgaas-glaptop.roam.corp.google.com> <153030406630.57832.11564334393458981467.stgit@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 04, 2018 at 11:40:52AM +0200, Rafael J. Wysocki wrote: > On Fri, Jun 29, 2018 at 10:27 PM, Bjorn Helgaas wrote: > > From: Bjorn Helgaas > > > > Add a writeup about how PCI host bridges should be described in ACPI > > using PNP0A03/PNP0A08 devices, PNP0C02 devices, and the MCFG table. > > > > Signed-off-by: Bjorn Helgaas > > --- > > Documentation/PCI/00-INDEX | 2 > > Documentation/PCI/acpi-info.txt | 183 +++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 185 insertions(+) > > create mode 100644 Documentation/PCI/acpi-info.txt > > > > diff --git a/Documentation/PCI/00-INDEX b/Documentation/PCI/00-INDEX > > index 0f1d1de087f1..fc6af2957e55 100644 > > --- a/Documentation/PCI/00-INDEX > > +++ b/Documentation/PCI/00-INDEX > > @@ -1,5 +1,7 @@ > > 00-INDEX > > - this file > > +acpi-info.txt > > + - info on how PCI host bridges are represented in ACPI > > MSI-HOWTO.txt > > - the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ. > > PCIEBUS-HOWTO.txt > > diff --git a/Documentation/PCI/acpi-info.txt b/Documentation/PCI/acpi-info.txt > > new file mode 100644 > > index 000000000000..9b8e7b560b50 > > --- /dev/null > > +++ b/Documentation/PCI/acpi-info.txt > > @@ -0,0 +1,183 @@ > > + ACPI considerations for PCI host bridges > > + > > +The general rule is that the ACPI namespace should describe everything the > > +OS might use unless there's another way for the OS to find it [1, 2]. > > + > > +For example, there's no standard hardware mechanism for enumerating PCI > > +host bridges, so ACPI must describe each host bridge, the method for > > +accessing PCI config space below it, the address space windows the bridge > > +forwards to PCI, and the routing of legacy INTx interrupts. > > + > > +PCI devices *below* the host bridge generally do not need to be described > > +via ACPI because the OS can discover them via the standard PCI enumeration > > +mechanism, which uses config accesses to discover and identify the device > > +and read and size its BARs. > > While they can be discovered without ACPI, power management or hotplug > may depend on it. > > Also things like _PRT come to mind here. Good point. I added some text for these items (see below). > > +ACPI resource description is done via _CRS objects of devices in the ACPI > > +namespace [2]. The _CRS is like a generalized PCI BAR: the OS can read > > +_CRS and figure out what resource is being consumed even if it doesn't have > > +a driver for the device [3]. That's important because it means an old OS > > +can work correctly even on a system with new devices unknown to the OS. > > +The new devices might not do anything, but the OS can at least make sure no > > +resources conflict with them. > > + > > +Static tables like MCFG, HPET, ECDT, etc., are *not* mechanisms for > > +reserving address space! The static tables are for things the OS needs to > > +know early in boot, before it can parse the ACPI namespace. If a new table > > +is defined, an old OS needs to operate correctly even though it ignores the > > +table. _CRS allows that because it is generic and understood by the old > > +OS; a static table does not. > > + > > +If the OS is expected to manage a non-discoverable device described via > > +ACPI, that device will have a specific _HID/_CID that tells the OS what > > +driver to bind to it, and the _CRS tells the OS and the driver where the > > +device's registers are. > > + > > +PCI host bridges are PNP0A03 or PNP0A08 devices. Their _CRS should > > +describe all the address space they consume. This includes all the windows > > +they forward down to the PCI bus, as well as bridge registers that are not > > I believe you mean registers of the host bridge itself here, but it is > somewhat unclear if that applies to bridges below it too. Right, I do mean host bridge registers for all the "bridge" occurrences in this paragraph. I changed all these references to "host bridge". PCI-to-PCI bridges below the host bridge are just like any other PCI device, of course. Their config registers are accessed via the normal config accessors and their MMIO space (if any) would be included in the host bridge's apertures. > > +forwarded to PCI. The bridge registers include things like secondary/ > > +subordinate bus registers that determine the bus range below the bridge, > > +window registers that describe the apertures, etc. These are all > > +device-specific, non-architected things, so the only way a PNP0A03/PNP0A08 > > +driver can manage them is via _PRS/_CRS/_SRS, which contain the > > +device-specific details. The bridge registers also include ECAM space, > > +since it is consumed by the bridge. I made the following changes (hand-edited to remove trivial changes): diff -u b/Documentation/PCI/acpi-info.txt b/Documentation/PCI/acpi-info.txt --- b/Documentation/PCI/acpi-info.txt +++ b/Documentation/PCI/acpi-info.txt @@ -1,17 +1,21 @@ For example, there's no standard hardware mechanism for enumerating PCI -host bridges, so ACPI must describe each host bridge, the method for -accessing PCI config space below it, the address space windows the bridge -forwards to PCI, and the routing of legacy INTx interrupts. - -PCI devices *below* the host bridge generally do not need to be described -via ACPI because the OS can discover them via the standard PCI enumeration -mechanism, which uses config accesses to discover and identify the device -and read and size its BARs. +host bridges, so the ACPI namespace must describe each host bridge, the +method for accessing PCI config space below it, the address space windows +the host bridge forwards to PCI (using _CRS), and the routing of legacy +INTx interrupts (using _PRT). + +PCI devices, which are below the host bridge, generally do not need to be +described via ACPI. The OS can discover them via the standard PCI +enumeration mechanism, using config accesses to discover and identify +devices and read and size their BARs. However, ACPI may describe PCI +devices if it provides power management or hotplug functionality for them +or if the device has INTx interrupts connected by platform interrupt +controllers and a _PRT is needed to describe those connections. @@ -35,14 +39,14 @@ PCI host bridges are PNP0A03 or PNP0A08 devices. ?Their _CRS should describe all the address space they consume. ?This includes all the windows -they forward down to the PCI bus, as well as bridge registers that are not -forwarded to PCI. ?The bridge registers include things like secondary/ -subordinate bus registers that determine the bus range below the bridge, -window registers that describe the apertures, etc. ?These are all -device-specific, non-architected things, so the only way a PNP0A03/PNP0A08 -driver can manage them is via _PRS/_CRS/_SRS, which contain the -device-specific details. ?The bridge registers also include ECAM space, -since it is consumed by the bridge. +they forward down to the PCI bus, as well as registers of the host bridge +itself that are not forwarded to PCI. ?The host bridge registers include +things like secondary/subordinate bus registers that determine the bus +range below the bridge, window registers that describe the apertures, etc. +These are all device-specific, non-architected things, so the only way a +PNP0A03/PNP0A08 driver can manage them is via _PRS/_CRS/_SRS, which contain +the device-specific details. ?The host bridge registers also include ECAM +space, since it is consumed by the host bridge.