Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp134543lqt; Thu, 18 Apr 2024 10:20:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXq2/Ez0dTrjIy27UlEW34JMbLNf+oRb2UiNKdmtHUkCxQRnqf9wjJo+MtOCe1TJ62vKPi/+qqsEXKxjPnbzyDkKynvmy+PqgJ3DFEgcw== X-Google-Smtp-Source: AGHT+IH0TaqnDOiIVcIN8pOHaTxa1zsJPl69LKdqOwklVDBQPdninwQNE/GSKaHZMoP58ujmMgqx X-Received: by 2002:a05:6a20:dd89:b0:1a7:4b6f:7934 with SMTP id kw9-20020a056a20dd8900b001a74b6f7934mr3653880pzb.17.1713460800301; Thu, 18 Apr 2024 10:20:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713460800; cv=pass; d=google.com; s=arc-20160816; b=mvzFyyoGNE9zTp7yczevtxwoIHen+g3GsPGGMeIEILIn5g/zq7eD4eCIAcxVh9W/9G sFcHRGmoRpyIvYMgx2xL0X9GuTx0lv4p6OUeQA8ujlNhaEwNIaSUTbK5DB1v3K16sIi3 9w3e0YGJd9IBMEFVUMNFB3BMy4wgq65KQvlc9FEECY5tXKjv+dp+DqUEsyo2t60XYOic g7ksUIvpW217UDnspl39tYDv/mzy2i6+PiLJngAkKGbPmuWTSROayKyusoWCMhB3UKqu BYHhKPwIK7VBYdCs6SqnFyY0/QYvwr7FzZoDH/GH7e9clY51kj5gWYwBHxuloPeCMZEB eUJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=AlJ4z944FORD4WccaSGuKBhP/u+9kIN6ZbXXOxG46bU=; fh=0WiMbuGNi5oclTO1eNTJi1msDrq/riHK5+dn4XoClJs=; b=LJgIWnmqBNJZeIq1WUNPgN0cCSO4ihN3RtGvK+tvMhQxSJDkjA2RsIMdDSzVtXztLr 7vab66sXax8bvY0s45561P0T+33ZNNRwwmwjRoS9hS3b0el1+ppA3U7BbLidFcxpGVSQ OZRCcyKudl70aemse9aD1N5V0z0rBnvbFQ6ZCapAi06jMpiOZ09VjtfgnCw58ffajxj1 dTaEY/AbaZxHRGbULrxM8DNfGsW+Kc8ZE/96wnZR83jE0mxY9i+fVK224wU+SFtYjCit eLNfmtwdpfcJp+tRsVyCqaPp/lkz1hxgLOYn/r9e/ppMYxp1uipi32aR3E8bDQsTcUGX I2oA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CjptRVcn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-150557-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150557-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x8-20020a1709029a4800b001e47d98b4e1si1718609plv.591.2024.04.18.10.19.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 10:20:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150557-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CjptRVcn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-150557-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150557-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 80A99B21075 for ; Thu, 18 Apr 2024 17:16:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51851172BD5; Thu, 18 Apr 2024 17:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CjptRVcn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C4E616191A; Thu, 18 Apr 2024 17:15:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713460556; cv=none; b=WChx58RtAf7oo9Hh53u836CjjWAjZliV7Hbue7C/GT4BoIf5dbFZcinj2F7jwXtgcxbyVljeK9Mrijiucs2o1LPhA4kPSCbEf1BHL3iAHnOUWaKCLRfJSeZx9g+4WD2cQcPwF1VD8LKqelJ1mxuHaTMgF3pkAH3dpYdkH78DRZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713460556; c=relaxed/simple; bh=LgJPMxU3HO9QRE31RUOPaGcABDjdwgiW7iye+x76HXU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=dAZKGUNGi8eKz3ni3/d4bf5MrBP+9x9jY0ljgRha19ymErVVb8WgdZQy5frkL6Zu+cKNWokA+33BDRyIvt8iaqaIQTk7FXSz0ab/8l2YfAcj4cK1JCCA4LbW43L0tw0aXqVZ1CfUxQAXKq6DFjwzPo0S6XDnqWYnxSN9yS1D0N0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CjptRVcn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A22C1C113CC; Thu, 18 Apr 2024 17:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713460555; bh=LgJPMxU3HO9QRE31RUOPaGcABDjdwgiW7iye+x76HXU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=CjptRVcnWckpf1w0k3mjQdfgDyZNJ9iiw5mf48AG27ABJcUFrlWeDe2520MNdOMQv Vsx8nHFWxYmvK8YXEQfxqEeIr3D/5C9C8/pBiWqHxxheNJMANFtbReKOkY/+xR4fM/ v+RiLZuudMNONV2yB0JFCxq6xDP9T58AVEAqhOEjUtK9+gueTcpp3LHOdISjDuX084 f82SPmO/83F0s7X1yTX1yC3JvbiivFEhWnCPlaI4vB/i7ZFCHrAR4alLE7Gk4iN5I3 tv7eWlIv8YaO5tiCeFTI+ae6iBsjl31Iy1z0BCWjPPKhhur9FbqQyqPL9FqZIf7irE f76Dj7kxQM7jw== Date: Thu, 18 Apr 2024 12:15:54 -0500 From: Bjorn Helgaas To: Hans de Goede Cc: linux-pci@vger.kernel.org, Mateusz Kaduk , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Tj , Andy Shevchenko , x86@kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , stable@vger.kernel.org Subject: Re: [PATCH 1/1] x86/pci: Skip early E820 check for ECAM region Message-ID: <20240418171554.GA243364@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 18, 2024 at 10:14:21AM +0200, Hans de Goede wrote: > On 4/17/24 10:40 PM, Bjorn Helgaas wrote: > > From: Bjorn Helgaas > > > > Arul, Mateusz, Imcarneiro91, and Aman reported a regression caused by > > 07eab0901ede ("efi/x86: Remove EfiMemoryMappedIO from E820 map"). On the > > Lenovo Legion 9i laptop, that commit removes the area containing ECAM from > > E820, which means the early E820 validation started failing, which meant we > > didn't enable ECAM in the "early MCFG" path > > > > The lack of ECAM caused many ACPI methods to fail, resulting in the > > embedded controller, PS/2, audio, trackpad, and battery devices not being > > detected. The _OSC method also failed, so Linux could not take control of > > the PCIe hotplug, PME, and AER features: > > > > # pci_mmcfg_early_init() > > > > PCI: ECAM [mem 0xc0000000-0xce0fffff] (base 0xc0000000) for domain 0000 [bus 00-e0] > > PCI: not using ECAM ([mem 0xc0000000-0xce0fffff] not reserved) > > > > ACPI Error: AE_ERROR, Returned by Handler for [PCI_Config] (20230628/evregion-300) > > ACPI: Interpreter enabled > > ACPI: Ignoring error and continuing table load > > ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PC00.RP01._SB.PC00], AE_NOT_FOUND (20230628/dswload2-162) > > ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20230628/psobject-220) > > ACPI: Skipping parse of AML opcode: OpcodeName unavailable (0x0010) > > ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PC00.RP01._SB.PC00], AE_NOT_FOUND (20230628/dswload2-162) > > ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20230628/psobject-220) > > ... > > ACPI Error: Aborting method \_SB.PC00._OSC due to previous error (AE_NOT_FOUND) (20230628/psparse-529) > > acpi PNP0A08:00: _OSC: platform retains control of PCIe features (AE_NOT_FOUND) > > > > # pci_mmcfg_late_init() > > > > PCI: ECAM [mem 0xc0000000-0xce0fffff] (base 0xc0000000) for domain 0000 [bus 00-e0] > > PCI: [Firmware Info]: ECAM [mem 0xc0000000-0xce0fffff] not reserved in ACPI motherboard resources > > PCI: ECAM [mem 0xc0000000-0xce0fffff] is EfiMemoryMappedIO; assuming valid > > PCI: ECAM [mem 0xc0000000-0xce0fffff] reserved to work around lack of ACPI motherboard _CRS > > > > Per PCI Firmware r3.3, sec 4.1.2, ECAM space must be reserved by a PNP0C02 > > resource, but it need not be mentioned in E820, so we shouldn't look at > > E820 to validate the ECAM space described by MCFG. > > > > 946f2ee5c731 ("[PATCH] i386/x86-64: Check that MCFG points to an e820 > > reserved area") added a sanity check of E820 to work around buggy MCFG > > tables, but that over-aggressive validation causes failures like this one. > > > > Keep the E820 validation check only for older BIOSes (pre-2016) so the > > buggy 2006-era machines don't break. Skip the early E820 check for 2016 > > and newer BIOSes. > > I know a fix for this has been long in the making so I don't want to throw > a spanner into the works, but I wonder why is the is_efi_mmio() check inside > the if (!early && !acpi_disabled) {} block (before this patch) ? > > is_efi_mmio() only relies on EFI memdescriptors and those are setup pretty > early. Assuming that the EFI memdescriptors are indeed setup before > pci_mmcfg_reserved(..., ..., early=true) gets called we could simply move > the is_efi_mmio(&cfg->res) outside (below) the if (!early && !acpi_disabled) > {} so that it always runs before the is_mmconf_reserved(e820__mapped_all, ...) > check. > > Looking at the dmesg above the is_efi_mmio() check does succeed, so this > should fix the issue without needing a BIOS year check ? As far as I know there is no spec requirement that an area described by MCFG appear in either the E820 map or the EFI map. I would like to get away from relying on these things that the spec doesn't require because they are so prone to breakage. I would love to just get rid of this early usage of pci_mmcfg_reserved() completely; I'm just afraid of breaking some ancient 2006-era machine that still happens to be running. Did I understand your question correctly? Bjorn