lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 29 Sep 2020 19:11:56 +0100
From:   Christoph Hellwig <hch@...radead.org>
To:     Sherry Sun <sherry.sun@....com>
Cc:     Christoph Hellwig <hch@...radead.org>,
        "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

On Tue, Sep 29, 2020 at 01:10:12PM +0000, Sherry Sun wrote:
> > >  	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?

That was my intention when writing it, yes.  But it seems like most
other callers don't care.  Maybe move the invocation of
dma_mmap_coherent into a new ->mmap helper, that way it seems like
the calling code doesn't need to know about the dma_addr_t at all.

That being said the layering in the code keeps puzzling me.  As far as
I can tell only a single instance of struct vop_driver even exists, so
we might be able to kill all the indirections entirely.

Powered by blists - more mailing lists