mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-02 20:29:20 +00:00
pci-v4.12-changes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJZEHmsAAoJEFmIoMA60/r88SgQAJbFddueb0+DfJ+USDud4b/Z akfS+G1UAm+TgtMyh1wM49dHzFssp36uWJxtWI+bPqBzuy94PMCbz7JVUV28gX9G tFhFuc5YH94I/3y85rbZnolb6uZN9MhLjzTFqDC9ilW6HFqmwK4t4wlHSCjQN1St svLYvs2G6n6/VK3Fre7/wOvdZ1erG4Qod+kn5Tx3K5TQydmRlaSBfK+DRANuDBkM KzGO7Bkc/Cx8hb9pHmaey/wxmNrrgmVjTtWrEnb2tEq833zP4h6GhUIJEKodMSi5 gXPNZgKlu3n5L592M0UCh4EoHejzkv9wrcsoDm+djmsc5Zg2Howq4kAdHP8k4hUG 0gt8n0ni9vhJN56jikrGi7cAdHCKSNnx2Ue/qTCbX0ncB3XUMuJxJwCsgW/6wa9f oU7tRtTS03UltnKoFAcyYclS4TaSY4SA4ySaK6Hi+cRkdVFDdyHQYbHHNSU7MsA+ IS2tXvGoIdSYyrZMHSRcl2rRTfYQUkmPEvBF3LvqZr32M4mJMmUNAPLZaly373ZE iwq0ZJlrLeM0cqdFIG3S60RtJyQk/HBN1NMqrYHArWOxvWIgNd5F8NCsTTxY3wU3 IxgBIuUFcbVwVkqEHGs8K5AvB3oghqdnA3eGOV79799eMtLn3LOvyIlpHMSw9WUq ags00JtMLitfNPBH3eSl =eE4D -----END PGP SIGNATURE----- Merge tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci Pull PCI updates from Bjorn Helgaas: - add framework for supporting PCIe devices in Endpoint mode (Kishon Vijay Abraham I) - use non-postable PCI config space mappings when possible (Lorenzo Pieralisi) - clean up and unify mmap of PCI BARs (David Woodhouse) - export and unify Function Level Reset support (Christoph Hellwig) - avoid FLR for Intel 82579 NICs (Sasha Neftin) - add pci_request_irq() and pci_free_irq() helpers (Christoph Hellwig) - short-circuit config access failures for disconnected devices (Keith Busch) - remove D3 sleep delay when possible (Adrian Hunter) - freeze PME scan before suspending devices (Lukas Wunner) - stop disabling MSI/MSI-X in pci_device_shutdown() (Prarit Bhargava) - disable boot interrupt quirk for ASUS M2N-LR (Stefan Assmann) - add arch-specific alignment control to improve device passthrough by avoiding multiple BARs in a page (Yongji Xie) - add sysfs sriov_drivers_autoprobe to control VF driver binding (Bodong Wang) - allow slots below PCI-to-PCIe "reverse bridges" (Bjorn Helgaas) - fix crashes when unbinding host controllers that don't support removal (Brian Norris) - add driver for MicroSemi Switchtec management interface (Logan Gunthorpe) - add driver for Faraday Technology FTPCI100 host bridge (Linus Walleij) - add i.MX7D support (Andrey Smirnov) - use generic MSI support for Aardvark (Thomas Petazzoni) - make Rockchip driver modular (Brian Norris) - advertise 128-byte Read Completion Boundary support for Rockchip (Shawn Lin) - advertise PCI_EXP_LNKSTA_SLC for Rockchip root port (Shawn Lin) - convert atomic_t to refcount_t in HV driver (Elena Reshetova) - add CPU IRQ affinity in HV driver (K. Y. Srinivasan) - fix PCI bus removal in HV driver (Long Li) - add support for ThunderX2 DMA alias topology (Jayachandran C) - add ThunderX pass2.x 2nd node MCFG quirk (Tomasz Nowicki) - add ITE 8893 bridge DMA alias quirk (Jarod Wilson) - restrict Cavium ACS quirk only to CN81xx/CN83xx/CN88xx devices (Manish Jaggi) * tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (146 commits) PCI: Don't allow unbinding host controllers that aren't prepared ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP MAINTAINERS: Add PCI Endpoint maintainer Documentation: PCI: Add userguide for PCI endpoint test function tools: PCI: Add sample test script to invoke pcitest tools: PCI: Add a userspace tool to test PCI endpoint Documentation: misc-devices: Add Documentation for pci-endpoint-test driver misc: Add host side PCI driver for PCI test function device PCI: Add device IDs for DRA74x and DRA72x dt-bindings: PCI: dra7xx: Add DT bindings to enable unaligned access PCI: dwc: dra7xx: Workaround for errata id i870 dt-bindings: PCI: dra7xx: Add DT bindings for PCI dra7xx EP mode PCI: dwc: dra7xx: Add EP mode support PCI: dwc: dra7xx: Facilitate wrapper and MSI interrupts to be enabled independently dt-bindings: PCI: Add DT bindings for PCI designware EP mode PCI: dwc: designware: Add EP mode support Documentation: PCI: Add binding documentation for pci-test endpoint function ixgbe: Use pcie_flr() instead of duplicating it IB/hfi1: Use pcie_flr() instead of duplicating it PCI: imx6: Fix spelling mistake: "contol" -> "control" ...
This commit is contained in:
commit
857f864014
148 changed files with 8948 additions and 1015 deletions
186
tools/pci/pcitest.c
Normal file
186
tools/pci/pcitest.c
Normal file
|
@ -0,0 +1,186 @@
|
|||
/**
|
||||
* Userspace PCI Endpoint Test Module
|
||||
*
|
||||
* Copyright (C) 2017 Texas Instruments
|
||||
* Author: Kishon Vijay Abraham I <kishon@ti.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 of
|
||||
* the License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linux/pcitest.h>
|
||||
|
||||
#define BILLION 1E9
|
||||
|
||||
static char *result[] = { "NOT OKAY", "OKAY" };
|
||||
|
||||
struct pci_test {
|
||||
char *device;
|
||||
char barnum;
|
||||
bool legacyirq;
|
||||
unsigned int msinum;
|
||||
bool read;
|
||||
bool write;
|
||||
bool copy;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
static int run_test(struct pci_test *test)
|
||||
{
|
||||
long ret;
|
||||
int fd;
|
||||
struct timespec start, end;
|
||||
double time;
|
||||
|
||||
fd = open(test->device, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror("can't open PCI Endpoint Test device");
|
||||
return fd;
|
||||
}
|
||||
|
||||
if (test->barnum >= 0 && test->barnum <= 5) {
|
||||
ret = ioctl(fd, PCITEST_BAR, test->barnum);
|
||||
fprintf(stdout, "BAR%d:\t\t", test->barnum);
|
||||
if (ret < 0)
|
||||
fprintf(stdout, "TEST FAILED\n");
|
||||
else
|
||||
fprintf(stdout, "%s\n", result[ret]);
|
||||
}
|
||||
|
||||
if (test->legacyirq) {
|
||||
ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0);
|
||||
fprintf(stdout, "LEGACY IRQ:\t");
|
||||
if (ret < 0)
|
||||
fprintf(stdout, "TEST FAILED\n");
|
||||
else
|
||||
fprintf(stdout, "%s\n", result[ret]);
|
||||
}
|
||||
|
||||
if (test->msinum > 0 && test->msinum <= 32) {
|
||||
ret = ioctl(fd, PCITEST_MSI, test->msinum);
|
||||
fprintf(stdout, "MSI%d:\t\t", test->msinum);
|
||||
if (ret < 0)
|
||||
fprintf(stdout, "TEST FAILED\n");
|
||||
else
|
||||
fprintf(stdout, "%s\n", result[ret]);
|
||||
}
|
||||
|
||||
if (test->write) {
|
||||
ret = ioctl(fd, PCITEST_WRITE, test->size);
|
||||
fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
|
||||
if (ret < 0)
|
||||
fprintf(stdout, "TEST FAILED\n");
|
||||
else
|
||||
fprintf(stdout, "%s\n", result[ret]);
|
||||
}
|
||||
|
||||
if (test->read) {
|
||||
ret = ioctl(fd, PCITEST_READ, test->size);
|
||||
fprintf(stdout, "READ (%7ld bytes):\t\t", test->size);
|
||||
if (ret < 0)
|
||||
fprintf(stdout, "TEST FAILED\n");
|
||||
else
|
||||
fprintf(stdout, "%s\n", result[ret]);
|
||||
}
|
||||
|
||||
if (test->copy) {
|
||||
ret = ioctl(fd, PCITEST_COPY, test->size);
|
||||
fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size);
|
||||
if (ret < 0)
|
||||
fprintf(stdout, "TEST FAILED\n");
|
||||
else
|
||||
fprintf(stdout, "%s\n", result[ret]);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
struct pci_test *test;
|
||||
|
||||
test = calloc(1, sizeof(*test));
|
||||
if (!test) {
|
||||
perror("Fail to allocate memory for pci_test\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* since '0' is a valid BAR number, initialize it to -1 */
|
||||
test->barnum = -1;
|
||||
|
||||
/* set default size as 100KB */
|
||||
test->size = 0x19000;
|
||||
|
||||
/* set default endpoint device */
|
||||
test->device = "/dev/pci-endpoint-test.0";
|
||||
|
||||
while ((c = getopt(argc, argv, "D:b:m:lrwcs:")) != EOF)
|
||||
switch (c) {
|
||||
case 'D':
|
||||
test->device = optarg;
|
||||
continue;
|
||||
case 'b':
|
||||
test->barnum = atoi(optarg);
|
||||
if (test->barnum < 0 || test->barnum > 5)
|
||||
goto usage;
|
||||
continue;
|
||||
case 'l':
|
||||
test->legacyirq = true;
|
||||
continue;
|
||||
case 'm':
|
||||
test->msinum = atoi(optarg);
|
||||
if (test->msinum < 1 || test->msinum > 32)
|
||||
goto usage;
|
||||
continue;
|
||||
case 'r':
|
||||
test->read = true;
|
||||
continue;
|
||||
case 'w':
|
||||
test->write = true;
|
||||
continue;
|
||||
case 'c':
|
||||
test->copy = true;
|
||||
continue;
|
||||
case 's':
|
||||
test->size = strtoul(optarg, NULL, 0);
|
||||
continue;
|
||||
case '?':
|
||||
case 'h':
|
||||
default:
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"usage: %s [options]\n"
|
||||
"Options:\n"
|
||||
"\t-D <dev> PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n"
|
||||
"\t-b <bar num> BAR test (bar number between 0..5)\n"
|
||||
"\t-m <msi num> MSI test (msi number between 1..32)\n"
|
||||
"\t-r Read buffer test\n"
|
||||
"\t-w Write buffer test\n"
|
||||
"\t-c Copy buffer test\n"
|
||||
"\t-s <size> Size of buffer {default: 100KB}\n",
|
||||
argv[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
run_test(test);
|
||||
return 0;
|
||||
}
|
56
tools/pci/pcitest.sh
Normal file
56
tools/pci/pcitest.sh
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "BAR tests"
|
||||
echo
|
||||
|
||||
bar=0
|
||||
|
||||
while [ $bar -lt 6 ]
|
||||
do
|
||||
pcitest -b $bar
|
||||
bar=`expr $bar + 1`
|
||||
done
|
||||
echo
|
||||
|
||||
echo "Interrupt tests"
|
||||
echo
|
||||
|
||||
pcitest -l
|
||||
msi=1
|
||||
|
||||
while [ $msi -lt 33 ]
|
||||
do
|
||||
pcitest -m $msi
|
||||
msi=`expr $msi + 1`
|
||||
done
|
||||
echo
|
||||
|
||||
echo "Read Tests"
|
||||
echo
|
||||
|
||||
pcitest -r -s 1
|
||||
pcitest -r -s 1024
|
||||
pcitest -r -s 1025
|
||||
pcitest -r -s 1024000
|
||||
pcitest -r -s 1024001
|
||||
echo
|
||||
|
||||
echo "Write Tests"
|
||||
echo
|
||||
|
||||
pcitest -w -s 1
|
||||
pcitest -w -s 1024
|
||||
pcitest -w -s 1025
|
||||
pcitest -w -s 1024000
|
||||
pcitest -w -s 1024001
|
||||
echo
|
||||
|
||||
echo "Copy Tests"
|
||||
echo
|
||||
|
||||
pcitest -c -s 1
|
||||
pcitest -c -s 1024
|
||||
pcitest -c -s 1025
|
||||
pcitest -c -s 1024000
|
||||
pcitest -c -s 1024001
|
||||
echo
|
Loading…
Add table
Add a link
Reference in a new issue