PCI: endpoint: Drop only_64bit on reserved BARs
authorNiklas Cassel <cassel@kernel.org>
Fri, 16 Feb 2024 13:45:15 +0000 (14:45 +0100)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Fri, 16 Feb 2024 15:01:10 +0000 (20:31 +0530)
The definition of a reserved BAR is that EPF drivers should not touch
them.

The definition of only_64bit is that the EPF driver must configure this
BAR as 64-bit. (An EPF driver is not allowed to choose if this BAR should
be configured as 32-bit or 64-bit.)

Thus, it does not make sense to put only_64bit of a BAR that EPF drivers
are not allow to touch.

Drop the only_64bit property from hardware descriptions that are of type
reserved BAR.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Kishon Vijay Abraham I <kishon@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240216134524.1142149-3-cassel@kernel.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/controller/dwc/pci-keystone.c
drivers/pci/controller/dwc/pcie-uniphier-ep.c
drivers/pci/endpoint/pci-epc-core.c
include/linux/pci-epc.h

index b2b93b4fa82d59186876871b576d8cdc0ab7ba25..844de441872429b230c9c5ccf594c38e684f7147 100644 (file)
@@ -924,7 +924,7 @@ static const struct pci_epc_features ks_pcie_am654_epc_features = {
        .linkup_notifier = false,
        .msi_capable = true,
        .msix_capable = true,
-       .bar[BAR_0] = { .type = BAR_RESERVED, .only_64bit = true, },
+       .bar[BAR_0] = { .type = BAR_RESERVED, },
        .bar[BAR_1] = { .type = BAR_RESERVED, },
        .bar[BAR_2] = { .type = BAR_FIXED, .fixed_size = SZ_1M, },
        .bar[BAR_3] = { .type = BAR_FIXED, .fixed_size = SZ_64K, },
index 265f65fc673f006a04d3b8c26e1aaf07396f008d..639bc2e12476f5dd92eb60309a2789bfe990b086 100644 (file)
@@ -415,7 +415,7 @@ static const struct uniphier_pcie_ep_soc_data uniphier_pro5_data = {
                .bar[BAR_1] = { .type = BAR_RESERVED, },
                .bar[BAR_2] = { .only_64bit = true, },
                .bar[BAR_3] = { .type = BAR_RESERVED, },
-               .bar[BAR_4] = { .type = BAR_RESERVED, .only_64bit = true, },
+               .bar[BAR_4] = { .type = BAR_RESERVED, },
                .bar[BAR_5] = { .type = BAR_RESERVED, },
        },
 };
index 7fe8f4336765771743b5da3e75e18c49516ddfe2..da3fc0795b0b620c06c39fe9304eb84857c6c0ca 100644 (file)
@@ -120,13 +120,6 @@ enum pci_barno pci_epc_get_next_free_bar(const struct pci_epc_features
                /* If the BAR is not reserved, return it. */
                if (epc_features->bar[i].type != BAR_RESERVED)
                        return i;
-
-               /*
-                * If the BAR is reserved, and marked as 64-bit only, then the
-                * succeeding BAR is also reserved.
-                */
-               if (epc_features->bar[i].only_64bit)
-                       i++;
        }
 
        return NO_BAR;
index 4ccb4f4f3883c6431c9ec6171e20bb93146ade19..cc2f70d061c83b551af24c866312147a09cdf820 100644 (file)
@@ -164,6 +164,11 @@ enum pci_epc_bar_type {
  *             should be configured as 32-bit or 64-bit, the EPF driver must
  *             configure this BAR as 64-bit. Additionally, the BAR succeeding
  *             this BAR must be set to type BAR_RESERVED.
+ *
+ *             only_64bit should not be set on a BAR of type BAR_RESERVED.
+ *             (If BARx is a 64-bit BAR that an EPF driver is not allowed to
+ *             touch, then both BARx and BARx+1 must be set to type
+ *             BAR_RESERVED.)
  */
 struct pci_epc_bar_desc {
        enum pci_epc_bar_type type;