From: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
Vinod Koul <vkoul@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Eugeniy Paltsev <eugeniy.paltsev@synopsys.com>,
Russell King <rmk+kernel@armlinux.org.uk>,
Niklas Cassel <niklas.cassel@linaro.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Joao Pinto <joao.pinto@synopsys.com>,
Jose Abreu <jose.abreu@synopsys.com>,
Luis Oliveira <luis.oliveira@synopsys.com>,
Vitor Soares <vitor.soares@synopsys.com>,
Nelson Costa <nelson.costa@synopsys.com>,
Pedro Sousa <pedrom.sousa@synopsys.com>
Subject: Re: [RFC v3 5/7] dmaengine: Add Synopsys eDMA IP PCIe glue-logic
Date: Mon, 14 Jan 2019 11:38:02 +0000 [thread overview]
Message-ID: <916f319b-9e45-6d78-4ecc-850feda84bb3@synopsys.com> (raw)
In-Reply-To: <20190111194705.GU9170@smile.fi.intel.com>
On 11/01/2019 19:47, Andy Shevchenko wrote:
> On Fri, Jan 11, 2019 at 07:33:41PM +0100, Gustavo Pimentel wrote:
>> Synopsys eDMA IP is normally distributed along with Synopsys PCIe
>> EndPoint IP (depends of the use and licensing agreement).
>>
>> This IP requires some basic configurations, such as:
>> - eDMA registers BAR
>> - eDMA registers offset
>> - eDMA registers size
>> - eDMA linked list memory BAR
>> - eDMA linked list memory offset
>> - eDMA linked list memory sze
>> - eDMA data memory BAR
>> - eDMA data memory offset
>> - eDMA data memory size
>> - eDMA version
>> - eDMA mode
>> - IRQs available for eDMA
>>
>> As a working example, PCIe glue-logic will attach to a Synopsys PCIe
>> EndPoint IP prototype kit (Vendor ID = 0x16c3, Device ID = 0xedda),
>> which has built-in an eDMA IP with this default configuration:
>> - eDMA registers BAR = 0
>> - eDMA registers offset = 0x00001000 (4 Kbytes)
>> - eDMA registers size = 0x00002000 (8 Kbytes)
>> - eDMA linked list memory BAR = 2
>> - eDMA linked list memory offset = 0x00000000 (0 Kbytes)
>> - eDMA linked list memory size = 0x00800000 (8 Mbytes)
>> - eDMA data memory BAR = 2
>> - eDMA data memory offset = 0x00800000 (8 Mbytes)
>> - eDMA data memory size = 0x03800000 (56 Mbytes)
>> - eDMA version = 0
>> - eDMA mode = EDMA_MODE_UNROLL
>> - IRQs = 1
>>
>> This driver can be compile as built-in or external module in kernel.
>>
>> To enable this driver just select DW_EDMA_PCIE option in kernel
>> configuration, however it requires and selects automatically DW_EDMA
>> option too.
>>
>
>> Changes:
>> RFC v1->RFC v2:
>
> Changes go after '--- ' line.
At the last Linux Plumbers Conference there were some subsystem maintainers who
asked that the track changes be included in the description as a way to not lose
the previous work done. That why I put it before the '---' line, but it's
indifferent to me, I can put it after the '---' line.
>
>> - Replace comments // (C99 style) by /**/
>> - Merge two pcim_iomap_regions() calls into just one call
>> - Remove pci_try_set_mwi() call
>> - Replace some dev_info() by dev_dbg() to reduce *noise*
>> - Remove pci_name(pdev) call after being call dw_edma_remove()
>> - Remove all power management support
>> - Fix the headers of the .c and .h files according to the most recent
>> convention
>> - Fix errors and checks pointed out by checkpatch with --strict option
>> - Replace patch small description tag from dma by dmaengine
>> RFC v2->RFC v3:
>> - Fix printk variable of phys_addr_t type
>> - Fix missing variable initialization (chan->configured)
>> - Change linked list size to 512 Kbytes
>> - Add data memory information
>> - Add register size information
>> - Add comments or improve existing ones
>> - Add possibility to work with multiple IRQs feature
>> - Replace MSI and MSI-X enable condition by pci_dev_msi_enabled()
>> - Replace code to acquire MSI(-X) address and data by
>> get_cached_msi_msg()
>
>> +enum dw_edma_pcie_bar {
>> + BAR_0,
>> + BAR_1,
>> + BAR_2,
>> + BAR_3,
>> + BAR_4,
>> + BAR_5
>> +};
>
> pci-epf.h has this.
> Why duplicate?
I can use that header sure. Thanks.
>
>
> What else is being duplicated from PCI core?
>
>> +static bool disable_msix;
>> +module_param(disable_msix, bool, 0644);
>> +MODULE_PARM_DESC(disable_msix, "Disable MSI-X interrupts");
>
> Why?!
> We are no allow new module parameters without very strong arguments.
Since this is a reference driver and might be used to test customized HW
solutions, I added this parameter to allow the possibility to test the solution
forcing the MSI feature binding. This is required specially if who will test
this solution has a Root Complex with both features available (MSI and MSI-X),
because the Kernel will give always preference to MSI-X binding (assuming that
the EP has also both features available).
>
>> +
>> +static int dw_edma_pcie_probe(struct pci_dev *pdev,
>> + const struct pci_device_id *pid)
>> +{
>> + const struct dw_edma_pcie_data *pdata = (void *)pid->driver_data;
>> + struct device *dev = &pdev->dev;
>> + struct dw_edma_chip *chip;
>> + struct dw_edma *dw;
>> + unsigned int irq_flags = PCI_IRQ_MSI;
>> + int err, nr_irqs, i;
>> +
>
>> + if (!pdata) {
>> + dev_err(dev, "%s missing data structure\n", pci_name(pdev));
>> + return -EFAULT;
>> + }
>
> Useless check.
Why? It's just a precaution, isn't it a good practice always to think of the
worst case?
>
>> +
>> + /* Enable PCI device */
>> + err = pcim_enable_device(pdev);
>> + if (err) {
>> + dev_err(dev, "%s enabling device failed\n", pci_name(pdev));
>> + return err;
>> + }
>> +
>> + /* Mapping PCI BAR regions */
>> + err = pcim_iomap_regions(pdev, BIT(pdata->rg_bar) |
>> + BIT(pdata->ll_bar) |
>> + BIT(pdata->dt_bar),
>> + pci_name(pdev));
>> + if (err) {
>
>> + dev_err(dev, "%s eDMA BAR I/O remapping failed\n",
>> + pci_name(pdev));
>
> Isn't it pci_err() ?
> Same comment for the rest similar cases above and below.
Ok, I'll replace all dev_* function in this file.
Thanks.
>
>> + return err;
>> + }
>> +
>> + pci_set_master(pdev);
>> +
>> + nr_irqs = pci_alloc_irq_vectors(pdev, 1, pdata->irqs_cnt, irq_flags);
>> + if (nr_irqs < 1) {
>> + dev_err(dev, "%s failed to alloc IRQ vector (Number of IRQs=%u)\n",
>> + pci_name(pdev), nr_irqs);
>> + return -EPERM;
>> + }
>> +
>> + /* Data structure initialization */
>> + chip->dw = dw;
>> + chip->dev = dev;
>> + chip->id = pdev->devfn;
>> + chip->irq = pdev->irq;
>> +
>
>> + if (!pcim_iomap_table(pdev))
>> + return -EACCES;
>
> Never happen condition. Thus useless.
pcim_iomap_table() can return NULL in case of allocation failure. Besides that,
isn't it a good practice always to think of the worst case?
>
>> + dev_info(dev, "DesignWare eDMA PCIe driver loaded completely\n");
>
> Useless.
It's helpful for bring up, I can pass it to dbg.
>
>> +}
>> +
>> +static void dw_edma_pcie_remove(struct pci_dev *pdev)
>> +{
>> + struct dw_edma_chip *chip = pci_get_drvdata(pdev);
>> + struct device *dev = &pdev->dev;
>> + int err;
>> +
>> + /* Stopping eDMA driver */
>> + err = dw_edma_remove(chip);
>> + if (err)
>> + dev_warn(dev, "can't remove device properly: %d\n", err);
>> +
>> + /* Freeing IRQs */
>> + pci_free_irq_vectors(pdev);
>> +
>> + dev_info(dev, "DesignWare eDMA PCIe driver unloaded completely\n");
>
> Ditto.
It's helpful for bring up, I can pass it to dbg.
>
>> +}
>
>> +MODULE_DEVICE_TABLE(pci, dw_edma_pcie_id_table);
>> +
>> +static struct pci_driver dw_edma_pcie_driver = {
>> + .name = "dw-edma-pcie",
>> + .id_table = dw_edma_pcie_id_table,
>> + .probe = dw_edma_pcie_probe,
>> + .remove = dw_edma_pcie_remove,
>
> Power management?
I've removed the power management for now, since with my current setup I don't
have the necessary conditions to test it. I prefer not submitting that code for now.
>
>> +};
>
Thanks for the inputs Andy! They have been pretty good!
Regards,
Gustavo
next prev parent reply other threads:[~2019-01-14 11:42 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 18:33 [RFC v3 0/6] dmaengine: Add Synopsys eDMA IP driver (version 0) Gustavo Pimentel
2019-01-11 18:33 ` [RFC v3 1/7] dmaengine: Add Synopsys eDMA IP core driver Gustavo Pimentel
2019-01-16 10:21 ` Jose Abreu
2019-01-16 11:53 ` Gustavo Pimentel
2019-01-19 16:21 ` Andy Shevchenko
2019-01-21 9:14 ` Gustavo Pimentel
2019-01-20 11:47 ` Vinod Koul
2019-01-21 15:49 ` Gustavo Pimentel
2019-01-20 11:44 ` Vinod Koul
2019-01-21 15:48 ` Gustavo Pimentel
2019-01-23 13:08 ` Vinod Koul
2019-01-31 11:33 ` Gustavo Pimentel
2019-02-01 4:14 ` Vinod Koul
2019-02-01 11:23 ` Gustavo Pimentel
2019-02-02 10:07 ` Vinod Koul
2019-02-06 18:06 ` Gustavo Pimentel
2019-01-11 18:33 ` [RFC v3 2/7] dmaengine: Add Synopsys eDMA IP version 0 support Gustavo Pimentel
2019-01-16 10:33 ` Jose Abreu
2019-01-16 14:02 ` Gustavo Pimentel
2019-01-11 18:33 ` [RFC v3 3/7] dmaengine: Add Synopsys eDMA IP version 0 debugfs support Gustavo Pimentel
2019-01-11 18:33 ` [RFC v3 4/7] PCI: Add Synopsys endpoint EDDA Device id Gustavo Pimentel
2019-01-14 14:41 ` Bjorn Helgaas
2019-01-11 18:33 ` [RFC v3 5/7] dmaengine: Add Synopsys eDMA IP PCIe glue-logic Gustavo Pimentel
2019-01-11 19:47 ` Andy Shevchenko
2019-01-14 11:38 ` Gustavo Pimentel [this message]
2019-01-15 5:43 ` Andy Shevchenko
2019-01-15 12:48 ` Gustavo Pimentel
2019-01-19 15:45 ` Andy Shevchenko
2019-01-21 9:21 ` Gustavo Pimentel
2019-01-11 18:33 ` [RFC v3 6/7] MAINTAINERS: Add Synopsys eDMA IP driver maintainer Gustavo Pimentel
2019-01-11 18:33 ` [RFC v3 7/7] dmaengine: Add Synopsys eDMA IP test and sample driver Gustavo Pimentel
2019-01-11 19:48 ` Andy Shevchenko
2019-01-14 11:44 ` Gustavo Pimentel
2019-01-15 5:45 ` Andy Shevchenko
2019-01-15 13:02 ` Gustavo Pimentel
2019-01-17 5:03 ` Vinod Koul
2019-01-21 15:59 ` Gustavo Pimentel
2019-01-16 10:45 ` Jose Abreu
2019-01-16 11:56 ` Gustavo Pimentel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=916f319b-9e45-6d78-4ecc-850feda84bb3@synopsys.com \
--to=gustavo.pimentel@synopsys.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=eugeniy.paltsev@synopsys.com \
--cc=joao.pinto@synopsys.com \
--cc=jose.abreu@synopsys.com \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=luis.oliveira@synopsys.com \
--cc=nelson.costa@synopsys.com \
--cc=niklas.cassel@linaro.org \
--cc=pedrom.sousa@synopsys.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=vitor.soares@synopsys.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).