Skip to content

Commit 235c2b1

Browse files
Mani-Sadhasivambjorn-helgaas
authored andcommitted
PCI: endpoint: pci-epf-test: Fix check for DMA MEMCPY test
Currently, if DMA MEMCPY test is requested by the host, and if the endpoint DMA controller supports DMA_PRIVATE, the test will fail. This is not correct since there is no check for DMA_MEMCPY capability and the DMA controller can support both DMA_PRIVATE and DMA_MEMCPY. Fix the check and also reword the error message. Link: https://lore.kernel.org/r/[email protected] Fixes: 8353813 ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities") Reported-by: Niklas Cassel <[email protected]> Closes: https://lore.kernel.org/linux-pci/Z3QtEihbiKIGogWA@ryzen Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Tested-by: Niklas Cassel <[email protected]> Reviewed-by: Niklas Cassel <[email protected]>
1 parent b1b1f4b commit 235c2b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pci/endpoint/functions/pci-epf-test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ static void pci_epf_test_copy(struct pci_epf_test *epf_test,
328328
void *copy_buf = NULL, *buf;
329329

330330
if (reg->flags & FLAG_USE_DMA) {
331-
if (epf_test->dma_private) {
332-
dev_err(dev, "Cannot transfer data using DMA\n");
331+
if (!dma_has_cap(DMA_MEMCPY, epf_test->dma_chan_tx->device->cap_mask)) {
332+
dev_err(dev, "DMA controller doesn't support MEMCPY\n");
333333
ret = -EINVAL;
334334
goto set_status;
335335
}

0 commit comments

Comments
 (0)