summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2023-04-15 05:35:34 +0300
committerBjorn Helgaas <bhelgaas@google.com>2023-06-23 23:02:12 +0300
commitfc97f5f7c23735da0c7314533203306d96a038fb (patch)
tree89602dfb491e87827f72732dfd14319c2c9c4071 /tools/perf
parent48d19fc6e4a74e8f7d395f0186cd9e6f93c6ee26 (diff)
downloadlinux-fc97f5f7c23735da0c7314533203306d96a038fb.tar.xz
PCI: epf-test: Improve handling of command and status registers
The pci-epf-test driver uses the test register BAR memory directly to get and execute a test registers set by the RC side and defined using a struct pci_epf_test_reg. This direct use relies on using the register BAR address as a pointer to a struct pci_epf_test_reg to execute the test case and to send back the test result through the status field of struct pci_epf_test_reg. In practice, the status field is always updated before an interrupt is raised in pci_epf_test_raise_irq(), to ensure that the RC side sees the updated status when receiving an interrupt. However, such assignment direct access does not ensure that changes to the status register make it to memory, and so visible to the host, before an interrupt is raised, thus potentially resulting in the RC host not seeing the correct status result for a test. Avoid this potential problem by using READ_ONCE()/WRITE_ONCE() when accessing the command and status fields of a pci_epf_test_reg structure. This ensure that a test start (pci_epf_test_cmd_handler() function) and completion (with the function pci_epf_test_raise_irq()) achieve a correct synchronization with the MMIO register accesses on the RC host. Link: https://lore.kernel.org/r/20230415023542.77601-10-dlemoal@kernel.org Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Diffstat (limited to 'tools/perf')
0 files changed, 0 insertions, 0 deletions