Skip to contentSkip to conversation

patches for FPGA

PATCH In review Alan Tull 2 participants 6 messages Nov 7, 2018 – Nov 12, 2018

Subsystems (3)
lore
Share & tools
lore

Alan Tull

author
#0 lore raw

cover patches for FPGA

Hi Greg,

Please take these four small fpga fixes patches. They have been reviewed on the mailing list and apply cleanly on current linux-next and char-misc-testing.

Thanks,
Alan

Anatolij Gustschin (1):
fpga: altera-cvp: fix 'bad IO access' on x86_64

Andreas Puhm (1):
fpga: altera-cvp: Fix registration for CvP incapable devices

Mike Looijmans (1):
zynq-fpga: Only route PR via PCAP when required

YueHaibing (1):
fpga: dfl: fme: remove set but not used variable 'priv'

 drivers/fpga/altera-cvp.c | 15 +++++++++++++--
 drivers/fpga/dfl-fme-pr.c |  2 --
 drivers/fpga/zynq-fpga.c  |  4 ++++
 3 files changed, 17 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/4 fpga: altera-cvp: fix 'bad IO access' on x86_64

From: Anatolij Gustschin <[email protected]>

If mapping the CvP BAR fails, we still can configure the FPGA via PCI config space access. In this case the iomap pointer is NULL. On x86_64, passing NULL address to pci_iounmap() generates "Bad IO access at port 0x0" output with stack call trace. Fix it.

---
 drivers/fpga/altera-cvp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/fpga/altera-cvp.c +4 -2
index 610a155..144fa2a 100644
@@ -477,7 +477,8 @@ static int altera_cvp_probe(struct pci_dev *pdev,
 	return 0;
 
 err_unmap:
-	pci_iounmap(pdev, conf->map);
+	if (conf->map)
+		pci_iounmap(pdev, conf->map);
 	pci_release_region(pdev, CVP_BAR);
 err_disable:
 	cmd &= ~PCI_COMMAND_MEMORY;
@@ -493,7 +494,8 @@ static void altera_cvp_remove(struct pci_dev *pdev)
 
 	driver_remove_file(&altera_cvp_driver.driver, &driver_attr_chkcfg);
 	fpga_mgr_unregister(mgr);
-	pci_iounmap(pdev, conf->map);
+	if (conf->map)
+		pci_iounmap(pdev, conf->map);
 	pci_release_region(pdev, CVP_BAR);
 	pci_read_config_word(pdev, PCI_COMMAND, &cmd);
 	cmd &= ~PCI_COMMAND_MEMORY;
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/4 fpga: dfl: fme: remove set but not used variable 'priv'

In reply to Alan Tull

From: YueHaibing <[email protected]>

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/fpga/dfl-fme-pr.c: In function 'pr_mgmt_uinit':
drivers/fpga/dfl-fme-pr.c:447:18: warning:
variable 'priv' set but not used [-Wunused-but-set-variable]

---
 drivers/fpga/dfl-fme-pr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/fpga/dfl-fme-pr.c +0 -2
index 0b84053..fe5a557 100644
@@ -444,10 +444,8 @@ static void pr_mgmt_uinit(struct platform_device *pdev,
 			  struct dfl_feature *feature)
 {
 	struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
-	struct dfl_fme *priv;
 
 	mutex_lock(&pdata->lock);
-	priv = dfl_fpga_pdata_get_private(pdata);
 
 	dfl_fme_destroy_regions(pdata);
 	dfl_fme_destroy_bridges(pdata);
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH 3/4 fpga: altera-cvp: Fix registration for CvP incapable devices

In reply to Alan Tull

From: Andreas Puhm <[email protected]>

The probe function needs to verify the CvP enable bit in order to properly determine if FPGA Manager functionality can be safely enabled.

Fixes 34d1dc17ce97 ("fpga manager: Add Altera CvP driver")
---
 drivers/fpga/altera-cvp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/fpga/altera-cvp.c +9 -0
index 144fa2a..7395085 100644
@@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,
 	struct altera_cvp_conf *conf;
 	struct fpga_manager *mgr;
 	u16 cmd, val;
+	u32 regval;
 	int ret;
 
 	/*
@@ -416,6 +417,14 @@ static int altera_cvp_probe(struct pci_dev *pdev,
 		return -ENODEV;
 	}
 
+	pci_read_config_dword(pdev, VSE_CVP_STATUS, &regval);
+	if (!(regval & VSE_CVP_STATUS_CVP_EN)) {
+		dev_err(&pdev->dev,
+			"CVP is disabled for this device: CVP_STATUS Reg 0x%x\n",
+			regval);
+		return -ENODEV;
+	}
+
 	conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL);
 	if (!conf)
 		return -ENOMEM;
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH 4/4 zynq-fpga: Only route PR via PCAP when required

In reply to Alan Tull

From: Mike Looijmans <[email protected]>

The Xilinx Zynq FPGA driver takes ownership of the PR interface, making it impossible to use the ICAP interface for partial reconfiguration.

This patch changes the driver to only activate PR over PCAP while the device is actively being accessed by the driver for programming.

This allows both PCAP and ICAP interfaces to be used for PR.

---
 drivers/fpga/zynq-fpga.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/fpga/zynq-fpga.c +4 -0
index bb82efe..57b0e67 100644
@@ -501,6 +501,10 @@ static int zynq_fpga_ops_write_complete(struct fpga_manager *mgr,
 	if (err)
 		return err;
 
+	/* Release 'PR' control back to the ICAP */
+	zynq_fpga_write(priv, CTRL_OFFSET,
+		zynq_fpga_read(priv, CTRL_OFFSET) & ~CTRL_PCAP_PR_MASK);
+
 	err = zynq_fpga_poll_timeout(priv, INT_STS_OFFSET, intr_status,
 				     intr_status & IXR_PCFG_DONE_MASK,
 				     INIT_POLL_DELAY,
Signature · 1 line
2.7.4
#5 lore raw
In reply to Alan Tull

Hello Alan,

Am 07.11.2018 18:51, schrieb Alan Tull:

Quoted 18 lines

Hi Greg,

Please take these four small fpga fixes patches. They have been reviewed on the mailing list and apply cleanly on current linux-next and char-misc-testing.

Thanks,
Alan

Anatolij Gustschin (1):
fpga: altera-cvp: fix 'bad IO access' on x86_64

Andreas Puhm (1):
fpga: altera-cvp: Fix registration for CvP incapable devices

Mike Looijmans (1):
zynq-fpga: Only route PR via PCAP when required

Quoted 7 lines

YueHaibing (1):
fpga: dfl: fme: remove set but not used variable 'priv'

drivers/fpga/altera-cvp.c | 15 +++++++++++++--
drivers/fpga/dfl-fme-pr.c |  2 --
drivers/fpga/zynq-fpga.c  |  4 ++++
3 files changed, 17 insertions(+), 4 deletions(-)

How is the backporting strategy for FPGA manager related bugfixes and drivers?

Best regards
Eric