[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190723132825.GA7148@minwoo-desktop>
Date: Tue, 23 Jul 2019 22:28:25 +0900
From: Minwoo Im <minwoo.im.dev@...il.com>
To: Bjorn Andersson <bjorn.andersson@...aro.org>
Cc: Christoph Hellwig <hch@....de>,
Marc Gonzalez <marc.w.gonzalez@...e.fr>,
MSM <linux-arm-msm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Andy Gross <agross@...nel.org>,
Stanimir Varbanov <svarbanov@...sol.com>,
Rob Clark <robdclark@...il.com>,
Stephen Boyd <sboyd@...nel.org>,
Minwoo Im <minwoo.im.dev@...il.com>
Subject: Re: [PATCH] firmware: qcom_scm: fix error for incompatible pointer
> > > > We just can cast phys_addr_t to dma_addr_t here.
> > >
> > > IME, casting is rarely a proper solution.
> >
> > *nod*
> >
> > ptr_phys probably should be a dma_addr_t. Unless this driver is so
> > magic that it really wants a physical and not a dma address, in which
> > case it needs to use alloc_pages instead of dma_alloc_coherent
> > and then call page_to_phys on the returned page, and a very big comment
> > explaining why it is so special.
>
> The scm call takes physical addresses (which happens to be 1:1 with DMA
> addresses for this driver).
>
> This allocation started off (downstream) as a simple kmalloc(), but
> while the scm call is being executed an access from Linux will cause a
> security violation (that's not handled gracefully). The properties of
> dma_alloc is closer, so that's where the code is today.
>
> Optimally this should be something like alloc_pages() and some mechanism
> for unmapping the pages during the call. But no one has come up with a
> suitable patch for that.
>
>
> But there's a patch from Stephen for this already (not doing a
> typecast). Apparently I missed merging this, so I'll do that.
>
> https://lore.kernel.org/linux-arm-msm/20190517210923.202131-2-swboyd@chromium.org/
Bjron,
I appreciate for checking this. And also thanks all you guys for the
comments here!
Thanks,
Powered by blists - more mailing lists