All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Pavel Machek <pavel@denx.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: [cip-dev] [PATCH 4.19.y-cip 21/26] PCI: endpoint: Clear BAR before freeing its space
Date: Tue, 20 Oct 2020 15:57:27 +0100	[thread overview]
Message-ID: <20201020145732.30343-22-prabhakar.mahadev-lad.rj@bp.renesas.com> (raw)
In-Reply-To: <20201020145732.30343-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

From: Alan Mikhak <alan.mikhak@sifive.com>

commit dbb7bbcc8ad248b1ab05bd27dfdb587ef4023dab upstream.

Associated pci_epf_bar structure is needed in pci_epc_clear_bar() to
clear a BAR correctly but it is reset in pci_epf_free_space() (that
is called first) which results in pci_epc_clear_bar() failure.

Reorder the pci_epc_clear_bar()/pci_epf_free_space() calls execution
to fix the issue.

Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
[lorenzo.pieralisi@arm.com: reworded the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index e8bcc924dbf8..1cfe3687a211 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -381,8 +381,8 @@ static void pci_epf_test_unbind(struct pci_epf *epf)
 		epf_bar = &epf->bar[bar];
 
 		if (epf_test->reg[bar]) {
-			pci_epf_free_space(epf, epf_test->reg[bar], bar);
 			pci_epc_clear_bar(epc, epf->func_no, epf_bar);
+			pci_epf_free_space(epf, epf_test->reg[bar], bar);
 		}
 	}
 }
-- 
2.17.1


[-- Attachment #2: Type: text/plain, Size: 420 bytes --]


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5618): https://lists.cip-project.org/g/cip-dev/message/5618
Mute This Topic: https://lists.cip-project.org/mt/77683538/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-


  parent reply	other threads:[~2020-10-20 14:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 14:57 [cip-dev] [PATCH 4.19.y-cip 00/26] Fixes and extension to PCIe EPF Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 01/26] PCI: endpoint: Add new pci_epc_ops to get EPC features Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 02/26] PCI: dwc: Add ->get_features() callback function to dw_pcie_ep_ops Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 03/26] PCI: designware-plat: Populate ->get_features() dw_pcie_ep_ops Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 04/26] PCI: pci-dra7xx: " Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 05/26] PCI: rockchip: " Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 06/26] PCI: cadence: Populate ->get_features() cdns_pcie_epc_ops Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 07/26] PCI: endpoint: Add helper to get first unreserved BAR Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 08/26] PCI: endpoint: Fix pci_epf_alloc_space() to set correct MEM TYPE flags Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 09/26] PCI: pci-epf-test: Remove setting epf_bar flags in function driver Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 10/26] PCI: pci-epf-test: Do not allocate next BARs memory if current BAR is 64Bit Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 11/26] PCI: pci-epf-test: Use pci_epc_get_features() to get EPC features Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 12/26] PCI: cadence: Remove pci_epf_linkup() from Cadence EP driver Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 13/26] PCI: rockchip: Remove pci_epf_linkup() from Rockchip " Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 14/26] PCI: designware-plat: Remove setting epc->features in Designware plat " Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 15/26] PCI: endpoint: Remove features member in struct pci_epc Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 16/26] PCI: endpoint: Fix a potential NULL pointer dereference Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 17/26] PCI: endpoint: Add support to specify alignment for buffers allocated to BARs Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 18/26] PCI: endpoint: Set endpoint controller pointer to NULL Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 19/26] PCI: endpoint: Allocate enough space for fixed size BAR Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 20/26] PCI: endpoint: Skip odd BAR when skipping 64bit BAR Lad Prabhakar
2020-10-20 14:57 ` Lad Prabhakar [this message]
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 22/26] PCI: endpoint: Cast the page number to phys_addr_t Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 23/26] PCI: endpoint: Fix clearing start entry in configfs Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 24/26] PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get correct MSI-X table address Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 25/26] tools: PCI: Exit with error code when test fails Lad Prabhakar
2020-10-20 14:57 ` [cip-dev] [PATCH 4.19.y-cip 26/26] tools: PCI: Fix fd leakage Lad Prabhakar
2020-10-20 20:40 ` [cip-dev] [PATCH 4.19.y-cip 00/26] Fixes and extension to PCIe EPF Pavel Machek
2020-10-20 21:34   ` Lad Prabhakar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201020145732.30343-22-prabhakar.mahadev-lad.rj@bp.renesas.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.