From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: "axboe@kernel.dk" <axboe@kernel.dk>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>,
"wsa+renesas@sang-engineering.com"
<wsa+renesas@sang-engineering.com>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>, "hch@lst.de" <hch@lst.de>
Subject: RE: [RFC PATCH v6 1/5] iommu: add an exported function to get minimum page size for a domain
Date: Mon, 17 Jun 2019 05:23:57 +0000 [thread overview]
Message-ID: <OSBPR01MB359067FF26C34F8D8090D606D8EB0@OSBPR01MB3590.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <5e295ec3-39c9-de8a-a649-0aeeb0078ae3@arm.com>
Hi Robin,
> From: Robin Murphy, Sent: Friday, June 14, 2019 6:41 PM
>
> On 13/06/2019 11:20, Yoshihiro Shimoda wrote:
> > This patch adds an exported function to get minimum page size for
> > a domain. This patch also modifies similar codes on the iommu.c.
>
> Heh, seeing this gave me a genuine déjà vu moment...
>
> ...but it turns out I actually *have* reviewed this patch before :)
>
> https://lore.kernel.org/lkml/05eca601-0264-8141-ceeb-7ef7ad5d5650@arm.com/
Thank you for the information :)
I realized my patch should have taken care of the CONFIG_IPMMU_API=n case.
However, the latest patch series doesn't have such a patch. So, I'll keep this
my patch on next patch version.
https://lore.kernel.org/lkml/20190603011620.31999-1-baolu.lu@linux.intel.com/
Best regards,
Yoshihiro Shimoda
> Robin.
>
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> > drivers/iommu/iommu.c | 18 +++++++++++++++---
> > include/linux/iommu.h | 1 +
> > 2 files changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> > index 2a90638..7ed16af 100644
> > --- a/drivers/iommu/iommu.c
> > +++ b/drivers/iommu/iommu.c
> > @@ -280,6 +280,18 @@ iommu_insert_device_resv_regions(struct list_head *dev_resv_regions,
> > return ret;
> > }
> >
> > +/**
> > + * iommu_get_minimum_page_size - get minimum page size for a domain
> > + * @domain: the domain
> > + *
> > + * Allow iommu driver to get a minimum page size for a domain.
> > + */
> > +unsigned long iommu_get_minimum_page_size(struct iommu_domain *domain)
> > +{
> > + return 1UL << __ffs(domain->pgsize_bitmap);
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_get_minimum_page_size);
> > +
> > int iommu_get_group_resv_regions(struct iommu_group *group,
> > struct list_head *head)
> > {
> > @@ -558,7 +570,7 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group,
> >
> > BUG_ON(!domain->pgsize_bitmap);
> >
> > - pg_size = 1UL << __ffs(domain->pgsize_bitmap);
> > + pg_size = iommu_get_minimum_page_size(domain);
> > INIT_LIST_HEAD(&mappings);
> >
> > iommu_get_resv_regions(dev, &mappings);
> > @@ -1595,7 +1607,7 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
> > return -EINVAL;
> >
> > /* find out the minimum page size supported */
> > - min_pagesz = 1 << __ffs(domain->pgsize_bitmap);
> > + min_pagesz = iommu_get_minimum_page_size(domain);
> >
> > /*
> > * both the virtual address and the physical one, as well as
> > @@ -1655,7 +1667,7 @@ static size_t __iommu_unmap(struct iommu_domain *domain,
> > return 0;
> >
> > /* find out the minimum page size supported */
> > - min_pagesz = 1 << __ffs(domain->pgsize_bitmap);
> > + min_pagesz = iommu_get_minimum_page_size(domain);
> >
> > /*
> > * The virtual address, as well as the size of the mapping, must be
> > diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> > index 91af22a..7e53b43 100644
> > --- a/include/linux/iommu.h
> > +++ b/include/linux/iommu.h
> > @@ -366,6 +366,7 @@ extern int iommu_request_dma_domain_for_dev(struct device *dev);
> > extern struct iommu_resv_region *
> > iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot,
> > enum iommu_resv_type type);
> > +extern unsigned long iommu_get_minimum_page_size(struct iommu_domain *domain);
> > extern int iommu_get_group_resv_regions(struct iommu_group *group,
> > struct list_head *head);
> >
> >
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2019-06-17 5:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 10:20 [RFC PATCH v6 0/5] treewide: improve R-Car SDHI performance Yoshihiro Shimoda
2019-06-13 10:20 ` [RFC PATCH v6 1/5] iommu: add an exported function to get minimum page size for a domain Yoshihiro Shimoda
2019-06-13 19:37 ` Wolfram Sang
2019-06-14 7:16 ` Christoph Hellwig
2019-06-17 5:08 ` Yoshihiro Shimoda
2019-06-14 9:41 ` Robin Murphy
2019-06-17 5:23 ` Yoshihiro Shimoda [this message]
2019-06-13 10:20 ` [RFC PATCH v6 2/5] block: sort headers on blk-setting.c Yoshihiro Shimoda
2019-06-13 19:40 ` Wolfram Sang
2019-06-13 10:20 ` [RFC PATCH v6 3/5] block: add a helper function to merge the segments by an IOMMU Yoshihiro Shimoda
2019-06-14 7:22 ` Christoph Hellwig
2019-06-14 9:54 ` Robin Murphy
2019-06-17 6:29 ` Yoshihiro Shimoda
2019-06-13 10:20 ` [RFC PATCH v6 4/5] mmc: tmio: Use dma_max_mapping_size() instead of a workaround Yoshihiro Shimoda
2019-06-13 19:45 ` Wolfram Sang
2019-06-17 4:25 ` Yoshihiro Shimoda
2019-06-13 20:35 ` Geert Uytterhoeven
2019-06-14 7:18 ` Christoph Hellwig
2019-06-14 7:27 ` Geert Uytterhoeven
2019-06-17 4:54 ` Yoshihiro Shimoda
2019-06-17 6:23 ` Geert Uytterhoeven
2019-06-17 6:54 ` Yoshihiro Shimoda
2019-06-13 10:20 ` [RFC PATCH v6 5/5] mmc: queue: Use bigger segments if IOMMU can merge the segments Yoshihiro Shimoda
2019-06-13 19:58 ` Wolfram Sang
2019-06-17 6:38 ` Yoshihiro Shimoda
2019-06-14 7:24 ` Christoph Hellwig
2019-06-14 10:42 ` Wolfram Sang
2019-06-17 6:46 ` Yoshihiro Shimoda
2019-06-17 6:53 ` Christoph Hellwig
2019-06-17 7:02 ` Yoshihiro Shimoda
2019-06-13 19:36 ` [RFC PATCH v6 0/5] treewide: improve R-Car SDHI performance Wolfram Sang
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=OSBPR01MB359067FF26C34F8D8090D606D8EB0@OSBPR01MB3590.jpnprd01.prod.outlook.com \
--to=yoshihiro.shimoda.uh@renesas.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.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;
as well as URLs for NNTP newsgroup(s).