misc: pci_endpoint_test: Use memcpy_toio()/memcpy_fromio() for BAR tests
authorNiklas Cassel <cassel@kernel.org>
Fri, 22 Mar 2024 16:41:38 +0000 (17:41 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 9 Jul 2024 22:57:27 +0000 (17:57 -0500)
commit2a35703a6a00e87bf65d61e70516ae2524f70ec7
tree941430be5b3c11ac186460a864b73bb59262578a
parent199b03db86b9d9e263cb136d6c8902d443725ca3
misc: pci_endpoint_test: Use memcpy_toio()/memcpy_fromio() for BAR tests

The current code uses writel()/readl(), which has an implicit memory
barrier for every single readl()/writel().

Additionally, reading 4 bytes at a time over the PCI bus is not really
optimal, considering that this code is running in an ioctl handler.

Use memcpy_toio()/memcpy_fromio() for BAR tests.

Before patch with a 4MB BAR:

  $ time /usr/bin/pcitest -b 1
  BAR1:           OKAY
  real    0m 1.56s

After patch with a 4MB BAR:

  $ time /usr/bin/pcitest -b 1
  BAR1:           OKAY
  real    0m 0.54s

Link: https://lore.kernel.org/linux-pci/20240322164139.678228-1-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
drivers/misc/pci_endpoint_test.c