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: 9656571 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 2666C60349 for ; Fri, 31 Mar 2017 15:07:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 198832621D for ; Fri, 31 Mar 2017 15:07:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E09F26E39; Fri, 31 Mar 2017 15:07:17 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 D5D6C2621D for ; Fri, 31 Mar 2017 15:07:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933017AbdCaPHP (ORCPT ); Fri, 31 Mar 2017 11:07:15 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:34785 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932934AbdCaPHP (ORCPT ); Fri, 31 Mar 2017 11:07:15 -0400 Received: by mail-lf0-f48.google.com with SMTP id z15so45785855lfd.1 for ; Fri, 31 Mar 2017 08:07:14 -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=Xuqb+EZqa+gtshskphpe874FapZknCtg94ZA8UW+ZQXne7RLRKaKuizWIlRggSxBlD O046llWuiwEssXB4sEwdneDc5wXntiWevPFNEXIoBy+LrVf1DLkLppMtu3lv+H7y2c1k 4hgCGJX0K1bJz2tFUDv7MyPRh5uqk9J4UAEq3nne0h3ZnlxkzfvnkTXUgu7tCF0w6Ww8 gDqx4VVzjFFKPwalCq+vdUJA111zdV9JrGCXSRyZz7lVsx5qBHtlhGq1ghUl8QViasfy fr46ZknW+j0JvJCmPo4Pjpw22RRgnTF/L0mAzqTH6Qxp1YfEfMLmhAi9C1FQWqRL6QdN cwHQ== X-Gm-Message-State: AFeK/H1wgg+T7ASnqOgR7+Z7K2tXcQ2E+71rad6ERPp+rHX2KbSp8W6tY/JJnSZBL7o97g== 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-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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); }