Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1427062lqm; Thu, 2 May 2024 14:45:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLcfVTSBuvg6nuxcThEc0mf5jhKpyQqnEx48uETs0tdXECazb3osg/w9IZ5tBeQTJvjLXzVycJMxEfuIP3fNKce2DRmcPWP3uhPHs/xg== X-Google-Smtp-Source: AGHT+IGAHZQG+WPiH61Pfu08nxdUxvn+hMcCMuNBUX+DyDgG6MVNxc4Ko3LQvVujzf0Ei3TFjM0M X-Received: by 2002:a05:620a:388c:b0:790:87fb:f618 with SMTP id qp12-20020a05620a388c00b0079087fbf618mr1754406qkn.0.1714686308214; Thu, 02 May 2024 14:45:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714686308; cv=pass; d=google.com; s=arc-20160816; b=qBW4cV1UNQ6j7Kn8ZPNNT+iongoxcIsXWbsVXUZknxLAIBkrnjC0SGeIHWjKDwQ2jl b9SSxGugWY9zPIcdZdkm3nDckCqTGMdBxuiCWMIJflnj0xOJn26LOWiPpkegCKuzJWKX 6FC/Hgtn0lFDbz5Xj1df8OnRx6mf5/Fb1zZUUIfRJ/V0QxxtU3rAu+Wzc4DzBTj+UEY/ PqAmluvYFCfxUay0Wjird4Zo0vrrsgUWiyenicMgdsMwphERuBw9lhRU0elIT2zg6P+p 9872Q9y5I0BmKAxXxc7RDdduJ1qEaWceLlcxddI1rIEX4EBHxye16fPkC2OxfDZorTfF obuQ== 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=Im9FbgHVdz6BnxEAmmKUPc7eO1EyloXYFIUx0tKGElU=; fh=idGlfjOoTRxzD+6UR9WzMJb49eLpqe4x3JynjLSv4z8=; b=z/sdp8jSwS0PczNmQVhCFERV8Qm6Y2EQ3Fe/wCMiWTdnQy4GrDBxTnkyVppSzi/ICT rtui9dyTNy67pbZ8/Pt/aaDQzoYqjrDnJdf9FAPRcm8e5xfBVnzgRI+yPCSrbHNOMlXg mwzhf/bwbahG1oxqDwnWfNQcobIyhu+/rBEc6dduzZRPisWRdqMbT7dW9DokJu0qKBIl oAE1xP2u/4jOgomfP205q6GVJWErfrdn3SMmwdzVpfeGdMneGpT6QjHwJuZ7iJDM8fpC BntBdGfoJ/bAvRFAeTzcs77K4Kq5Kac0AYDzEM98DvBO8wynRzMarQkUyaknCHhFSHbZ lDBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CvnPyn+E; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166982-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y7-20020a37e307000000b0078d628a2c71si1857514qki.242.2024.05.02.14.45.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:45:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166982-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CvnPyn+E; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166982-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166982-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DE65C1C22364 for ; Thu, 2 May 2024 21:45:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 155E0172BCB; Thu, 2 May 2024 21:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CvnPyn+E" 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 13F1757CB5; Thu, 2 May 2024 21:43:02 +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=1714686183; cv=none; b=BuJZpFxRZziZsBnou0F/0rGgCYCR047XbSqKj9haho3Xla3BQDgUtSMIC2kJG3RuRG2T+e71GsuUtt+JrbtLg380dKft0/xDuj+vRWLji4Ew8gcYUxpkACoLUR+/4yMQG35v6IawFj9ioLo+k+Jyf6cAbXcv41ODZMFqwMq9rvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714686183; c=relaxed/simple; bh=hU0rwDyItfrpYEKW9APHQwJSc/rZVbSW7HMod3rGJt0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=EwSA+vn1oIUK6eqnMnmh9zl22lkpkCqAnoiLu416eNwJBt2guohD/EBt9iZkW7vaWcb6wIc1GlV9AtqIdYJrsGeXFqZNXGLOaRzlhBS21FtwkzRqi3qyTzeG56zdujiqpNE+AX4QN18dlXAmlZtIjkl/cZdoDbHBrdSHwoHnZTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CvnPyn+E; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC32C113CC; Thu, 2 May 2024 21:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714686182; bh=hU0rwDyItfrpYEKW9APHQwJSc/rZVbSW7HMod3rGJt0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=CvnPyn+EX/NmZZdNbjM4BI2Dj6j9krHnP/4y7s7t38FK34ToT1ExioKiJAF5wty7S eDuI5KsHBDz92OjB4uTIaMNTqbwSj9mpmRdCe85pONeDODTjMmgEUceQwPAv0ehEo7 6LKNDDQMuUGPf3S7B3Roq797esg1ODWseJa1fmJ7qP/a2ihXbXZXn+essmLA3TN/Pd hjCngZ5RBqgECPah0fCRfDxa1q4mgDuldJi/yiSx1rQ28wIvoVxGj0peHYKt7d8R5x jryC1p6YtUorrnsDSumPBRRbmm1wPwF9AOIC8j+8HNDoFy/nSNoSZj9KW1lduN/2l2 9woaFVdcsLPBg== Date: Thu, 2 May 2024 16:43:00 -0500 From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Mateusz Kaduk , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Tj , Andy Shevchenko , Hans de Goede , 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: <20240502214300.GA1547650@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: <20240417204012.215030-2-helgaas@kernel.org> On Wed, Apr 17, 2024 at 03:40:12PM -0500, 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. > > Fixes: 07eab0901ede ("efi/x86: Remove EfiMemoryMappedIO from E820 map") > Reported-by: Mateusz Kaduk > Reported-by: Arul <...> > Reported-by: Imcarneiro91 <...> > Reported-by: Aman <...> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218444 > Signed-off-by: Bjorn Helgaas > Tested-by: Mateusz Kaduk > Cc: stable@vger.kernel.org I applied this to pci/enumeration for v6.10, thanks everybody for your testing and review. > --- > arch/x86/pci/mmconfig-shared.c | 35 +++++++++++++++++++++++++++------- > 1 file changed, 28 insertions(+), 7 deletions(-) > > diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c > index 0cc9520666ef..53c7afa606c3 100644 > --- a/arch/x86/pci/mmconfig-shared.c > +++ b/arch/x86/pci/mmconfig-shared.c > @@ -518,7 +518,34 @@ static bool __ref pci_mmcfg_reserved(struct device *dev, > { > struct resource *conflict; > > - if (!early && !acpi_disabled) { > + if (early) { > + > + /* > + * Don't try to do this check unless configuration type 1 > + * is available. How about type 2? > + */ > + > + /* > + * 946f2ee5c731 ("Check that MCFG points to an e820 > + * reserved area") added this E820 check in 2006 to work > + * around BIOS defects. > + * > + * 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. Before the ACPI interpreter is > + * available, we can't check for PNP0C02 resources, so > + * there's no reliable way to verify the region in this > + * early check. Keep it only for the old machines that > + * motivated 946f2ee5c731. > + */ > + if (dmi_get_bios_year() < 2016 && raw_pci_ops) > + return is_mmconf_reserved(e820__mapped_all, cfg, dev, > + "E820 entry"); > + > + return true; > + } > + > + if (!acpi_disabled) { > if (is_mmconf_reserved(is_acpi_reserved, cfg, dev, > "ACPI motherboard resource")) > return true; > @@ -554,12 +581,6 @@ static bool __ref pci_mmcfg_reserved(struct device *dev, > if (pci_mmcfg_running_state) > return true; > > - /* Don't try to do this check unless configuration > - type 1 is available. how about type 2 ?*/ > - if (raw_pci_ops) > - return is_mmconf_reserved(e820__mapped_all, cfg, dev, > - "E820 entry"); > - > return false; > } > > -- > 2.34.1 >