diff mbox series

PCI: endpoint: functions/pci-epf-test: Fix dma_chan direction

Message ID 20230221100949.3530608-1-yoshihiro.shimoda.uh@renesas.com
State New
Headers show
Series PCI: endpoint: functions/pci-epf-test: Fix dma_chan direction | expand

Commit Message

Yoshihiro Shimoda Feb. 21, 2023, 10:09 a.m. UTC
In the pci_epf_test_init_dma_chan(), epf_test->dma_chan_rx
is assigned from dma_request_channel() with DMA_DEV_TO_MEM as
filter.dma_mask. However, in the pci_epf_test_data_transfer(),
if the dir is DMA_DEV_TO_MEM, it should use epf->dma_chan_rx,
but it used epf_test->dma_chan_tx. So, fix it. Otherwise,
results of pcitest with enabled DMA will be NG on eDMA
environment.

Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yoshihiro Shimoda Feb. 21, 2023, 10:14 a.m. UTC | #1
Hi all,

> From: Yoshihiro Shimoda, Sent: Tuesday, February 21, 2023 7:10 PM
> 
> In the pci_epf_test_init_dma_chan(), epf_test->dma_chan_rx
> is assigned from dma_request_channel() with DMA_DEV_TO_MEM as
> filter.dma_mask. However, in the pci_epf_test_data_transfer(),
> if the dir is DMA_DEV_TO_MEM, it should use epf->dma_chan_rx,
> but it used epf_test->dma_chan_tx. So, fix it. Otherwise,
> results of pcitest with enabled DMA will be NG on eDMA
> environment.
> 
> Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

I'm sorry. But, I will resend this patch with right email address.

Best regards,
Yoshihiro Shimoda
Frank Li Feb. 21, 2023, 4:06 p.m. UTC | #2
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c
> b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 55283d2379a6..3a720ed4655e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -113,7 +113,7 @@ static int pci_epf_test_data_transfer(struct
> pci_epf_test *epf_test,
>                                       enum dma_transfer_direction dir)
>  {
>         struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ?

Can you use (dir == DMA_MEM_TO_DEV)? match following check
dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ?

Frank Li

> -                                epf_test->dma_chan_tx : epf_test->dma_chan_rx;
> +                                epf_test->dma_chan_rx : epf_test->dma_chan_tx;
>         dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ? dma_src :
> dma_dst;
>         enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
>         struct pci_epf *epf = epf_test->epf;
> --
> 2.25.1
Yoshihiro Shimoda Feb. 22, 2023, 12:47 a.m. UTC | #3
Hi Frank,

> From: Frank Li, Sent: Wednesday, February 22, 2023 1:06 AM
> 
> >
> > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c
> > b/drivers/pci/endpoint/functions/pci-epf-test.c
> > index 55283d2379a6..3a720ed4655e 100644
> > --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> > @@ -113,7 +113,7 @@ static int pci_epf_test_data_transfer(struct
> > pci_epf_test *epf_test,
> >                                       enum dma_transfer_direction dir)
> >  {
> >         struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ?
> 
> Can you use (dir == DMA_MEM_TO_DEV)? match following check
> dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ?

Yes, I'll use (dir == DMA_MEM_TO_DEV) instead.

Best regards,
Yoshihiro Shimoda

> Frank Li
> 
> > -                                epf_test->dma_chan_tx : epf_test->dma_chan_rx;
> > +                                epf_test->dma_chan_rx : epf_test->dma_chan_tx;
> >         dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ? dma_src :
> > dma_dst;
> >         enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
> >         struct pci_epf *epf = epf_test->epf;
> > --
> > 2.25.1
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 55283d2379a6..3a720ed4655e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -113,7 +113,7 @@  static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test,
 				      enum dma_transfer_direction dir)
 {
 	struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ?
-				 epf_test->dma_chan_tx : epf_test->dma_chan_rx;
+				 epf_test->dma_chan_rx : epf_test->dma_chan_tx;
 	dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ? dma_src : dma_dst;
 	enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
 	struct pci_epf *epf = epf_test->epf;