Re: [PATCH v1 3/7] fpga: dfl: Allow for ports with no local bar space.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/14/22 3:26 AM, Tianfei zhang wrote:
From: Matthew Gerlach <matthew.gerlach@xxxxxxxxxxxxxxx>

 From a fpga partial reconfiguration standpoint, a port
may not be connected any local BAR space.  The port could
be connected to a different PCIe Physical Function (PF) or
Virtual Function (VF), in which case another driver instance
would manage the endpoint.

It is not clear if this is part of iofs or a bug fix.

Signed-off-by: Matthew Gerlach <matthew.gerlach@xxxxxxxxxxxxxxx>
Signed-off-by: Tianfei Zhang <tianfei.zhang@xxxxxxxxx>
---
  drivers/fpga/dfl-pci.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 4d68719e608f..8abd9b408403 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -243,6 +243,7 @@ static int find_dfls_by_default(struct pci_dev *pcidev,
  		v = readq(base + FME_HDR_CAP);
  		port_num = FIELD_GET(FME_CAP_NUM_PORTS, v);
+ dev_info(&pcidev->dev, "port_num = %d\n", port_num);
  		WARN_ON(port_num > MAX_DFL_FPGA_PORT_NUM);
for (i = 0; i < port_num; i++) {
@@ -258,6 +259,13 @@ static int find_dfls_by_default(struct pci_dev *pcidev,
  			 */
  			bar = FIELD_GET(FME_PORT_OFST_BAR_ID, v);
  			offset = FIELD_GET(FME_PORT_OFST_DFH_OFST, v);
+			if (bar >= PCI_STD_NUM_BARS) {

Is bar set to a better magic number that pci_std_num_bars ? maybe 0xff's

How do you tell between this case and broken hw ?

Move up a line and skip getting an offset that will not be used.

+				dev_info(&pcidev->dev, "skipping port without local BAR space %d\n",
+					 bar);
+				continue;
+			} else {
+				dev_info(&pcidev->dev, "BAR %d offset %u\n", bar, offset);
+			}
  			start = pci_resource_start(pcidev, bar) + offset;
  			len = pci_resource_len(pcidev, bar) - offset;

Is similar logic needed for else-if (port) block below this ?

Tom




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux