Re: [PATCH 1/5] PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data

From: Alan Mikhak
Date: Tue Mar 03 2020 - 18:57:30 EST


On Wed, Feb 26, 2020 at 9:39 AM Alan Mikhak <alan.mikhak@xxxxxxxxxx> wrote:
>
> On Tue, Feb 25, 2020 at 9:27 PM Kishon Vijay Abraham I <kishon@xxxxxx> wrote:
> >
> > Hi Alan,
> >
> > On 26/02/20 2:41 am, Alan Mikhak wrote:
> > > @@ -380,6 +572,7 @@ static void pci_epf_test_unbind(struct pci_epf *epf)
> > > int bar;
> > >
> > > cancel_delayed_work(&epf_test->cmd_handler);
> > > + pci_epf_clean_dma_chan(epf_test);
> > > pci_epc_stop(epc);
> > > for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
> > > epf_bar = &epf->bar[bar];
> > > @@ -550,6 +743,12 @@ static int pci_epf_test_bind(struct pci_epf *epf)
> > > }
> > > }
> > >
> > > + epf_test->dma_supported = true;
> > > +
> > > + ret = pci_epf_init_dma_chan(epf_test);
> > > + if (ret)
> > > + epf_test->dma_supported = false;
> > > +
> > > if (linkup_notifier) {
> > > epf->nb.notifier_call = pci_epf_test_notifier;
> > > pci_epc_register_notifier(epc, &epf->nb);
> > >
> > > Hi Kishon,
> > >
> > > Looking forward to building and trying this patch series on
> > > a platform I work on.

Hi Kishon,

I applied this v1 patch series to kernel.org linux 5.6-rc3 and built for
x86_64 Debian and riscv. I verified that when I execute the pcitest
command on the x86_64 host with -d flag, the riscv endpoint performs
the transfer by using an available dma channel.

Regards,
Alan

> > >
> > > Would you please point me to where I can find the patches
> > > which add pci_epf_init_dma_chan() and pci_epf_clean_dma_chan()
> > > to Linux PCI Endpoint Framework?
> >
> > I've added these functions in pci-epf-test itself instead of adding in
> > the core files. I realized adding it in core files may not be helpful if
> > the endpoint function decides to use more number of DMA channels etc.,
>
> Thanks Kishon,
>
> I now realize they are in [PATCH 1/5] of this series. May I suggest renaming
> them to pci_epf_test_init_dma_chan() and pci_epf_test_cleanup_dma_chan()?
> With just pci_epf in their name, I was looking for them in pci-epf-core.c.
>
> Regards,
> Alan
>
> >
> > Thanks
> > Kishon