From patchwork Tue Feb 2 16:56:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 12062321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F6A5C433E0 for ; Tue, 2 Feb 2021 17:00:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FB4164F88 for ; Tue, 2 Feb 2021 17:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237031AbhBBQ7y (ORCPT ); Tue, 2 Feb 2021 11:59:54 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:53106 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237024AbhBBQ5v (ORCPT ); Tue, 2 Feb 2021 11:57:51 -0500 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id C3AFD401D7; Tue, 2 Feb 2021 16:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612285007; bh=hjAVmHC62hqnPFQCk0S7Hm21hPzEXOtAr+1vKzySnq0=; h=From:To:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=U2I6hLA43fj4uKzLnwQFsLXEHhWaoRNGz2MFru5zEEafLoIjO70oemUVwP0BY5lQg vcYoxj/FZf+i0RdCGbdRB0Ygge2wdq0CH4SdkmOrKgTuYBib8bG1nEMQyIcLhgZoFY u38IrNJ2UqcRIVu/rSFWDBm41IjZJ4O+3VYu1cEvT2zWVPTAHSPShr1SDQKlOzz3dS o6PDk/L7g8LQUmZiuKzs+IJ58o+GtDGHjz0X6MU4CpZKmLmjfPj8WZnaLyk5EcOaL/ aNcy1pU6RE+kJK/eY3Pe1gGrGEiGQCqY3pAqcsC/mWYytqP+qmztNPrN3rHcActpDx ken9GLZVcScuw== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 8F610A0062; Tue, 2 Feb 2021 16:56:45 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Greg Kroah-Hartman , Jonathan Corbet , Gustavo Pimentel Subject: [RESEND PATCH v3 1/5] misc: Add Synopsys DesignWare xData IP driver Date: Tue, 2 Feb 2021 17:56:34 +0100 Message-Id: <2c70018d5965c171c15870638ee717fe5f9483f6.1612284945.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Synopsys DesignWare xData IP driver. This driver enables/disables the PCI traffic generator module pertain to the Synopsys DesignWare prototype. Signed-off-by: Gustavo Pimentel --- drivers/misc/dw-xdata-pcie.c | 379 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 379 insertions(+) create mode 100644 drivers/misc/dw-xdata-pcie.c diff --git a/drivers/misc/dw-xdata-pcie.c b/drivers/misc/dw-xdata-pcie.c new file mode 100644 index 00000000..683bfda --- /dev/null +++ b/drivers/misc/dw-xdata-pcie.c @@ -0,0 +1,379 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates. + * Synopsys DesignWare xData driver + * + * Author: Gustavo Pimentel + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DW_XDATA_DRIVER_NAME "dw-xdata-pcie" + +#define DW_XDATA_EP_MEM_OFFSET 0x8000000 + +struct dw_xdata_pcie_data { + /* xData registers location */ + enum pci_barno rg_bar; + off_t rg_off; + size_t rg_sz; +}; + +static const struct dw_xdata_pcie_data snps_edda_data = { + /* xData registers location */ + .rg_bar = BAR_0, + .rg_off = 0x00000000, /* 0 Kbytes */ + .rg_sz = 0x0000012c, /* 300 bytes */ +}; + +#define STATUS_DONE BIT(0) + +#define CONTROL_DOORBELL BIT(0) +#define CONTROL_IS_WRITE BIT(1) +#define CONTROL_LENGTH(a) FIELD_PREP(GENMASK(13, 2), a) +#define CONTROL_PATTERN_INC BIT(16) +#define CONTROL_NO_ADDR_INC BIT(18) + +#define XPERF_CONTROL_ENABLE BIT(5) + +struct dw_xdata_regs { + u32 addr_lsb; /* 0x000 */ + u32 addr_msb; /* 0x004 */ + u32 burst_cnt; /* 0x008 */ + u32 control; /* 0x00c */ + u32 pattern; /* 0x010 */ + u32 status; /* 0x014 */ + u32 RAM_addr; /* 0x018 */ + u32 RAM_port; /* 0x01c */ + u32 _reserved0[14]; /* 0x020..0x054 */ + u32 perf_control; /* 0x058 */ + u32 _reserved1[41]; /* 0x05c..0x0fc */ + u32 wr_cnt_lsb; /* 0x100 */ + u32 wr_cnt_msb; /* 0x104 */ + u32 rd_cnt_lsb; /* 0x108 */ + u32 rd_cnt_msb; /* 0x10c */ +} __packed; + +struct dw_xdata_region { + phys_addr_t paddr; /* physical address */ + void __iomem *vaddr; /* virtual address */ + size_t sz; /* size */ +}; + +struct dw_xdata { + struct dw_xdata_region rg_region; /* registers */ + size_t max_wr_len; /* max wr xfer len */ + size_t max_rd_len; /* max rd xfer len */ + struct pci_dev *pdev; +}; + +static inline struct dw_xdata_regs __iomem *__dw_regs(struct dw_xdata *dw) +{ + return dw->rg_region.vaddr; +} + +static void dw_xdata_stop(struct dw_xdata *dw) +{ + u32 burst = readl(&(__dw_regs(dw)->burst_cnt)); + + if (burst & BIT(31)) { + burst &= ~(u32)BIT(31); + writel(burst, &(__dw_regs(dw)->burst_cnt)); + } +} + +static void dw_xdata_start(struct dw_xdata *dw, bool write) +{ + u32 control, status; + + /* Stop first if xfer in progress */ + dw_xdata_stop(dw); + + /* Clear status register */ + writel(0x0, &(__dw_regs(dw)->status)); + + /* Burst count register set for continuous until stopped */ + writel(0x80001001, &(__dw_regs(dw)->burst_cnt)); + + /* Pattern register */ + writel(0x0, &(__dw_regs(dw)->pattern)); + + /* Control register */ + control = CONTROL_DOORBELL | CONTROL_PATTERN_INC | CONTROL_NO_ADDR_INC; + if (write) { + control |= CONTROL_IS_WRITE; + control |= CONTROL_LENGTH(dw->max_wr_len); + } else { + control |= CONTROL_LENGTH(dw->max_rd_len); + } + writel(control, &(__dw_regs(dw)->control)); + + usleep_range(100, 150); + + status = readl(&(__dw_regs(dw)->status)); + if (!(status & STATUS_DONE)) + pci_dbg(dw->pdev, "xData: started %s direction\n", + write ? "write" : "read"); +} + +static void dw_xdata_perf_meas(struct dw_xdata *dw, u64 *data, bool write) +{ + if (write) { + *data = readl(&(__dw_regs(dw)->wr_cnt_msb)); + *data <<= 32; + *data |= readl(&(__dw_regs(dw)->wr_cnt_lsb)); + } else { + *data = readl(&(__dw_regs(dw)->rd_cnt_msb)); + *data <<= 32; + *data |= readl(&(__dw_regs(dw)->rd_cnt_lsb)); + } +} + +static u64 dw_xdata_perf_diff(u64 *m1, u64 *m2, u64 time) +{ + u64 rate = (*m1 - *m2); + + rate *= (1000 * 1000 * 1000); + rate >>= 20; + rate = DIV_ROUND_CLOSEST_ULL(rate, time); + + return rate; +} + +static void dw_xdata_perf(struct dw_xdata *dw, u64 *rate, bool write) +{ + u64 data[2], time[2], diff; + + /* First measurement */ + writel(0x0, &(__dw_regs(dw)->perf_control)); + dw_xdata_perf_meas(dw, &data[0], write); + time[0] = jiffies; + writel((u32)XPERF_CONTROL_ENABLE, &(__dw_regs(dw)->perf_control)); + + /* Delay 100ms */ + mdelay(100); + + /* Second measurement */ + writel(0x0, &(__dw_regs(dw)->perf_control)); + dw_xdata_perf_meas(dw, &data[1], write); + time[1] = jiffies; + writel((u32)XPERF_CONTROL_ENABLE, &(__dw_regs(dw)->perf_control)); + + /* Calculations */ + diff = jiffies_to_nsecs(time[1] - time[0]); + *rate = dw_xdata_perf_diff(&data[1], &data[0], diff); + + pci_dbg(dw->pdev, "xData: time=%llu us, %s=%llu MB/s\n", + diff, write ? "write" : "read", *rate); +} + +static inline struct device *kobj2device(struct kobject *kobj) +{ + return container_of(kobj, struct device, kobj); +} + +static inline struct pci_dev *device2pci_dev(struct device *dev) +{ + return container_of(dev, struct pci_dev, dev); +} + +static ssize_t sysfs_write_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct device *dev = kobj2device(kobj); + struct pci_dev *pdev = device2pci_dev(dev); + struct dw_xdata *dw = pci_get_drvdata(pdev); + u64 rate; + + dw_xdata_perf(dw, &rate, true); + return sprintf(buf, "%llu MB/s\n", rate); +} + +static ssize_t sysfs_write_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, + size_t count) +{ + struct device *dev = kobj2device(kobj); + struct pci_dev *pdev = device2pci_dev(dev); + struct dw_xdata *dw = pci_get_drvdata(pdev); + + pci_dbg(pdev, "xData: requested write transfer\n"); + dw_xdata_start(dw, true); + + return count; +} + +struct kobj_attribute sysfs_write_attr = __ATTR(write, 0644, + sysfs_write_show, + sysfs_write_store); + +static ssize_t sysfs_read_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct device *dev = kobj2device(kobj); + struct pci_dev *pdev = device2pci_dev(dev); + struct dw_xdata *dw = pci_get_drvdata(pdev); + u64 rate; + + dw_xdata_perf(dw, &rate, false); + return sprintf(buf, "%llu MB/s\n", rate); +} + +static ssize_t sysfs_read_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, + size_t count) +{ + struct device *dev = kobj2device(kobj); + struct pci_dev *pdev = device2pci_dev(dev); + struct dw_xdata *dw = pci_get_drvdata(pdev); + + pci_dbg(pdev, "xData: requested read transfer\n"); + dw_xdata_start(dw, false); + + return count; +} + +struct kobj_attribute sysfs_read_attr = __ATTR(read, 0644, + sysfs_read_show, + sysfs_read_store); + +static ssize_t sysfs_stop_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, + size_t count) +{ + struct device *dev = kobj2device(kobj); + struct pci_dev *pdev = device2pci_dev(dev); + struct dw_xdata *dw = pci_get_drvdata(pdev); + + pci_dbg(pdev, "xData: requested stop any transfer\n"); + dw_xdata_stop(dw); + + return count; +} + +struct kobj_attribute sysfs_stop_attr = __ATTR(stop, 0644, + NULL, + sysfs_stop_store); + +static int dw_xdata_pcie_probe(struct pci_dev *pdev, + const struct pci_device_id *pid) +{ + const struct dw_xdata_pcie_data *pdata = (void *)pid->driver_data; + struct device *dev = &pdev->dev; + struct dw_xdata *dw; + u64 addr; + int err; + + /* Enable PCI device */ + err = pcim_enable_device(pdev); + if (err) { + pci_err(pdev, "enabling device failed\n"); + return err; + } + + /* Mapping PCI BAR regions */ + err = pcim_iomap_regions(pdev, BIT(pdata->rg_bar), pci_name(pdev)); + if (err) { + pci_err(pdev, "xData BAR I/O remapping failed\n"); + return err; + } + + pci_set_master(pdev); + + /* Allocate memory */ + dw = devm_kzalloc(&pdev->dev, sizeof(*dw), GFP_KERNEL); + if (!dw) + return -ENOMEM; + + /* Data structure initialization */ + dw->rg_region.vaddr = pcim_iomap_table(pdev)[pdata->rg_bar]; + if (!dw->rg_region.vaddr) + return -ENOMEM; + + dw->rg_region.vaddr += pdata->rg_off; + dw->rg_region.paddr = pdev->resource[pdata->rg_bar].start; + dw->rg_region.paddr += pdata->rg_off; + dw->rg_region.sz = pdata->rg_sz; + + dw->max_wr_len = pcie_get_mps(pdev); + dw->max_wr_len >>= 2; + + dw->max_rd_len = pcie_get_readrq(pdev); + dw->max_rd_len >>= 2; + + dw->pdev = pdev; + + writel(0x0, &(__dw_regs(dw)->RAM_addr)); + writel(0x0, &(__dw_regs(dw)->RAM_port)); + + addr = dw->rg_region.paddr + DW_XDATA_EP_MEM_OFFSET; + writel(lower_32_bits(addr), &(__dw_regs(dw)->addr_lsb)); + writel(upper_32_bits(addr), &(__dw_regs(dw)->addr_msb)); + pci_dbg(pdev, "xData: target address = 0x%.16llx\n", addr); + + pci_dbg(pdev, "xData: wr_len=%zu, rd_len=%zu\n", + dw->max_wr_len * 4, dw->max_rd_len * 4); + + err = sysfs_create_file(&dev->kobj, &sysfs_write_attr.attr); + if (err) + return err; + + err = sysfs_create_file(&dev->kobj, &sysfs_read_attr.attr); + if (err) + return err; + + err = sysfs_create_file(&dev->kobj, &sysfs_stop_attr.attr); + if (err) + return err; + + err = sysfs_create_link(kernel_kobj, &dev->kobj, DW_XDATA_DRIVER_NAME); + if (err) + return err; + + /* Saving data structure reference */ + pci_set_drvdata(pdev, dw); + + return 0; +} + +static void dw_xdata_pcie_remove(struct pci_dev *pdev) +{ + struct dw_xdata *dw = pci_get_drvdata(pdev); + struct device *dev = &pdev->dev; + + if (dw) + dw_xdata_stop(dw); + + sysfs_remove_link(kernel_kobj, DW_XDATA_DRIVER_NAME); + sysfs_remove_file(&dev->kobj, &sysfs_stop_attr.attr); + sysfs_remove_file(&dev->kobj, &sysfs_read_attr.attr); + sysfs_remove_file(&dev->kobj, &sysfs_write_attr.attr); + kobject_put(&dev->kobj); +} + +static const struct pci_device_id dw_xdata_pcie_id_table[] = { + { PCI_DEVICE_DATA(SYNOPSYS, EDDA, &snps_edda_data) }, + { } +}; +MODULE_DEVICE_TABLE(pci, dw_xdata_pcie_id_table); + +static struct pci_driver dw_xdata_pcie_driver = { + .name = DW_XDATA_DRIVER_NAME, + .id_table = dw_xdata_pcie_id_table, + .probe = dw_xdata_pcie_probe, + .remove = dw_xdata_pcie_remove, +}; + +module_pci_driver(dw_xdata_pcie_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Synopsys DesignWare xData PCIe driver"); +MODULE_AUTHOR("Gustavo Pimentel "); + From patchwork Tue Feb 2 16:56:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 12062349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E75FC433DB for ; Tue, 2 Feb 2021 17:04:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11C7B64E9A for ; Tue, 2 Feb 2021 17:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236989AbhBBRD6 (ORCPT ); Tue, 2 Feb 2021 12:03:58 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:37826 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237029AbhBBQ5u (ORCPT ); Tue, 2 Feb 2021 11:57:50 -0500 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 65E7FC00BA; Tue, 2 Feb 2021 16:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612285008; bh=jSQ7gPD0eg5i7tdOXR7I0dbZcd3MOQ43M0ZUh6bw2F0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=ltFaExBi5SoZXkLuhjrd8/KIg2kkE5HZJpX7w0nLSFSPjZw8Z8EmMrjsPW2gMyEYt hmQTwrrqnpeSh8gQ0QZkqsV+4fjMXIzGqy9ARUgr5aLFZU6zLoUV5mdWS4R3t9VfyA C6L8t0+ibXqKrOD8SlyBi7jRVFzw1jsqTfiulmhG4QNMbDGRWpm/uz2s/06sIRiKeG z2XOaKW/eTH01vNFN8+IrZz/l+1m8oFv9/j+IgTvioQkfBJr92ea/G4yBESISs23Pq BKmrSBjsx+pfDqTYbvbceD/zK6B1rD2PJxu+y7KjIPb03ZCJLy0LuoUXi8AnXeeBP1 j7ZmKhI7ROCxA== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 824D3A005F; Tue, 2 Feb 2021 16:56:46 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Greg Kroah-Hartman , Jonathan Corbet Cc: Gustavo Pimentel Subject: [RESEND PATCH v3 2/5] misc: Add Synopsys DesignWare xData IP driver to Makefile Date: Tue, 2 Feb 2021 17:56:35 +0100 Message-Id: <978462554997e50683e78a69493c0e169de6ef18.1612284945.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Synopsys DesignWare xData IP driver to Makefile. This driver enables/disables the PCIe traffic generator module pertain to the Synopsys DesignWare prototype. Signed-off-by: Gustavo Pimentel --- drivers/misc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index d23231e..bf22021 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_SRAM_EXEC) += sram-exec.o obj-$(CONFIG_GENWQE) += genwqe/ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_CXL_BASE) += cxl/ +obj-$(CONFIG_DW_XDATA_PCIE) += dw-xdata-pcie.o obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o obj-$(CONFIG_OCXL) += ocxl/ obj-y += cardreader/ From patchwork Tue Feb 2 16:56:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 12062355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4B0EC43381 for ; Tue, 2 Feb 2021 17:05:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90D3D64E40 for ; Tue, 2 Feb 2021 17:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237118AbhBBRE1 (ORCPT ); Tue, 2 Feb 2021 12:04:27 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:53126 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237027AbhBBQ5u (ORCPT ); Tue, 2 Feb 2021 11:57:50 -0500 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 9F82340216; Tue, 2 Feb 2021 16:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612285008; bh=wTDtZw8zXSiDJYCQgfDlx/77INQB9/ASV35kYlcbdFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=V5WH+bzztxQJxHdLdtlLf4L2ovtrK4RaTrE5A1xTMDC0C5vmtGPdREGDmiV63Z4LC 4Qy2XnZ1JaWZszr2F70uopp5drUWFqXmNMgI3humqQeZhj996CAITZiC06a8d1qZle V/cCHvmdIDPVz4fN3YmEaWJ+TcMOsPvbBMIcg1PLAkTpe266z6dNUuhDfzXaxK7p+A 4VPM5Vbnq4P1D0UsA+KEuFxmXfKjhI2P/Erz56lWnmnocJXapl0CWg5/UHyuGpq2p/ s69mcuZu3rmtu6Dy18P7ZuF8o3NHit4zeFeZaKAFT8+X0E1zj28Zg1P0r4EY3ICyOB GjShPELxBUBdA== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 6DD3CA005E; Tue, 2 Feb 2021 16:56:47 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Greg Kroah-Hartman , Jonathan Corbet Cc: Gustavo Pimentel Subject: [RESEND PATCH v3 3/5] misc: Add Synopsys DesignWare xData IP driver to Kconfig Date: Tue, 2 Feb 2021 17:56:36 +0100 Message-Id: <850ba8b075a65f753bbb802b9af23839624908bd.1612284945.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Synopsys DesignWare xData IP driver to Kconfig. This driver enables/disables the PCIe traffic generator module pertain to the Synopsys DesignWare prototype. Signed-off-by: Gustavo Pimentel --- drivers/misc/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index fafa8b0..6d5783f 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -423,6 +423,17 @@ config SRAM config SRAM_EXEC bool +config DW_XDATA_PCIE + depends on PCI + tristate "Synopsys DesignWare xData PCIe driver" + default n + help + This driver allows controlling Synopsys DesignWare PCIe traffic + generator IP also known as xData, present in Synopsys Designware + PCIe Endpoint prototype. + + If unsure, say N. + config PCI_ENDPOINT_TEST depends on PCI select CRC32 From patchwork Tue Feb 2 16:56:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 12062353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6437C433DB for ; Tue, 2 Feb 2021 17:05:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B91C664E3F for ; Tue, 2 Feb 2021 17:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237171AbhBBREd (ORCPT ); Tue, 2 Feb 2021 12:04:33 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:37846 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237033AbhBBQ5v (ORCPT ); Tue, 2 Feb 2021 11:57:51 -0500 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id C216FC00BB; Tue, 2 Feb 2021 16:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612285009; bh=xjFl0ry1f4kLV7eWV2SxeXcHKekFmdWi7FGEn+fooAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Dqy7n9FJUj7E9G+Two1YIWVoz+lOZO6zZB5i0AKU1ULrcUFx7gc3I++1FBKdND6Ww 53kbqq9KctPB55GRZGw1DSc5slOwu6MBDGN/3FY8hfsnAM/wiUBglG8kR/PqpaC8/Z 5xwLVCu1jcfMm/NEBCn/viJzV/L1iSV8XDmmQl2WR7Tk1N8rJ99ckW5oD3PJQXn5sT Unwj8x6C3vlAwy8f8echlrYiaI85p7MwT4PX21iCB2vapo8LfDa9Db08DrsyqAL8n6 2KqQJXi6OagE1D9G3lWTEiT69gfDznt0VD3+gY9XzyoLDMFlwNDwFoAqxoLnLaKuhz a82wkt9LCzOPQ== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 85442A0064; Tue, 2 Feb 2021 16:56:48 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Greg Kroah-Hartman , Jonathan Corbet , Gustavo Pimentel Cc: linux-doc@vger.kernel.org Subject: [RESEND PATCH v3 4/5] Documentation: misc-devices: Add Documentation for dw-xdata-pcie driver Date: Tue, 2 Feb 2021 17:56:37 +0100 Message-Id: <1461be78c771e63dc38721b775c38caee4a77bc0.1612284945.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Documentation for dw-xdata-pcie driver. Signed-off-by: Gustavo Pimentel --- Documentation/misc-devices/dw-xdata-pcie.rst | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/misc-devices/dw-xdata-pcie.rst diff --git a/Documentation/misc-devices/dw-xdata-pcie.rst b/Documentation/misc-devices/dw-xdata-pcie.rst new file mode 100644 index 00000000..3af9fad --- /dev/null +++ b/Documentation/misc-devices/dw-xdata-pcie.rst @@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=========================================================================== +Driver for Synopsys DesignWare PCIe traffic generator (also known as xData) +=========================================================================== + +This driver should be used as a host-side (Root Complex) driver and Synopsys +DesignWare prototype that includes this IP. + +The "dw-xdata-pcie" driver can be used to enable/disable PCIe traffic +generator in either direction (mutual exclusion) besides allowing the +PCIe link performance analysis. + +The interaction with this driver is done through the module parameter and +can be changed in runtime. The driver outputs the requested command state +information to /var/log/kern.log or dmesg. + +Request write TLPs traffic generation - Root Complex to Endpoint direction +- Command: + echo 1 > /sys/kernel/dw-xdata-pcie/write + +Get write TLPs traffic link throughput +- Command: + cat /sys/kernel/dw-xdata-pcie/write +- Output example: + 204 MB/s + +Request read TLPs traffic generation - Endpoint to Root Complex direction: +- Command: + echo 1 > /sys/kernel/dw-xdata-pcie/read + +Get read TLPs traffic link throughput +- Command: + cat /sys/kernel/dw-xdata-pcie/read +- Output example: + 199 MB/s + +Request to stop any current TLP transfer: +- Command: + echo 1 > /sys/kernel/dw-xdata-pcie/stop From patchwork Tue Feb 2 16:56:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 12062323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 899F2C43381 for ; Tue, 2 Feb 2021 17:00:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F3A864F87 for ; Tue, 2 Feb 2021 17:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237093AbhBBQ76 (ORCPT ); Tue, 2 Feb 2021 11:59:58 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:53138 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237034AbhBBQ5v (ORCPT ); Tue, 2 Feb 2021 11:57:51 -0500 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 8F508401F1; Tue, 2 Feb 2021 16:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612285010; bh=x6qwlQ3unob1xa78MC32IMOFOlfkiuMvvCbd1vCCzC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=DOlHRSRbRskTtsKcMVpGRayc+AgUApQudbqdqM2Ms95sjOS1S3btwUIuzHUA625Dp Rtmo4GxRRrum4vj2Oe15EVJZym5AG9pkjQ5q0ISRVnRj/eeYO09EsfZRa7vobLKip+ iK+fR9hanVOiVWPMeS0yDbH4vPQPXq/IVRbU5Pt1rQTwcslX5G+j4zpJiiRziOzV8S Rj0cEG/L0hY6jTpGNYddoiy/3EIYykXg+NVhMQo0bHFs2KtWo8yEnonSFHOK014T90 H/OSnX6PYKR0gaahlVIBf5vgfGNuPaT0MvKGrQijd4WNr7zll6WVXY1ZL76tf5vL+S l397HPM90CGeA== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 5CBEDA005E; Tue, 2 Feb 2021 16:56:49 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Greg Kroah-Hartman , Jonathan Corbet Cc: Gustavo Pimentel Subject: [RESEND PATCH v3 5/5] MAINTAINERS: Add Synopsys xData IP driver maintainer Date: Tue, 2 Feb 2021 17:56:38 +0100 Message-Id: <4a0f089ec12d3f81c984cdc842160ba5b52064ec.1612284945.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Synopsys xData IP driver maintainer. This driver aims to support Synopsys xData IP and is normally distributed along with Synopsys PCIe EndPoint IP as a PCIe traffic generator (depends of the use and licensing agreement). Signed-off-by: Gustavo Pimentel --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 546aa66..f9d681b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5061,6 +5061,13 @@ S: Maintained F: drivers/dma/dw-edma/ F: include/linux/dma/edma.h +DESIGNWARE XDATA IP DRIVER +M: Gustavo Pimentel +L: linux-pci@vger.kernel.org +S: Maintained +F: Documentation/misc-devices/dw-xdata-pcie.rst +F: drivers/misc/dw-xdata-pcie.c + DESIGNWARE USB2 DRD IP DRIVER M: Minas Harutyunyan L: linux-usb@vger.kernel.org