From: Manikanta Maddireddy <mmaddireddy@nvidia.com>
To: Niklas Cassel <cassel@kernel.org>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
"Vidya Sagar" <vidyas@nvidia.com>,
"Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
stable@vger.kernel.org, "Thierry Reding" <treding@nvidia.com>,
linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>
Subject: Re: [PATCH v2 2/3] PCI: tegra194: Reset BARs when running in PCIe endpoint mode
Date: Tue, 10 Feb 2026 09:40:44 +0530 [thread overview]
Message-ID: <94458c39-587b-4bb4-a410-e921e5d99f10@nvidia.com> (raw)
In-Reply-To: <aYonDJyd_dbV0GBK@ryzen>
On 09/02/26 11:57 pm, Niklas Cassel wrote:
> On Sun, Feb 08, 2026 at 11:41:42PM +0530, Manikanta Maddireddy wrote:
>> Hi Niklas,
>>
>> Tegra PCIe exposes only DMA register over BAR4, not iATU.
>> So, the issue described in this commit message is not applicable.
>> This patch is disabling BAR2 and BAR4, after enumeration I see
>> only BAR0. I think we should revert this patch.
>> Please share your inputs on this.
> If you look at this commit, it only disables all BARs by default,
> which brings the tegra driver in-line with all other DWC based
> endpoint drivers: dra7xx, imx6, layerscape-ep, artpec6, dw-rockchip,
> qcom-ep, rcar-gen4, and uniphier-ep.
>
> A PCI endpoint function (EPF) driver will still be able to enable a
> BAR that was disabled in .init().
> However, an EPF driver will not be able to use/enable a reserved BAR.
>
> Look at e.g. the code in pci-epf-test. It will not allocate backing
> memory for a BAR that is reserved, so having a BAR enabled that we
> have not allocated backing memory for is wrong.
>
> Commit c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint
> mode in Tegra194") is the commit that marked all BARs other than
> BAR0 as reserved, so if you want to test BARs other than BAR0,
> talk to the author of that commit.
>
> If you revert this patch, tools/testing/selftests/pci_endpoint/pci_endpoint_test
> will once again fail the consecutive BAR test, so I think it would
> be wrong to revert this patch.
>
> If it is ATU registers or eDMA registers exposed in BAR4 does not
> really matter. The end result is that you overwrite eDMA registers
> that you should not be overwriting when you run the BAR tests.
> (So BAR4 should absolutely be marked as reserved).
>
> I don't recall, but if you overwrite the eDMA registers, then in
> addition to the consecutive BAR test failing, most likely the DMA
> test cases will also fail.
>
> Have you tried running
> tools/testing/selftests/pci_endpoint/pci_endpoint_test
> ?
>
>
> Kind regards,
> Niklas
Hi Niklas,
In Tegra234 PCIe, BAR1 is MSI-X table and BAR2 is DMA registers backed
by PCIe HW RAM and registers. EPF driver shouldn't allocate memory for
these two BARs. This is the reason for marking them as reserved in
Tegra PCIe driver. DMA registers are exposed over BAR2 to allow
PCI client driver in host to transfer data from host to endpoint
using endpoint remote DMA read functionality. BAR test fails on this
because not all register bits are writable. Consider NVMe example
which has RO capability bits at the start of the BAR, it is not correct
to add BAR test on these bits.
I think following fixes are required to address this issue,
1. BAR test in pci_endpoint_test should skip MSI-X table.
2. BAR test in pci_endpoint_test should provide option to
skip this test on known reserved BARs, maybe we can use
pci_endpoint_test_data for this.
3. EPC driver should provide BAR_DISABLED enum to disable
unused BARs.
4. Tegra PCIe driver should disable only BAR_DISABLED bars and
leave BAR_RESERVED untouched.
5. Return NO_BAR for both BAR_DISABLED and BAR_RESERVED in
pci_epc_get_next_free_bar()
Let me know your opinion on this.
next prev parent reply other threads:[~2026-02-10 4:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 14:08 [PATCH v2 0/3] tegra194 PCI endpoint fixes Niklas Cassel
2025-09-22 14:08 ` [PATCH v2 1/3] PCI: tegra194: Fix broken tegra_pcie_ep_raise_msi_irq() Niklas Cassel
2025-09-24 15:54 ` Manivannan Sadhasivam
2025-09-24 16:28 ` Manivannan Sadhasivam
2025-09-25 14:52 ` Niklas Cassel
2025-09-22 14:08 ` [PATCH v2 2/3] PCI: tegra194: Reset BARs when running in PCIe endpoint mode Niklas Cassel
2026-02-08 18:11 ` Manikanta Maddireddy
2026-02-09 18:27 ` Niklas Cassel
2026-02-10 4:10 ` Manikanta Maddireddy [this message]
2026-02-10 10:06 ` Niklas Cassel
2026-02-10 10:39 ` Niklas Cassel
2026-02-12 12:10 ` Aksh Garg
2026-02-12 12:20 ` Niklas Cassel
2026-02-12 13:46 ` Aksh Garg
[not found] ` <c8e42e96-212f-451d-802b-7166611f6fcd@nvidia.com>
2026-02-10 11:04 ` Niklas Cassel
2026-02-08 18:21 ` Manikanta Maddireddy
2025-09-22 14:08 ` [PATCH v2 3/3] PCI: tegra194: Handle errors in BPMP response Niklas Cassel
2025-09-24 16:27 ` [PATCH v2 0/3] tegra194 PCI endpoint fixes Manivannan Sadhasivam
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=94458c39-587b-4bb4-a410-e921e5d99f10@nvidia.com \
--to=mmaddireddy@nvidia.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kwilczynski@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=stable@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=treding@nvidia.com \
--cc=vidyas@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox