linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] patches for FPGA
@ 2018-11-07 17:51 Alan Tull
  2018-11-07 17:51 ` [PATCH 1/4] fpga: altera-cvp: fix 'bad IO access' on x86_64 Alan Tull
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Alan Tull @ 2018-11-07 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Moritz Fischer, Alan Tull, linux-kernel, linux-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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] fpga: altera-cvp: fix 'bad IO access' on x86_64
  2018-11-07 17:51 [PATCH 0/4] patches for FPGA Alan Tull
@ 2018-11-07 17:51 ` Alan Tull
  2018-11-07 17:51 ` [PATCH 2/4] fpga: dfl: fme: remove set but not used variable 'priv' Alan Tull
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alan Tull @ 2018-11-07 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Moritz Fischer, Alan Tull, linux-kernel, linux-fpga, Anatolij Gustschin

From: Anatolij Gustschin <agust@denx.de>

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.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Alan Tull <atull@kernel.org>
---
 drivers/fpga/altera-cvp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index 610a155..144fa2a 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] fpga: dfl: fme: remove set but not used variable 'priv'
  2018-11-07 17:51 [PATCH 0/4] patches for FPGA Alan Tull
  2018-11-07 17:51 ` [PATCH 1/4] fpga: altera-cvp: fix 'bad IO access' on x86_64 Alan Tull
@ 2018-11-07 17:51 ` Alan Tull
  2018-11-07 17:51 ` [PATCH 3/4] fpga: altera-cvp: Fix registration for CvP incapable devices Alan Tull
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alan Tull @ 2018-11-07 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Moritz Fischer, Alan Tull, linux-kernel, linux-fpga, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

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]

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Moritz Fischer <mdf@kernel.org>
Acked-by: Wu Hao <hao.wu@intel.com>
Acked-by: Alan Tull <atull@kernel.org>
---
 drivers/fpga/dfl-fme-pr.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/fpga/dfl-fme-pr.c b/drivers/fpga/dfl-fme-pr.c
index 0b84053..fe5a557 100644
--- a/drivers/fpga/dfl-fme-pr.c
+++ b/drivers/fpga/dfl-fme-pr.c
@@ -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);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] fpga: altera-cvp: Fix registration for CvP incapable devices
  2018-11-07 17:51 [PATCH 0/4] patches for FPGA Alan Tull
  2018-11-07 17:51 ` [PATCH 1/4] fpga: altera-cvp: fix 'bad IO access' on x86_64 Alan Tull
  2018-11-07 17:51 ` [PATCH 2/4] fpga: dfl: fme: remove set but not used variable 'priv' Alan Tull
@ 2018-11-07 17:51 ` Alan Tull
  2018-11-07 17:51 ` [PATCH 4/4] zynq-fpga: Only route PR via PCAP when required Alan Tull
  2018-11-12  7:59 ` [PATCH 0/4] patches for FPGA Eric Schwarz
  4 siblings, 0 replies; 6+ messages in thread
From: Alan Tull @ 2018-11-07 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Moritz Fischer, Alan Tull, linux-kernel, linux-fpga,
	Andreas Puhm, Anatolij Gustschin

From: Andreas Puhm <puhm@oregano.at>

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")
Signed-off-by: Andreas Puhm <puhm@oregano.at>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Acked-by: Alan Tull <atull@kernel.org>
---
 drivers/fpga/altera-cvp.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index 144fa2a..7395085 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] zynq-fpga: Only route PR via PCAP when required
  2018-11-07 17:51 [PATCH 0/4] patches for FPGA Alan Tull
                   ` (2 preceding siblings ...)
  2018-11-07 17:51 ` [PATCH 3/4] fpga: altera-cvp: Fix registration for CvP incapable devices Alan Tull
@ 2018-11-07 17:51 ` Alan Tull
  2018-11-12  7:59 ` [PATCH 0/4] patches for FPGA Eric Schwarz
  4 siblings, 0 replies; 6+ messages in thread
From: Alan Tull @ 2018-11-07 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Moritz Fischer, Alan Tull, linux-kernel, linux-fpga, Mike Looijmans

From: Mike Looijmans <mike.looijmans@topic.nl>

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.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Acked-by: Alan Tull <atull@kernel.org>
---
 drivers/fpga/zynq-fpga.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
index bb82efe..57b0e67 100644
--- a/drivers/fpga/zynq-fpga.c
+++ b/drivers/fpga/zynq-fpga.c
@@ -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,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] patches for FPGA
  2018-11-07 17:51 [PATCH 0/4] patches for FPGA Alan Tull
                   ` (3 preceding siblings ...)
  2018-11-07 17:51 ` [PATCH 4/4] zynq-fpga: Only route PR via PCAP when required Alan Tull
@ 2018-11-12  7:59 ` Eric Schwarz
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Schwarz @ 2018-11-12  7:59 UTC (permalink / raw)
  To: Alan Tull; +Cc: Greg Kroah-Hartman, Moritz Fischer, linux-kernel, linux-fpga

Hello Alan,

Am 07.11.2018 18:51, schrieb Alan Tull:

> 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(-)

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

Best regards
Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-12  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 17:51 [PATCH 0/4] patches for FPGA Alan Tull
2018-11-07 17:51 ` [PATCH 1/4] fpga: altera-cvp: fix 'bad IO access' on x86_64 Alan Tull
2018-11-07 17:51 ` [PATCH 2/4] fpga: dfl: fme: remove set but not used variable 'priv' Alan Tull
2018-11-07 17:51 ` [PATCH 3/4] fpga: altera-cvp: Fix registration for CvP incapable devices Alan Tull
2018-11-07 17:51 ` [PATCH 4/4] zynq-fpga: Only route PR via PCAP when required Alan Tull
2018-11-12  7:59 ` [PATCH 0/4] patches for FPGA Eric Schwarz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).