From: "yf.wang--- via iommu" <iommu@lists.linux-foundation.org>
To: <yong.wu@mediatek.com>
Cc: isaacm@codeaurora.org, miles.chen@mediatek.com,
wsd_upstream@mediatek.com, will@kernel.org,
linux-kernel@vger.kernel.org, Libo.Kang@mediatek.com,
iommu@lists.linux-foundation.org, yf.wang@mediatek.com,
linux-mediatek@lists.infradead.org, ning.li@mediatek.com,
matthias.bgg@gmail.com, robin.murphy@arm.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v10 1/2] iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit
Date: Wed, 29 Jun 2022 20:44:03 +0800 [thread overview]
Message-ID: <20220629124403.18122-1-yf.wang@mediatek.com> (raw)
In-Reply-To: <1ce1947984043bc4284abe94b53888c11a072345.camel@mediatek.com>
On Wed, 2022-06-22 at 09:28 +0800, Yong Wu wrote:
> On Thu, 2022-06-16 at 20:07 +0800, yf.wang@mediatek.com wrote:
> > From: Yunfei Wang <yf.wang@mediatek.com>
> >
> > Single memory zone feature will remove ZONE_DMA32 and ZONE_DMA and
> > cause pgtable PA size larger than 32bit.
> >
> > Since Mediatek IOMMU hardware support at most 35bit PA in pgtable,
> > so add a quirk to allow the PA of pgtables support up to bit35.
> >
> > Signed-off-by: Ning Li <ning.li@mediatek.com>
> > Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
> > ---
> > drivers/iommu/io-pgtable-arm-v7s.c | 67 +++++++++++++++++++++++---
> > --
> > --
> > include/linux/io-pgtable.h | 15 ++++---
> > 2 files changed, 63 insertions(+), 19 deletions(-)
>
> [...]
>
> > /* TTBR */
> > - cfg->arm_v7s_cfg.ttbr = virt_to_phys(data->pgd) |
> > ARM_V7S_TTBR_S |
> > + paddr = virt_to_phys(data->pgd);
> > + cfg->arm_v7s_cfg.ttbr = paddr | ARM_V7S_TTBR_S |
> > (cfg->coherent_walk ? (ARM_V7S_TTBR_NOS
> > >
> >
> > ARM_V7S_TTBR_IRGN_ATTR(ARM_V7S_RGN_WBW
> > A) |
> > ARM_V7S_TTBR_ORGN_ATTR(ARM_V7S_RGN_WBW
> > A)) :
> > (ARM_V7S_TTBR_IRGN_ATTR(ARM_V7S_RGN_NC)
> > >
> >
> > ARM_V7S_TTBR_ORGN_ATTR(ARM_V7S_RGN_NC)
> > ));
> > +
> > + if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT)
> > + cfg->arm_v7s_cfg.ttbr = (paddr & GENMASK(31, 7)) |
> > + upper_32_bits(paddr);
>
> If we keep ttbr u32, we have to put the special logic here. This line
> is ok for all the MediaTek cases, not only for this quirk. It means:
>
> if (arm_v7s_is_mtk_enabled(cfg))
> cfg->arm_v7s_cfg.ttbr = (virt_to_phys(data->pgd) &
> GENMASK(31, 7)) | upper_32_bits(paddr);
> else
> xxx
>
> Then we don't need add "& MMU_PT_ADDR_MASK" in mtk_iommu.c since
> you have done it here.
>
Hi Yong,
Thanks for your suggestion, PATCH v11 version will modify it.
Thanks,
Yunfei.
> > +
> > return &data->iop;
> >
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-06-29 12:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220616120713.12728-1-yf.wang@mediatek.com>
2022-06-16 12:07 ` [PATCH v10 1/2] iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit yf.wang--- via iommu
2022-06-22 1:28 ` Yong Wu via iommu
2022-06-29 12:44 ` yf.wang--- via iommu [this message]
2022-06-16 12:07 ` [PATCH v10 2/2] iommu/mediatek: Allow page table " yf.wang--- via iommu
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=20220629124403.18122-1-yf.wang@mediatek.com \
--to=iommu@lists.linux-foundation.org \
--cc=Libo.Kang@mediatek.com \
--cc=isaacm@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=miles.chen@mediatek.com \
--cc=ning.li@mediatek.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=wsd_upstream@mediatek.com \
--cc=yf.wang@mediatek.com \
--cc=yong.wu@mediatek.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