From patchwork Wed May 18 19:42:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12854030 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B180C433F5 for ; Wed, 18 May 2022 19:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eFeUVQYBeDWjm3C/+an7axzGMFZvXp15XJEZ1f6t9FU=; b=Jt9m2vQ2nDxU/E QQUfBl6OLh2hTjjWCofGpp4ZzPRvMChDy2rscni87iBaB4XQ1slBc7XU8JH10SUFtLt9mEl8zrYVk 0qNEavPwrJChXrdhnyUmq1ba0x9ktIkCf9PIJFQJhSPyc9COu+Vue2w6SGKF1VZCK/roCnRKETE41 osLmxb/FrtRFFz8lqNDu7MHrGY9E3OWF+jkkWafLSH7AMRPAHgppAoVNZUH3QokLIgWJA0Up3kfDB O1CA4KgAjqLQL8ZDaug2nt2WyUpL4eWeJgtvhnHbWnRyWx46vipjRYQlgkglqDu2rwqP4HQXtTQBB y6FunE2o8TotrMTsKUjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrPZ0-003eLn-HN; Wed, 18 May 2022 19:42:30 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrPYx-003eIe-1i; Wed, 18 May 2022 19:42:28 +0000 Received: by mail-pg1-x52f.google.com with SMTP id h186so3060921pgc.3; Wed, 18 May 2022 12:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=rT3oa73xcTkbyKbZvAP0rpZLJAssviOZM8Y3RSNfhUQ=; b=Ss0uYNtLa/8IAbmW7eG22wtU/AKDcZo0H8gGz7YaF4Ovo9vKLt54KXvbcgtxQJOleU Xi+Vhb2Wh6NnGTPcZ3Z/ZGpCZPyo1bf+8RaUpsVuNpKNvi3I1jWcd+UXTiKTRdzs9FcL Uv7vTo1Nl7ls5uKRTDJsqYbdVT1kiFLzN79sCJgxOFZ+Sti9Hf7vmId/GaBtxGQ6qYme 8FjJitq/w28r2fHj9WE/Ug/I0CFOsQtUajwnfkSBBfYx70M+0oKLNYQ4zP/7HCa0obXn NSYavvW/iA6xo12wU7/HpoTvG8b/WZsZ1bh/ZCn1vxUxTtAYjA6op9I211wnFYET1l/V XzAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rT3oa73xcTkbyKbZvAP0rpZLJAssviOZM8Y3RSNfhUQ=; b=yx17tveDIuSRv5gGwdsx58xAVvRvaHjmrXQxIv9vEv2mqpWAiZvpjoh6q6UivX6eqS XlduXFn/u/LB9KPIYDQLLkYOKn1fFNw/SIhnxSgYDEHXBA9Hs2DlCIHzT0vP5Xnqnlnr sQ239c7dmhbaV0OjMlOHES4dPQEps33UEFBJZrCC8sioQ+BB0RvVnHJNrEcfwoXGx2q7 uT9CuX3w6bMRGvld+Q+Ij6NGdXB/ggSxtiYzjnwh98ttSiNeTLtqk+ScClcQdkvK0O/v QLXUFOtCpWC95tr/v/FB4Rq4smf2wD6IfZsKf5Nti/d5CeEA2IzzMZB/9BZhadUZEijd IrOg== X-Gm-Message-State: AOAM5326dAvD/SQDgxQ+vsrvZeW3KNmzhXj707GxbXjc0SK3DOAp0xJQ FsUgKSQuNWqWXapoDiI2IrA= X-Google-Smtp-Source: ABdhPJy4GhpCLByKZa531OCaCG0BJCwsLPGSG/QCgnluQs4C2+MuSZJQ77ZaPIdIhvXGTjUla7eSnA== X-Received: by 2002:a62:f901:0:b0:518:307a:b392 with SMTP id o1-20020a62f901000000b00518307ab392mr949450pfh.44.1652902937630; Wed, 18 May 2022 12:42:17 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id g10-20020a62f94a000000b0050dc762815esm2362469pfm.56.2022.05.18.12.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 12:42:17 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , james.dutton@gmail.com, kibi@debian.org, bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1] PCI: brcmstb: Fix regression regarding missing PCIe linkup Date: Wed, 18 May 2022 15:42:11 -0400 Message-Id: <20220518194211.20143-1-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220518_124227_117060_3EA5821A X-CRM114-Status: GOOD ( 15.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org commit 93e41f3fca3d ("PCI: brcmstb: Add control of subdevice voltage regulators") introduced a regression on the PCIe RPi4 Compute Module. If the PCIe endpoint node described in [2] was missing, no linkup would be attempted, and subsequent accesses would cause a panic because this particular PCIe HW causes a CPU abort on illegal accesses (instead of returning 0xffffffff). We fix this by allowing the DT endpoint subnode to be missing. This is important for platforms like the CM4 which have a standard PCIe socket and the endpoint device is unknown. Please do not accept this commit until someone with a CM4 has tested this solution; I have only emulated the problem and fix on different platform. Note that a bisection identified commit 830aa6f29f07 ("PCI: brcmstb: Split brcm_pcie_setup() into two funcs") as the first failing commit. This commit is a regression, but is unrelated and was fixed by a subsequent commit in the original patchset. [1] https://bugzilla.kernel.org/show_bug.cgi?id=215925 [2] Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml Fixes: 93e41f3fca3d ("PCI: brcmstb: Add control of subdevice voltage regulators") Fixes: 830aa6f29f07 ("PCI: brcmstb: Split brcm_pcie_setup() into two funcs") Link: https://bugzilla.kernel.org/show_bug.cgi?id=215925 Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) base-commit: ef1302160bfb19f804451d0e919266703501c875 prerequisite-patch-id: 23a425390a4226bd70bbff459148c80f5e28379c prerequisite-patch-id: e3f2875124b46b2b1cf9ea28883bf0c864b79479 prerequisite-patch-id: 9cdd706ee2038c7b393c4d65ff76a1873df1ca03 prerequisite-patch-id: 332ac90be6e4e4110e27bdd1caaff212c129f547 prerequisite-patch-id: 32a74f87cbfe9e8d52c34a4edeee6d271925665a prerequisite-patch-id: f57cdf7ec7080bb8c95782bc7c3ec672db8ec1ce prerequisite-patch-id: 18dc9236aed47f708f5c854afd832f3c80be5ea7 prerequisite-patch-id: dd147c6854c4ca12a9a8bd4f5714968a59d60e4e diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index ba5c120816b2..adca74e235cb 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -540,16 +540,18 @@ static int pci_subdev_regulators_add_bus(struct pci_bus *bus) static int brcm_pcie_add_bus(struct pci_bus *bus) { - struct device *dev = &bus->dev; struct brcm_pcie *pcie = (struct brcm_pcie *) bus->sysdata; int ret; - if (!dev->of_node || !bus->parent || !pci_is_root_bus(bus->parent)) + /* Only busno==1 requires us to linkup */ + if ((int)bus->number != 1) return 0; ret = pci_subdev_regulators_add_bus(bus); - if (ret) + if (ret) { + pcie->refusal_mode = true; return ret; + } /* Grab the regulators for suspend/resume */ pcie->sr = bus->dev.driver_data;