From: Janne Grunau <j@jannau.net>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>,
asahi@lists.linux.dev, Lu Baolu <baolu.lu@linux.intel.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
David Woodhouse <dwmw2@infradead.org>,
iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
Kevin Tian <kevin.tian@intel.com>,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, Hector Martin <marcan@marcan.st>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Robin Murphy <robin.murphy@arm.com>,
Sven Peter <sven@svenpeter.dev>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH 7/8] iommu/dart: Convert to domain_alloc_paging()
Date: Tue, 26 Sep 2023 21:06:36 +0200 [thread overview]
Message-ID: <ZRMrvJ4ZVibVQLNS@robin> (raw)
In-Reply-To: <7-v1-8060f06462cc+c0a39-dart_paging_jgg@nvidia.com>
On Fri, Sep 22, 2023 at 02:07:58PM -0300, Jason Gunthorpe wrote:
> Since the IDENTITY and BLOCKED behaviors were moved to global statics all
> that remains is the paging domain. Rename to
> apple_dart_attach_dev_paging() and remove the left over cruft.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/iommu/apple-dart.c | 33 +++++++++++----------------------
> 1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index 376f4c5461e8f7..62efe0aa056f60 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -650,8 +650,8 @@ static int apple_dart_domain_add_streams(struct apple_dart_domain *domain,
> true);
> }
>
> -static int apple_dart_attach_dev(struct iommu_domain *domain,
> - struct device *dev)
> +static int apple_dart_attach_dev_paging(struct iommu_domain *domain,
> + struct device *dev)
> {
> int ret, i;
> struct apple_dart_stream_map *stream_map;
> @@ -665,21 +665,13 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
> if (ret)
> return ret;
>
> - switch (domain->type) {
> - case IOMMU_DOMAIN_DMA:
> - case IOMMU_DOMAIN_UNMANAGED:
> - ret = apple_dart_domain_add_streams(dart_domain, cfg);
> - if (ret)
> - return ret;
> + ret = apple_dart_domain_add_streams(dart_domain, cfg);
> + if (ret)
> + return ret;
>
> - for_each_stream_map(i, cfg, stream_map)
> - apple_dart_setup_translation(dart_domain, stream_map);
> - break;
> - default:
> - return -EINVAL;
> - }
> -
> - return ret;
> + for_each_stream_map(i, cfg, stream_map)
> + apple_dart_setup_translation(dart_domain, stream_map);
> + return 0;
> }
>
> static int apple_dart_attach_dev_identity(struct iommu_domain *domain,
> @@ -755,13 +747,10 @@ static void apple_dart_release_device(struct device *dev)
> kfree(cfg);
> }
>
> -static struct iommu_domain *apple_dart_domain_alloc(unsigned int type)
> +static struct iommu_domain *apple_dart_domain_alloc_paging(struct device *dev)
> {
> struct apple_dart_domain *dart_domain;
>
> - if (type != IOMMU_DOMAIN_DMA && type != IOMMU_DOMAIN_UNMANAGED)
> - return NULL;
> -
> dart_domain = kzalloc(sizeof(*dart_domain), GFP_KERNEL);
> if (!dart_domain)
> return NULL;
> @@ -982,7 +971,7 @@ static void apple_dart_get_resv_regions(struct device *dev,
> static const struct iommu_ops apple_dart_iommu_ops = {
> .identity_domain = &apple_dart_identity_domain,
> .blocked_domain = &apple_dart_blocked_domain,
> - .domain_alloc = apple_dart_domain_alloc,
> + .domain_alloc_paging = apple_dart_domain_alloc_paging,
> .probe_device = apple_dart_probe_device,
> .release_device = apple_dart_release_device,
> .device_group = apple_dart_device_group,
> @@ -992,7 +981,7 @@ static const struct iommu_ops apple_dart_iommu_ops = {
> .pgsize_bitmap = -1UL, /* Restricted during dart probe */
> .owner = THIS_MODULE,
> .default_domain_ops = &(const struct iommu_domain_ops) {
> - .attach_dev = apple_dart_attach_dev,
> + .attach_dev = apple_dart_attach_dev_paging,
> .map_pages = apple_dart_map_pages,
> .unmap_pages = apple_dart_unmap_pages,
> .flush_iotlb_all = apple_dart_flush_iotlb_all,
> --
> 2.42.0
Reviewed-by: Janne Grunau <j@jannau.net>
best regards
Janne
WARNING: multiple messages have this Message-ID (diff)
From: Janne Grunau <j@jannau.net>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: linux-arm-kernel@lists.infradead.org,
Kevin Tian <kevin.tian@intel.com>, Will Deacon <will@kernel.org>,
Sven Peter <sven@svenpeter.dev>,
linuxppc-dev@lists.ozlabs.org, Joerg Roedel <joro@8bytes.org>,
Hector Martin <marcan@marcan.st>,
Nicholas Piggin <npiggin@gmail.com>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, asahi@lists.linux.dev,
David Woodhouse <dwmw2@infradead.org>,
Alyssa Rosenzweig <alyssa@rosenzweig.io>,
Lu Baolu <baolu.lu@linux.intel.com>
Subject: Re: [PATCH 7/8] iommu/dart: Convert to domain_alloc_paging()
Date: Tue, 26 Sep 2023 21:06:36 +0200 [thread overview]
Message-ID: <ZRMrvJ4ZVibVQLNS@robin> (raw)
In-Reply-To: <7-v1-8060f06462cc+c0a39-dart_paging_jgg@nvidia.com>
On Fri, Sep 22, 2023 at 02:07:58PM -0300, Jason Gunthorpe wrote:
> Since the IDENTITY and BLOCKED behaviors were moved to global statics all
> that remains is the paging domain. Rename to
> apple_dart_attach_dev_paging() and remove the left over cruft.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/iommu/apple-dart.c | 33 +++++++++++----------------------
> 1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index 376f4c5461e8f7..62efe0aa056f60 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -650,8 +650,8 @@ static int apple_dart_domain_add_streams(struct apple_dart_domain *domain,
> true);
> }
>
> -static int apple_dart_attach_dev(struct iommu_domain *domain,
> - struct device *dev)
> +static int apple_dart_attach_dev_paging(struct iommu_domain *domain,
> + struct device *dev)
> {
> int ret, i;
> struct apple_dart_stream_map *stream_map;
> @@ -665,21 +665,13 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
> if (ret)
> return ret;
>
> - switch (domain->type) {
> - case IOMMU_DOMAIN_DMA:
> - case IOMMU_DOMAIN_UNMANAGED:
> - ret = apple_dart_domain_add_streams(dart_domain, cfg);
> - if (ret)
> - return ret;
> + ret = apple_dart_domain_add_streams(dart_domain, cfg);
> + if (ret)
> + return ret;
>
> - for_each_stream_map(i, cfg, stream_map)
> - apple_dart_setup_translation(dart_domain, stream_map);
> - break;
> - default:
> - return -EINVAL;
> - }
> -
> - return ret;
> + for_each_stream_map(i, cfg, stream_map)
> + apple_dart_setup_translation(dart_domain, stream_map);
> + return 0;
> }
>
> static int apple_dart_attach_dev_identity(struct iommu_domain *domain,
> @@ -755,13 +747,10 @@ static void apple_dart_release_device(struct device *dev)
> kfree(cfg);
> }
>
> -static struct iommu_domain *apple_dart_domain_alloc(unsigned int type)
> +static struct iommu_domain *apple_dart_domain_alloc_paging(struct device *dev)
> {
> struct apple_dart_domain *dart_domain;
>
> - if (type != IOMMU_DOMAIN_DMA && type != IOMMU_DOMAIN_UNMANAGED)
> - return NULL;
> -
> dart_domain = kzalloc(sizeof(*dart_domain), GFP_KERNEL);
> if (!dart_domain)
> return NULL;
> @@ -982,7 +971,7 @@ static void apple_dart_get_resv_regions(struct device *dev,
> static const struct iommu_ops apple_dart_iommu_ops = {
> .identity_domain = &apple_dart_identity_domain,
> .blocked_domain = &apple_dart_blocked_domain,
> - .domain_alloc = apple_dart_domain_alloc,
> + .domain_alloc_paging = apple_dart_domain_alloc_paging,
> .probe_device = apple_dart_probe_device,
> .release_device = apple_dart_release_device,
> .device_group = apple_dart_device_group,
> @@ -992,7 +981,7 @@ static const struct iommu_ops apple_dart_iommu_ops = {
> .pgsize_bitmap = -1UL, /* Restricted during dart probe */
> .owner = THIS_MODULE,
> .default_domain_ops = &(const struct iommu_domain_ops) {
> - .attach_dev = apple_dart_attach_dev,
> + .attach_dev = apple_dart_attach_dev_paging,
> .map_pages = apple_dart_map_pages,
> .unmap_pages = apple_dart_unmap_pages,
> .flush_iotlb_all = apple_dart_flush_iotlb_all,
> --
> 2.42.0
Reviewed-by: Janne Grunau <j@jannau.net>
best regards
Janne
WARNING: multiple messages have this Message-ID (diff)
From: Janne Grunau <j@jannau.net>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>,
asahi@lists.linux.dev, Lu Baolu <baolu.lu@linux.intel.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
David Woodhouse <dwmw2@infradead.org>,
iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
Kevin Tian <kevin.tian@intel.com>,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, Hector Martin <marcan@marcan.st>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Robin Murphy <robin.murphy@arm.com>,
Sven Peter <sven@svenpeter.dev>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH 7/8] iommu/dart: Convert to domain_alloc_paging()
Date: Tue, 26 Sep 2023 21:06:36 +0200 [thread overview]
Message-ID: <ZRMrvJ4ZVibVQLNS@robin> (raw)
In-Reply-To: <7-v1-8060f06462cc+c0a39-dart_paging_jgg@nvidia.com>
On Fri, Sep 22, 2023 at 02:07:58PM -0300, Jason Gunthorpe wrote:
> Since the IDENTITY and BLOCKED behaviors were moved to global statics all
> that remains is the paging domain. Rename to
> apple_dart_attach_dev_paging() and remove the left over cruft.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/iommu/apple-dart.c | 33 +++++++++++----------------------
> 1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index 376f4c5461e8f7..62efe0aa056f60 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -650,8 +650,8 @@ static int apple_dart_domain_add_streams(struct apple_dart_domain *domain,
> true);
> }
>
> -static int apple_dart_attach_dev(struct iommu_domain *domain,
> - struct device *dev)
> +static int apple_dart_attach_dev_paging(struct iommu_domain *domain,
> + struct device *dev)
> {
> int ret, i;
> struct apple_dart_stream_map *stream_map;
> @@ -665,21 +665,13 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
> if (ret)
> return ret;
>
> - switch (domain->type) {
> - case IOMMU_DOMAIN_DMA:
> - case IOMMU_DOMAIN_UNMANAGED:
> - ret = apple_dart_domain_add_streams(dart_domain, cfg);
> - if (ret)
> - return ret;
> + ret = apple_dart_domain_add_streams(dart_domain, cfg);
> + if (ret)
> + return ret;
>
> - for_each_stream_map(i, cfg, stream_map)
> - apple_dart_setup_translation(dart_domain, stream_map);
> - break;
> - default:
> - return -EINVAL;
> - }
> -
> - return ret;
> + for_each_stream_map(i, cfg, stream_map)
> + apple_dart_setup_translation(dart_domain, stream_map);
> + return 0;
> }
>
> static int apple_dart_attach_dev_identity(struct iommu_domain *domain,
> @@ -755,13 +747,10 @@ static void apple_dart_release_device(struct device *dev)
> kfree(cfg);
> }
>
> -static struct iommu_domain *apple_dart_domain_alloc(unsigned int type)
> +static struct iommu_domain *apple_dart_domain_alloc_paging(struct device *dev)
> {
> struct apple_dart_domain *dart_domain;
>
> - if (type != IOMMU_DOMAIN_DMA && type != IOMMU_DOMAIN_UNMANAGED)
> - return NULL;
> -
> dart_domain = kzalloc(sizeof(*dart_domain), GFP_KERNEL);
> if (!dart_domain)
> return NULL;
> @@ -982,7 +971,7 @@ static void apple_dart_get_resv_regions(struct device *dev,
> static const struct iommu_ops apple_dart_iommu_ops = {
> .identity_domain = &apple_dart_identity_domain,
> .blocked_domain = &apple_dart_blocked_domain,
> - .domain_alloc = apple_dart_domain_alloc,
> + .domain_alloc_paging = apple_dart_domain_alloc_paging,
> .probe_device = apple_dart_probe_device,
> .release_device = apple_dart_release_device,
> .device_group = apple_dart_device_group,
> @@ -992,7 +981,7 @@ static const struct iommu_ops apple_dart_iommu_ops = {
> .pgsize_bitmap = -1UL, /* Restricted during dart probe */
> .owner = THIS_MODULE,
> .default_domain_ops = &(const struct iommu_domain_ops) {
> - .attach_dev = apple_dart_attach_dev,
> + .attach_dev = apple_dart_attach_dev_paging,
> .map_pages = apple_dart_map_pages,
> .unmap_pages = apple_dart_unmap_pages,
> .flush_iotlb_all = apple_dart_flush_iotlb_all,
> --
> 2.42.0
Reviewed-by: Janne Grunau <j@jannau.net>
best regards
Janne
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-09-26 19:06 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 17:07 [PATCH 0/8] iommu: Convert dart & iommufd to the new domain_alloc_paging() Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-22 17:07 ` [PATCH 1/8] iommu: Move IOMMU_DOMAIN_BLOCKED global statics to ops->blocked_domain Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-25 2:26 ` Baolu Lu
2023-09-25 2:26 ` Baolu Lu
2023-09-22 17:07 ` [PATCH 2/8] iommu/vt-d: Update the definition of the blocking domain Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-25 2:27 ` Baolu Lu
2023-09-25 2:27 ` Baolu Lu
2023-09-22 17:07 ` [PATCH 3/8] iommu/vt-d: Use ops->blocked_domain Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-25 2:29 ` Baolu Lu
2023-09-25 2:29 ` Baolu Lu
2023-09-25 11:41 ` Jason Gunthorpe
2023-09-25 11:41 ` Jason Gunthorpe
2023-09-25 11:41 ` Jason Gunthorpe
2023-09-26 3:28 ` Baolu Lu
2023-09-26 3:28 ` Baolu Lu
2023-09-26 3:28 ` Baolu Lu
2023-09-22 17:07 ` [PATCH 4/8] iommufd: Convert to alloc_domain_paging() Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-22 17:07 ` [PATCH 5/8] iommu/dart: Use static global identity domains Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-26 18:49 ` Janne Grunau
2023-09-26 18:49 ` Janne Grunau
2023-09-22 17:07 ` [PATCH 6/8] iommu/dart: Move the blocked domain support to a global static Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-26 19:05 ` Janne Grunau
2023-09-26 19:05 ` Janne Grunau
2023-09-26 19:05 ` Janne Grunau
2023-09-26 19:34 ` Robin Murphy
2023-09-26 19:34 ` Robin Murphy
2023-09-26 19:34 ` Robin Murphy
2023-09-26 19:41 ` Robin Murphy
2023-09-26 19:41 ` Robin Murphy
2023-09-26 19:41 ` Robin Murphy
2023-09-27 12:59 ` Jason Gunthorpe
2023-09-27 12:59 ` Jason Gunthorpe
2023-09-27 12:59 ` Jason Gunthorpe
2023-09-22 17:07 ` [PATCH 7/8] iommu/dart: Convert to domain_alloc_paging() Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-26 19:06 ` Janne Grunau [this message]
2023-09-26 19:06 ` Janne Grunau
2023-09-26 19:06 ` Janne Grunau
2023-09-22 17:07 ` [PATCH 8/8] iommu/dart: Call apple_dart_finalize_domain() as part of alloc_paging() Jason Gunthorpe
2023-09-22 17:07 ` Jason Gunthorpe
2023-09-26 19:07 ` Janne Grunau
2023-09-26 19:07 ` Janne Grunau
2023-09-26 19:07 ` Janne Grunau
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=ZRMrvJ4ZVibVQLNS@robin \
--to=j@jannau.net \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=baolu.lu@linux.intel.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=marcan@marcan.st \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=robin.murphy@arm.com \
--cc=sven@svenpeter.dev \
--cc=will@kernel.org \
/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.