2018-11-07 17:53:11

by Alan Tull

[permalink] [raw]
Subject: [PATCH 0/4] 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(-)

--
2.7.4



2018-11-07 17:53:08

by Alan Tull

[permalink] [raw]
Subject: [PATCH 3/4] fpga: altera-cvp: Fix registration for CvP incapable devices

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")
Signed-off-by: Andreas Puhm <[email protected]>
Signed-off-by: Anatolij Gustschin <[email protected]>
Reviewed-by: Moritz Fischer <[email protected]>
Acked-by: Alan Tull <[email protected]>
---
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


2018-11-07 17:53:12

by Alan Tull

[permalink] [raw]
Subject: [PATCH 4/4] zynq-fpga: Only route PR via PCAP when required

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.

Signed-off-by: Mike Looijmans <[email protected]>
Reviewed-by: Moritz Fischer <[email protected]>
Acked-by: Alan Tull <[email protected]>
---
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


2018-11-07 17:54:22

by Alan Tull

[permalink] [raw]
Subject: [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.

Signed-off-by: Anatolij Gustschin <[email protected]>
Acked-by: Alan Tull <[email protected]>
---
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


2018-11-07 17:54:29

by Alan Tull

[permalink] [raw]
Subject: [PATCH 2/4] fpga: dfl: fme: remove set but not used variable 'priv'

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]

Signed-off-by: YueHaibing <[email protected]>
Acked-by: Moritz Fischer <[email protected]>
Acked-by: Wu Hao <[email protected]>
Acked-by: Alan Tull <[email protected]>
---
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


2018-11-12 08:03:06

by Eric Schwarz

[permalink] [raw]
Subject: Re: [PATCH 0/4] patches for 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