From nobody Sun Dec 22 06:27:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1712865132988819.2442269831992; Thu, 11 Apr 2024 12:52:12 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id A144717CA5E; Thu, 11 Apr 2024 19:52:07 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 925D017CA3E for ; Thu, 11 Apr 2024 19:51:50 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 0EE5960C37; Thu, 11 Apr 2024 22:51:50 +0300 (MSK) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id gphmjd2IduQ0-YWlCbRNu; Thu, 11 Apr 2024 22:51:49 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1712865109; bh=l2torsqdPEPPS8vqQcvObLj3363jX86w9QZ79R/QGEM=; h=Message-Id:Date:Cc:Subject:To:From; b=HQsBYP7RfNf2Lh+po6ce9aCW5GAlxqgXkK5zmVal04QkOILNN+slkJ+oEAGgHwgUO 6auAzgEawT7CzEjjN+zrmZ5vpBa/a1ObGphu3ehLRJxQrauxmvucO6W4R7oosR+j/5 QPhnEvXmu7bkvu/SJNJMzCft03U7O3DLpn3GIgwU= From: Daniil Tatianin To: seabios@seabios.org Date: Thu, 11 Apr 2024 22:51:35 +0300 Message-Id: <20240411195135.181615-1-d-tatianin@yandex-team.ru> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: DWA7GNIJF4TH2JR5GRRJNUF7PNSBT7GL X-Message-ID-Hash: DWA7GNIJF4TH2JR5GRRJNUF7PNSBT7GL X-MailFrom: d-tatianin@yandex-team.ru X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Daniil Tatianin , Gerd Hoffmann , yc-core@yandex-team.ru X-Mailman-Version: 3.3.6b1 Subject: [SeaBIOS] [RESEND PATCH] fw/pciinit: don't misalign large BARs List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1712865134744100001 Content-Type: text/plain; charset="utf-8" Previously we would unconditionally lower the alignment for large BARs in case their alignment was greater than "pci_mem64_top >> 11", this would make it impossible to use these devices by the kernel: [ 13.821108] pci 0000:9c:00.0: can't claim BAR 1 [mem 0x66000000000-0= x67fffffffff 64bit pref]: no compatible bridge window [ 13.823492] pci 0000:9d:00.0: can't claim BAR 1 [mem 0x64000000000-0= x65fffffffff 64bit pref]: no compatible bridge window [ 13.824218] pci 0000:9e:00.0: can't claim BAR 1 [mem 0x62000000000-0= x63fffffffff 64bit pref]: no compatible bridge window [ 13.828322] pci 0000:8a:00.0: can't claim BAR 1 [mem 0x6e000000000-0= x6ffffffffff 64bit pref]: no compatible bridge window [ 13.830691] pci 0000:8b:00.0: can't claim BAR 1 [mem 0x6c000000000-0= x6dfffffffff 64bit pref]: no compatible bridge window [ 13.832218] pci 0000:8c:00.0: can't claim BAR 1 [mem 0x6a000000000-0= x6bfffffffff 64bit pref]: no compatible bridge window Fix it by only overwriting the alignment in case it's actually greater than the desired by the BAR window. Fixes: 96a8d130a8c ("be less conservative with the 64bit pci io window") Signed-off-by: Daniil Tatianin Reviewed-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- src/fw/pciinit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 6b13cd5b..bb44dc29 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -970,9 +970,11 @@ static int pci_bios_check_devices(struct pci_bus *buss= es) int resource_optional =3D 0; if (hotplug_support =3D=3D HOTPLUG_PCIE) resource_optional =3D pcie_cap && (type =3D=3D PCI_REGION_= TYPE_IO); + + u64 top_align =3D pci_mem64_top >> 11; if (hotplug_support && pci_pad_mem64 && is64 - && (type =3D=3D PCI_REGION_TYPE_PREFMEM)) - align =3D pci_mem64_top >> 11; + && (type =3D=3D PCI_REGION_TYPE_PREFMEM) && (top_align > a= lign)) + align =3D top_align; if (align > sum && hotplug_support && !resource_optional) sum =3D align; /* reserve min size for hot-plug */ if (size > sum) { --=20 2.34.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org