Re: [PATCH v1] PCI: endpoint: Skip upper halves of 64-bit BARs during search
From: Niklas Cassel
Date: Wed Oct 21 2026 - 06:51:41 EST
On Wed, Oct 21, 2026 at 01:36:44PM +0530, Manikanta Maddireddy wrote:
> pci_epc_get_next_free_bar() skips the upper half of a 64-bit BAR only
> when it is the starting BAR. If the search subsequently passes a
> reserved or disabled 64-bit BAR, it can return its upper half as an
> independent BAR because that slot has a default programmable descriptor.
>
> For example, Tegra exposes a programmable 64-bit BAR0 and reserved
> 64-bit BAR2 and BAR4. A search starting at BAR1 skips BAR1 and BAR2,
> then incorrectly returns BAR3. The next search can similarly return
> BAR5, causing the EPF test driver to allocate and program BARs that
> belong to the reserved hardware windows.
The 'only_64bit' property tells an EPF that it can only configure the
BAR as 64-bit.
BARs that are reserved are hidden from an EPF, and can not be programmed
at all, so the 'only_64bit' property does not make sense on reserved BARs.
See:
9266514689fe ("PCI: endpoint: Drop only_64bit on reserved BARs")
At least when I cleanup up all the properties (including tegra) in:
e01c9797c0eb ("PCI: endpoint: Clean up hardware description for BARs")
I made sure that there were no BARs that were marked both reserved and
only_64bit.
This also matches the @only_64bit kdoc in include/linux/pci-epc.h.
I see you changed this in:
12a22fb38cbb ("PCI: tegra194: Expose BAR2 (MSI-X) and BAR4 (DMA) as
64-bit BAR_RESERVED").
I'm fine with this patch, but I think you need to rephrase the kdoc
to reflect this new reality, because currently the kdoc is confusing/
not in line with the 'new' meaning of BAR_RESERVED, which can contain
MSI-X table etc.
(The old BAR_RESERVED was renamed to be BAR_DISABLED, to be more clear.)
Kind regards,
Niklas