[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR04MB4960A4E7D6A72C2CDEAC47CE92320@VI1PR04MB4960.eurprd04.prod.outlook.com>
Date: Tue, 29 Sep 2020 13:10:12 +0000
From: Sherry Sun <sherry.sun@....com>
To: Christoph Hellwig <hch@...radead.org>
CC: "sudeep.dutt@...el.com" <sudeep.dutt@...el.com>,
"ashutosh.dixit@...el.com" <ashutosh.dixit@...el.com>,
"arnd@...db.de" <arnd@...db.de>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"kishon@...com" <kishon@...com>,
"lorenzo.pieralisi@....com" <lorenzo.pieralisi@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH V2 3/4] misc: vop: simply return the saved dma address
instead of virt_to_phys
Hi Christoph,
> On Tue, Sep 29, 2020 at 04:44:24PM +0800, Sherry Sun wrote:
> > The device page and vring should use consistent memory which are
> > allocated by dma_alloc_coherent api, when user space wants to get its
> > physical address, virt_to_phys cannot be used, should simply return
> > the saved device page dma address by get_dp_dma callback and the vring
> > dma address saved in mic_vqconfig.
>
> More importantly you can't just all virt_to_phys on a return value from
> dma_alloc_coherent, so this needs to be folded into patch 1.
Okay, will move this change into patch 1.
>
> > if (!offset) {
> > - *pa = virt_to_phys(vpdev->hw_ops->get_dp(vpdev));
> > + if (vpdev->hw_ops->get_dp_dma)
> > + *pa = vpdev->hw_ops->get_dp_dma(vpdev);
> > + else {
> > + dev_err(vop_dev(vdev), "can't get device page
> physical address\n");
> > + return -EINVAL;
> > + }
>
> I don't think we need the NULL check here. Wouldn't it also make sense to
> return the virtual and DMA address from ->get_dp instead of adding another
> method?
Do you mean that we should only change the original ->get_dp callback to return virtual
and DMA address at the same time, instead of adding the ->get_dp_dma callback?
Regards
Sherry
Powered by blists - more mailing lists