Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2636189pxv; Sun, 11 Jul 2021 20:59:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMdl47qFh9Z+9ojlgmjavzoz8iTFkO9KPaEN0xIZznQsyh4KlfSy5C5kGv4LcAPiLYzJbe X-Received: by 2002:a17:906:dc92:: with SMTP id cs18mr51963340ejc.433.1626062360040; Sun, 11 Jul 2021 20:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626062360; cv=none; d=google.com; s=arc-20160816; b=bT9w/c03a24YTg3s2MDSlf0j40THj9jO9TOQdGEwmBRXxyifH0aLXeS6LUDCbTsa+n mLpiTl7PYEGmQAMqrVWki3Vnjne6ZEaFqgvKy8XrEy4mHnEZi5nqLj1OMc/Eiu5HHSZA kLCl9APF2YsGy2Cd2H+aTeP5/XpTTdh92rCcOaY+Bcie2TjPymKKpxv93p+Kctcsyjkg kqdBjQ+0pntsO24mBJap4IVHplgN1oezWr6t/8cgxp950ZT+Cwbxt5lBbhC197Ip5es4 sIFRm4A0+TIWuVYMmDTbNGyh7NPDrNoK4e6uXro5w4fCq2h7rFa+qWFSS2MRt43YJRle CQsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TS6ZtQlpQH2xl9ZNXcYMmhzZw7AVZ3Gie0AgelezqWc=; b=YYI8H23AqDRvDfKPxihy2oxuVs5vIYjoVl6M43wtMkXYUBRYHs26nOZb85cMJ7JrBo 2O1jtx4lEO6zPn47ZVpEMQzAgmP5VAqEAjkdMwrbfUMx9oKrqUrA1LaVdpgpNHP4PRrh tIGvNgTnbHmTM7jv7aRQoQ2kMgapEGcRPUXMedq67O4RLpQiMXAQTdDx6TlodIn9Dpl/ I3ijuU+VVZRhLYWeHMksHcDnHWyaR8pf/SCpx7h4oPpOVqTGFhnAXINpWnt9I0PkuWCB hYI9SVi6zcKHQBT+c3rMUIEUWflDkpWIZBJJmEtFN6611owK8PvprRn9XCDHTQQr/lHT U/1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=PG+VTIQn; 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 ze15si16106847ejb.253.2021.07.11.20.58.57; Sun, 11 Jul 2021 20:59:20 -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=PG+VTIQn; 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 S229379AbhGLEAt (ORCPT + 99 others); Mon, 12 Jul 2021 00:00:49 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:45288 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbhGLEAr (ORCPT ); Mon, 12 Jul 2021 00:00:47 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (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 ESMTPS id A020640615 for ; Mon, 12 Jul 2021 03:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626061857; bh=TS6ZtQlpQH2xl9ZNXcYMmhzZw7AVZ3Gie0AgelezqWc=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=PG+VTIQnkHI4sSIXmU5wHFKqsyZ5m8UqMoOSDyR8ogNZjx31IHzmsUhRwnMqvU2Yg WoTicngYr3Bqeba07p9wzNVjLTkheNJdQkruYvW/dFPDetURW6Jsnmh9V50M76IKa2 NwiJQgNQlAw6OVQgN2kTHjX10vqasMlVOQwNUSVrZoGK7mq4iwLR3OvscCif9Wf0pK Yx6Bz+5NLxvm62rYoBrOObER08sjrWAiqFz8xz74N/SomrJEA/ry1psuvtA5WXaCJ1 TeEBRr04YpR4lcuGg3QAGNF6c259p0o1p/gcRu0VYJS0HnTaqBrJp7M02cSIgaa1yQ 9b3mZy1VzEZwg== Received: by mail-ed1-f72.google.com with SMTP id e3-20020a0564020883b029039ef9536577so7672696edy.5 for ; Sun, 11 Jul 2021 20:50:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TS6ZtQlpQH2xl9ZNXcYMmhzZw7AVZ3Gie0AgelezqWc=; b=YCwDiXRzF8AVpYJGohrjzCrig6nUsRXh0Op22KMC/6oc7absDvNwLYei5dTRbzrumO RULxMiwKN6f3xCX69iOcesYI7VNAG8X03UgZ2ufPnuisxvtoOkT7oGFO0IOjzROlv7eO sditVo9Wev3MwIaRgAwsaeId9JP+ojNTangtG7D+oSmvVtOE0hCTZvW1CV3OdsCs8V/Z 9F4kRH8wHXhF7HPmjUWWMeRvjjrIrq6hKRurR4Yc/Ui8AP8owsVRRTsTfzlyJ5L0rR0Z nsVxFlZgNZ7rLJnW5MdHIvf/Qc1GApm+qBM9yncajUcXKsZSvBICaE+4MAatQQ9K9UWP bSCQ== X-Gm-Message-State: AOAM533SA21Faj7q0tphBeCG0Q+wIE+SsPa+Tja/wkJRXULtxhbktzjC 7XzTlNoXLX1Qcfr4MwRgSD/MdxkxMQ+fYTYjoZ5npxC4OsbTlX1HDACs9utiO7a2lnZhzPCMyYh p3p6xJjkeC2SXWYWgmDe0sHOXPAocUMO6TZ9TTW4kFJYb4sZkrXzIMXi07w== X-Received: by 2002:a17:906:7946:: with SMTP id l6mr49182617ejo.230.1626061857227; Sun, 11 Jul 2021 20:50:57 -0700 (PDT) X-Received: by 2002:a17:906:7946:: with SMTP id l6mr49182591ejo.230.1626061856904; Sun, 11 Jul 2021 20:50:56 -0700 (PDT) MIME-Version: 1.0 References: <20210401131252.531935-1-kai.heng.feng@canonical.com> <20210709231529.GA3270116@roeck-us.net> In-Reply-To: <20210709231529.GA3270116@roeck-us.net> From: Kai-Heng Feng Date: Mon, 12 Jul 2021 11:50:45 +0800 Message-ID: Subject: Re: [PATCH v2] PCI: Coalesce contiguous regions for host bridges To: Guenter Roeck Cc: Bjorn Helgaas , "open list:PCI SUBSYSTEM" , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guenter, On Sat, Jul 10, 2021 at 7:15 AM Guenter Roeck wrote: > > Hi, > > On Thu, Apr 01, 2021 at 09:12:52PM +0800, Kai-Heng Feng wrote: > > Built-in graphics on HP EliteDesk 805 G6 doesn't work because graphics > > can't get the BAR it needs: > > [ 0.611504] pci_bus 0000:00: root bus resource [mem 0x10020200000-0x100303fffff window] > > [ 0.611505] pci_bus 0000:00: root bus resource [mem 0x10030400000-0x100401fffff window] > > ... > > [ 0.638083] pci 0000:00:08.1: bridge window [mem 0xd2000000-0xd23fffff] > > [ 0.638086] pci 0000:00:08.1: bridge window [mem 0x10030000000-0x100401fffff 64bit pref] > > [ 0.962086] pci 0000:00:08.1: can't claim BAR 15 [mem 0x10030000000-0x100401fffff 64bit pref]: no compatible bridge window > > [ 0.962086] pci 0000:00:08.1: [mem 0x10030000000-0x100401fffff 64bit pref] clipped to [mem 0x10030000000-0x100303fffff 64bit pref] > > [ 0.962086] pci 0000:00:08.1: bridge window [mem 0x10030000000-0x100303fffff 64bit pref] > > [ 0.962086] pci 0000:07:00.0: can't claim BAR 0 [mem 0x10030000000-0x1003fffffff 64bit pref]: no compatible bridge window > > [ 0.962086] pci 0000:07:00.0: can't claim BAR 2 [mem 0x10040000000-0x100401fffff 64bit pref]: no compatible bridge window > > > > However, the root bus has two contiguous regions that can contain the > > child resource requested. > > > > Bjorn Helgaas pointed out that we can simply coalesce contiguous regions > > for host bridges, since host bridge don't have _SRS. So do that > > accordingly to make child resource can be contained. This change makes > > the graphics works on the system in question. > > > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212013 > > Suggested-by: Bjorn Helgaas > > Signed-off-by: Kai-Heng Feng > > With this patch in place, I can no longer boot the ppc:sam460ex > qemu emulation from nvme. I see the following boot error: > > nvme nvme0: Device not ready; aborting initialisation, CSTS=0x0 > nvme nvme0: Removing after probe failure status: -19 > > A key difference seems to be swapped region addresses: > > ok: > > PCI host bridge to bus 0002:00^M > pci_bus 0002:00: root bus resource [io 0x0000-0xffff] > pci_bus 0002:00: root bus resource [mem 0xd80000000-0xdffffffff] (bus address [0x80000000-0xffffffff]) > pci_bus 0002:00: root bus resource [mem 0xc0ee00000-0xc0eefffff] (bus address [0x00000000-0x000fffff]) > > bad: > > PCI host bridge to bus 0002:00^M > pci_bus 0002:00: root bus resource [io 0x0000-0xffff] > pci_bus 0002:00: root bus resource [mem 0xc0ee00000-0xc0eefffff] (bus address [0x00000000-0x000fffff]) > pci_bus 0002:00: root bus resource [mem 0xd80000000-0xdffffffff] (bus address [0x80000000-0xffffffff]) > > and then bar address assignments are swapped/changed. > > ok: > > pci 0002:00:06.0: BAR 0: assigned [mem 0xd80000000-0xd83ffffff]^M > pci 0002:00:06.0: BAR 1: assigned [mem 0xd84000000-0xd841fffff]^M > pci 0002:00:02.0: BAR 0: assigned [mem 0xd84200000-0xd84203fff 64bit]^M > pci 0002:00:01.0: BAR 5: assigned [mem 0xd84204000-0xd842041ff]^M > pci 0002:00:03.0: BAR 0: assigned [io 0x1000-0x107f]^M > pci 0002:00:03.0: BAR 1: assigned [mem 0xd84204200-0xd8420427f]^M > pci 0002:00:01.0: BAR 4: assigned [io 0x1080-0x108f]^M > pci 0002:00:01.0: BAR 0: assigned [io 0x1090-0x1097]^M > pci 0002:00:01.0: BAR 2: assigned [io 0x1098-0x109f]^M > pci 0002:00:01.0: BAR 1: assigned [io 0x10a0-0x10a3]^M > pci 0002:00:01.0: BAR 3: assigned [io 0x10a4-0x10a7]^M > pci_bus 0002:00: resource 4 [io 0x0000-0xffff]^M > pci_bus 0002:00: resource 5 [mem 0xd80000000-0xdffffffff]^M > pci_bus 0002:00: resource 6 [mem 0xc0ee00000-0xc0eefffff]^M > > bad: > > pci 0002:00:06.0: BAR 0: assigned [mem 0xd80000000-0xd83ffffff]^M > pci 0002:00:06.0: BAR 1: assigned [mem 0xd84000000-0xd841fffff]^M > pci 0002:00:02.0: BAR 0: assigned [mem 0xc0ee00000-0xc0ee03fff 64bit]^M > pci 0002:00:01.0: BAR 5: assigned [mem 0xc0ee04000-0xc0ee041ff]^M > pci 0002:00:03.0: BAR 0: assigned [io 0x1000-0x107f]^M > pci 0002:00:03.0: BAR 1: assigned [mem 0xc0ee04200-0xc0ee0427f]^M > pci 0002:00:01.0: BAR 4: assigned [io 0x1080-0x108f]^M > pci 0002:00:01.0: BAR 0: assigned [io 0x1090-0x1097]^M > pci 0002:00:01.0: BAR 2: assigned [io 0x1098-0x109f]^M > pci 0002:00:01.0: BAR 1: assigned [io 0x10a0-0x10a3]^M > pci 0002:00:01.0: BAR 3: assigned [io 0x10a4-0x10a7]^M > pci_bus 0002:00: resource 4 [io 0x0000-0xffff]^M > pci_bus 0002:00: resource 5 [mem 0xc0ee00000-0xc0eefffff]^M > pci_bus 0002:00: resource 6 [mem 0xd80000000-0xdffffffff]^M > > Reverting this patch fixes the problem. Can you please comment out the list_sort()? Seems like the precaution breaks your system... Kai-Heng > > Guenter > > --- > bisect log: > > # bad: [f55966571d5eb2876a11e48e798b4592fa1ffbb7] Merge tag 'drm-next-2021-07-08-1' of git://anongit.freedesktop.org/drm/drm > # good: [e9f1cbc0c4114880090c7a578117d3b9cf184ad4] Merge tag 'acpi-5.14-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm > git bisect start 'f55966571d5e' 'e9f1cbc0c411' > # bad: [b0dfd9af28b60d7ec42c359ae84c1ba97e093100] Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux > git bisect bad b0dfd9af28b60d7ec42c359ae84c1ba97e093100 > # bad: [364a716bd73e9846d3118a43f600f8f517658b38] Merge branch 'pci/host/intel-gw' > git bisect bad 364a716bd73e9846d3118a43f600f8f517658b38 > # good: [c9fb9042c98df94197a1ba4cf14a77c8053b0fae] Merge branch 'pci/p2pdma' > git bisect good c9fb9042c98df94197a1ba4cf14a77c8053b0fae > # bad: [7132700067f234d37c234e5d711bb49ea06d2352] Merge branch 'pci/sysfs' > git bisect bad 7132700067f234d37c234e5d711bb49ea06d2352 > # bad: [131e4f76c9ae9636046bf04d19d43af0e4ae9807] Merge branch 'pci/resource' > git bisect bad 131e4f76c9ae9636046bf04d19d43af0e4ae9807 > # good: [411e2a43d210e98730713acf6d01dcf823ee35e3] PCI: Work around Huawei Intelligent NIC VF FLR erratum > git bisect good 411e2a43d210e98730713acf6d01dcf823ee35e3 > # good: [e92605b0a0cdafb6c37b9d1ad24fe1cf8280eeb6] Merge branch 'pci/pm' > git bisect good e92605b0a0cdafb6c37b9d1ad24fe1cf8280eeb6 > # bad: [65db04053efea3f3e412a7e0cc599962999c96b4] PCI: Coalesce host bridge contiguous apertures > git bisect bad 65db04053efea3f3e412a7e0cc599962999c96b4 > # first bad commit: [65db04053efea3f3e412a7e0cc599962999c96b4] PCI: Coalesce host bridge contiguous apertures