From patchwork Fri Mar 31 15:06:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9656569 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 161B760349 for ; Fri, 31 Mar 2017 15:07:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 092D32621D for ; Fri, 31 Mar 2017 15:07:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1C9526E39; Fri, 31 Mar 2017 15:07:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6773C2621D for ; Fri, 31 Mar 2017 15:07:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933040AbdCaPHL (ORCPT ); Fri, 31 Mar 2017 11:07:11 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:33383 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933017AbdCaPHK (ORCPT ); Fri, 31 Mar 2017 11:07:10 -0400 Received: by mail-lf0-f47.google.com with SMTP id h125so45694146lfe.0 for ; Fri, 31 Mar 2017 08:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=WCDee2ojDE0s3faDNzSvI+yTfiWTj0FB9WOQx0NbLHc=; b=NGwY1SJIw072Gg+abjEJ+prUNswNUR5Qi75RyX25wOezTn2CXyPVSj/bDWn1+oPhB1 C9YrorMjrnC89eaUQRaLf5zdHDF4ff4V8XUFxnNQv9rh9iAsibkWRz8KNK06QiU6ete9 6hkJnMDHOEKTvj39kef0EJ3nAQSVjJlVQ5RLHuqU18lI0qj6FiIn6lUG0uHf/kO/WIF8 OsH679+4wHiu1482CS+nVNn5/yF+/e82ad8EYYRk9lBe/PxdQpt7A0UTaqPZTL6Y0Pgn cf4/zjAc2FRBpgETZzZBP9Hdv2l11sztF6REhqRyT+aBnJtIQNsw6NLi2SbbMa99l0L1 gCCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WCDee2ojDE0s3faDNzSvI+yTfiWTj0FB9WOQx0NbLHc=; b=hxakgPxRy7QEG+YdwcD1KAaV6Pwem3bFZf+0+wZPPmCT4on2wLnfwxW7XFio5QKGZ0 S64c3EcaY39ncGawPCtNLh4kwNpNlTlOcd9siOD4eQVSp2x7VxSA+086XePXarhk9K8s GhL4gFQaQS28QSCj9Lg3SokK1uo7IZiZ60T4BQSH+RKg4ExglWj44dLw2Isy/zjVWsnV nGSpijcB4ixGPmSxCubNeT6EN/5NKHnAdQS7seU9VEW5Ra7dqxLYMZTuM6U5XzbjfFoV ovmnWNBFiUMBWLN8xKNqNkaKguwWZ3Vpx/0Ig1YtcDMpfnAohjv9/AV4rLOwmAc5jrLM uAtQ== X-Gm-Message-State: AFeK/H1vbpwhheDvy4c5d4DmK5XMWeiFe2P1ZD13vT0gq+WpZtghOQkGXuVfHhtJZiW8kQ== X-Received: by 10.46.84.76 with SMTP id y12mr1200056ljd.126.1490972827947; Fri, 31 Mar 2017 08:07:07 -0700 (PDT) Received: from tn-desktop.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id e13sm976522lfb.14.2017.03.31.08.07.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Mar 2017 08:07:07 -0700 (PDT) From: Tomasz Nowicki To: helgaas@kernel.org, Lorenzo.Pieralisi@arm.com, robert.richter@caviumnetworks.com, ddaney@caviumnetworks.com, Vadim.Lomovtsev@caviumnetworks.com, rafael@kernel.org Cc: Sunil.Goutham@cavium.com, geethasowjanya.akula@gmail.com, linu.cherian@cavium.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, Tomasz Nowicki Subject: [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case Date: Fri, 31 Mar 2017 17:06:44 +0200 Message-Id: <1490972804-25830-1-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SZ_16M PEM resource size includes PEM-specific register and its children resources. Reservation of the whole SZ_16M range leads to child device driver failure when pcieport driver is requesting resources: pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed So we cannot reserve full 16M here and instead we want to reserve PEM-specific register only which is SZ_64K. At the end increase PEM resource to SZ_16M since this is what thunder_pem_init() call expects for proper initialization. Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller") Signed-off-by: Tomasz Nowicki CC: stable@vger.kernel.org # v4.10+ --- drivers/pci/host/pci-thunder-pem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c index b89c373..6e031b5 100644 --- a/drivers/pci/host/pci-thunder-pem.c +++ b/drivers/pci/host/pci-thunder-pem.c @@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root, index -= node * PEM_MAX_DOM_IN_NODE; res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) | FIELD_PREP(PEM_INDX_MASK, index); - res_pem->end = res_pem->start + SZ_16M - 1; res_pem->flags = IORESOURCE_MEM; } @@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg) */ if (ret) { thunder_pem_legacy_fw(root, res_pem); - /* Reserve PEM-specific resources and PCI configuration space */ + /* + * Reserve 64K size PEM specific resources. The full 16M range + * size is required for thunder_pem_init() call. + */ + res_pem->end = res_pem->start + SZ_64K - 1; thunder_pem_reserve_range(dev, root->segment, res_pem); + res_pem->end = res_pem->start + SZ_16M - 1; + + /* Reserve PCI configuration space as well. */ thunder_pem_reserve_range(dev, root->segment, &cfg->res); }