From patchwork Mon Jan 7 06:41:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 10750005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6824D1399 for ; Mon, 7 Jan 2019 06:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 567052885E for ; Mon, 7 Jan 2019 06:45:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A0992888C; Mon, 7 Jan 2019 06:45:34 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E0C0C2885E for ; Mon, 7 Jan 2019 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ThL/4kSOjCi2IifOQoRrPJuSvD3pgkfKS+Fg5R/jSRY=; b=h5jBisXZM5eZT7 IyhN0R0X4BVs/eMg9Ry21EgIcrxUv7UMQnutXK76fbg6giKujyxsfOJOYe3IAHWHOqWXKlnvNFnlI g8K6XvZvWCHdEWP4Li9buTknrZfqPgeKu94Yzt3RsEipazr/LTOHkmPehNrijzBxLTCP+twczrxyK No4i3887Scgs3rnbE3fRgmbdUCIW1gXAmllQHCV1Eu48PS7pG7JH8Mxj2RQl1AhLZDJl/Y4Q1a5n4 TUSTYkykCP1Mf4Z55xbKwCnKSxQQYhg9Y+KDqquSdNP7vxVlmTcifW6MR+2FIWRyAtOfoq8/i/mD3 1qQS/63BhHtQNgINbvQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggOfB-0006OY-70; Mon, 07 Jan 2019 06:45:29 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggOdc-0003VK-TQ; Mon, 07 Jan 2019 06:43:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9uy7oBAgopBKXmOWf1Xu6i0EmqFED+atLS7+JVzPan8=; b=O3yOTelT/n0L3PSy5AB6MHD7t gj8sbvjgPua2Bk42NKoMJCkVaC3+mjB3/A7g330Zkb0mrbsVpnrwRMk8bWAkw2nhXDjy9xdOGgYza aV2abwsdj/7lfeKPgsOOZVrtEu167srGsxAhCpS8B9JOA+1X1+biLm8M/ka18PL5FjZSDcHuEeZt8 8GwEhR1wNPS+Bo10WBwPx7nkM0OAP5w2QikFWfxCni9c+lSJaLvDSkKJAJm2PQG/ZzWjCJvYywxvg ZQgZBdzovkB+o+yLyZOEtPnI8lW9+fYdjeIWbf+Uh452URkUqW9+J7YPgsLHU872EiwmJUu59UwKf 0G0yfey8Q==; Received: from fllv0015.ext.ti.com ([198.47.19.141]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggOdZ-0002Au-Pk; Mon, 07 Jan 2019 06:43:50 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x076hUCk059031; Mon, 7 Jan 2019 00:43:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1546843410; bh=9uy7oBAgopBKXmOWf1Xu6i0EmqFED+atLS7+JVzPan8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JYWkdfNv1+e1GG3acZ9gMSouaODqZz61M0RplwA1XRHpoOBXPR+m2NpGK9wh60yN/ I0S5fdtEZQlaB57gc9lWAtGb1YXw29A6O3MtjBhw7qA0gJQMB7tbjnpIjdV9cMheao YPIgPv+ma6VzsGONL3s77GSYs5s1rnFmemOjiEwU= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x076hUZE038637 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 7 Jan 2019 00:43:30 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 7 Jan 2019 00:43:30 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 7 Jan 2019 00:43:30 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x076gfo7002672; Mon, 7 Jan 2019 00:43:26 -0600 From: Kishon Vijay Abraham I To: Lorenzo Pieralisi , Bjorn Helgaas , Gustavo Pimentel , Alan Douglas , Shawn Lin Subject: [PATCH 10/15] PCI: pci-epf-test: Do not allocate next BARs memory if current BAR is 64Bit Date: Mon, 7 Jan 2019 12:11:43 +0530 Message-ID: <20190107064148.10152-11-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190107064148.10152-1-kishon@ti.com> References: <20190107064148.10152-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190107_014349_946190_03ABA250 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Jingoo Han , linux-kernel@vger.kernel.org, kishon@ti.com, linux-rockchip@lists.infradead.org, Jia-Ju Bai , Cyrille Pitchen , linux-pci@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP It's useless to allocate memory for next BAR if the current BAR is a 64Bit BAR. Stop allocating memory for the next BAR, if the current BARs flag indicates this is a 64Bit BAR. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 44cc31343a80..ade296180383 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -429,6 +429,7 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) { struct pci_epf_test *epf_test = epf_get_drvdata(epf); struct device *dev = &epf->dev; + struct pci_epf_bar *epf_bar; void *base; int bar; enum pci_barno test_reg_bar = epf_test->test_reg_bar; @@ -442,6 +443,7 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) epf_test->reg[test_reg_bar] = base; for (bar = BAR_0; bar <= BAR_5; bar++) { + epf_bar = &epf->bar[bar]; if (bar == test_reg_bar) continue; base = pci_epf_alloc_space(epf, bar_size[bar], bar); @@ -449,6 +451,8 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) dev_err(dev, "Failed to allocate space for BAR%d\n", bar); epf_test->reg[bar] = base; + if (epf_bar->flags & PCI_BASE_ADDRESS_MEM_TYPE_64) + bar++; } return 0;