From: Cho KyongHo <pullip.cho@samsung.com>
To: Grant Grundler <grundler@chromium.org>
Cc: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>,
Linux DeviceTree <devicetree@vger.kernel.org>,
Linux IOMMU <iommu@lists.linux-foundation.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Samsung SOC <linux-samsung-soc@vger.kernel.org>,
Antonios Motakis <a.motakis@virtualopensystems.com>,
Joerg Roedel <joro@8bytes.org>,
Kukjin Kim <kgene.kim@samsung.com>,
Prathyush <prathyush.k@samsung.com>,
Rahul Sharma <rahul.sharma@samsung.com>,
Sachin Kamat <sachin.kamat@linaro.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Tomasz Figa <t.figa@samsung.com>,
Varun Sethi <Varun.Sethi@freescale.com>
Subject: Re: [PATCH v11 24/27] iommu/exynos: use exynos-iommu specific typedef
Date: Thu, 20 Mar 2014 18:55:19 +0900 [thread overview]
Message-ID: <20140320185519.0035bf69004da6c570133414@samsung.com> (raw)
In-Reply-To: <CANEJEGu=yDfYi-gH7W7h7up2gd7MxBOg9bz4konLoe-UGf4RYA@mail.gmail.com>
On Tue, 18 Mar 2014 18:33:20 -0700, Grant Grundler wrote:
> On Thu, Mar 13, 2014 at 10:13 PM, Cho KyongHo <pullip.cho@samsung.com> wrote:
> > This commit introduces sysmmu_pte_t for page table entries and
> > sysmmu_iova_t vor I/O virtual address that is manipulated by
> > exynos-iommu driver. The purpose of the typedef is to remove
> > dependencies to the driver code from the change of CPU architecture
> > from 32 bit to 64 bit.
>
> hi Cho,
> I noticed this before but understood this code was only compiled for
> ILP-32 programming model. I'm assuming that is going to change in the
> not-to-distant future. Good. :)
>
Thanks.
> >
> > Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
> > ---
> > drivers/iommu/exynos-iommu.c | 103 ++++++++++++++++++++++--------------------
> > 1 file changed, 54 insertions(+), 49 deletions(-)
> >
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index e375501..6e716cc 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -56,19 +56,19 @@
> > #define lv2ent_large(pent) ((*(pent) & 3) == 1)
> >
> > #define section_phys(sent) (*(sent) & SECT_MASK)
> > -#define section_offs(iova) ((iova) & 0xFFFFF)
> > +#define section_offs(iova) ((sysmmu_iova_t)(iova) & 0xFFFFF)
>
> The cast will mask abuses of iova. Define section_offs as a static
> function and GCC can type check iova parameter to make sure it's a
> sysmmu_iova_t.
> Thoughts?
>
> I was thinking "((iova) & (sysmmu_iova_t) 0XFFFFF)" might do what you
> want but it doesn't warn on abuse that I tried. I believe GCC knows
> the upper bits are being ignored.
Thank you for advice.
I agree that type checking by compiler will be more helpful
as you mentioned.
Regards,
KyongHo
prev parent reply other threads:[~2014-03-20 9:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 5:13 [PATCH v11 24/27] iommu/exynos: use exynos-iommu specific typedef Cho KyongHo
[not found] ` <20140314141302.393cfdf96dd7b82eee3f700e-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-19 1:33 ` Grant Grundler
2014-03-20 9:55 ` Cho KyongHo [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=20140320185519.0035bf69004da6c570133414@samsung.com \
--to=pullip.cho@samsung.com \
--cc=Varun.Sethi@freescale.com \
--cc=a.motakis@virtualopensystems.com \
--cc=devicetree@vger.kernel.org \
--cc=grundler@chromium.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=prathyush.k@samsung.com \
--cc=rahul.sharma@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=sachin.kamat@linaro.org \
--cc=t.figa@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox