All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: fix misuse of COMMAND_READ/WRITE
@ 2021-12-29  6:07 Li Chen
  2021-12-29 10:49 ` Li Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Li Chen @ 2021-12-29  6:07 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Arnd Bergmann, Greg Kroah-Hartman,
	linux-pci, linux-kernel

IIUC, COMMAND_WRITE should be set for pci_endpoint_test_write,
and COMMAND_READ should be set for pci_endpoint_test_read.

Signed-off-by: Li Chen <lchen@ambarella.com>
---
 drivers/misc/pci_endpoint_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 2ed7e3aaff3a8..ea7a90830932d 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -551,12 +551,12 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test,
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type);
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
-				 COMMAND_READ);
+				 COMMAND_WRITE);
 
 	wait_for_completion(&test->irq_raised);
 
 	reg = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_STATUS);
-	if (reg & STATUS_READ_SUCCESS)
+	if (reg & STATUS_WRITE_SUCCESS)
 		ret = true;
 
 	dma_unmap_single(dev, orig_phys_addr, size + alignment,
@@ -643,7 +643,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test,
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type);
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
-				 COMMAND_WRITE);
+				 COMMAND_READ);
 
 	wait_for_completion(&test->irq_raised);
 
-- 
2.34.1

**********************************************************************
This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] misc: pci_endpoint_test: fix misuse of COMMAND_READ/WRITE
  2021-12-29  6:07 [PATCH] misc: pci_endpoint_test: fix misuse of COMMAND_READ/WRITE Li Chen
@ 2021-12-29 10:49 ` Li Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Li Chen @ 2021-12-29 10:49 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Arnd Bergmann, Greg Kroah-Hartman,
	linux-pci, linux-kernel

Sorry, I misunderstood the two functions. pci_endpoint_test_write has fulfilled orig_addr, which is used to dma_map_single. So it ask the device to read from the dma address, and **writes** to its own dma address/buf. 

Pls ignore this patch, thanks.

> -----Original Message-----
> From: Li Chen
> Sent: Wednesday, December 29, 2021 2:07 PM
> To: Kishon Vijay Abraham I; Lorenzo Pieralisi; Krzysztof Wilczyński; Arnd
> Bergmann; Greg Kroah-Hartman; linux-pci@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] misc: pci_endpoint_test: fix misuse of
> COMMAND_READ/WRITE
> 
> IIUC, COMMAND_WRITE should be set for pci_endpoint_test_write,
> and COMMAND_READ should be set for pci_endpoint_test_read.
> 
> Signed-off-by: Li Chen <lchen@ambarella.com>
> ---
>  drivers/misc/pci_endpoint_test.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 2ed7e3aaff3a8..ea7a90830932d 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -551,12 +551,12 @@ static bool pci_endpoint_test_write(struct
> pci_endpoint_test *test,
>  	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
> irq_type);
>  	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
>  	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
> -				 COMMAND_READ);
> +				 COMMAND_WRITE);
> 
>  	wait_for_completion(&test->irq_raised);
> 
>  	reg = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_STATUS);
> -	if (reg & STATUS_READ_SUCCESS)
> +	if (reg & STATUS_WRITE_SUCCESS)
>  		ret = true;
> 
>  	dma_unmap_single(dev, orig_phys_addr, size + alignment,
> @@ -643,7 +643,7 @@ static bool pci_endpoint_test_read(struct
> pci_endpoint_test *test,
>  	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
> irq_type);
>  	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
>  	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
> -				 COMMAND_WRITE);
> +				 COMMAND_READ);
> 
>  	wait_for_completion(&test->irq_raised);
> 
> --
> 2.34.1

Regards,
Li

**********************************************************************
This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-29 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29  6:07 [PATCH] misc: pci_endpoint_test: fix misuse of COMMAND_READ/WRITE Li Chen
2021-12-29 10:49 ` Li Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.