Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1459720rwl; Thu, 5 Jan 2023 14:04:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQmkTtkopGaISkVEJGP3O/b7uOtVaS8DoxPY8KflOlBpHo7+m8Ox9A/tPVxOlQccSUlFxH X-Received: by 2002:a17:902:ecce:b0:192:b16b:8e49 with SMTP id a14-20020a170902ecce00b00192b16b8e49mr31148059plh.43.1672956263831; Thu, 05 Jan 2023 14:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672956263; cv=none; d=google.com; s=arc-20160816; b=Wcby3+HY2CaRDcQDFLlCWH7rPF3B8kcdR3HQUy0gD/kN740AkaCk39WSxVL0eTC4Sv Za94CgKKs+dWs/20qsT/bQtraxBTUU1oghTtsgsndhkFBMwIsX0Y4woq9R6uw8hXLh5O YIk95HiwVud3zk2cBxFJmKxsgVVz56bp+YW5HwrITfnpvEpDFod5BDnwW+B4Wv1qNvY7 5aP2cs1Avg5i0h+BVRmgx8oHPqfUyrmO+EdOR5ZQzt6ZOw+ywku1xoWC3qjR1TKCoGQK JXUpnQWB7mMXeKv7MhtPR6O8UyePR3EtbEOfJOJv05XkHAcEaBNcPFos6qs22DijU4W8 Pv4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=94tKi+wtegt29C0qEseRa2zPiIQt7ThzjhI+p3E0P4A=; b=YQO5kM2Waeh5x3p6IExXco2/hpa34KL6Vj6zV2PVb/VGI8D8Swxt2D2BJd9r9mUZWt J6lPxzFNvGcY7YxywVpiTZ7ScBYjDDGNRaQgAOE6GoXe7u+gDK/xcnTSbl6TK4kNHiCP JBUZ3bBn1qTaTKT+lK2calsb0x4pg9EMOjDRv58m9yYa4sMN1ubB9Q4wG/PaP5LBq9t1 KeBWPJE3sJRp6X62piU6Hy8HMyGH8yxR1EqKScRIq6krQktNlWRQrnAsQhL9ha9YNPxX mIT7cJj5CfgMsfLklEA+WV9/xi9X4aKoQicVlLRRUqsGaVmHQtBhKhSiVb+oWbu/0aTt PXIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JPNdeFZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a170902da8700b00188f3bd383csi41572939plx.266.2023.01.05.14.04.16; Thu, 05 Jan 2023 14:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JPNdeFZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235645AbjAEVft (ORCPT + 55 others); Thu, 5 Jan 2023 16:35:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233552AbjAEVfr (ORCPT ); Thu, 5 Jan 2023 16:35:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 645BD63F7F; Thu, 5 Jan 2023 13:35:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 17639B81BDF; Thu, 5 Jan 2023 21:35:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF86C433F0; Thu, 5 Jan 2023 21:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672954543; bh=J1jmUwTH6dincuSOTR/OwUfYpuEsFtTrqbv5U3W9pYc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=JPNdeFZCCvikdHla0ZygAa51wkbMeDXnfzt+HFZgVweaZx8TXyidw1l5pt9Q6/oU8 SMxfSdEkna+XLuaBmYOCTznqkug73bStiu+U2W4lBmQumbSb0B0AqgiYtOAEE/hmaL 3Y4DNHhVjJL6xGCCjfHZoleDGwaUnZfzNKGw7mqB2ZNgOdQVgm8zzmf/V2LaqyH4mR hTcW0TUDs9xOIwK4mKIm5qkbKmfEu83nNtuEw6tjOOaSOWf1ZCCJTog89uyE53BRqz yIFgwk18LGbh3jBFIpMkNsn6itojvS78za+Orjl2PI2SNvZqBIOje/oCMuDBO2AQ5y dBazfx/xVNuFw== Date: Thu, 5 Jan 2023 15:35:41 -0600 From: Bjorn Helgaas To: Dan Williams Cc: "Luck, Tony" , "Liang, Kan" , "bhelgaas@google.com" , "hdegoede@redhat.com" , "kernelorg@undead.fr" , "kjhambrick@gmail.com" , "2lprbe78@duck.com" <2lprbe78@duck.com>, "nicholas.johnson-opensource@outlook.com.au" , "benoitg@coeus.ca" , "mika.westerberg@linux.intel.com" , "wse@tuxedocomputers.com" , "mumblingdrunkard@protonmail.com" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Box, David E" , "Sun, Yunying" Subject: Re: Bug report: the extended PCI config space is missed with 6.2-rc2 Message-ID: <20230105213541.GA1171476@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <63b73f24c1a_517412943a@dwillia2-xfh.jf.intel.com.notmuch> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 05, 2023 at 01:20:36PM -0800, Dan Williams wrote: > Bjorn Helgaas wrote: > > On Thu, Jan 05, 2023 at 11:44:28AM -0800, Dan Williams wrote: > > > Bjorn Helgaas wrote: > > > > > > Apparently the only mention of [mem 0x80000000-0x8fffffff] in the > > > > firmware/kernel interface is as an EfiMemoryMappedIO region. > > > > > > > > I think this is a firmware bug, but obviously we're going to have to > > > > figure out a way around it. > > > > > > Definitely an ambiguity / conflict, but not sure it is a bug when you > > > look at from the perspective of how would an EFI runtime service use > > > ECAM/MMCONFIG space? > > > > I think it's perfectly fine for firmware to advertise ECAM space as an > > EfiMemoryMappedIO region via EFI GetMemoryMap() because it certainly > > makes sense that EFI runtime services would use config space. > > > > My understanding is that the OS should learn about device address > > space via ACPI _CRS, not GetMemoryMap(). The MCFG spec (PCI Firmware > > Spec, r3.3, sec 4.1.2) requires ECAM space to be reserved via a > > PNP0C02 motherboard device _CRS. > > > > So what I think *is* a bug is that this firmware doesn't report the > > ECAM space via PNP0C02 _CRS. > > > > If somebody thinks the lack of this reservation is not a bug, I would > > love to hear ideas about how Linux *should* be handling this. There > > are many variations on how firmware does things like this, and it's > > been a nightmare trying to figure out something that works with all of > > them. > > I am trying to get a statement from a BIOS person, but in the meantime I > am confused by this lead in sentence of Note 2 in "PCI Firmware Spec > v3.2 Table 4-2: MCFG Table to Support Enhanced Configuration Space > Access": > > If the operating system does not natively comprehend reserving the MMCFG > region, the MMCFG region must be reserved by firmware. The address range > reported in the MCFG table or by _CBA method (see Section 4.1.3) must be > reserved by declaring a motherboard resource... > > Which seems to say it is ok for the OS to treat MMCFG space as reserved > by default. It certainly fails the Robustness Principle for the BIOS to > *assume* that the OS can natively comprehend that reservation, but it > seems Linux is in its rights to make that assumption. I read "OS natively comprehends MMCFG space" as meaning "the OS has device-specific knowledge of the PCI host bridge and the associated MMCFG space." But in that case, the OS wouldn't need MCFG at all, so maybe I'm not reading it right. There must have been some reason for that sentence, e.g., some system that didn't or couldn't report MMCFG via PNP0C02 _CBA, but it sure makes a mess of what could have been a simple "range must be reserved" statement. > > > Would it be enough to add this clarification in "EFI 2.9 Table 7-6 > > > Memory Type Usage after ExitBootServices()"? > > > > > > s/This memory is not used by the OS./This memory is not used by the OS, > > > unless ACPI declares it for another purpose./ > > > > I guess the idea is that MCFG is a form of "ACPI declaring it"? I > > don't have an explicit citation for it, but I infer at [1] that ACPI > > static tables are second-class citizens and not intended as a way of > > reserving address space because that would lead to problems booting > > old OSes on firmware that provides new tables unknown to the OS. > > Ah, true, certainly for new stuff, but what about MCFG specifically? > What harm is there an assuming that MMCONFIG intersecting with > EfiMemoryMappedIO shall be treated as reserved for MMCONFIG usage. Probably none, and I think that's what we'll have to do. Ugh. Another random special-case rule. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/PCI/acpi-info.rst?id=v6.1#n32 > >