From: Minwoo Im <minwoo.im.dev@gmail.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Christoph Hellwig <hch@lst.de>,
Marc Gonzalez <marc.w.gonzalez@free.fr>,
MSM <linux-arm-msm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andy Gross <agross@kernel.org>,
Stanimir Varbanov <svarbanov@mm-sol.com>,
Rob Clark <robdclark@gmail.com>, Stephen Boyd <sboyd@kernel.org>,
Minwoo Im <minwoo.im.dev@gmail.com>
Subject: Re: [PATCH] firmware: qcom_scm: fix error for incompatible pointer
Date: Tue, 23 Jul 2019 22:28:25 +0900 [thread overview]
Message-ID: <20190723132825.GA7148@minwoo-desktop> (raw)
In-Reply-To: <20190722151234.GJ7234@tuxbook-pro>
> > > > 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,
prev parent reply other threads:[~2019-07-23 13:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 13:43 [PATCH] firmware: qcom_scm: fix error for incompatible pointer Minwoo Im
2019-07-22 8:38 ` Marc Gonzalez
2019-07-22 9:30 ` Christoph Hellwig
2019-07-22 15:12 ` Bjorn Andersson
2019-07-23 13:28 ` Minwoo Im [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190723132825.GA7148@minwoo-desktop \
--to=minwoo.im.dev@gmail.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=hch@lst.de \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.w.gonzalez@free.fr \
--cc=robdclark@gmail.com \
--cc=sboyd@kernel.org \
--cc=svarbanov@mm-sol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.