Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2055289pxb; Mon, 11 Oct 2021 20:24:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyx3Ptp1oE+GQqpqrendi5hK+2AE8xZPu0rVE3IFWbAwPBIW6ZRn6rKWFA75gr63/xqG1a X-Received: by 2002:a17:90b:390b:: with SMTP id ob11mr3202067pjb.145.1634009059638; Mon, 11 Oct 2021 20:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634009059; cv=none; d=google.com; s=arc-20160816; b=SrorIE47DuM+TPveyf7iy4odLesX4Hg/Ezj+qwyl+ORwQr5i/+27svB66RgF6rScbL JWHmPB2ro50kispYkJi/BSEQbdUAJTxg0jH/2oTY7nY0RS0kC8xXCM0jdTw/wcJa03zj S3MGZgqUb/LVKR4dgHL4lpPO+p4YWDrax/JdBCFboT4K6rDj8kEgpBcpICrdpogGnEB0 wFBLYzTV8HaMLQiIdbpdeIAVBf/4dDRXdF/5vxDdsPbyZ/Mmtt3qK6Ga/mE7cG+woGaW +ecM8BWQ8s/BpPoCel1mzG5zUrH7bC2/muxuWYamJXMB6pxaTrkpWYHXLsjGz3kyE37B aJrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=yp4QdxqP/gT9M/VQy0h5lM6TzTfPeMuLkazEpnjIXSY=; b=OWkOwv085SLWQAYM5iFCZDU5+SF2U23/uq3FizrasiWSvsKKHAvuFACODzbXiOuZRU jh/v8Yr3lKXkvWbH2d+QVbgkFnYlZmYS956FTDlHPnUEshkb1O/QALyrrzKYN0HallWk k1ex61HtUygQoUScLmoCcSJmL7CcsjMQgN1H0lneISnsUlluttJnIUIMqEBLxcP9NizW FQ9YM01bL0LD50JmJZSAuY+qarOY9L/SFe0VE5fAtXsHLqwtpjLuH6WWQD7YD+Jv3YCf 3qkOHO9EAmyxPtWWEtA2mZR6Dt36uto8Y4tCE7AqFZ2AN97veZHpiG7MI6O4tqYpwa15 jYmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=jMsqyRMx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si13755242pfl.332.2021.10.11.20.24.04; Mon, 11 Oct 2021 20:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=jMsqyRMx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232164AbhJLDYP (ORCPT + 99 others); Mon, 11 Oct 2021 23:24:15 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:38580 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232034AbhJLDYO (ORCPT ); Mon, 11 Oct 2021 23:24:14 -0400 Received: from [10.1.1.116] (unknown [103.229.218.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 6FDA33F112; Tue, 12 Oct 2021 03:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1634008930; bh=yp4QdxqP/gT9M/VQy0h5lM6TzTfPeMuLkazEpnjIXSY=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=jMsqyRMx2gZirkLsa8f2mOnARgd5ntFqup1tdEaqMwVImGpI1wioszbyHl3zO1nkZ KNkAFCWE9cge8puVX5E/lkEwYj72M/hVgEMhkNnFKal/0FTpIXAwh3wEbnwzVU6+25 u3/fisjTs1KQwmQOfRfaLnVTkOCD2Ez82/Y2ZW5UJ35iXAUOD/Q7UTrbPqfRZELLoS fqSJbmIJekd3y+uyOxiwi4pZvq0t+CbeNDno6LYIqii5+SItG0yENg8IAI/C+AAP5t JnPv2OPdSrrqsX/qgdp0fJK8dTOVS65Lh232ZNiH+nuyMXpB3yDHDnpfNExO7GmVAT IRK4TuY2Bmruw== Subject: Re: [PATCH v2] x86/PCI: Ignore E820 reservations for bridge windows on newer systems To: Mika Westerberg , Hans de Goede Cc: "Rafael J . Wysocki" , Bjorn Helgaas , Myron Stowe , Juha-Pekka Heikkila , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , linux-pci@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Benoit_Gr=c3=a9goire?= References: <20211011090531.244762-1-hdegoede@redhat.com> From: Hui Wang Message-ID: <7545b263-b1a4-1c85-7f88-674ae0bb87ac@canonical.com> Date: Tue, 12 Oct 2021 11:22:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11/21 9:53 PM, Mika Westerberg wrote: > Hi Hans, > > On Mon, Oct 11, 2021 at 11:05:31AM +0200, Hans de Goede wrote: >> Some BIOS-es contain a bug where they add addresses which map to system RAM >> in the PCI bridge memory window returned by the ACPI _CRS method, see >> commit 4dc2287c1805 ("x86: avoid E820 regions when allocating address >> space"). >> >> To avoid this Linux by default excludes E820 reservations when allocating >> addresses since 2010. Windows however ignores E820 reserved regions for PCI >> mem allocations, so in hindsight Linux honoring them is a problem. >> >> Recently (2020) some systems have shown-up with E820 reservations which >> cover the entire _CRS returned PCI bridge memory window, causing all >> attempts to assign memory to PCI BARs which have not been setup by the BIOS >> to fail. For example here are the relevant dmesg bits from a >> Lenovo IdeaPad 3 15IIL 81WE: >> >> [ 0.000000] BIOS-e820: [mem 0x000000004bc50000-0x00000000cfffffff] reserved >> [ 0.557473] pci_bus 0000:00: root bus resource [mem 0x65400000-0xbfffffff window] >> >> Ideally Linux would fully stop honoring E820 reservations for PCI mem >> allocations, but then the old systems this was added for will regress. >> Instead keep the old behavior for old systems, while ignoring the E820 >> reservations like Windows does for any systems from now on. >> >> Old systems are defined here as BIOS year < 2018, this was chosen to >> make sure that pci_use_e820 will not be set on the currently affected >> systems, while at the same time also taking into account that the >> systems for which the E820 checking was orignally added may have >> received BIOS updates for quite a while (esp. CVE related ones), >> giving them a more recent BIOS year then 2010. >> >> Also add pci=no_e820 and pci=use_e820 options to allow overriding >> the BIOS year heuristic. >> >> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206459 >> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1868899 >> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1871793 >> BugLink: https://bugs.launchpad.net/bugs/1878279 >> BugLink: https://bugs.launchpad.net/bugs/1931715 >> BugLink: https://bugs.launchpad.net/bugs/1932069 >> BugLink: https://bugs.launchpad.net/bugs/1921649 >> Cc: Benoit Grégoire >> Cc: Hui Wang >> Signed-off-by: Hans de Goede > Thanks for fixing this! Few comments below. Otherwise looks good, > > Reviewed-by: Mika Westerberg > Thanks for fixing this! We almost reach a solution. :-) Thanks, Hui.