[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200928060904.GA9387@infradead.org>
Date: Mon, 28 Sep 2020 07:09:04 +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>,
"wang.yi59@....com.cn" <wang.yi59@....com.cn>,
"huang.zijiang@....com.cn" <huang.zijiang@....com.cn>,
"rikard.falkeborn@...il.com" <rikard.falkeborn@...il.com>,
"lee.jones@...aro.org" <lee.jones@...aro.org>,
"mst@...hat.com" <mst@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH 1/5] misc: vop: change the way of allocating vring for
noncoherent platform
On Sun, Sep 27, 2020 at 07:58:29AM +0000, Sherry Sun wrote:
> Thanks for your reply.
> Can you explain why we cannot use the API and header above in drivers?
> And do you know if there are any APIs that could replace this to check the device hardware dma coherent support?
If your treat the memory as if it is coherent with device access you
should always use dma_alloc_coherent. The whole point of the DMA API
is to abstract such differences away.
> >
> > > + vdev->vvr[i].vrh.vring.used =
> > > + (void __force *)vpdev->hw_ops->remap(
> >
> > And you must not use __force casts without a comment explanation why
> > they are safe.
>
> Here is the original code, I moved the original code into the if() without change it.
> But I think this is because vpdev->hw_ops->remap() return type is void __iomem *, but vring.used need type void *.
> Maybe this is a workaround for Intel MIC platform, as it reassigns the used ring on the EP side.
Well, we'll need to figure out what is going on here, and blind casts to
and from __iomem are dangerous.
Powered by blists - more mailing lists