Message ID | 20230227021221.17980-1-shawn.guo@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2202235wrd; Sun, 26 Feb 2023 18:58:35 -0800 (PST) X-Google-Smtp-Source: AK7set99283lhcec1xQjEdjrCkuJJnz0nTAUtNwe1gDoKmeJf9DjJSbj7HPPEM/1Mo53onu9xpVn X-Received: by 2002:a17:906:4081:b0:88c:617f:bcf8 with SMTP id u1-20020a170906408100b0088c617fbcf8mr30987721ejj.61.1677466715168; Sun, 26 Feb 2023 18:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677466715; cv=none; d=google.com; s=arc-20160816; b=I6MnYWurjpahxGrYyXCrWJbIVvBPEX5UWTpSEeQipHz++zmhf1Rdj/3WTuSMkiUN8N u+TpDcInHREu3Na5fOf5re3x9S89Yko1xXyVKAJzClSgEmChvRWLy+xhL+iiPEcpEpJJ 2XJKuVmvjrY3NU6xfmG6iNonG0CB7NWdDG5QRDA6omh3fgQKuaT0RTbgERuYSIyya3uo ijYHft4c8lKiA+bRnmWX5OncB6bkiAsniG3pzXzPuv6xP0DEOTUOjaLMLFSCbtcMES2K YwtUY/lb6BEHGw59/PTqD/xGalk5AMMZf471uu2mlxTEBM7euxZpRKApFKJlPi0OIRid TSwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=W9Elx/OktSxbW/ZTsMXsiJKt2uP4I2yrugiLovEI2eU=; b=a+biz8QVnvDY2dAHNz3/tOBHA+1JJ9GLd35TnSB3dc2nZt12qffGRdE4qD1Dl5Cw48 FlvViTqVZYAPYk9ONKEqHbrmNHNqYaf/g/zvpkckZcH/xADanpTdC2oIJ7HxcARe9QNA erpfw8yianz0b70XAfnXwEJ/wW4kovm2UxVJ3pWj64X/S61StDWlZXYzcbD3Wab/+aEN Q8XBhinWv6yW11WcxxlTjSbqNKamzRaar5VgvRBZJKZnts7q5p1o4M9LT3JIlcOetOmc gv6U/bto73V/TBI9qiz4aaaCgSplAoCSGQ4wr/ou7TkrgHuHowq+bKxwtcEq7Uk8EaPR WRBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tF1eklQm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mf27-20020a170906cb9b00b008c797d4010dsi6556579ejb.230.2023.02.26.18.58.12; Sun, 26 Feb 2023 18:58:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tF1eklQm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230392AbjB0Caq (ORCPT <rfc822;sukrut.bellary@gmail.com> + 99 others); Sun, 26 Feb 2023 21:30:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbjB0CaZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 26 Feb 2023 21:30:25 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D3CD1C5BF for <linux-kernel@vger.kernel.org>; Sun, 26 Feb 2023 18:28:15 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id c18so5264651qte.5 for <linux-kernel@vger.kernel.org>; Sun, 26 Feb 2023 18:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W9Elx/OktSxbW/ZTsMXsiJKt2uP4I2yrugiLovEI2eU=; b=tF1eklQmlLz5nvLkUV7z7sNrSoRJ5Z3ElhvAX1ZQ46oBIl56yxrldAoNyZyN49kR75 KRW4AnMlCGgt56FtQKXPH0oGjc0T8r9j350X6iO6r3b06ipjlWhfDhoJU+DtXe+NsOYN uYgq6878KXvXZVfk56ZjfhBEkmbYdjlLHQQw26dOHmO1PdU/qgQV+TQjh1dKs5lcBzO7 9X3F2qgc8kf/3dv11Og0C7iWqUMKD0+55Wypw7gHBEEx6MrZiUeKHy1fXwqV4gpZ6iX+ gG80HjwtEeckb7qpZFrVA51OO2tMhsVPZrcReZBjMMniRmmOxKQI3xuF4R6JMU27goJz 6tgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W9Elx/OktSxbW/ZTsMXsiJKt2uP4I2yrugiLovEI2eU=; b=LLpftm8O+RDaUYAJYSPDtjzUno0qgIgcZLaSvgXT+PIrSv1dEFmDzO2oLOPJTjcdvM hTbPWP+T4FJz19+6OYfkPyES4fxPtXl+SIJQTe+AFydC2D1y51p+ha1ZeP/hV9lUeOBK INkNA0/5K13PPr+BESqRmOWhvSMlP1RpPhbKBTW6jXQogApJr3EE7emVyEEkRHmScKja YczK7DDd/PiEb36xWC2Ad2/bWihCBuLSm2h+NmOS/LSpdh4fDWJEc4bLbNW0fBbwDkoI EQ9ClUSOeHGxAXlMGPD8WyVp8AvrEwV4YsPBqmvX+Dp9LZ7m1uZKzvKPEvyh8n3rjIlT o/4w== X-Gm-Message-State: AO0yUKWEZR6CxSZtXnTRNSFuOwNvqO95YJsL3jQY+Cw2pXaJi1jx7RtL Gty2MB1sgEJoS0bY3PyXclf1GYUOQaUAsLoQ X-Received: by 2002:a17:90b:4c50:b0:234:1f57:ecb1 with SMTP id np16-20020a17090b4c5000b002341f57ecb1mr23918858pjb.40.1677463966735; Sun, 26 Feb 2023 18:12:46 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id q2-20020a17090a68c200b00234b785af1dsm3124513pjj.26.2023.02.26.18.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 18:12:45 -0800 (PST) From: Shawn Guo <shawn.guo@linaro.org> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com>, Maximilian Luz <luzmaximilian@gmail.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Shawn Guo <shawn.guo@linaro.org> Subject: [PATCH] arm64: PCI: Add quirk for platforms running Windows Date: Mon, 27 Feb 2023 10:12:21 +0800 Message-Id: <20230227021221.17980-1-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758951338314566035?= X-GMAIL-MSGID: =?utf-8?q?1758951338314566035?= |
Series |
arm64: PCI: Add quirk for platforms running Windows
|
|
Commit Message
Shawn Guo
Feb. 27, 2023, 2:12 a.m. UTC
Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from
host bridge windows") introduced a check to remove host bridge register
resources for all arm64 platforms, with the assumption that the PNP0A03
_CRS resources would always be host bridge registers and never as windows
on arm64.
The assumption stands true until Qualcomm Snapdragon Windows laptops
emerge. These laptops describe host bridge windows in PNP0A03 _CRS
resources instead. For example, the Microsoft Surface Pro X has host
bridges defined as
Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
Name (RBUF, ResourceTemplate ()
{
Memory32Fixed (ReadWrite,
0x60200000, // Address Base
0x01DF0000, // Address Length
)
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
0x0000, // Granularity
0x0000, // Range Minimum
0x0001, // Range Maximum
0x0000, // Translation Offset
0x0002, // Length
,, )
})
Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */
}
The Memory32Fixed holds a host bridge window, but it's not properly
defined as a "producer" resource. Consequently the resource gets
removed by kernel, and the BAR allocation fails later on:
[ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000]
[ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000]
[ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit]
[ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit]
This eventually prevents the PCIe NVME drive from being accessible.
Add a quirk for these platforms to avoid the resource being removed.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
We are running into the issue on more devices than just Surface Pro X
now, so trying to sort it out with a quirk as suggested by Lorenzo [1].
[1] https://lore.kernel.org/all/20210527093200.GA16444@lpieralisi/
arch/arm64/kernel/pci.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Comments
Hi, On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > index 2276689b5411..896dbd028b67 100644 > --- a/arch/arm64/kernel/pci.c > +++ b/arch/arm64/kernel/pci.c > @@ -109,16 +109,42 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) > return 0; > } > > +#define QCOM_DSDT_QUIRK "Host bridge windows in PNP0A03 _CRS" > + > +static struct acpi_platform_list qcom_platlist[] = { ^^^ const > + /* Thinkpad X13s */ > + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */ > + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > + /* Microsoft Surface Pro X */ > + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > + { } > +}; > + > static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci) > { > struct resource_entry *entry, *tmp; > int status; > + int idx; > > status = acpi_pci_probe_root_resources(ci); > + > + /* > + * Most arm64 platforms that do not run Windows describe host bridge > + * registers in PNP0A03 _CRS resources, but some like Qualcomm > + * Snapdragon Windows laptops describe host bridge windows in there. > + * We do not want to destroy the resources for these platforms. > + */ > + idx = acpi_match_platform_list(qcom_platlist); > + if (idx >= 0) > + goto done; > + > resource_list_for_each_entry_safe(entry, tmp, &ci->resources) { > if (!(entry->res->flags & IORESOURCE_WINDOW)) > resource_list_destroy_entry(entry); > } > + > +done: > return status; > } > > -- > 2.17.1 >
On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from > host bridge windows") introduced a check to remove host bridge register > resources for all arm64 platforms, with the assumption that the PNP0A03 > _CRS resources would always be host bridge registers and never as windows > on arm64. > > The assumption stands true until Qualcomm Snapdragon Windows laptops > emerge. These laptops describe host bridge windows in PNP0A03 _CRS > resources instead. For example, the Microsoft Surface Pro X has host > bridges defined as > > Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID > Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > { > Name (RBUF, ResourceTemplate () > { > Memory32Fixed (ReadWrite, > 0x60200000, // Address Base > 0x01DF0000, // Address Length > ) > WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, > 0x0000, // Granularity > 0x0000, // Range Minimum > 0x0001, // Range Maximum > 0x0000, // Translation Offset > 0x0002, // Length > ,, ) > }) > Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */ > } > > The Memory32Fixed holds a host bridge window, but it's not properly > defined as a "producer" resource. Consequently the resource gets > removed by kernel, and the BAR allocation fails later on: > > [ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000] > [ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000] > [ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit] > [ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit] > > This eventually prevents the PCIe NVME drive from being accessible. > > Add a quirk for these platforms to avoid the resource being removed. > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > --- > We are running into the issue on more devices than just Surface Pro X > now, so trying to sort it out with a quirk as suggested by Lorenzo [1]. One thing I don't like about this application of quirks is that the list of affected platforms is likely to grow, which is an ongoing burden for users and developers. Can we have a conversation with Qualcomm about how they *intend* this to work? Linux is probably doing something wrong (interpreting something differently than Windows does), and if we could fix that, we have a better chance of future platforms working without quirks. > [1] https://lore.kernel.org/all/20210527093200.GA16444@lpieralisi/ > > arch/arm64/kernel/pci.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > index 2276689b5411..896dbd028b67 100644 > --- a/arch/arm64/kernel/pci.c > +++ b/arch/arm64/kernel/pci.c > @@ -109,16 +109,42 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) > return 0; > } > > +#define QCOM_DSDT_QUIRK "Host bridge windows in PNP0A03 _CRS" > + > +static struct acpi_platform_list qcom_platlist[] = { > + /* Thinkpad X13s */ > + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */ > + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > + /* Microsoft Surface Pro X */ > + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > + { } > +}; > + > static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci) > { > struct resource_entry *entry, *tmp; > int status; > + int idx; > > status = acpi_pci_probe_root_resources(ci); > + > + /* > + * Most arm64 platforms that do not run Windows describe host bridge > + * registers in PNP0A03 _CRS resources, but some like Qualcomm > + * Snapdragon Windows laptops describe host bridge windows in there. > + * We do not want to destroy the resources for these platforms. > + */ > + idx = acpi_match_platform_list(qcom_platlist); > + if (idx >= 0) > + goto done; > + > resource_list_for_each_entry_safe(entry, tmp, &ci->resources) { > if (!(entry->res->flags & IORESOURCE_WINDOW)) > resource_list_destroy_entry(entry); > } > + > +done: > return status; > } > > -- > 2.17.1 >
+ linux-arm-msm and MSM maintainer Bjorn On Wed, Mar 08, 2023 at 12:53:10PM -0600, Bjorn Helgaas wrote: > On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > > Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from > > host bridge windows") introduced a check to remove host bridge register > > resources for all arm64 platforms, with the assumption that the PNP0A03 > > _CRS resources would always be host bridge registers and never as windows > > on arm64. > > > > The assumption stands true until Qualcomm Snapdragon Windows laptops > > emerge. These laptops describe host bridge windows in PNP0A03 _CRS > > resources instead. For example, the Microsoft Surface Pro X has host > > bridges defined as > > > > Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID > > Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID > > > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > > { > > Name (RBUF, ResourceTemplate () > > { > > Memory32Fixed (ReadWrite, > > 0x60200000, // Address Base > > 0x01DF0000, // Address Length > > ) > > WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, > > 0x0000, // Granularity > > 0x0000, // Range Minimum > > 0x0001, // Range Maximum > > 0x0000, // Translation Offset > > 0x0002, // Length > > ,, ) > > }) > > Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */ > > } > > > > The Memory32Fixed holds a host bridge window, but it's not properly > > defined as a "producer" resource. Consequently the resource gets > > removed by kernel, and the BAR allocation fails later on: > > > > [ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000] > > [ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000] > > [ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit] > > [ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit] > > > > This eventually prevents the PCIe NVME drive from being accessible. > > > > Add a quirk for these platforms to avoid the resource being removed. > > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > --- > > We are running into the issue on more devices than just Surface Pro X > > now, so trying to sort it out with a quirk as suggested by Lorenzo [1]. > > One thing I don't like about this application of quirks is that the > list of affected platforms is likely to grow, which is an ongoing > burden for users and developers. It's a very reasonable concern. I really hope that Qualcomm will start thinking about Linux support on these machines in the future not too far away, so that the list will not grow too long. > Can we have a conversation with Qualcomm about how they *intend* this > to work? Linux is probably doing something wrong (interpreting > something differently than Windows does), and if we could fix that, we > have a better chance of future platforms working without quirks. Today Qualcomm only ships and cares about Windows on these machines, but I believe it will change sooner or later. Shawn
On Thu, Mar 09, 2023 at 10:52:13AM +0800, Shawn Guo wrote: > + linux-arm-msm and MSM maintainer Bjorn > > On Wed, Mar 08, 2023 at 12:53:10PM -0600, Bjorn Helgaas wrote: > > On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > > > Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from > > > host bridge windows") introduced a check to remove host bridge register > > > resources for all arm64 platforms, with the assumption that the PNP0A03 > > > _CRS resources would always be host bridge registers and never as windows > > > on arm64. > > > > > > The assumption stands true until Qualcomm Snapdragon Windows laptops > > > emerge. These laptops describe host bridge windows in PNP0A03 _CRS > > > resources instead. For example, the Microsoft Surface Pro X has host > > > bridges defined as > > > > > > Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID > > > Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID > > > > > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > > > { > > > Name (RBUF, ResourceTemplate () > > > { > > > Memory32Fixed (ReadWrite, > > > 0x60200000, // Address Base > > > 0x01DF0000, // Address Length > > > ) > > > WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, > > > 0x0000, // Granularity > > > 0x0000, // Range Minimum > > > 0x0001, // Range Maximum > > > 0x0000, // Translation Offset > > > 0x0002, // Length > > > ,, ) > > > }) > > > Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */ > > > } > > > > > > The Memory32Fixed holds a host bridge window, but it's not properly > > > defined as a "producer" resource. Consequently the resource gets > > > removed by kernel, and the BAR allocation fails later on: > > > > > > [ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000] > > > [ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000] > > > [ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit] > > > [ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit] > > > > > > This eventually prevents the PCIe NVME drive from being accessible. > > > > > > Add a quirk for these platforms to avoid the resource being removed. > > > > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > > --- > > > We are running into the issue on more devices than just Surface Pro X > > > now, so trying to sort it out with a quirk as suggested by Lorenzo [1]. > > > > One thing I don't like about this application of quirks is that the > > list of affected platforms is likely to grow, which is an ongoing > > burden for users and developers. > > It's a very reasonable concern. I really hope that Qualcomm will start > thinking about Linux support on these machines in the future not too far > away, so that the list will not grow too long. > > > Can we have a conversation with Qualcomm about how they *intend* this > > to work? Linux is probably doing something wrong (interpreting > > something differently than Windows does), and if we could fix that, we > > have a better chance of future platforms working without quirks. > > Today Qualcomm only ships and cares about Windows on these machines, but > I believe it will change sooner or later. I don't maintain arch/arm64/kernel/pci.c, but my opinion is that we should not pursue quirks like this until we've tried really hard to figure out a generic approach. Bjorn
On Wed, Mar 08, 2023 at 12:53:10PM -0600, Bjorn Helgaas wrote: > On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > > Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from > > host bridge windows") introduced a check to remove host bridge register > > resources for all arm64 platforms, with the assumption that the PNP0A03 > > _CRS resources would always be host bridge registers and never as windows > > on arm64. > > > > The assumption stands true until Qualcomm Snapdragon Windows laptops > > emerge. These laptops describe host bridge windows in PNP0A03 _CRS > > resources instead. For example, the Microsoft Surface Pro X has host > > bridges defined as > > > > Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID > > Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID > > > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > > { > > Name (RBUF, ResourceTemplate () > > { > > Memory32Fixed (ReadWrite, > > 0x60200000, // Address Base > > 0x01DF0000, // Address Length > > ) > > WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, > > 0x0000, // Granularity > > 0x0000, // Range Minimum > > 0x0001, // Range Maximum > > 0x0000, // Translation Offset > > 0x0002, // Length > > ,, ) > > }) > > Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */ > > } > > > > The Memory32Fixed holds a host bridge window, but it's not properly > > defined as a "producer" resource. Consequently the resource gets > > removed by kernel, and the BAR allocation fails later on: > > > > [ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000] > > [ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000] > > [ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit] > > [ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit] > > > > This eventually prevents the PCIe NVME drive from being accessible. > > > > Add a quirk for these platforms to avoid the resource being removed. > > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > --- > > We are running into the issue on more devices than just Surface Pro X > > now, so trying to sort it out with a quirk as suggested by Lorenzo [1]. > > One thing I don't like about this application of quirks is that the > list of affected platforms is likely to grow, which is an ongoing > burden for users and developers. > > Can we have a conversation with Qualcomm about how they *intend* this > to work? Linux is probably doing something wrong (interpreting > something differently than Windows does), and if we could fix that, we > have a better chance of future platforms working without quirks. Catch-22. What if some firmware would add host bridge MMIO register space (marked as consumer) in the _CRS ? We would end up allocating BAR regions in there, which is not right, so your commit: 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from host bridge windows") is correct and if we revert it we would trigger regressions on some arm64 platforms for the reason I mention above. We can look for clarification at ACPI specs level but for firmware that is out there I am not sure what options we have. Lorenzo > > [1] https://lore.kernel.org/all/20210527093200.GA16444@lpieralisi/ > > > > arch/arm64/kernel/pci.c | 26 ++++++++++++++++++++++++++ > > 1 file changed, 26 insertions(+) > > > > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > > index 2276689b5411..896dbd028b67 100644 > > --- a/arch/arm64/kernel/pci.c > > +++ b/arch/arm64/kernel/pci.c > > @@ -109,16 +109,42 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) > > return 0; > > } > > > > +#define QCOM_DSDT_QUIRK "Host bridge windows in PNP0A03 _CRS" > > + > > +static struct acpi_platform_list qcom_platlist[] = { > > + /* Thinkpad X13s */ > > + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */ > > + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > + /* Microsoft Surface Pro X */ > > + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > + { } > > +}; > > + > > static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci) > > { > > struct resource_entry *entry, *tmp; > > int status; > > + int idx; > > > > status = acpi_pci_probe_root_resources(ci); > > + > > + /* > > + * Most arm64 platforms that do not run Windows describe host bridge > > + * registers in PNP0A03 _CRS resources, but some like Qualcomm > > + * Snapdragon Windows laptops describe host bridge windows in there. > > + * We do not want to destroy the resources for these platforms. > > + */ > > + idx = acpi_match_platform_list(qcom_platlist); > > + if (idx >= 0) > > + goto done; > > + > > resource_list_for_each_entry_safe(entry, tmp, &ci->resources) { > > if (!(entry->res->flags & IORESOURCE_WINDOW)) > > resource_list_destroy_entry(entry); > > } > > + > > +done: > > return status; > > } > > > > -- > > 2.17.1 > >
On Fri, Mar 10, 2023 at 02:26:55PM +0100, Lorenzo Pieralisi wrote: > On Wed, Mar 08, 2023 at 12:53:10PM -0600, Bjorn Helgaas wrote: > > On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > > > Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from > > > host bridge windows") introduced a check to remove host bridge register > > > resources for all arm64 platforms, with the assumption that the PNP0A03 > > > _CRS resources would always be host bridge registers and never as windows > > > on arm64. > > > > > > The assumption stands true until Qualcomm Snapdragon Windows laptops > > > emerge. These laptops describe host bridge windows in PNP0A03 _CRS > > > resources instead. For example, the Microsoft Surface Pro X has host > > > bridges defined as > > > > > > Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID > > > Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID > > > > > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > > > { > > > Name (RBUF, ResourceTemplate () > > > { > > > Memory32Fixed (ReadWrite, > > > 0x60200000, // Address Base > > > 0x01DF0000, // Address Length > > > ) > > > WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, > > > 0x0000, // Granularity > > > 0x0000, // Range Minimum > > > 0x0001, // Range Maximum > > > 0x0000, // Translation Offset > > > 0x0002, // Length > > > ,, ) > > > }) > > > Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */ > > > } > > > > > > The Memory32Fixed holds a host bridge window, but it's not properly > > > defined as a "producer" resource. Consequently the resource gets > > > removed by kernel, and the BAR allocation fails later on: > > > > > > [ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000] > > > [ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000] > > > [ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit] > > > [ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit] > > > > > > This eventually prevents the PCIe NVME drive from being accessible. > > > > > > Add a quirk for these platforms to avoid the resource being removed. > > > > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > > --- > > > We are running into the issue on more devices than just Surface Pro X > > > now, so trying to sort it out with a quirk as suggested by Lorenzo [1]. > > > > One thing I don't like about this application of quirks is that the > > list of affected platforms is likely to grow, which is an ongoing > > burden for users and developers. > > > > Can we have a conversation with Qualcomm about how they *intend* this > > to work? Linux is probably doing something wrong (interpreting > > something differently than Windows does), and if we could fix that, we > > have a better chance of future platforms working without quirks. > > Catch-22. What if some firmware would add host bridge MMIO register > space (marked as consumer) in the _CRS ? We would end up allocating > BAR regions in there, which is not right, so your commit: > > 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from host bridge windows") > > is correct and if we revert it we would trigger regressions on some > arm64 platforms for the reason I mention above. > > We can look for clarification at ACPI specs level but for firmware > that is out there I am not sure what options we have. I don't remember why 8fd4391ee717 exists; I assume there was some platform that needed it. I should have included that in the commit log; mea culpa. In any event, I assume Windows works on both that platform and the ones mentioned in this quirk, and I assume Windows doesn't require platform-specific quirks for something like this. I admit that's a lot of assuming, but if Windows can do it, Linux should be able to do it, too. > > > +static struct acpi_platform_list qcom_platlist[] = { > > > + /* Thinkpad X13s */ > > > + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > > + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */ > > > + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > > + /* Microsoft Surface Pro X */ > > > + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK },
On Fri, Mar 10, 2023 at 05:05:39PM -0600, Bjorn Helgaas wrote: > On Fri, Mar 10, 2023 at 02:26:55PM +0100, Lorenzo Pieralisi wrote: > > On Wed, Mar 08, 2023 at 12:53:10PM -0600, Bjorn Helgaas wrote: > > > On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote: > > > > Commit 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from > > > > host bridge windows") introduced a check to remove host bridge register > > > > resources for all arm64 platforms, with the assumption that the PNP0A03 > > > > _CRS resources would always be host bridge registers and never as windows > > > > on arm64. > > > > > > > > The assumption stands true until Qualcomm Snapdragon Windows laptops > > > > emerge. These laptops describe host bridge windows in PNP0A03 _CRS > > > > resources instead. For example, the Microsoft Surface Pro X has host > > > > bridges defined as > > > > > > > > Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID > > > > Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID > > > > > > > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > > > > { > > > > Name (RBUF, ResourceTemplate () > > > > { > > > > Memory32Fixed (ReadWrite, > > > > 0x60200000, // Address Base > > > > 0x01DF0000, // Address Length > > > > ) > > > > WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, > > > > 0x0000, // Granularity > > > > 0x0000, // Range Minimum > > > > 0x0001, // Range Maximum > > > > 0x0000, // Translation Offset > > > > 0x0002, // Length > > > > ,, ) > > > > }) > > > > Return (RBUF) /* \_SB_.PCI0._CRS.RBUF */ > > > > } > > > > > > > > The Memory32Fixed holds a host bridge window, but it's not properly > > > > defined as a "producer" resource. Consequently the resource gets > > > > removed by kernel, and the BAR allocation fails later on: > > > > > > > > [ 0.150731] pci 0002:00:00.0: BAR 14: no space for [mem size 0x00100000] > > > > [ 0.150744] pci 0002:00:00.0: BAR 14: failed to assign [mem size 0x00100000] > > > > [ 0.150758] pci 0002:01:00.0: BAR 0: no space for [mem size 0x00004000 64bit] > > > > [ 0.150769] pci 0002:01:00.0: BAR 0: failed to assign [mem size 0x00004000 64bit] > > > > > > > > This eventually prevents the PCIe NVME drive from being accessible. > > > > > > > > Add a quirk for these platforms to avoid the resource being removed. > > > > > > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > > > --- > > > > We are running into the issue on more devices than just Surface Pro X > > > > now, so trying to sort it out with a quirk as suggested by Lorenzo [1]. > > > > > > One thing I don't like about this application of quirks is that the > > > list of affected platforms is likely to grow, which is an ongoing > > > burden for users and developers. > > > > > > Can we have a conversation with Qualcomm about how they *intend* this > > > to work? Linux is probably doing something wrong (interpreting > > > something differently than Windows does), and if we could fix that, we > > > have a better chance of future platforms working without quirks. > > > > Catch-22. What if some firmware would add host bridge MMIO register > > space (marked as consumer) in the _CRS ? We would end up allocating > > BAR regions in there, which is not right, so your commit: > > > > 8fd4391ee717 ("arm64: PCI: Exclude ACPI "consumer" resources from host bridge windows") > > > > is correct and if we revert it we would trigger regressions on some > > arm64 platforms for the reason I mention above. > > > > We can look for clarification at ACPI specs level but for firmware > > that is out there I am not sure what options we have. > > I don't remember why 8fd4391ee717 exists; I assume there was some > platform that needed it. I should have included that in the commit > log; mea culpa. I believe it is because there were arm64 platforms (early) that added a consumer descriptor in the host bridge CRS with MMIO registers space in it (I am not sure I can find the bug report - it has been a while, remember the issue with non-ECAM config space and where to add the MMIO resource required to "extend" MCFG config space ? I will never forget that :)). > In any event, I assume Windows works on both that platform and the > ones mentioned in this quirk, and I assume Windows doesn't require > platform-specific quirks for something like this. I don't think it can work *without* quirks. If, for reasons that I don't understand, anyone would add consumer resources in the host bridge CRS that include at the same time PCI memory windows and bridge MMIO registers, how can Windows detect which one is what ? There is no way - at least none I can see. Most likely, on platforms on which Windows boots, nobody ever added in FW MMIO register space as a consumer resource in the host bridge CRS (or Windows has a quirk mechanism for those). > I admit that's a lot of assuming, but if Windows can do it, Linux > should be able to do it, too. I don't think it can do it, would be happy to be wrong. I can ask, that will not solve anything but at least we know. Lorenzo > > > > +static struct acpi_platform_list qcom_platlist[] = { > > > > + /* Thinkpad X13s */ > > > > + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > > > + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */ > > > > + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, > > > > + /* Microsoft Surface Pro X */ > > > > + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK },
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 2276689b5411..896dbd028b67 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -109,16 +109,42 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) return 0; } +#define QCOM_DSDT_QUIRK "Host bridge windows in PNP0A03 _CRS" + +static struct acpi_platform_list qcom_platlist[] = { + /* Thinkpad X13s */ + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */ + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, + /* Microsoft Surface Pro X */ + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK }, + { } +}; + static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci) { struct resource_entry *entry, *tmp; int status; + int idx; status = acpi_pci_probe_root_resources(ci); + + /* + * Most arm64 platforms that do not run Windows describe host bridge + * registers in PNP0A03 _CRS resources, but some like Qualcomm + * Snapdragon Windows laptops describe host bridge windows in there. + * We do not want to destroy the resources for these platforms. + */ + idx = acpi_match_platform_list(qcom_platlist); + if (idx >= 0) + goto done; + resource_list_for_each_entry_safe(entry, tmp, &ci->resources) { if (!(entry->res->flags & IORESOURCE_WINDOW)) resource_list_destroy_entry(entry); } + +done: return status; }