RE: [PATCH v4] PCI: endpoint: Add prefetch BAR support

From: Shradha Todi
Date: Thu Feb 29 2024 - 02:38:21 EST


Reviewed-by: Shradha Todi <shradha.t@xxxxxxxxxxx>

This patch looks useful. Can we revisit this and get it merged?

>Date: Fri, 21 Jan 2022 12:12:56 +0800
>From: Li Chen <lchen.firstlove@xxxxxxxxxxxx>
>To: "Bjorn Helgaas" <helgaas@xxxxxxxxxx>
>Cc: "Kishon Vijay Abraham I" <kishon@xxxxxx>,
> "Lorenzo Pieralisi" <lorenzo.pieralisi@xxxxxxx>,
> "Bjorn Helgaas" <bhelgaas@xxxxxxxxxx>,
> "linux-pci" <linux-pci@xxxxxxxxxxxxxxx>,
> "linux-kernel" <linux-kernel@xxxxxxxxxxxxxxx>
>Message-ID: <17e7ad65ff5.d9de88b4962.1109678039880040918@xxxxxxxxxxxx>
>In-Reply-To:
>Subject: [PATCH v4] PCI: endpoint: Add prefetch BAR support
>MIME-Version: 1.0
>Content-Type: text/plain; charset="UTF-8"
>Content-Transfer-Encoding: 7bit
>Importance: Medium
>User-Agent: Zoho Mail
>X-Mailer: Zoho Mail
>Precedence: bulk
>List-ID: <linux-pci.vger.kernel.org>
>X-Mailing-List: linux-pci@xxxxxxxxxxxxxxx
>
>From: Li Chen <lchen@xxxxxxxxxxxxx>
>
>Before this commit, epf cannot set BAR to be prefetchable.
>Prefetchable BAR can also help epf device to use bridge's
>prefetch memory window.
>
>Signed-off-by: Li Chen <lchen@xxxxxxxxxxxxx>
>---
>Changes in v2:
>Remove Gerrit Change-id
>Changes in v3:
>capitalize "BAR" in the subject and commit log as suggested by Bjorn.
>Changes in v4:
>This patch context doesn't change but resend with my Zoho mail account in that previous
>company mail will contain un-removeable proprietary messages.
>Add "From:" to the first line of the message body.
>
> drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++
> include/linux/pci-epc.h | 2 ++
> 2 files changed, 6 insertions(+)
>
>diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
>index 90d84d3bc868..96489cfdf58d 100644
>--- a/drivers/pci/endpoint/functions/pci-epf-test.c
>+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
>@@ -817,15 +817,19 @@ static void pci_epf_configure_bar(struct pci_epf *epf,
> {
> struct pci_epf_bar *epf_bar;
> bool bar_fixed_64bit;
>+ bool bar_prefetch;
> int i;
>
> for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> epf_bar = &epf->bar[i];
> bar_fixed_64bit = !!(epc_features->bar_fixed_64bit & (1 << i));
>+ bar_prefetch = !!(epc_features->bar_prefetch & (1 << i));
> if (bar_fixed_64bit)
> epf_bar->flags |= PCI_BASE_ADDRESS_MEM_TYPE_64;
> if (epc_features->bar_fixed_size[i])
> bar_size[i] = epc_features->bar_fixed_size[i];
>+ if (bar_prefetch)
>+ epf_bar->flags |= PCI_BASE_ADDRESS_MEM_PREFETCH;
> }
> }
>
>diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
>index a48778e1a4ee..825632d581d0 100644
>--- a/include/linux/pci-epc.h
>+++ b/include/linux/pci-epc.h
>@@ -161,6 +161,7 @@ struct pci_epc {
> * @msix_capable: indicate if the endpoint function has MSI-X capability
> * @reserved_bar: bitmap to indicate reserved BAR unavailable to function driver
> * @bar_fixed_64bit: bitmap to indicate fixed 64bit BARs
>+ * @bar_prefetch: bitmap to indicate prefetchable BARs
> * @bar_fixed_size: Array specifying the size supported by each BAR
> * @align: alignment size required for BAR buffer allocation
> */
>@@ -171,6 +172,7 @@ struct pci_epc_features {
> unsigned int msix_capable : 1;
> u8 reserved_bar;
> u8 bar_fixed_64bit;
>+ u8 bar_prefetch;
> u64 bar_fixed_size[PCI_STD_NUM_BARS];
> size_t align;
> };
>--
>2.34.1
>
>
>